Commit Graph

376 Commits

Author SHA1 Message Date
clowwindy 3c1154923f fix json unicode issue in manager 2015-08-10 00:06:19 +08:00
clowwindy c8b3f71e1b respond ok to add and remove commands 2015-08-06 19:45:37 +08:00
clowwindy 3576b3006c support IPv6 on control socket 2015-08-06 15:13:29 +08:00
clowwindy 249bcc0b29 refine unit test 2015-08-06 00:52:25 +08:00
clowwindy 30efc30360 fix pyflakes 2015-08-06 00:34:20 +08:00
clowwindy a8ae8ab373 add unit test for manager 2015-08-05 23:59:59 +08:00
clowwindy 4f948b2286 fix password type in udprelay 2015-08-05 23:59:14 +08:00
clowwindy d20a07192c allow manager to bind on unix socket 2015-08-05 23:11:56 +08:00
clowwindy 9c3af61433 add statistics 2015-08-05 22:43:21 +08:00
clowwindy e08845d6f3 fix manager 2015-08-05 18:31:55 +08:00
clowwindy 956199efcd add control manager 2015-08-05 18:12:38 +08:00
clowwindy 58df1d82d0 close poll object after loop stopped 2015-08-03 23:54:30 +08:00
clowwindy 4211184886 remove unnecessary overwrite 2015-08-03 01:40:18 +08:00
clowwindy 177c639b19 fix graceful restart test 2015-08-02 15:53:00 +08:00
clowwindy 02120e3402 optimize eventloop 2015-08-02 14:45:15 +08:00
clowwindy 111acf66c1 fix graceful restart and add unit test 2015-08-02 14:37:44 +08:00
clowwindy e8b2946999 fix workers 2015-08-01 19:09:29 +08:00
clowwindy d319fab5ca fix asyncdns unit test 2015-08-01 18:58:57 +08:00
clowwindy 80102f3899 fix pyflakes 2015-08-01 18:57:44 +08:00
clowwindy 4a8d0774b4 optimize performance for multiple ports
UDPRelay is broken now
2015-08-01 18:53:18 +08:00
Christopher Meng 2555aa8e2b PEP8 indent
A tiny change to perfect the indent.
2015-07-27 00:38:23 -04:00
clowwindy 13a6bb007c cache DNS results in UDPRelay 2015-07-10 17:39:24 +08:00
clowwindy 99b4121fd9 fix problem when UDP client requesting both IPv4 and IPv6 2015-07-10 17:32:31 +08:00
clowwindy c34c99450f fix UDP source port issue 2015-07-10 16:58:04 +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 082c8a80f4 fix duplicated close in LRUCache
close #324
2015-05-19 08:14:47 +08:00
Kim Wong e17279e5bf remove duplicated line (refer line 221) 2015-03-14 07:35:43 +08:00
lazybios d3831bef8c remove duplicate code from shell.py 2015-03-01 14:14:35 +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 d774286dc0 rename utils module into shell
Since utils is ambiguous, we want to give the module a more
clear role.
2015-02-10 17:26:10 +08:00
clowwindy cb7062e1c1 implement utils.print_exception()
Previously we used logging.error(e) and traceback.print_exc()
to output error stack trace. The problem is, we want to
output the stack trace only when verbose > 0. The if statement
scattered around the code. So we replaced them with the new
utils.print_exception() call.
2015-02-10 17:21:29 +08:00
clowwindy dfd81af844 support --version 2015-02-09 14:43:11 +08:00
clowwindy 783a6ef7f2 support multiple server ip on client side 2015-02-09 13:50:46 +08:00
clowwindy e71ce6c758 fix server check 2015-02-03 18:45:36 +08:00
clowwindy e564f17505 fix bytes in utils 2015-02-03 18:23:22 +08:00
clowwindy 6d09cd21ca fix openssl 2015-02-03 18:13:01 +08:00
clowwindy 318d88ec89 use string more 2015-02-03 18:09:07 +08:00
clowwindy ce805f0aea license under Apache License v2.0 2015-02-03 14:10:36 +08:00
clowwindy 0cd261dd10 catch KeyError 2015-02-02 16:22:56 +08:00
clowwindy 1c81465436 fix command line 2015-02-02 15:57:44 +08:00
clowwindy 73f21ffbf6 do not check config for daemon stop 2015-02-02 15:50:41 +08:00
clowwindy 7aa37cad8e check cipher before daemon start
fix #280
2015-02-02 15:46:22 +08:00
clowwindy ae99698b4e implement --user
fix @278
2015-02-02 15:38:55 +08:00
clowwindy 453a9c61a6 show CIDR error more friendly 2015-02-01 09:09:35 +08:00
Sunny a0aa9173a8 Fix for Python3 map changed behavior
In Python3, map returns an iterator instead of list in Python2,
which cause map "lazier" than before, wrap with list() force it running.
2015-02-01 02:37:30 +08:00
Sunny 79b9b53dbe Never process empty string and prevent infinite loop
If user provide an empty string as network range, inet_pton will
treate it as an IPv6 unspecified address, it seems a bug but I
can't confirm. Then empty string will be converted to 0, 0 & 1
always be zero, so it caused dead loop.
2015-02-01 01:57:17 +08:00
Sunny 070108f78b Disable forbidden ip feature for local shadowsocks
Since forbidden ip is server-side only, disable it for local-side.
This commit also supress warning about IPv6 loopback because I can
confirm ::1/128 is the only loopback address, not like IPv4.
2015-02-01 01:34:23 +08:00
Sunny b11d848986 Fix for Python3 lambda behavior change
In Python3, lambda no longer support use tuple as syntax.
So, ugly changes is inevitable.
2015-02-01 01:34:18 +08:00
Sunny aa28796524 Make common fit PEP8 2015-02-01 01:34:13 +08:00
Sunny 8af359ae05 Use IPNetwork supporting forbidden ip feature in config utils
This commit also make "forbidden_ip" field available in config file.
If no forbidden ip specified in command line and config file,
default to "127.0.0.0/8,::1".
2015-01-31 22:56:23 +08:00
Sunny 100ebcf064 Add IPNetwork class to support CIDR calculation
Usage:
Use IPNetwork(str|list<str>) to create an IPNetwork object.
Use operator 'in' to determine whether the specified
IP address is in the IP network or not, like:
>>> '192.168.1.1' in IPNetwork('192.168.1.0/24')
True

