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()); }
// // 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()) { }
IPSockAddress IPSockAddress::defaults(const IPSockAddress &defaultAddr) const { return defaults(defaultAddr.address(), defaultAddr.port()); }