| 189 | } |
| 190 | |
| 191 | std::vector<CService> Lookup(const std::string& name, uint16_t portDefault, bool fAllowLookup, unsigned int nMaxSolutions, DNSLookupFn dns_lookup_function) |
| 192 | { |
| 193 | if (name.empty() || !ContainsNoNUL(name)) { |
| 194 | return {}; |
| 195 | } |
| 196 | uint16_t port{portDefault}; |
| 197 | std::string hostname; |
| 198 | SplitHostPort(name, port, hostname); |
| 199 | |
| 200 | const std::vector<CNetAddr> addresses{LookupIntern(hostname, nMaxSolutions, fAllowLookup, dns_lookup_function)}; |
| 201 | if (addresses.empty()) return {}; |
| 202 | std::vector<CService> services; |
| 203 | services.reserve(addresses.size()); |
| 204 | for (const auto& addr : addresses) |
| 205 | services.emplace_back(addr, port); |
| 206 | return services; |
| 207 | } |
| 208 | |
| 209 | std::optional<CService> Lookup(const std::string& name, uint16_t portDefault, bool fAllowLookup, DNSLookupFn dns_lookup_function) |
| 210 | { |