diff options
Diffstat (limited to 'src/netbase.cpp')
-rw-r--r-- | src/netbase.cpp | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp index e2a516986c..bb16dd0439 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -195,6 +195,16 @@ bool LookupHost(const char *pszName, std::vector<CNetAddr>& vIP, unsigned int nM return LookupIntern(strHost.c_str(), vIP, nMaxSolutions, fAllowLookup); } +bool LookupHost(const char *pszName, CNetAddr& addr, bool fAllowLookup) +{ + std::vector<CNetAddr> vIP; + LookupHost(pszName, vIP, 1, fAllowLookup); + if(vIP.empty()) + return false; + addr = vIP.front(); + return true; +} + bool Lookup(const char *pszName, std::vector<CService>& vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions) { if (pszName[0] == 0) @@ -695,22 +705,6 @@ CNetAddr::CNetAddr(const struct in6_addr& ipv6Addr, const uint32_t scope) scopeId = scope; } -CNetAddr::CNetAddr(const char *pszIp) -{ - Init(); - std::vector<CNetAddr> vIP; - if (LookupHost(pszIp, vIP, 1, false)) - *this = vIP[0]; -} - -CNetAddr::CNetAddr(const std::string &strIp) -{ - Init(); - std::vector<CNetAddr> vIP; - if (LookupHost(strIp.c_str(), vIP, 1, false)) - *this = vIP[0]; -} - unsigned int CNetAddr::GetByte(int n) const { return ip[15-n]; |