|
@ -354,7 +354,7 @@ class TCPRelayHandler(object): |
|
|
if type(host_list) == list: |
|
|
if type(host_list) == list: |
|
|
host_post = common.to_str(host_list[((hash_code & 0xffffffff) + addr) % len(host_list)]) |
|
|
host_post = common.to_str(host_list[((hash_code & 0xffffffff) + addr) % len(host_list)]) |
|
|
else: |
|
|
else: |
|
|
host_post = host_list |
|
|
host_post = common.to_str(host_list) |
|
|
items = host_post.rsplit(':', 1) |
|
|
items = host_post.rsplit(':', 1) |
|
|
if len(items) > 1: |
|
|
if len(items) > 1: |
|
|
try: |
|
|
try: |
|
@ -464,20 +464,19 @@ class TCPRelayHandler(object): |
|
|
if data is None: |
|
|
if data is None: |
|
|
data = self._handel_protocol_error(self._client_address, ogn_data) |
|
|
data = self._handel_protocol_error(self._client_address, ogn_data) |
|
|
header_result = parse_header(data) |
|
|
header_result = parse_header(data) |
|
|
|
|
|
if header_result is not None: |
|
|
|
|
|
try: |
|
|
|
|
|
common.to_str(remote_addr) |
|
|
|
|
|
except Exception as e: |
|
|
|
|
|
header_result = None |
|
|
if header_result is None: |
|
|
if header_result is None: |
|
|
data = self._handel_protocol_error(self._client_address, ogn_data) |
|
|
data = self._handel_protocol_error(self._client_address, ogn_data) |
|
|
header_result = parse_header(data) |
|
|
header_result = parse_header(data) |
|
|
connecttype, remote_addr, remote_port, header_length = header_result |
|
|
connecttype, remote_addr, remote_port, header_length = header_result |
|
|
try: |
|
|
|
|
|
common.connect_log('%s connecting %s:%d from %s:%d' % |
|
|
common.connect_log('%s connecting %s:%d from %s:%d' % |
|
|
((connecttype == 0) and 'TCP' or 'UDP', |
|
|
((connecttype == 0) and 'TCP' or 'UDP', |
|
|
common.to_str(remote_addr), remote_port, |
|
|
common.to_str(remote_addr), remote_port, |
|
|
self._client_address[0], self._client_address[1])) |
|
|
self._client_address[0], self._client_address[1])) |
|
|
except Exception as e: |
|
|
|
|
|
common.connect_log('%s connecting %s:%d from %s:%d' % |
|
|
|
|
|
((connecttype == 0) and 'TCP' or 'UDP', |
|
|
|
|
|
binascii.hexlify(remote_addr), remote_port, |
|
|
|
|
|
self._client_address[0], self._client_address[1])) |
|
|
|
|
|
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 |
|
|