Skip to content

Commit 0f344b9

Browse files
authored
v1.7.1 upgrade
1 parent db061e0 commit 0f344b9

2 files changed

Lines changed: 102 additions & 61 deletions

File tree

README.rst

Lines changed: 78 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ python-proxy
1010
.. |Hit-Count| image:: http://hits.dwyl.io/qwj/python-proxy.svg
1111
:target: https://pypi.python.org/pypi/pproxy/
1212

13-
HTTP/Socks4/Socks5/Shadowsocks/ShadowsocksR/Redirect/Pf asynchronous tunnel proxy implemented in Python3 asyncio.
13+
HTTP/Socks4/Socks5/Shadowsocks/ShadowsocksR/Redirect/Pf TCP/UDP asynchronous tunnel proxy implemented in Python3 asyncio.
1414

1515
QuickStart
1616
----------
1717

1818
.. code:: rst
1919
2020
$ pip3 install pproxy
21-
Successfully installed pproxy-1.6.4
21+
Successfully installed pproxy-1.7.0
2222
$ pproxy
2323
Serving on :8080 by http,socks4,socks5
2424
^C
@@ -71,6 +71,7 @@ Features
7171
- Iptables NAT redirect packet tunnel.
7272
- PyPy3 support with JIT speedup.
7373
- System proxy auto-setting support.
74+
- UDP proxy client/server support.
7475

7576
.. _One-Time-Auth: https://shadowsocks.org/en/spec/one-time-auth.html
7677

