diff --git a/local.py b/local.py index 00b49b9..edbd7e2 100755 --- a/local.py +++ b/local.py @@ -122,6 +122,10 @@ class Socks5Server(SocketServer.StreamRequestHandler): addr_len = self.rfile.read(1) addr = self.rfile.read(ord(addr_len)) addr_to_send += addr_len + addr + elif addrtype == 4: + addr_ip = self.rfile.read(16) + addr = socket.inet_ntop(socket.AF_INET6, addr_ip) + addr_to_send += addr_ip else: logging.warn('addr_type not support') # not support @@ -155,7 +159,7 @@ class Socks5Server(SocketServer.StreamRequestHandler): if __name__ == '__main__': os.chdir(os.path.dirname(__file__) or '.') - print 'shadowsocks v1.0' + print 'shadowsocks v1.1' with open('config.json', 'rb') as f: config = json.load(f) diff --git a/server.py b/server.py index d945266..a3fccfd 100755 --- a/server.py +++ b/server.py @@ -108,6 +108,8 @@ class Socks5Server(SocketServer.StreamRequestHandler): elif addrtype == 3: addr = self.decrypt( self.rfile.read(ord(self.decrypt(sock.recv(1))))) + elif addrtype == 4: + addr = socket.inet_ntop(socket.AF_INET6, self.decrypt(self.rfile.read(16))) else: # not support logging.warn('addr_type not support') @@ -129,7 +131,7 @@ class Socks5Server(SocketServer.StreamRequestHandler): if __name__ == '__main__': os.chdir(os.path.dirname(__file__) or '.') - print 'shadowsocks v1.0' + print 'shadowsocks v1.1' with open('config.json', 'rb') as f: config = json.load(f)