diff --git a/shadowsocks/tcprelay.py b/shadowsocks/tcprelay.py index 7f01f71..817bfb2 100644 --- a/shadowsocks/tcprelay.py +++ b/shadowsocks/tcprelay.py @@ -573,9 +573,9 @@ class TCPRelayHandler(object): data = self._handel_protocol_error(self._client_address, ogn_data) header_result = parse_header(data) connecttype, remote_addr, remote_port, header_length = header_result - common.connect_log('%s connecting %s:%d via port %d' % + common.connect_log('%s connecting %s:%d via port %d by UID %d' % ((connecttype == 0) and 'TCP' or 'UDP', - common.to_str(remote_addr), remote_port, self._server._listen_port)) + common.to_str(remote_addr), remote_port, self._server._listen_port, self._user_id)) self._remote_address = (common.to_str(remote_addr), remote_port) self._remote_udp = (connecttype != 0) # pause reading diff --git a/shadowsocks/udprelay.py b/shadowsocks/udprelay.py index 3d8df3b..19f4728 100644 --- a/shadowsocks/udprelay.py +++ b/shadowsocks/udprelay.py @@ -1229,9 +1229,13 @@ class UDPRelay(object): logging.debug('UDP port %5d sockets %d' % (self._listen_port, len(self._sockets))) - common.connect_log('UDP data to %s:%d via port %d' % + if uid is None: + user_id = self._listen_port + else: + user_id = struct.unpack('