@@ -115,17 +116,19 @@ Usage
115116
.. code:: rst
116117
117118
$ pproxy -h
118-
usage: pproxy [-h] [-i LISTEN] [-r RSERVER] [-b BLOCK] [-a ALIVED] [-v]
119-
[--ssl SSLFILE] [--pac PAC] [--get GETS] [--sys]
120-
[--test TESTURL] [--version]
119+
usage: pproxy [-h] [-i LISTEN] [-r RSERVER] [-ui ULISTEN] [-ur URSERVER]
120+
[-b BLOCK] [-a ALIVED] [-v] [--ssl SSLFILE] [--pac PAC]
121+
[--get GETS] [--sys] [--test TESTURL] [--version]
121122
122123
Proxy server that can tunnel among remote servers by regex rules. Supported
123-
protocols: http,socks4,socks5,shadowsocks,shadowsocksr,redirect
124+
protocols: http,socks4,socks5,shadowsocks,shadowsocksr,redirect,pf,tunnel
124125
125126
optional arguments:
126127
-h, --help show this help message and exit
127-
-i LISTEN proxy server setting uri (default: http+socks://:8080/)
128-
-r RSERVER remote server setting uri (default: direct)
128+
-i LISTEN tcp server uri (default: http+socks4+socks5://:8080/)
129+
-r RSERVER tcp remote server uri (default: direct)
130+
-ui ULISTEN udp server setting uri (default: none)
131+
-ur URSERVER udp remote server uri (default: direct)
129132
-b BLOCK block regex rules
130133
-a ALIVED interval to check remote alive (default: no check)
131134
-v print verbose output
@@ -141,31 +144,36 @@ Usage
141144
Protocols
142145
---------
143146

144-
+-------------------+------------+-----------+-------------+
145-
| Name | server | client | scheme |
146-
+===================+============+===========+=============+
147-
| http (connect) ||| http:// |
148-
+-------------------+------------+-----------+-------------+
149-
| http (get,post) ||| http:// |
150-
+-------------------+------------+-----------+-------------+
151-
| https ||| http+ssl:// |
152-
+-------------------+------------+-----------+-------------+
153-
| socks4 ||| socks4:// |
154-
+-------------------+------------+-----------+-------------+
155-
| socks5 ||| socks5:// |
156-
+-------------------+------------+-----------+-------------+
157-
| shadowsocks ||| ss:// |
158-
+-------------------+------------+-----------+-------------+
159-
| shadowsocks aead ||| ss:// |
160-
+-------------------+------------+-----------+-------------+
161-
| shadowsocksR ||| ssr:// |
162-
+-------------------+------------+-----------+-------------+
163-
| iptables nat || | redir:// |
164-
+-------------------+------------+-----------+-------------+
165-
| pfctl nat (macos) || | pf:// |
166-
+-------------------+------------+-----------+-------------+
167-
| AUTO DETECT || | a+b+c+d:// |
168-
+-------------------+------------+-----------+-------------+
147+
+-------------------+------------+------------+------------+------------+--------------+
148+
| Name | TCP server | TCP client | UDP server | UDP client | scheme |
149+
+===================+============+============+============+============+==============+
150+
| http (connect) ||| | | http:// |
151+
+-------------------+------------+------------+------------+------------+--------------+
152+
| http (get,post) ||| | | http:// |
153+
+-------------------+------------+------------+------------+------------+--------------+
154+
| https ||| | | http+ssl:// |
155+
+-------------------+------------+------------+------------+------------+--------------+
156+
| socks4 ||| | | socks4:// |
157+
+-------------------+------------+------------+------------+------------+--------------+
158+
| socks5 ||| ✔ udp-only | ✔ udp-only | socks5:// |
159+
+-------------------+------------+------------+------------+------------+--------------+
160+
| shadowsocks ||||| ss:// |
161+
+-------------------+------------+------------+------------+------------+--------------+
162+
| shadowsocks aead ||| | | ss:// |
163+
+-------------------+------------+------------+------------+------------+--------------+
164+
| shadowsocksR ||| | | ssr:// |
165+
+-------------------+------------+------------+------------+------------+--------------+
166+
| iptables nat || | | | redir:// |
167+
+-------------------+------------+------------+------------+------------+--------------+
168+
| pfctl nat (macos) || | | | pf:// |
169+
+-------------------+------------+------------+------------+------------+--------------+
170+
| echo || | | | echo:// |
171+
+-------------------+------------+------------+------------+------------+--------------+
172+
| tunnel ||||| tunnel:// |
173+
| (raw socket) | | | | | tunnel{ip}://|
174+
+-------------------+------------+------------+------------+------------+--------------+
175+
| AUTO DETECT || || | a+b+c+d:// |
176+
+-------------------+------------+------------+------------+------------+--------------+
169177

170178
URI Syntax
171179
----------
@@ -197,6 +205,10 @@ URI Syntax
197205
+--------+-----------------------------+
198206
| secure | secured ssl/tls (cert) |
199207
+--------+-----------------------------+
208+
| tunnel | raw connection |
209+
+--------+-----------------------------+
210+
| echo | echo-back service |
211+
+--------+-----------------------------+
200212
| direct | direct connection |
201213
+--------+-----------------------------+
202214

@@ -451,3 +463,36 @@ Examples
451463
452464
*pproxy* will connect to server1 first, tell server1 connect to server2, and tell server2 connect to server3, and make real traffic by server3.
453465

466+
- Raw connection tunnel
467+
468+
TCP raw connection tunnel example:
469+
470+
.. code:: rst
471+
472+
$ pproxy -i tunnel{google.com}://:80
473+
$ curl -H "Host: google.com" http://localhost
474+
475+
UDP dns tunnel example:
476+
477+
.. code:: rst
478+
479+
$ pproxy -ui tunnel{8.8.8.8}://:53
480+
$ nslookup google.com localhost
481+
482+
- UDP more complicated example
483+
484+
Run the shadowsocks udp proxy on remote machine:
485+
486+
.. code:: rst
487+
488+
$ pproxy -ui ss://remote_server:13245
489+
490+
Run the commands on local machine:
491+
492+
.. code:: rst
493+
494+
$ pproxy -ui tunnel{8.8.8.8}://:53 -ur ss://remote_server:13245
495+
UDP tunnel 127.0.0.1:60573 -> ss remote_server:13245 -> 8.8.8.8:53
496+
UDP tunnel 127.0.0.1:60574 -> ss remote_server:13245 -> 8.8.8.8:53
497+
...
498+
$ nslookup google.com localhost

setup.py

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
11
from setuptools import setup
2-
import os, io, re
2+
import os, re
33

44
def read(*names, **kwargs):
5-
with io.open(
6-
os.path.join(os.path.dirname(__file__), *names),
7-
encoding=kwargs.get("encoding", "utf8")
8-
) as fp:
5+
with open(os.path.join(os.path.dirname(__file__), *names)) as fp:
96
return fp.read()
107

11-
def find_version(*file_paths):
12-
version_file = read(*file_paths)
13-
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
14-
version_file, re.M)
15-
if version_match:
16-
return version_match.group(1)
17-
raise RuntimeError("Unable to find version string.")
8+
def find_value(name):
9+
data_file = read('pproxy', '__doc__.py')
10+
data_match = re.search(r"^__%s__ += ['\"]([^'\"]*)['\"]" % name, data_file, re.M)
11+
if data_match:
12+
return data_match.group(1)
13+
raise RuntimeError(f"Unable to find '{name}' string.")
1814

1915
setup(
20-
name='pproxy',
21-
version=find_version('pproxy', '__init__.py'),
22-
description='Proxy server that can tunnel among remote servers by regex rules.',
23-
long_description=read('README.rst'),
24-
url='https://github.com/qwj/python-proxy',
25-
author='Qian Wenjie',
26-
author_email='qianwenjie@gmail.com',
27-
license='MIT',
28-
python_requires='>=3.6',
29-
classifiers=[
16+
name = find_value('title'),
17+
version = find_value('version'),
18+
description = find_value('description'),
19+
long_description = read('README.rst'),
20+
url = find_value('url'),
21+
author = find_value('author'),
22+
author_email = find_value('email'),
23+
license = find_value('license'),
24+
python_requires = '>=3.6',
25+
keywords = find_value('keywords'),
26+
packages = ['pproxy'],
27+
classifiers = [
3028
'Development Status :: 5 - Production/Stable',
3129
'Environment :: Console',
3230
'Intended Audience :: Developers',
@@ -37,17 +35,15 @@ def find_version(*file_paths):
3735
'Programming Language :: Python :: 3.6',
3836
'Programming Language :: Python :: 3.7',
3937
],
40-
keywords='proxy socks http shadowsocks shadowsocksr ssr redirect tunnel cipher ssl',
41-
packages=['pproxy'],
42-
extras_require={
38+
extras_require = {
4339
'accelerated': [
4440
'pycryptodome',
4541
],
4642
},
47-
install_requires=[],
48-
entry_points={
43+
install_requires = [],
44+
entry_points = {
4945
'console_scripts': [
50-
'pproxy=pproxy:main',
46+
'pproxy = pproxy.server:main',
5147
],
5248
},
5349
)

0 commit comments

Comments
 (0)