MCPcopy Create free account
hub / github.com/catboost/catboost / Ip4Or6FromString

Function Ip4Or6FromString

util/draft/ip.h:96–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94using TIp4Or6 = std::variant<TIp4, TIp6>;
95
96static 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
109static inline TString Ip4Or6ToString(const TIp4Or6& ip) {
110 if (std::holds_alternative<TIp6>(ip)) {

Callers

nothing calls this directly

Calls 2

IpFromStringFunction · 0.85
Ip6FromStringFunction · 0.85

Tested by

no test coverage detected