15 std::vector<std::string> output;
19 struct addrinfo* result;
20 auto s = getaddrinfo(hostname.c_str(),
nullptr,
nullptr, &result);
27 for (
auto rp = result; rp !=
nullptr; rp = rp->ai_next) {
28 char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
31 if (rp->ai_family == AF_INET6)
34 getnameinfo(rp->ai_addr, rp->ai_addrlen, hbuf,
sizeof(hbuf), sbuf,
sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV);
35 auto result = std::string(hbuf);
36 bool duplicate =
false;
37 for (
auto& res : output) {
44 TLOG_DEBUG(13) <<
"Found address " << result <<
" for hostname " << hostname;
45 output.push_back(result);
77 if (connection_string.find(
"://") == std::string::npos) {
78 throw InvalidUri(
ERS_HERE, connection_string);
81 output.
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 output.
port = connection_string.substr(connection_string.find(
":") + 1);
86 connection_string = connection_string.substr(0, connection_string.find(
":"));
88 output.
host = connection_string;