Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
082c8a80f4 | ||
|
|
893d21da76 | ||
|
|
ea7a3e1b58 | ||
|
|
e898f92191 | ||
|
|
5c0391d146 | ||
|
|
e17279e5bf | ||
|
|
f17da943b3 | ||
|
|
d3831bef8c | ||
|
|
b6e6e14b8a | ||
|
|
4172639d48 | ||
|
|
e8488895f0 | ||
|
|
edb7822a7b | ||
|
|
294556f8bc |
@@ -28,11 +28,11 @@ See [Install Server on Windows]
|
|||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
ssserver -p 443 -k password -m rc4-md5
|
ssserver -p 443 -k password -m aes-256-cfb
|
||||||
|
|
||||||
To run in the background:
|
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:
|
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
|
[Build Status]: https://img.shields.io/travis/shadowsocks/shadowsocks/master.svg?style=flat
|
||||||
[Configuration]: https://github.com/shadowsocks/shadowsocks/wiki/Configuration-via-Config-File
|
[Configuration]: https://github.com/shadowsocks/shadowsocks/wiki/Configuration-via-Config-File
|
||||||
[Coverage Status]: https://jenkins.shadowvpn.org/result/shadowsocks
|
[Coverage Status]: https://jenkins.shadowvpn.org/result/shadowsocks
|
||||||
@@ -103,4 +103,4 @@ Bugs and Issues
|
|||||||
[Travis CI]: https://travis-ci.org/shadowsocks/shadowsocks
|
[Travis CI]: https://travis-ci.org/shadowsocks/shadowsocks
|
||||||
[Troubleshooting]: https://github.com/shadowsocks/shadowsocks/wiki/Troubleshooting
|
[Troubleshooting]: https://github.com/shadowsocks/shadowsocks/wiki/Troubleshooting
|
||||||
[Wiki]: https://github.com/shadowsocks/shadowsocks/wiki
|
[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
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ with codecs.open('README.rst', encoding='utf-8') as f:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="shadowsocks",
|
name="shadowsocks",
|
||||||
version="2.6.8",
|
version="2.6.9",
|
||||||
license='http://www.apache.org/licenses/LICENSE-2.0',
|
license='http://www.apache.org/licenses/LICENSE-2.0',
|
||||||
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',
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ class LRUCache(collections.MutableMapping):
|
|||||||
# O(m)
|
# O(m)
|
||||||
now = time.time()
|
now = time.time()
|
||||||
c = 0
|
c = 0
|
||||||
|
values_closed = list() # list is cheaper to create
|
||||||
while len(self._last_visits) > 0:
|
while len(self._last_visits) > 0:
|
||||||
least = self._last_visits[0]
|
least = self._last_visits[0]
|
||||||
if now - least <= self.timeout:
|
if now - least <= self.timeout:
|
||||||
@@ -83,7 +84,9 @@ class LRUCache(collections.MutableMapping):
|
|||||||
if key in self._store:
|
if key in self._store:
|
||||||
if now - self._keys_to_last_time[key] > self.timeout:
|
if now - self._keys_to_last_time[key] > self.timeout:
|
||||||
value = self._store[key]
|
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]:
|
for key in self._time_to_keys[least]:
|
||||||
self._last_visits.popleft()
|
self._last_visits.popleft()
|
||||||
if key in self._store:
|
if key in self._store:
|
||||||
@@ -126,5 +129,21 @@ def test():
|
|||||||
assert 'a' not in c
|
assert 'a' not in c
|
||||||
assert 'b' 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__':
|
if __name__ == '__main__':
|
||||||
test()
|
test()
|
||||||
|
|||||||
@@ -157,7 +157,6 @@ def get_config(is_local):
|
|||||||
else:
|
else:
|
||||||
config = {}
|
config = {}
|
||||||
|
|
||||||
optlist, args = getopt.getopt(sys.argv[1:], shortopts, longopts)
|
|
||||||
v_count = 0
|
v_count = 0
|
||||||
for key, value in optlist:
|
for key, value in optlist:
|
||||||
if key == '-p':
|
if key == '-p':
|
||||||
@@ -222,7 +221,6 @@ def get_config(is_local):
|
|||||||
config['workers'] = config.get('workers', 1)
|
config['workers'] = config.get('workers', 1)
|
||||||
config['pid-file'] = config.get('pid-file', '/var/run/shadowsocks.pid')
|
config['pid-file'] = config.get('pid-file', '/var/run/shadowsocks.pid')
|
||||||
config['log-file'] = config.get('log-file', '/var/log/shadowsocks.log')
|
config['log-file'] = config.get('log-file', '/var/log/shadowsocks.log')
|
||||||
config['workers'] = config.get('workers', 1)
|
|
||||||
config['verbose'] = config.get('verbose', False)
|
config['verbose'] = config.get('verbose', False)
|
||||||
config['local_address'] = to_str(config.get('local_address', '127.0.0.1'))
|
config['local_address'] = to_str(config.get('local_address', '127.0.0.1'))
|
||||||
config['local_port'] = config.get('local_port', 1080)
|
config['local_port'] = config.get('local_port', 1080)
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ class TCPRelayHandler(object):
|
|||||||
logging.info('connecting %s:%d from %s:%d' %
|
logging.info('connecting %s:%d from %s:%d' %
|
||||||
(common.to_str(remote_addr), remote_port,
|
(common.to_str(remote_addr), remote_port,
|
||||||
self._client_address[0], self._client_address[1]))
|
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
|
# pause reading
|
||||||
self._update_stream(STREAM_UP, WAIT_STATUS_WRITING)
|
self._update_stream(STREAM_UP, WAIT_STATUS_WRITING)
|
||||||
self._stage = STAGE_DNS
|
self._stage = STAGE_DNS
|
||||||
|
|||||||
@@ -42,10 +42,12 @@ if __name__ == '__main__':
|
|||||||
if ip not in ips:
|
if ip not in ips:
|
||||||
ips[ip] = 1
|
ips[ip] = 1
|
||||||
print(ip)
|
print(ip)
|
||||||
|
sys.stdout.flush()
|
||||||
else:
|
else:
|
||||||
ips[ip] += 1
|
ips[ip] += 1
|
||||||
if ip not in banned and ips[ip] >= config.count:
|
if ip not in banned and ips[ip] >= config.count:
|
||||||
banned.add(ip)
|
banned.add(ip)
|
||||||
cmd = 'iptables -A INPUT -s %s -j DROP' % ip
|
cmd = 'iptables -A INPUT -s %s -j DROP' % ip
|
||||||
print(cmd, file=sys.stderr)
|
print(cmd, file=sys.stderr)
|
||||||
|
sys.stderr.flush()
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
|
|||||||
Reference in New Issue
Block a user