add quiet mode; close #164
This commit is contained in:
parent
da842918bd
commit
72fe18212e
3 changed files with 23 additions and 9 deletions
4
CHANGES
4
CHANGES
|
@ -1,3 +1,7 @@
|
||||||
|
2.0.12 2014-07-26
|
||||||
|
- Support -q quiet mode
|
||||||
|
- Exit 0 when showing help with -h
|
||||||
|
|
||||||
2.0.11 2014-07-12
|
2.0.11 2014-07-12
|
||||||
- Prefers IP addresses over hostnames, more friendly with socksify and openvpn
|
- Prefers IP addresses over hostnames, more friendly with socksify and openvpn
|
||||||
|
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -6,7 +6,7 @@ with open('README.rst') as f:
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="shadowsocks",
|
name="shadowsocks",
|
||||||
version="2.0.11",
|
version="2.0.12",
|
||||||
license='MIT',
|
license='MIT',
|
||||||
description="A fast tunnel proxy that help you get through firewalls",
|
description="A fast tunnel proxy that help you get through firewalls",
|
||||||
author='clowwindy',
|
author='clowwindy',
|
||||||
|
|
|
@ -84,10 +84,10 @@ def check_config(config):
|
||||||
|
|
||||||
def get_config(is_local):
|
def get_config(is_local):
|
||||||
if is_local:
|
if is_local:
|
||||||
shortopts = 'hs:b:p:k:l:m:c:t:v'
|
shortopts = 'hs:b:p:k:l:m:c:t:vq'
|
||||||
longopts = ['fast-open']
|
longopts = ['fast-open']
|
||||||
else:
|
else:
|
||||||
shortopts = 'hs:p:k:m:c:t:v'
|
shortopts = 'hs:p:k:m:c:t:vq'
|
||||||
longopts = ['fast-open', 'workers:']
|
longopts = ['fast-open', 'workers:']
|
||||||
try:
|
try:
|
||||||
config_path = find_config()
|
config_path = find_config()
|
||||||
|
@ -139,6 +139,9 @@ def get_config(is_local):
|
||||||
else:
|
else:
|
||||||
print_server_help()
|
print_server_help()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
elif key == '-q':
|
||||||
|
v_count -= 1
|
||||||
|
config['verbose'] = v_count
|
||||||
except getopt.GetoptError as e:
|
except getopt.GetoptError as e:
|
||||||
print >>sys.stderr, e
|
print >>sys.stderr, e
|
||||||
if is_local:
|
if is_local:
|
||||||
|
@ -162,10 +165,14 @@ def get_config(is_local):
|
||||||
|
|
||||||
logging.getLogger('').handlers = []
|
logging.getLogger('').handlers = []
|
||||||
logging.addLevelName(VERBOSE_LEVEL, 'VERBOSE')
|
logging.addLevelName(VERBOSE_LEVEL, 'VERBOSE')
|
||||||
if config['verbose'] == 2:
|
if config['verbose'] >= 2:
|
||||||
level = VERBOSE_LEVEL
|
level = VERBOSE_LEVEL
|
||||||
elif config['verbose']:
|
elif config['verbose'] == 1:
|
||||||
level = logging.DEBUG
|
level = logging.DEBUG
|
||||||
|
elif config['verbose'] == -1:
|
||||||
|
level = logging.WARN
|
||||||
|
elif config['verbose'] <= -2:
|
||||||
|
level = logging.ERROR
|
||||||
else:
|
else:
|
||||||
level = logging.INFO
|
level = logging.INFO
|
||||||
logging.basicConfig(level=level,
|
logging.basicConfig(level=level,
|
||||||
|
@ -180,7 +187,7 @@ def get_config(is_local):
|
||||||
def print_local_help():
|
def print_local_help():
|
||||||
print '''usage: sslocal [-h] -s SERVER_ADDR -p SERVER_PORT [-b LOCAL_ADDR]
|
print '''usage: sslocal [-h] -s SERVER_ADDR -p SERVER_PORT [-b LOCAL_ADDR]
|
||||||
-l LOCAL_PORT -k PASSWORD -m METHOD [-t TIMEOUT] [-c CONFIG]
|
-l LOCAL_PORT -k PASSWORD -m METHOD [-t TIMEOUT] [-c CONFIG]
|
||||||
[--fast-open] [-v]
|
[--fast-open] [-v] [-q]
|
||||||
|
|
||||||
optional arguments:
|
optional arguments:
|
||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
|
@ -193,7 +200,8 @@ optional arguments:
|
||||||
-t TIMEOUT timeout in seconds
|
-t TIMEOUT timeout in seconds
|
||||||
-c CONFIG path to config file
|
-c CONFIG path to config file
|
||||||
--fast-open use TCP_FASTOPEN, requires Linux 3.7+
|
--fast-open use TCP_FASTOPEN, requires Linux 3.7+
|
||||||
-v verbose mode
|
-v, -vv verbose mode
|
||||||
|
-q, -qq quiet mode, only show warnings/errors
|
||||||
|
|
||||||
Online help: <https://github.com/clowwindy/shadowsocks>
|
Online help: <https://github.com/clowwindy/shadowsocks>
|
||||||
'''
|
'''
|
||||||
|
@ -201,7 +209,8 @@ Online help: <https://github.com/clowwindy/shadowsocks>
|
||||||
|
|
||||||
def print_server_help():
|
def print_server_help():
|
||||||
print '''usage: ssserver [-h] -s SERVER_ADDR -p SERVER_PORT -k PASSWORD
|
print '''usage: ssserver [-h] -s SERVER_ADDR -p SERVER_PORT -k PASSWORD
|
||||||
-m METHOD [-t TIMEOUT] [-c CONFIG] [--fast-open] [-v]
|
-m METHOD [-t TIMEOUT] [-c CONFIG] [--fast-open] [--workders]
|
||||||
|
[-v] [-q]
|
||||||
|
|
||||||
optional arguments:
|
optional arguments:
|
||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
|
@ -213,7 +222,8 @@ optional arguments:
|
||||||
-c CONFIG path to config file
|
-c CONFIG path to config file
|
||||||
--fast-open use TCP_FASTOPEN, requires Linux 3.7+
|
--fast-open use TCP_FASTOPEN, requires Linux 3.7+
|
||||||
--workers WORKERS number of workers, available on Unix/Linux
|
--workers WORKERS number of workers, available on Unix/Linux
|
||||||
-v verbose mode
|
-v, -vv verbose mode
|
||||||
|
-q, -qq quiet mode, only show warnings/errors
|
||||||
|
|
||||||
Online help: <https://github.com/clowwindy/shadowsocks>
|
Online help: <https://github.com/clowwindy/shadowsocks>
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue