Browse Source

fix UDP server

auth
clowwindy 10 years ago
parent
commit
efd45ddfc6
  1. 6
      shadowsocks/common.py

6
shadowsocks/common.py

@ -105,14 +105,14 @@ def pack_addr(address):
try: try:
r = socket.inet_pton(family, address) r = socket.inet_pton(family, address)
if family == socket.AF_INET6: if family == socket.AF_INET6:
return '\x04' + r return b'\x04' + r
else: else:
return '\x01' + r return b'\x01' + r
except (TypeError, ValueError, OSError, IOError): except (TypeError, ValueError, OSError, IOError):
pass pass
if len(address) > 255: if len(address) > 255:
address = address[:255] # TODO address = address[:255] # TODO
return '\x03' + chr(len(address)) + address return b'\x03' + chr(len(address)) + address
def parse_header(data): def parse_header(data):

Loading…
Cancel
Save