Both IPv4 and IPv6 address are supported.
Note: When using string to initialize the IPNetwork,
a comma seperated IP network list should be provided.

Currently, IPNetwork just support standard CIDR like:
x.x.x.x/y eg. 192.168.1.0/24
::x/y     eg. ::1/10
If pure IP address was provided,
it will be treated as implicit IP network,
like 192.168.0.0 will be treated as 192.168.0.0/16
and  192.168.1.1 will be treated as 192.168.1.1/32
This implicit translate may cause some unexpected behavior,
like user provide 192.168.2.0 and expect it will be treated as
192.168.2.0/24 but actually it will be translated to
192.168.2.0/23 because there are 9 continuous 0 from right.
In order to avoid confusion, a warning message
will be displayed when pure IP address was provided.

Other variants of CIDR are not supported yet.
2015-01-31 22:56:16 +08:00
Sunny 8783e0e9ae Move is_ip from asyncdns to common
Since implement CIDR forbidden need this function,
move it to common file seems to be a better choice.
2015-01-31 22:56:09 +08:00
clowwindy ada97ab6d9 improve comments 2015-01-31 02:58:40 +08:00
clowwindy 1f8819f790 fix #270 2015-01-23 17:33:48 +08:00
clowwindy 6efb3d00e4 fix #264 2015-01-16 18:52:40 +08:00
clowwindy bd22e3ef75 try every dll that matches by name in PATH 2015-01-16 16:50:18 +08:00
clowwindy af6c6f3f23 also search lib* for library names 2015-01-14 12:59:43 +08:00
clowwindy 5c05a74727 fix a potential name conflict 2015-01-13 00:42:27 +08:00
clowwindy 53a7e4d0e4 remove print 2015-01-12 23:21:16 +08:00
clowwindy f7316c0047 change logging level for UDP warning 2015-01-12 23:08:27 +08:00
clowwindy 4312eb9e58 add forbidden support for UDP and add tests 2015-01-12 23:02:59 +08:00
clowwindy eb94bd1cc3 support forbidden iplist 2015-01-12 22:30:03 +08:00
clowwindy 80b8bd7014 remove M2Crypto completely 2015-01-12 14:11:33 +08:00
clowwindy a4b0ea5b8f fix find_library 2015-01-12 14:08:21 +08:00
clowwindy e582b2b929 rename ctypes_* and remove salsa20-ctr 2015-01-12 14:05:20 +08:00
clowwindy 3d03dbf716 extract find_library 2015-01-12 14:00:35 +08:00
fa08c ebfd1486d8 Removing the overhead of creating a new list per event 2015-01-12 10:32:03 +08:00
fa08c 6eadfca78e Removing trailing whites 2015-01-11 15:19:31 +08:00
fa08c 3294a92a61 Search libcrypto.so in more locations
Some linux distro may store .so in some alternative locations. Now we
try harder to find them.
2015-01-10 22:26:20 +08:00
fa08c 2711002142 Merge remote-tracking branch 'upstream/master' 2015-01-10 21:27:41 +08:00
fa08c 18da3554ff Minor fix: never use except: unless you reraise 2015-01-08 08:27:28 -06:00
peter 8b2deb01d8 Set default method as bytes.
Default method as string may cause false error report.
2015-01-08 11:22:34 +08:00
fa08c 176e97bb45 Fixing some minor issues 2015-01-08 11:03:12 +08:00
clowwindy 4598e09b78 now works on OpenWRT 2015-01-07 00:25:28 +08:00
clowwindy 0bc0117cd7 update help url 2015-01-04 23:55:50 +08:00
clowwindy bac675d7f6 2015 2015-01-03 13:24:40 +08:00
clowwindy 291adf8b85 log client address 2015-01-03 12:48:03 +08:00
v3aqb d91f7d85d4 Update ctypes_libsodium.py 2014-12-28 08:30:29 +08:00
clowwindy e8501da271 fix vim 2014-12-25 16:23:43 +08:00
clowwindy 99c8bbafe7 fix fastopen and add a new test 2014-12-25 16:20:15 +08:00
clowwindy 30f4f78557 fix travis 2014-12-24 18:23:35 +08:00
clowwindy 5ea8403e56 fix daemon and add fastopen tests 2014-12-22 22:42:39 +08:00
clowwindy be1d1d5032 add SIGINT in workers 2014-12-22 17:29:58 +08:00
clowwindy 536b7d1ee6 use SIGINT instead in tests
Conflicts:
	tests/test.py
