| 214 | } |
| 215 | |
| 216 | CService LookupNumeric(const std::string& name, uint16_t portDefault, DNSLookupFn dns_lookup_function) |
| 217 | { |
| 218 | if (!ContainsNoNUL(name)) { |
| 219 | return {}; |
| 220 | } |
| 221 | // "1.2:345" will fail to resolve the ip, but will still set the port. |
| 222 | // If the ip fails to resolve, re-init the result. |
| 223 | return Lookup(name, portDefault, /*fAllowLookup=*/false, dns_lookup_function).value_or(CService{}); |
| 224 | } |
| 225 | |
| 226 | bool IsUnixSocketPath(const std::string& name) |
| 227 | { |