def proc_udp_request(self, req): self.client_associate = (req.dstaddr, req.dstport) log.info("UDP client adress: (%s:%d)" % self.client_associate) self.last_clientaddr = self.client_associate self.client2local_udpsock = bind_local_udp(self.socksconn) if not self.client2local_udpsock: request_fail(self.socksconn, req, GENERAL_SOCKS_SERVER_FAILURE) return False self.track_sock(self.client2local_udpsock) bndtype, bndaddr, bndport = sock_addr_info(self.client2local_udpsock) log.info("UDP ACCOSIATE: (%s:%d)" % (bndaddr, bndport)) request_success(self.socksconn, bndtype, bndaddr, bndport) return True
def proc_udp_request(self, req): self.client_associate = (req.dstaddr, req.dstport) self.last_clientaddr = self.client_associate self.client2local_udpsock = bind_local_udp(self.socksconn) self.local2remote_udpsock = bind_local_udp(self.remoteconn) if not self.client2local_udpsock or not self.local2remote_udpsock: request_fail(self.socksconn, req, GENERAL_SOCKS_SERVER_FAILURE) return False self.track_sock(self.client2local_udpsock) self.track_sock(self.local2remote_udpsock) send_request(self.remoteconn, UDP_ASSOCIATE, *sock_addr_info(self.local2remote_udpsock)) reply = read_reply(self.remoteconn) if reply.rep != SUCCEEDED: return False self.remote_associate = (reply.bndaddr, reply.bndport) request_success(self.socksconn, *sock_addr_info(self.client2local_udpsock)) return True
def cmd_bind(self, req): request_fail(self.socksconn, req, CMD_NOT_SUPPORTED)