Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e9ce11ea1 | ||
|
|
6efb3d00e4 | ||
|
|
13413267dc | ||
|
|
bd22e3ef75 |
@@ -1,3 +1,6 @@
|
|||||||
|
2.6.5 2015-01-18
|
||||||
|
- Try both 32 bit and 64 bit dll on Windows
|
||||||
|
|
||||||
2.6.4 2015-01-14
|
2.6.4 2015-01-14
|
||||||
- Also search lib* when searching libraries
|
- Also search lib* when searching libraries
|
||||||
|
|
||||||
|
|||||||
@@ -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.4",
|
version="2.6.5",
|
||||||
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)
|
||||||
|
|||||||
@@ -23,9 +23,28 @@
|
|||||||
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):
|
||||||
import ctypes.util
|
import ctypes.util
|
||||||
from ctypes import CDLL
|
from ctypes import CDLL
|
||||||
@@ -41,9 +60,12 @@ def find_library(possible_lib_names, search_symbol, library_name):
|
|||||||
lib_names.append('lib' + lib_name)
|
lib_names.append('lib' + lib_name)
|
||||||
|
|
||||||
for name in lib_names:
|
for name in lib_names:
|
||||||
path = ctypes.util.find_library(name)
|
if os.name == "nt":
|
||||||
if path:
|
paths.extend(find_library_nt(name))
|
||||||
paths.append(path)
|
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,
|
||||||
@@ -56,8 +78,7 @@ def find_library(possible_lib_names, search_symbol, library_name):
|
|||||||
'/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)
|
||||||
|
|||||||
Reference in New Issue
Block a user