13 Commits
Author SHA1 Message Date
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
6 changed files with 28 additions and 9 deletions
+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.9",
license='http://www.apache.org/licenses/LICENSE-2.0',
description="A fast tunnel proxy that help you get through firewalls",
author='clowwindy',
+20 -1
View File
@@ -74,6 +74,7 @@ class LRUCache(collections.MutableMapping):
# O(m)
now = time.time()
c = 0
values_closed = list() # list is cheaper to create
while len(self._last_visits) > 0:
least = self._last_visits[0]
if now - least <= self.timeout:
@@ -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 values_closed:
self.close_callback(value)
values_closed.append(value)
for key in self._time_to_keys[least]:
self._last_visits.popleft()
if key in self._store:
@@ -126,5 +129,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)