MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / Lookup

Function Lookup

src/netbase.cpp:191–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189}
190
191std::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
209std::optional<CService> Lookup(const std::string& name, uint16_t portDefault, bool fAllowLookup, DNSLookupFn dns_lookup_function)
210{

Callers 15

InitHTTPServerFunction · 0.85
ConnectMethod · 0.85
ConnectMethod · 0.85
LookupNumericFunction · 0.85
AppInitMainFunction · 0.85
TryParseMethod · 0.85
GetListenPortFunction · 0.85
ConnectNodeMethod · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
ResolveServiceFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
MakeCorruptPeersDatFunction · 0.85

Calls 8

ContainsNoNULFunction · 0.85
SplitHostPortFunction · 0.85
LookupInternFunction · 0.85
emptyMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
emplace_backMethod · 0.45
frontMethod · 0.45

Tested by 9

BOOST_AUTO_TEST_CASEFunction · 0.68
ResolveServiceFunction · 0.68
BOOST_AUTO_TEST_CASEFunction · 0.68
MakeCorruptPeersDatFunction · 0.68
PCPTestingSetupMethod · 0.68
BOOST_AUTO_TEST_CASEFunction · 0.68
BOOST_AUTO_TEST_CASEFunction · 0.68
FUZZ_TARGETFunction · 0.68
TESTFunction · 0.68