Ejemplo n.º 1
0
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
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
0
bool operator<(const CService& a, const CService& b)
{
#ifdef USE_NATIVE_I2P
    return (CNetAddr)a < (CNetAddr)b || ((CNetAddr)a == (CNetAddr)b && (a.port < b.port) && !(a.IsNativeI2P() && b.IsNativeI2P()));
#else
    return (CNetAddr)a < (CNetAddr)b || ((CNetAddr)a == (CNetAddr)b && a.port < b.port);
#endif
}
Ejemplo n.º 4
0
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()));
}
Ejemplo n.º 5
0
bool operator!=(const CService& a, const CService& b)
{
    return (CNetAddr)a != (CNetAddr)b || !(a.port == b.port || (a.IsNativeI2P() && b.IsNativeI2P()));
}