46 Commits
Author SHA1 Message Date
破娃酱 47c6e16833 fix a mem leak 2017-06-03 23:06:12 +08:00
破娃酱 8826f515b6 fix async DNS 2017-06-03 21:47:17 +08:00
破娃酱 2cf5f1982e add DNS cache 2017-06-01 00:11:15 +08:00
破娃酱 b89931f9fc fix cmp in Python 3 2017-05-31 17:46:07 +08:00
破娃酱 abe4ac3b90 Async DNS query under UDP 2017-05-12 18:11:38 +08:00
glzjin c7815a0ee8 Support redirect rule (#145)
Syntax:

match_hostname_regex:port(* means match all port)#redirect_dist_host:redirect_port

and in the config.json(user-config.json) redirect param should be a list,

for example

```
"redirect": ["*:8080#zhaoj.in:80","zhaojin97.cn:80#127.0.0.1:80","*#pku.edu.cn:80"]
```

This example means abnormal connection which connect to port 8080 will be redirected to zhaoj.in:80,and if there a http request with hostname zhaojin97.cn(you can set hosts file to test it) will be redirected to 127.0.0.1:80,and the rest of abnormal connection will be redirect to pku.edu.cn:80
2016-12-24 21:25:53 +08:00
BreakWa11 f5434bdbd0 process empty str 2016-06-25 00:17:41 +08:00
BreakWa11 8031337d65 compatible python3 2016-06-21 21:04:41 +08:00
BreakWa11 2f8517190c ignore empty 2016-06-16 00:17:31 +08:00
BreakWa11 5c1b90b774 custom 'forbidden_ip' for each user
fix cmp for IPNetwork & PortRange
2016-06-15 18:34:05 +08:00
BreakWa11 8cbca008c6 custom 'forbidden_port' for each user 2016-06-15 18:13:45 +08:00
BreakWa11 72aab7701f fix a tiny bug 2016-06-15 17:29:05 +08:00
BreakWa11 d653c9bdb3 add forbidden_port 2016-06-15 17:09:12 +08:00
BreakWa11 b71af8f4df log connection info as debug level by default 2016-05-17 23:12:37 +08:00
BreakWa11 7f480248f8 Merge pull request #27 from falseen/manyuser-travis
fix travis
2015-12-04 21:24:08 +08:00
BreakWa11 19c84cac17 avoid conflict with OTA 2015-11-17 16:55:15 +08:00
BreakWa11 8826629741 fix http_simple calc 'head_size'
add 'iv', 'key', 'head_len' in server_info
2015-11-16 17:10:39 +08:00
Falseen 82b5980422 fix test files 2015-11-01 19:43:01 +08:00
BreakWa11 39dffa220f optimize code
add logs
add timestamp
2015-10-23 15:17:30 +08:00
breakwa11 36dc8f9463 add verify_deflate 2015-10-09 13:07:52 +08:00
breakwa11 61959945c3 revert encrypt.py
new obfs header
2015-08-27 16:41:00 +08:00
breakwa11 a9ea55c396 new UDP over TCP protocol, merge master 2015-08-05 16:24:14 +08:00
breakwa11 d4ca0d281c always UDP on
random length TCP/UDP packet
2015-06-23 17:43:20 +08:00
breakwa11 565812ae15 elaborate reasons of header parsing failure 2015-06-11 01:07:54 +08:00
breakwa11 c27f6283a2 UDP remote DNS resolve 2015-06-09 23:59:49 +08:00
breakwa11 f2efed9608 add manyuser branch
support udp over tcp
support chacha20 & salsa20 (base on libsodium)
2015-06-08 20:03:10 +08:00
clowwindy e74ae193d0 elaborate reasons of header parsing failure 2015-06-08 08:29:01 +08:00
clowwindy ce805f0aea license under Apache License v2.0 2015-02-03 14:10:36 +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 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 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 70dae91e7c add tests for common.py 2014-11-06 14:04:28 +08:00
clowwindy b5010df575 fix args on Python 3 2014-11-06 13:08:40 +08:00
clowwindy efd45ddfc6 fix UDP server 2014-10-31 21:59:22 +08:00
clowwindy 0fd2f30911 lint code 2014-10-31 18:43:15 +08:00
clowwindy 2a53b67c65 python 3 support; not stable yet 2014-10-31 18:28:22 +08:00
clowwindy 972bf22e6d fix PEP8 2014-08-27 00:17:26 +08:00
clowwindy a323f878e1 prefer addrtype 1 and 4 over 3 in UDP relay 2014-07-12 10:32:51 +08:00
clowwindy 45f9998fa9 more work 2014-06-08 14:17:26 +08:00
clowwindy bacf9cb443 more work 2014-06-01 13:42:48 +08:00
clowwindy c2f6bc369c more work 2014-06-01 11:01:11 +08:00
clowwindy 0d6c39900b more work 2014-05-30 23:55:33 +08:00