Browse Source

add bind address

1.4
clowwindy 12 years ago
parent
commit
fbe7ce13a9
  1. 6
      README.md
  2. 11
      local.py
  3. 2
      packaging/py2exe/setup.py
  4. 2
      server.py
  5. 2
      test.py

6
README.md

@ -2,7 +2,7 @@ shadowsocks
=========== ===========
[![Build Status](https://travis-ci.org/clowwindy/shadowsocks.png)](https://travis-ci.org/clowwindy/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 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`. 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 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 python server.py -p server_port -k password -m bf-cfb -6
Performance Performance
------------ ------------

11
local.py

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

2
packaging/py2exe/setup.py

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

2
server.py

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

2
test.py

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

Loading…
Cancel
Save