From 5e9a9c9beb7b7734a5ca6b457938b87296646fd9 Mon Sep 17 00:00:00 2001 From: clowwindy Date: Sun, 1 Jun 2014 14:20:40 +0800 Subject: [PATCH] almost done --- shadowsocks/local.py | 4 ++-- shadowsocks/server.py | 4 ++-- shadowsocks/utils.py | 12 +++++++++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/shadowsocks/local.py b/shadowsocks/local.py index 66070aa..7219c08 100755 --- a/shadowsocks/local.py +++ b/shadowsocks/local.py @@ -40,10 +40,10 @@ def main(): p = os.path.dirname(os.path.abspath(sys.executable)) os.chdir(p) - utils.print_shadowsocks() - config = utils.get_config(True) + utils.print_shadowsocks() + encrypt.init_table(config['password'], config['method']) try: diff --git a/shadowsocks/server.py b/shadowsocks/server.py index bb64bcc..bfb2f8b 100755 --- a/shadowsocks/server.py +++ b/shadowsocks/server.py @@ -34,9 +34,9 @@ import udprelay def main(): utils.check_python() - utils.print_shadowsocks() + config = utils.get_config(False) - config = utils.get_config(True) + utils.print_shadowsocks() if config['port_password']: if config['server_port'] or config['password']: diff --git a/shadowsocks/utils.py b/shadowsocks/utils.py index 84a514b..0daa507 100644 --- a/shadowsocks/utils.py +++ b/shadowsocks/utils.py @@ -125,7 +125,7 @@ def get_config(is_local): elif key == '--workers': config['workers'] = value except getopt.GetoptError as e: - logging.error(e) + print >>sys.stderr, e if is_local: print_local_help() else: @@ -151,7 +151,7 @@ def get_config(is_local): def print_local_help(): print '''usage: sslocal [-h] -s SERVER_ADDR -p SERVER_PORT [-b LOCAL_ADDR] -l LOCAL_PORT -k PASSWORD -m METHOD [-t TIMEOUT] [-c CONFIG] - [--fast-open] + [--fast-open] [-v] optional arguments: -h, --help show this help message and exit @@ -164,12 +164,15 @@ optional arguments: -t TIMEOUT timeout in seconds -c CONFIG path to config file --fast-open use TCP_FASTOPEN, requires Linux 3.7+ + -v verbose mode + +Online help: ''' def print_server_help(): print '''usage: ssserver [-h] -s SERVER_ADDR -p SERVER_PORT -k PASSWORD - -m METHOD [-t TIMEOUT] [-c CONFIG] [--fast-open] + -m METHOD [-t TIMEOUT] [-c CONFIG] [--fast-open] [-v] optional arguments: -h, --help show this help message and exit @@ -181,4 +184,7 @@ optional arguments: -c CONFIG path to config file --fast-open use TCP_FASTOPEN, requires Linux 3.7+ --workers WORKERS number of workers, available on Unix/Linux + -v verbose mode + +Online help: ''' \ No newline at end of file