Ejemplo n.º 1
0
void Server::connect(SocksClientSocket &me, const IPSockAddress &peer)
{
    open(me, me);
    Message request(socksConnect, peer.address(), peer.port());
    request.send(me);
    Message reply(me);
    me.mLocalAddress = reply.address();
    me.mPeerAddress = peer;
    secdebug("socks", "%d socks connected to %s", me.fd(), string(peer).c_str());
}
Ejemplo n.º 2
0
//
// TCPServerSockets (BIND access)
//
void SocksServerSocket::open(const IPSockAddress &local, int)
{
    if (mServer) {
#if BUG_GCC
        if (mConnectionPeer)
            Support::bind(*this, mConnectionPeer, local.port());
        else
            Support::bind(*this, lastConnected(), local.port());
#else
        Support::bind(*this,
            mConnectionPeer ? mConnectionPeer : lastConnected(),
            local.port());
#endif
    } else {
        TCPServerSocket::open(local, 1);
    }
}
//
// Message properties
//
Message::Message(Command cmd, const IPSockAddress &address)
    : version(4), message(cmd), port(htons(address.port())), addr(address.address())
{
}
Ejemplo n.º 4
0
IPSockAddress IPSockAddress::defaults(const IPSockAddress &defaultAddr) const
{
    return defaults(defaultAddr.address(), defaultAddr.port());
}