2014-12-22 17:25:39 +08:00
clowwindy 2b4c3619d6 reorder setsid and kill 2014-12-21 14:52:00 +08:00
clowwindy dae2624b30 add setsid 2014-12-21 14:49:51 +08:00
clowwindy 35c3b0b41c refine documentation 2014-12-21 14:06:28 +08:00
clowwindy 28347b685e add unit test for daemon 2014-12-21 13:46:27 +08:00
clowwindy 134497c24f implement daemon 2014-12-21 12:47:07 +08:00
clowwindy 7274c7ad96 fix comments 2014-12-18 13:34:41 +08:00
clowwindy 706a137b3f fix typo 2014-12-18 13:29:00 +08:00
clowwindy 4b0b252953 improve comments 2014-12-18 13:23:59 +08:00
clowwindy 163992b98b small fix 2014-12-12 00:04:17 +08:00
clowwindy 676bf9617b fix key cache when just method changes 2014-12-11 23:45:39 +08:00
clowwindy cbbc880f44 try to find the problem 2014-12-11 23:22:48 +08:00
clowwindy 810db996cd disable M2Crypto on Python 3 2014-12-11 22:54:49 +08:00
clowwindy 3e503bf677 log method in encrypt unit test 2014-12-11 22:43:46 +08:00
clowwindy 1459282ae6 only test some ciphers 2014-12-11 18:02:57 +08:00
clowwindy 4d5d6c7c85 add unit tests in encrypt 2014-12-11 17:47:12 +08:00