|
@ -136,10 +136,13 @@ class Socks5Server(SocketServer.StreamRequestHandler): |
|
|
# reply immediately |
|
|
# reply immediately |
|
|
if '-6' in sys.argv[1:]: |
|
|
if '-6' in sys.argv[1:]: |
|
|
remote = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) |
|
|
remote = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) |
|
|
|
|
|
remote.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) |
|
|
|
|
|
remote.connect((SERVER, REMOTE_PORT, 0, 0)) |
|
|
else: |
|
|
else: |
|
|
remote = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
|
|
remote = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
|
|
remote.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) |
|
|
remote.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) |
|
|
remote.connect((SERVER, REMOTE_PORT)) |
|
|
remote.connect((SERVER, REMOTE_PORT)) |
|
|
|
|
|
|
|
|
self.send_encrypt(remote, addr_to_send) |
|
|
self.send_encrypt(remote, addr_to_send) |
|
|
logging.info('connecting %s:%d' % (addr, port[0])) |
|
|
logging.info('connecting %s:%d' % (addr, port[0])) |
|
|
except socket.error, e: |
|
|
except socket.error, e: |
|
@ -161,7 +164,11 @@ if __name__ == '__main__': |
|
|
PORT = config['local_port'] |
|
|
PORT = config['local_port'] |
|
|
KEY = config['password'] |
|
|
KEY = config['password'] |
|
|
|
|
|
|
|
|
optlist, args = getopt.getopt(sys.argv[1:], 's:p:k:l:') |
|
|
argv = sys.argv[1:] |
|
|
|
|
|
if '-6' in sys.argv[1:]: |
|
|
|
|
|
argv.remove('-6') |
|
|
|
|
|
|
|
|
|
|
|
optlist, args = getopt.getopt(argv, 's:p:k:l:') |
|
|
for key, value in optlist: |
|
|
for key, value in optlist: |
|
|
if key == '-p': |
|
|
if key == '-p': |
|
|
REMOTE_PORT = int(value) |
|
|
REMOTE_PORT = int(value) |
|
|