close #97
This commit is contained in:
parent
e0a27f1df3
commit
04d4db1f0b
5 changed files with 34 additions and 18 deletions
20
.travis.yml
20
.travis.yml
|
@ -1,10 +1,10 @@
|
|||
language: python
|
||||
python:
|
||||
- 2.6
|
||||
- 2.7
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq libevent-dev python-gevent
|
||||
- pip install gevent
|
||||
script:
|
||||
- python test.py
|
||||
language: python
|
||||
python:
|
||||
- 2.6
|
||||
- 2.7
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq libevent-dev python-gevent python-m2crypto
|
||||
- pip install gevent
|
||||
script:
|
||||
- python test.py
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"server":"localhost",
|
||||
"server":"0.0.0.0",
|
||||
"server_port":8388,
|
||||
"local_port":1080,
|
||||
"password":"barfoo!",
|
||||
"timeout":600,
|
||||
"timeout":300,
|
||||
"method":"table",
|
||||
"local_address":"127.0.0.1",
|
||||
"fast_open":false
|
||||
|
|
|
@ -36,14 +36,20 @@ def find_config():
|
|||
|
||||
|
||||
def check_config(config):
|
||||
if config.get('local_address', '') in ['0.0.0.0']:
|
||||
logging.warn('warning: local set to listen 0.0.0.0, which is not safe')
|
||||
if config.get('server', '') in ['127.0.0.1', 'localhost']:
|
||||
logging.warn('Server is set to "%s", maybe it\'s not correct' %
|
||||
config['server'])
|
||||
logging.warn('Notice server will listen at %s:%s' %
|
||||
logging.warn('warning: server set to listen %s:%s, are you sure?' %
|
||||
(config['server'], config['server_port']))
|
||||
if (config.get('method', '') or '').lower() == 'rc4':
|
||||
logging.warn('RC4 is not safe; please use a safer cipher, '
|
||||
logging.warn('warning: RC4 is not safe; please use a safer cipher, '
|
||||
'like AES-256-CFB')
|
||||
if (config.get('timeout', 600) or 600) < 100:
|
||||
logging.warn('warning: your timeout %d seems too short' %
|
||||
config.get('timeout'))
|
||||
if (config.get('timeout', 600) or 600) > 600:
|
||||
logging.warn('warning: your timeout %d seems too long' %
|
||||
config.get('timeout'))
|
||||
|
||||
|
||||
def print_local_help():
|
||||
|
|
4
test.py
4
test.py
|
@ -82,9 +82,9 @@ decrypt_table = string.maketrans(encrypt_table, string.maketrans('', ''))
|
|||
for i in range(0, 256):
|
||||
assert(target2[0][i] == ord(encrypt_table[i]))
|
||||
assert(target2[1][i] == ord(decrypt_table[i]))
|
||||
p1 = Popen(['python', 'shadowsocks/server.py'], shell=False, bufsize=0, stdin=PIPE,
|
||||
p1 = Popen(['python', 'shadowsocks/server.py', '-c', 'test/config.json'], shell=False, bufsize=0, stdin=PIPE,
|
||||
stdout=PIPE, stderr=PIPE, close_fds=True)
|
||||
p2 = Popen(['python', 'shadowsocks/local.py'], shell=False, bufsize=0, stdin=PIPE,
|
||||
p2 = Popen(['python', 'shadowsocks/local.py', '-c', 'test/config.json'], shell=False, bufsize=0, stdin=PIPE,
|
||||
stdout=PIPE, stderr=PIPE, close_fds=True)
|
||||
p3 = None
|
||||
|
||||
|
|
10
test/config.json
Normal file
10
test/config.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"server":"127.0.0.1",
|
||||
"server_port":8388,
|
||||
"local_port":1080,
|
||||
"password":"barfoo!",
|
||||
"timeout":300,
|
||||
"method":"aes-256-cfb",
|
||||
"local_address":"127.0.0.1",
|
||||
"fast_open":false
|
||||
}
|
Loading…
Reference in a new issue