Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70ebd2ef28 | ||
|
|
1f8819f790 | ||
|
|
0e6a4cd8ff | ||
|
|
f4052fbc84 | ||
|
|
5e5d25efd9 | ||
|
|
2e9ce11ea1 | ||
|
|
6efb3d00e4 | ||
|
|
13413267dc | ||
|
|
bd22e3ef75 | ||
|
|
5179e018e2 | ||
|
|
af6c6f3f23 | ||
|
|
5c05a74727 | ||
|
|
53a7e4d0e4 | ||
|
|
5e476843ec |
+2
-1
@@ -24,6 +24,7 @@ function run_test {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
python --version
|
||||||
coverage erase
|
coverage erase
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
run_test pep8 .
|
run_test pep8 .
|
||||||
@@ -45,7 +46,7 @@ run_test python tests/test.py --with-coverage -c tests/workers.json
|
|||||||
run_test python tests/test.py --with-coverage -s tests/ipv6.json -c tests/ipv6-client-side.json
|
run_test python tests/test.py --with-coverage -s tests/ipv6.json -c tests/ipv6-client-side.json
|
||||||
run_test python tests/test.py --with-coverage -b "-m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -q" -a "-m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -l 1081 -vv"
|
run_test python tests/test.py --with-coverage -b "-m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -q" -a "-m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -l 1081 -vv"
|
||||||
run_test python tests/test.py --with-coverage -b "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 --workers 1" -a "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 -l 1081 -t 30 -qq -b 127.0.0.1"
|
run_test python tests/test.py --with-coverage -b "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 --workers 1" -a "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 -l 1081 -t 30 -qq -b 127.0.0.1"
|
||||||
run_test python tests/test.py --with-coverage --should-fail --url="http://127.0.0.1/" -b "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 --forbidden-ip=127.0.0.1,::1,8.8.8.8" -a "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 -l 1081 -t 30 -b 127.0.0.1"
|
run_test python tests/test.py --with-coverage --should-fail --url="http://localhost/" -b "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 --forbidden-ip=127.0.0.1,::1,8.8.8.8" -a "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 -l 1081 -t 30 -b 127.0.0.1"
|
||||||
|
|
||||||
if [ -f /proc/sys/net/ipv4/tcp_fastopen ] ; then
|
if [ -f /proc/sys/net/ipv4/tcp_fastopen ] ; then
|
||||||
if [ 3 -eq `cat /proc/sys/net/ipv4/tcp_fastopen` ] ; then
|
if [ 3 -eq `cat /proc/sys/net/ipv4/tcp_fastopen` ] ; then
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
2.6.3 2015-01-03
|
2.6.6 2015-01-23
|
||||||
|
- Fix a crash in forbidden list
|
||||||
|
|
||||||
|
2.6.5 2015-01-18
|
||||||
|
- Try both 32 bit and 64 bit dll on Windows
|
||||||
|
|
||||||
|
2.6.4 2015-01-14
|
||||||
|
- Also search lib* when searching libraries
|
||||||
|
|
||||||
|
2.6.3 2015-01-12
|
||||||
- Support --forbidden-ip to ban some IP, i.e. localhost
|
- Support --forbidden-ip to ban some IP, i.e. localhost
|
||||||
- Search OpenSSL and libsodium harder
|
- Search OpenSSL and libsodium harder
|
||||||
- Now works on OpenWRT
|
- Now works on OpenWRT
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ a pull request, or ask some of your friends to do so.
|
|||||||
3. We don't answer questions of any other types here. Since very few people
|
3. We don't answer questions of any other types here. Since very few people
|
||||||
are watching the issue tracker here, you'll probably get no help from here.
|
are watching the issue tracker here, you'll probably get no help from here.
|
||||||
Read [Troubleshooting] and get help from forums or [mailing lists].
|
Read [Troubleshooting] and get help from forums or [mailing lists].
|
||||||
|
4. Issues in languages other than English will be Google translated into English
|
||||||
|
later.
|
||||||
|
|
||||||
|
|
||||||
[Troubleshooting]: https://github.com/clowwindy/shadowsocks/wiki/Troubleshooting
|
[Troubleshooting]: https://github.com/clowwindy/shadowsocks/wiki/Troubleshooting
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
recursive-include *.py
|
recursive-include shadowsocks *.py
|
||||||
include README.rst
|
include README.rst
|
||||||
include LICENSE
|
include LICENSE
|
||||||
|
|||||||
@@ -12,17 +12,17 @@ Server
|
|||||||
|
|
||||||
### Install
|
### Install
|
||||||
|
|
||||||
#### Debian / Ubuntu:
|
Debian / Ubuntu:
|
||||||
|
|
||||||
apt-get install python-pip
|
apt-get install python-pip
|
||||||
pip install shadowsocks
|
pip install shadowsocks
|
||||||
|
|
||||||
#### CentOS:
|
CentOS:
|
||||||
|
|
||||||
yum install python-setuptools && easy_install pip
|
yum install python-setuptools && easy_install pip
|
||||||
pip install shadowsocks
|
pip install shadowsocks
|
||||||
|
|
||||||
#### Windows:
|
Windows:
|
||||||
|
|
||||||
See [Install Server on Windows]
|
See [Install Server on Windows]
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ with codecs.open('README.rst', encoding='utf-8') as f:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="shadowsocks",
|
name="shadowsocks",
|
||||||
version="2.6.3",
|
version="2.6.6",
|
||||||
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',
|
||||||
|
|||||||
@@ -93,11 +93,12 @@ def build_address(address):
|
|||||||
return b''.join(results)
|
return b''.join(results)
|
||||||
|
|
||||||
|
|
||||||
def build_request(address, qtype, request_id):
|
def build_request(address, qtype):
|
||||||
header = struct.pack('!HBBHHHH', request_id, 1, 0, 1, 0, 0, 0)
|
request_id = os.urandom(2)
|
||||||
|
header = struct.pack('!BBHHHH', 1, 0, 1, 0, 0, 0)
|
||||||
addr = build_address(address)
|
addr = build_address(address)
|
||||||
qtype_qclass = struct.pack('!HH', qtype, QCLASS_IN)
|
qtype_qclass = struct.pack('!HH', qtype, QCLASS_IN)
|
||||||
return header + addr + qtype_qclass
|
return request_id + header + addr + qtype_qclass
|
||||||
|
|
||||||
|
|
||||||
def parse_ip(addrtype, data, length, offset):
|
def parse_ip(addrtype, data, length, offset):
|
||||||
@@ -270,7 +271,6 @@ class DNSResolver(object):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._loop = None
|
self._loop = None
|
||||||
self._request_id = 1
|
|
||||||
self._hosts = {}
|
self._hosts = {}
|
||||||
self._hostname_status = {}
|
self._hostname_status = {}
|
||||||
self._hostname_to_cb = {}
|
self._hostname_to_cb = {}
|
||||||
@@ -412,10 +412,7 @@ class DNSResolver(object):
|
|||||||
del self._hostname_status[hostname]
|
del self._hostname_status[hostname]
|
||||||
|
|
||||||
def _send_req(self, hostname, qtype):
|
def _send_req(self, hostname, qtype):
|
||||||
self._request_id += 1
|
req = build_request(hostname, qtype)
|
||||||
if self._request_id > 32768:
|
|
||||||
self._request_id = 1
|
|
||||||
req = build_request(hostname, qtype, self._request_id)
|
|
||||||
for server in self._servers:
|
for server in self._servers:
|
||||||
logging.debug('resolving %s with type %d using server %s',
|
logging.debug('resolving %s with type %d using server %s',
|
||||||
hostname, qtype, server)
|
hostname, qtype, server)
|
||||||
|
|||||||
+37
-10
@@ -23,11 +23,30 @@
|
|||||||
from __future__ import absolute_import, division, print_function, \
|
from __future__ import absolute_import, division, print_function, \
|
||||||
with_statement
|
with_statement
|
||||||
|
|
||||||
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
|
def find_library_nt(name):
|
||||||
|
# modified from ctypes.util
|
||||||
|
# ctypes.util.find_library just returns first result he found
|
||||||
|
# but we want to try them all
|
||||||
|
# because on Windows, users may have both 32bit and 64bit version installed
|
||||||
|
results = []
|
||||||
|
for directory in os.environ['PATH'].split(os.pathsep):
|
||||||
|
fname = os.path.join(directory, name)
|
||||||
|
if os.path.isfile(fname):
|
||||||
|
results.append(fname)
|
||||||
|
if fname.lower().endswith(".dll"):
|
||||||
|
continue
|
||||||
|
fname = fname + ".dll"
|
||||||
|
if os.path.isfile(fname):
|
||||||
|
results.append(fname)
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
def find_library(possible_lib_names, search_symbol, library_name):
|
def find_library(possible_lib_names, search_symbol, library_name):
|
||||||
from ctypes.util import find_library
|
import ctypes.util
|
||||||
from ctypes import CDLL
|
from ctypes import CDLL
|
||||||
|
|
||||||
paths = []
|
paths = []
|
||||||
@@ -35,10 +54,18 @@ def find_library(possible_lib_names, search_symbol, library_name):
|
|||||||
if type(possible_lib_names) not in (list, tuple):
|
if type(possible_lib_names) not in (list, tuple):
|
||||||
possible_lib_names = [possible_lib_names]
|
possible_lib_names = [possible_lib_names]
|
||||||
|
|
||||||
for name in possible_lib_names:
|
lib_names = []
|
||||||
path = find_library(name)
|
for lib_name in possible_lib_names:
|
||||||
if path:
|
lib_names.append(lib_name)
|
||||||
paths.append(path)
|
lib_names.append('lib' + lib_name)
|
||||||
|
|
||||||
|
for name in lib_names:
|
||||||
|
if os.name == "nt":
|
||||||
|
paths.extend(find_library_nt(name))
|
||||||
|
else:
|
||||||
|
path = ctypes.util.find_library(name)
|
||||||
|
if path:
|
||||||
|
paths.append(path)
|
||||||
|
|
||||||
if not paths:
|
if not paths:
|
||||||
# We may get here when find_library fails because, for example,
|
# We may get here when find_library fails because, for example,
|
||||||
@@ -46,13 +73,12 @@ def find_library(possible_lib_names, search_symbol, library_name):
|
|||||||
# tools underlying find_library on linux.
|
# tools underlying find_library on linux.
|
||||||
import glob
|
import glob
|
||||||
|
|
||||||
for name in possible_lib_names:
|
for name in lib_names:
|
||||||
patterns = [
|
patterns = [
|
||||||
'/usr/local/lib*/lib%s.*' % name,
|
'/usr/local/lib*/lib%s.*' % name,
|
||||||
'/usr/lib*/lib%s.*' % name,
|
'/usr/lib*/lib%s.*' % name,
|
||||||
'lib%s.*' % name,
|
'lib%s.*' % name,
|
||||||
'%s.dll' % name,
|
'%s.dll' % name]
|
||||||
'lib%s.dll' % name]
|
|
||||||
|
|
||||||
for pat in patterns:
|
for pat in patterns:
|
||||||
files = glob.glob(pat)
|
files = glob.glob(pat)
|
||||||
@@ -106,10 +132,11 @@ def test_find_library():
|
|||||||
assert find_library('c', 'strcpy', 'libc') is not None
|
assert find_library('c', 'strcpy', 'libc') is not None
|
||||||
assert find_library(['c'], 'strcpy', 'libc') is not None
|
assert find_library(['c'], 'strcpy', 'libc') is not None
|
||||||
assert find_library(('c',), 'strcpy', 'libc') is not None
|
assert find_library(('c',), 'strcpy', 'libc') is not None
|
||||||
assert find_library('crypto', 'EVP_CipherUpdate', 'libcrypto') is not None
|
assert find_library(('crypto', 'eay32'), 'EVP_CipherUpdate',
|
||||||
|
'libcrypto') is not None
|
||||||
assert find_library('notexist', 'strcpy', 'libnotexist') is None
|
assert find_library('notexist', 'strcpy', 'libnotexist') is None
|
||||||
assert find_library('c', 'symbol_not_exist', 'c') is None
|
assert find_library('c', 'symbol_not_exist', 'c') is None
|
||||||
assert find_library(('notexist', 'c', 'crypto'),
|
assert find_library(('notexist', 'c', 'crypto', 'eay32'),
|
||||||
'EVP_CipherUpdate', 'libc') is not None
|
'EVP_CipherUpdate', 'libc') is not None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ class TCPRelayHandler(object):
|
|||||||
self._update_stream(STREAM_UP, WAIT_STATUS_READWRITING)
|
self._update_stream(STREAM_UP, WAIT_STATUS_READWRITING)
|
||||||
self._update_stream(STREAM_DOWN, WAIT_STATUS_READING)
|
self._update_stream(STREAM_DOWN, WAIT_STATUS_READING)
|
||||||
return
|
return
|
||||||
except (OSError, IOError) as e:
|
except Exception as e:
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
if self._config['verbose']:
|
if self._config['verbose']:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ class UDPRelay(object):
|
|||||||
self._closed = False
|
self._closed = False
|
||||||
self._last_time = time.time()
|
self._last_time = time.time()
|
||||||
self._sockets = set()
|
self._sockets = set()
|
||||||
print(config)
|
|
||||||
if 'forbidden_ip' in config:
|
if 'forbidden_ip' in config:
|
||||||
self._forbidden_iplist = config['forbidden_ip']
|
self._forbidden_iplist = config['forbidden_ip']
|
||||||
else:
|
else:
|
||||||
|
|||||||
+1
-1
@@ -90,7 +90,6 @@ try:
|
|||||||
|
|
||||||
for fd in r:
|
for fd in r:
|
||||||
line = fd.readline()
|
line = fd.readline()
|
||||||
sys.stderr.write(line)
|
|
||||||
if not line:
|
if not line:
|
||||||
if stage == 2 and fd == p3.stdout:
|
if stage == 2 and fd == p3.stdout:
|
||||||
stage = 3
|
stage = 3
|
||||||
@@ -98,6 +97,7 @@ try:
|
|||||||
stage = 5
|
stage = 5
|
||||||
if bytes != str:
|
if bytes != str:
|
||||||
line = str(line, 'utf8')
|
line = str(line, 'utf8')
|
||||||
|
sys.stderr.write(line)
|
||||||
if line.find('starting local') >= 0:
|
if line.find('starting local') >= 0:
|
||||||
local_ready = True
|
local_ready = True
|
||||||
if line.find('starting server') >= 0:
|
if line.find('starting server') >= 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user