Browse Source

connect_log include local addr & port

dev
破娃酱 8 years ago
parent
commit
582d7b7256
  1. 13
      shadowsocks/tcprelay.py

13
shadowsocks/tcprelay.py

@ -596,9 +596,12 @@ class TCPRelayHandler(object):
server_info = self._protocol.get_server_info() server_info = self._protocol.get_server_info()
server_info.buffer_size = self._recv_buffer_size server_info.buffer_size = self._recv_buffer_size
connecttype, remote_addr, remote_port, header_length = header_result connecttype, remote_addr, remote_port, header_length = header_result
common.connect_log('%s connecting %s:%d via port %d by UID %d' % if connecttype != 0:
((connecttype == 0) and 'TCP' or 'UDP', common.connect_log('UDP over TCP by user %d' %
common.to_str(remote_addr), remote_port, self._server._listen_port, self._user_id)) (self._user_id, ))
else:
common.connect_log('TCP request %s:%d by user %d' %
(common.to_str(remote_addr), remote_port, self._user_id))
self._remote_address = (common.to_str(remote_addr), remote_port) self._remote_address = (common.to_str(remote_addr), remote_port)
self._remote_udp = (connecttype != 0) self._remote_udp = (connecttype != 0)
# pause reading # pause reading
@ -746,6 +749,10 @@ class TCPRelayHandler(object):
pass # always goto here pass # always goto here
else: else:
raise e raise e
addr, port = self._remote_sock.getsockname()[:2]
common.connect_log('TCP connecting %s(%s):%d from %s:%d by user %d' %
(self._remote_address[0], remote_addr, remote_port, addr, port, self._user_id))
self._loop.add(remote_sock, self._loop.add(remote_sock,
eventloop.POLL_ERR | eventloop.POLL_OUT, eventloop.POLL_ERR | eventloop.POLL_OUT,
self._server) self._server)

Loading…
Cancel
Save