18 std::vector<std::string> output;
22 struct addrinfo* addrinfo =
nullptr;
23 auto s = getaddrinfo(hostname.c_str(),
nullptr,
nullptr, &addrinfo);
30 for (
auto rp = addrinfo; rp !=
nullptr; rp = rp->ai_next) {
31 char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
34 if (rp->ai_family == AF_INET6)
37 getnameinfo(rp->ai_addr, rp->ai_addrlen, hbuf,
sizeof(hbuf), sbuf,
sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV);
38 auto ipaddr = std::string(hbuf);
39 bool duplicate =
false;
40 for (
auto& ip : output) {
47 TLOG_DEBUG(13) <<
"Found address " << ipaddr <<
" for hostname " << hostname;
48 output.push_back(ipaddr);
52 freeaddrinfo(addrinfo);
77 if (connection_string.find(
"://") == std::string::npos) {
78 throw InvalidUri(
ERS_HERE, connection_string);
81 scheme = connection_string.substr(0, connection_string.find(
"://"));
82 connection_string = connection_string.substr(connection_string.find(
"://") + 3);
84 if (connection_string.find(
":") != std::string::npos) {
85 port = connection_string.substr(connection_string.find(
":") + 1);
86 connection_string = connection_string.substr(0, connection_string.find(
":"));
88 host = connection_string;