32 if (
pos == string::npos) {
39 if (
node.size() >= 2 &&
node.front() ==
'[' &&
node.back() ==
']') {
47 const auto pos =
uri.find(
"://");
49 if (
pos == string::npos) {
61 int family{-1}, protocol{0};
65 }
else if (
scheme ==
"ip4") {
67 }
else if (
scheme ==
"ip6") {
69 }
else if (
scheme ==
"tcp4") {
74 }
else if (
scheme ==
"tcp6") {
79 }
else if (
scheme ==
"udp4") {
84 }
else if (
scheme ==
"udp6") {
89 }
else if (
scheme ==
"unix") {
97 !
service.empty() ?
service.c_str() :
nullptr, family, type, protocol);
122 constexpr const char*
scheme =
"unix://";
125 if (path[0] ==
'\0') {
126 size_t size =
ep.size() -
sizeof(std::declval<sockaddr_un>().sun_family) - 1;
127 return os <<
scheme <<
'|' << std::string_view{path + 1,
size};
136 const auto p =
ep.protocol();
158 const auto p =
ep.protocol();
182 char buf[INET_ADDRSTRLEN];
184 return os << buf <<
':' << ntohs(sa.sin_port);
189 char buf[INET6_ADDRSTRLEN];
191 return os <<
'[' << buf <<
"]:" << ntohs(sa.sin6_port);
196 return os << sa.sun_path;
201 if (sa.sa_family == AF_INET) {
202 os << reinterpret_cast<const sockaddr_in&>(sa);
203 }
else if (sa.sa_family == AF_INET6) {
204 os << reinterpret_cast<const sockaddr_in6&>(sa);
205 }
else if (sa.sa_family == AF_UNIX) {
206 os << reinterpret_cast<const sockaddr_un&>(sa);
215 const char* scheme =
"";
216 if (ai.ai_family == AF_INET) {
217 if (ai.ai_protocol == IPPROTO_TCP) {
219 }
else if (ai.ai_protocol == IPPROTO_UDP) {
224 }
else if (ai.ai_family == AF_INET6) {
225 if (ai.ai_protocol == IPPROTO_TCP) {
227 }
else if (ai.ai_protocol == IPPROTO_UDP) {
232 }
else if (ai.ai_family == AF_UNIX) {
235 return os << scheme << *ai.ai_addr;
ostream & operator<<(ostream &os, const pair< T, U > &p)