本文整理汇总了C++中CService::IsNativeI2P方法的典型用法代码示例。如果您正苦于以下问题:C++ CService::IsNativeI2P方法的具体用法?C++ CService::IsNativeI2P怎么用?C++ CService::IsNativeI2P使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CService
的用法示例。
在下文中一共展示了CService::IsNativeI2P方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: return
bool operator!=(const CService& a, const CService& b)
{
#ifdef USE_NATIVE_I2P
return (CNetAddr)a != (CNetAddr)b || !(a.port == b.port || (a.IsNativeI2P() && b.IsNativeI2P()));
#else
return (CNetAddr)a != (CNetAddr)b || a.port != b.port;
#endif
}
示例2: ConnectSocket
bool ConnectSocket(const CService &addrDest, SOCKET& hSocketRet, int nTimeout)
{
const proxyType &proxy = proxyInfo[addrDest.GetNetwork()];
#ifdef USE_NATIVE_I2P
if (addrDest.IsNativeI2P()&&IsI2PEnabled()) {
SOCKET streamSocket = I2PSession::Instance().connect(addrDest.GetI2PDestination(), false/*, streamSocket*/);
if (SetSocketOptions(streamSocket)) {
hSocketRet = streamSocket;
return true;
}
return false;
}
#endif
// no proxy needed
if (!proxy.second)
return ConnectSocketDirectly(addrDest, hSocketRet, nTimeout);
SOCKET hSocket = INVALID_SOCKET;
// first connect to proxy server
if (!ConnectSocketDirectly(proxy.first, hSocket, nTimeout))
return false;
// do socks negotiation
switch (proxy.second) {
case 4:
if (!Socks4(addrDest, hSocket))
return false;
break;
case 5:
if (!Socks5(addrDest.ToStringIP(), addrDest.GetPort(), hSocket))
return false;
break;
default:
return false;
}
hSocketRet = hSocket;
return true;
}
示例3: return
bool operator<(const CService& a, const CService& b)
{
return (CNetAddr)a < (CNetAddr)b || ((CNetAddr)a == (CNetAddr)b && (a.port < b.port) && !(a.IsNativeI2P() && b.IsNativeI2P()));
}