Skip to content

Commit 9ccfb2a

Browse files
authored
Add files via upload
1 parent b647d12 commit 9ccfb2a

1 file changed

Lines changed: 30 additions & 16 deletions

File tree

README.rst

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
python-proxy
22
===========
33

4-
HTTP/Socks5/Shadowsocks asynchronous tunnel proxy implemented in Python 3.6 asyncio.
4+
HTTP/Socks/Shadowsocks asynchronous tunnel proxy implemented in Python 3.6 asyncio.
55

66
Features
77
-----------
88

99
- Single-thread asynchronous IO with high availability and scalability.
1010
- Compact (~500 lines) and powerful by leveraging python builtin *asyncio* library.
11-
- Automatically detect incoming traffic: HTTP/Socks5/Shadowsocks.
12-
- Specify multiple remote servers for outcoming traffic: HTTP/Socks5/Shadowsocks.
11+
- Automatically detect incoming traffic: HTTP/Socks/Shadowsocks.
12+
- Specify multiple remote servers for outcoming traffic: HTTP/Socks/Shadowsocks.
1313
- Unix domain socket support for communicating locally.
1414
- Basic authentication support for all three protocols.
1515
- Regex pattern file support to route/block by hostname matching.
@@ -22,7 +22,7 @@ Features
2222
Python 3.6
2323
-----------
2424

25-
*Python 3.5* added new syntax *async def* and *await* to make asyncio programming easier. *Python 3.6* added new syntax *formatted string literals*. This tool is to demonstrate how compact these new syntax can be. It includes many features, and is also fully ready for production usage.
25+
*Python 3.5* added new syntax *async def* and *await* to make asyncio programming easier. *Python 3.6* added new syntax *formatted string literals*. This tool is to demonstrate these new syntax so the minimal Python requirement is *Python 3.6*. It has many features, and is also fully ready for production usage.
2626

2727
Installation
2828
-----------
@@ -55,23 +55,26 @@ Usage
5555

5656
Online help: <https://github.com/qwj/python-proxy>
5757

58-
Uri Syntax
58+
URI Syntax
5959
-----------
6060

6161
{scheme}://[{cipher}@]{netloc}[?{rules}][#{auth}]
6262

6363
- scheme
6464
- Currently supported scheme: http, socks, ss, ssl, secure. You can use + to link multiple protocols together.
65-
:http: http protocol
66-
:socks: socks5 protocol
67-
:ss: shadowsocks protocol
68-
:ssl: communicate in (unsecured) ssl
69-
:secure: comnunicate in (secured) ssl
65+
66+
:http http protocol
67+
:socks socks5 protocol
68+
:ss shadowsocks protocol
69+
:ssl communicate in (unsecured) ssl
70+
:secure comnunicate in (secured) ssl
71+
7072
- Valid schemes: http://, http+socks://, http+ssl://, ss+secure://, http+socks+ss://
7173
- Invalid schemes: ssl://, secure://
7274
- cipher
7375
- Cipher is consisted by cipher name, colon ':' and cipher key.
7476
- Full supported cipher list:
77+
7578
+------------+------------+-----------+-------------+
7679
| Cipher | Key Length | IV Length | Security |
7780
+============+============+===========+=============+
@@ -97,6 +100,7 @@ Uri Syntax
97100
+------------+------------+-----------+-------------+
98101
| des-cfb | 8 | 8 | 1 |
99102
+------------+------------+-----------+-------------+
103+
100104
- To enable OTA encryption with shadowsocks, add '!' immediately after cipher name.
101105
- netloc
102106
- It can be "hostname:port" or "/unix_domaon_path". If the hostname is empty, server will listen on all interfaces.
@@ -129,24 +133,34 @@ We can define file "rules" as follow:
129133
130134
Then start the pproxy
131135

132-
pproxy -i http+socks://:8080 -r http://aa.bb.cc.dd:8080?rules -v
133-
136+
$ pproxy -i http+socks://:8080 -r http://aa.bb.cc.dd:8080?rules -v
137+
http www.googleapis.com:443 -> http aa.bb.cc.dd:8080
138+
socks www.youtube.com:443 -> http aa.bb.cc.dd:8080
139+
http www.yahoo.com:80
140+
DIRECT: 1 (0.5K/s,1.2M/s) PROXY: 2 (24.3K/s,1.9M/s)
141+
134142
With these parameters, this utility will serve incoming traffic by either http/socks5 protocol, redirect all google traffic to http proxy aa.bb.cc.dd:8080, and visit all other traffic locally.
135143

136-
To bridge two servers, add cipher key to ensure data can't be intercepted. First, run pproxy locally
144+
To bridge two servers, add cipher encryption to ensure data can't be intercepted. First, run pproxy locally
137145

138-
pproxy -i ss://:8888 -r ss://chacha20:cipher_key@aa.bb.cc.dd:12345 -v
146+
$ pproxy -i ss://:8888 -r ss://chacha20:cipher_key@aa.bb.cc.dd:12345 -v
139147

140148
Next, run pproxy.py remotely on server "aa.bb.cc.dd"
141149

142-
pproxy -i ss://chacha20:cipher_key@:12345
150+
$ pproxy -i ss://chacha20:cipher_key@:12345
143151

144152
By doing this, the traffic between local and aa.bb.cc.dd is encrypted by stream cipher Chacha20 with key "cipher_key". If target hostname is not matched by regex file "rules", traffic will go through locally. Otherwise, traffic will go through the remote server by encryption.
145153

146154
A more complex example:
147155

148-
pproxy -i ss://salsa20!:complex_cipher_key@/tmp/pproxy_socket -r http+ssl://domain1.com:443#username:password
156+
$ pproxy -i ss://salsa20!:complex_cipher_key@/tmp/pproxy_socket -r http+ssl://domain1.com:443#username:password
149157

150158
It listen on the unix domain socket /tmp/pproxy_socket, and use cipher name salsa20, cipher key "complex_cipher_key", and enable OTA encryption for shadowsocks protocol. The traffic is tunneled to remote https proxy with simple authentication.
151159

160+
If you want to listen in SSL, you must specify ssl certificate and private key files by parameter "--ssl", there is an example:
161+
162+
$ pproxy -i http+ssl://0.0.0.0:443 --ssl server.crt,server.key --pac /autopac
163+
164+
It listen on 443 HTTPS port, use the specified certificate and private key files. The "--pac" enable PAC support, so you can put https://yourdomain.com/autopac in your device's auto-configure url.
165+
152166

0 commit comments

Comments
 (0)