add bind address

This commit is contained in:
clowwindy 2013-06-14 12:22:24 +08:00
parent f18d6cd2f8
commit fbe7ce13a9
5 changed files with 13 additions and 10 deletions

View file

@ -2,7 +2,7 @@ shadowsocks
===========
[![Build Status](https://travis-ci.org/clowwindy/shadowsocks.png)](https://travis-ci.org/clowwindy/shadowsocks)
Current version: 1.2.2
Current version: 1.2.3
shadowsocks is a lightweight tunnel proxy which can help you get through firewalls
@ -55,8 +55,8 @@ Command line args
You can use args to override settings from `config.json`.
python local.py -s server_name -p server_port -l local_port -k password -m bf-cfb
python server.py -p server_port -k password -m bf-cfb
python local.py -s server_name -p server_port -l local_port -k password -m bf-cfb -b bind_address -6
python server.py -p server_port -k password -m bf-cfb -6
Performance
------------

View file

@ -151,7 +151,7 @@ if __name__ == '__main__':
("windows_exe", "console_exe"):
p = os.path.dirname(os.path.abspath(sys.executable))
os.chdir(p)
print 'shadowsocks v1.2.2'
print 'shadowsocks v1.2.3'
with open('config.json', 'rb') as f:
config = json.load(f)
@ -160,9 +160,10 @@ if __name__ == '__main__':
PORT = config['local_port']
KEY = config['password']
METHOD = config.get('method', None)
LOCAL = config.get('local', '')
IPv6 = False
optlist, args = getopt.getopt(sys.argv[1:], 's:p:k:l:m:6')
optlist, args = getopt.getopt(sys.argv[1:], 's:b:p:k:l:m:6')
for key, value in optlist:
if key == '-p':
REMOTE_PORT = int(value)
@ -174,6 +175,8 @@ if __name__ == '__main__':
SERVER = value
elif key == '-m':
METHOD = value
elif key == '-b':
LOCAL = value
elif key == '-6':
IPv6 = True
@ -186,8 +189,8 @@ if __name__ == '__main__':
try:
if IPv6:
ThreadingTCPServer.address_family = socket.AF_INET6
server = ThreadingTCPServer(('', PORT), Socks5Server)
logging.info("starting server at port %d ..." % PORT)
server = ThreadingTCPServer((LOCAL, PORT), Socks5Server)
logging.info("starting server at %s:%d" % tuple(server.server_address[:2]))
server.serve_forever()
except socket.error, e:
logging.error(e)

View file

@ -9,7 +9,7 @@ except ImportError:
pass
setup(name='shadowsocks',
version='1.2.2',
version='1.2.3',
description='a lightweight tunnel proxy which can help you get through firewalls',
author='clowwindy',
author_email='clowwindy42@gmail.com',

View file

@ -126,7 +126,7 @@ class Socks5Server(SocketServer.StreamRequestHandler):
if __name__ == '__main__':
os.chdir(os.path.dirname(__file__) or '.')
print 'shadowsocks v1.2.2'
print 'shadowsocks v1.2.3'
with open('config.json', 'rb') as f:
config = json.load(f)

View file

@ -101,7 +101,7 @@ try:
for fd in r:
line = fd.readline()
sys.stdout.write(line)
if line.find('starting server at port') >= 0:
if line.find('starting server') >= 0:
ready_count += 1
if ready_count == 2 and p3 is None: