Browse Source

fix args on Python 3

auth
clowwindy 10 years ago
parent
commit
b5010df575
  1. 2
      .travis.yml
  2. 4
      shadowsocks/common.py
  3. 9
      shadowsocks/utils.py

2
.travis.yml

@ -26,7 +26,7 @@ script:
- python tests/test.py -c tests/salsa20.json - python tests/test.py -c tests/salsa20.json
- python tests/test.py -c tests/table.json - python tests/test.py -c tests/table.json
- python tests/test.py -c tests/server-multi-ports.json - python tests/test.py -c tests/server-multi-ports.json
- python tests/test.py -c tests/server-multi-passwd.json tests/server-multi-passwd-client-side.json - python tests/test.py -s tests/server-multi-passwd.json -c tests/server-multi-passwd-client-side.json
- python tests/test.py -c tests/workers.json - python tests/test.py -c tests/workers.json
- python tests/test.py -b "-m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388" -a "-m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -l 1081" - python tests/test.py -b "-m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388" -a "-m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -l 1081"
- python tests/test.py -b "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388" -a "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 -l 1081" - python tests/test.py -b "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388" -a "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 -l 1081"

4
shadowsocks/common.py

@ -47,6 +47,10 @@ ord = compat_ord
chr = compat_chr chr = compat_chr
def to_bytes(s):
return s.encode('utf-8')
def inet_ntop(family, ipstr): def inet_ntop(family, ipstr):
if family == socket.AF_INET: if family == socket.AF_INET:
return socket.inet_ntoa(ipstr) return socket.inet_ntoa(ipstr)

9
shadowsocks/utils.py

@ -29,6 +29,7 @@ import json
import sys import sys
import getopt import getopt
import logging import logging
from shadowsocks.common import to_bytes
VERBOSE_LEVEL = 5 VERBOSE_LEVEL = 5
@ -126,15 +127,15 @@ def get_config(is_local):
if key == '-p': if key == '-p':
config['server_port'] = int(value) config['server_port'] = int(value)
elif key == '-k': elif key == '-k':
config['password'] = value config['password'] = to_bytes(value)
elif key == '-l': elif key == '-l':
config['local_port'] = int(value) config['local_port'] = int(value)
elif key == '-s': elif key == '-s':
config['server'] = value config['server'] = to_bytes(value)
elif key == '-m': elif key == '-m':
config['method'] = value config['method'] = to_bytes(value)
elif key == '-b': elif key == '-b':
config['local_address'] = value config['local_address'] = to_bytes(value)
elif key == '-v': elif key == '-v':
v_count += 1 v_count += 1
# '-vv' turns on more verbose mode # '-vv' turns on more verbose mode

Loading…
Cancel
Save