18 Commits
Author SHA1 Message Date
clowwindy 56c289ba21 update CHANGES 2015-06-08 08:35:30 +08:00
clowwindy e74ae193d0 elaborate reasons of header parsing failure 2015-06-08 08:29:01 +08:00
clowwindy 16db66675b optimize LRUCache 2015-05-19 08:35:28 +08:00
clowwindy c46234af41 update CHANGES 2015-05-19 08:20:56 +08:00
clowwindy 405120c59f bump 2015-05-19 08:19:25 +08:00
clowwindy 082c8a80f4 fix duplicated close in LRUCache
close #324
2015-05-19 08:14:47 +08:00
clowwindy 893d21da76 Merge pull request #332 from sky-chen/master
flush autoban output
2015-05-03 15:25:14 +08:00
sky ea7a3e1b58 flush autoban output 2015-05-03 14:34:54 +08:00
clowwindy e898f92191 Merge pull request #295 from jlund/no-rc4
Use AES in the Usage example instead of RC4.
2015-03-29 12:19:22 +08:00
clowwindy 5c0391d146 Merge pull request #312 from kimw/patch-1
remove duplicated line (refer line 221)
2015-03-14 13:38:19 +08:00
Kim Wong e17279e5bf remove duplicated line (refer line 221) 2015-03-14 07:35:43 +08:00
clowwindy f17da943b3 Merge pull request #305 from lazybios/patch
remove duplicate code from shell.py
2015-03-01 16:17:06 +08:00
lazybios d3831bef8c remove duplicate code from shell.py 2015-03-01 14:14:35 +08:00
Joshua Lund b6e6e14b8a Use AES in the Usage example instead of RC4. 2015-02-14 21:33:40 -07:00
clowwindy 4172639d48 Update README.md 2015-02-12 14:18:18 +08:00
clowwindy e8488895f0 Merge pull request #291 from felixonmars/py3-remote-address
convert remote_address to str so it will be printed more correctly on python 3
2015-02-11 15:53:24 +08:00
Felix Yan edb7822a7b convert remote_address to str so it will be printed more correctly on python 3 2015-02-11 10:40:20 +08:00
clowwindy 294556f8bc bump 2.6.9 2015-02-10 18:26:06 +08:00
8 changed files with 38 additions and 11 deletions
+7
View File
@@ -1,3 +1,10 @@
2.6.10 2015-06-08
- Optimize LRU cache
- Refine logging
2.6.9 2015-05-19
- Fix a stability issue on Windows
2.6.8 2015-02-10
- Support multiple server ip on client side
- Support --version
+4 -4
View File
@@ -28,11 +28,11 @@ See [Install Server on Windows]
### Usage
ssserver -p 443 -k password -m rc4-md5
ssserver -p 443 -k password -m aes-256-cfb
To run in the background:
sudo ssserver -p 443 -k password -m rc4-md5 --user nobody -d start
sudo ssserver -p 443 -k password -m aes-256-cfb --user nobody -d start
To stop:
@@ -86,7 +86,7 @@ Bugs and Issues
[Android]: https://github.com/shadowsocks/shadowsocks/wiki/Ports-and-Clients#android
[Android]: https://github.com/shadowsocks/shadowsocks-android
[Build Status]: https://img.shields.io/travis/shadowsocks/shadowsocks/master.svg?style=flat
[Configuration]: https://github.com/shadowsocks/shadowsocks/wiki/Configuration-via-Config-File
[Coverage Status]: https://jenkins.shadowvpn.org/result/shadowsocks
@@ -103,4 +103,4 @@ Bugs and Issues
[Travis CI]: https://travis-ci.org/shadowsocks/shadowsocks
[Troubleshooting]: https://github.com/shadowsocks/shadowsocks/wiki/Troubleshooting
[Wiki]: https://github.com/shadowsocks/shadowsocks/wiki
[Windows]: https://github.com/shadowsocks/shadowsocks/wiki/Ports-and-Clients#windows
[Windows]: https://github.com/shadowsocks/shadowsocks-csharp
+1 -1
View File
@@ -7,7 +7,7 @@ with codecs.open('README.rst', encoding='utf-8') as f:
setup(
name="shadowsocks",
version="2.6.8",
version="2.6.10",
license='http://www.apache.org/licenses/LICENSE-2.0',
description="A fast tunnel proxy that help you get through firewalls",
author='clowwindy',
+2 -2
View File
@@ -171,8 +171,8 @@ def parse_header(data):
else:
logging.warn('header is too short')
else:
logging.warn('unsupported addrtype %d, maybe wrong password' %
addrtype)
logging.warn('unsupported addrtype %d, maybe wrong password or '
'encryption method' % addrtype)
if dest_addr is None:
return None
return addrtype, to_bytes(dest_addr), dest_port, header_length
+21 -1
View File
@@ -41,6 +41,7 @@ class LRUCache(collections.MutableMapping):
self._time_to_keys = collections.defaultdict(list)
self._keys_to_last_time = {}
self._last_visits = collections.deque()
self._closed_values = set()
self.update(dict(*args, **kwargs)) # use the free update to set keys
def __getitem__(self, key):
@@ -83,7 +84,9 @@ class LRUCache(collections.MutableMapping):
if key in self._store:
if now - self._keys_to_last_time[key] > self.timeout:
value = self._store[key]
self.close_callback(value)
if value not in self._closed_values:
self.close_callback(value)
self._closed_values.add(value)
for key in self._time_to_keys[least]:
self._last_visits.popleft()
if key in self._store:
@@ -93,6 +96,7 @@ class LRUCache(collections.MutableMapping):
c += 1
del self._time_to_keys[least]
if c:
self._closed_values.clear()
logging.debug('%d keys swept' % c)
@@ -126,5 +130,21 @@ def test():
assert 'a' not in c
assert 'b' not in c
global close_cb_called
close_cb_called = False
def close_cb(t):
global close_cb_called
assert not close_cb_called
close_cb_called = True
c = LRUCache(timeout=0.1, close_callback=close_cb)
c['s'] = 1
c['s']
time.sleep(0.1)
c['s']
time.sleep(0.3)
c.sweep()
if __name__ == '__main__':
test()
-2
View File
@@ -157,7 +157,6 @@ def get_config(is_local):
else:
config = {}
optlist, args = getopt.getopt(sys.argv[1:], shortopts, longopts)
v_count = 0
for key, value in optlist:
if key == '-p':
@@ -222,7 +221,6 @@ def get_config(is_local):
config['workers'] = config.get('workers', 1)
config['pid-file'] = config.get('pid-file', '/var/run/shadowsocks.pid')
config['log-file'] = config.get('log-file', '/var/log/shadowsocks.log')
config['workers'] = config.get('workers', 1)
config['verbose'] = config.get('verbose', False)
config['local_address'] = to_str(config.get('local_address', '127.0.0.1'))
config['local_port'] = config.get('local_port', 1080)
+1 -1
View File
@@ -295,7 +295,7 @@ class TCPRelayHandler(object):
logging.info('connecting %s:%d from %s:%d' %
(common.to_str(remote_addr), remote_port,
self._client_address[0], self._client_address[1]))
self._remote_address = (remote_addr, remote_port)
self._remote_address = (common.to_str(remote_addr), remote_port)
# pause reading
self._update_stream(STREAM_UP, WAIT_STATUS_WRITING)
self._stage = STAGE_DNS
+2
View File
@@ -42,10 +42,12 @@ if __name__ == '__main__':
if ip not in ips:
ips[ip] = 1
print(ip)
sys.stdout.flush()
else:
ips[ip] += 1
if ip not in banned and ips[ip] >= config.count:
banned.add(ip)
cmd = 'iptables -A INPUT -s %s -j DROP' % ip
print(cmd, file=sys.stderr)
sys.stderr.flush()
os.system(cmd)