| 94 | using TIp4Or6 = std::variant<TIp4, TIp6>; |
| 95 | |
| 96 | static inline TIp4Or6 Ip4Or6FromString(const char* ipStr) { |
| 97 | const char* c = ipStr; |
| 98 | for (; *c; ++c) { |
| 99 | if (*c == '.') { |
| 100 | return IpFromString(ipStr); |
| 101 | } |
| 102 | if (*c == ':') { |
| 103 | return Ip6FromString(ipStr); |
| 104 | } |
| 105 | } |
| 106 | ythrow TSystemError() << "Failed to convert (" << ipStr << ") to ipv4 or ipv6 address"; |
| 107 | } |
| 108 | |
| 109 | static inline TString Ip4Or6ToString(const TIp4Or6& ip) { |
| 110 | if (std::holds_alternative<TIp6>(ip)) { |
nothing calls this directly
no test coverage detected