wisp-python 0.9.1__tar.gz → 0.10.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {wisp_python-0.9.1/src/wisp_python.egg-info → wisp_python-0.10.0}/PKG-INFO +13 -5
- {wisp_python-0.9.1 → wisp_python-0.10.0}/README.md +10 -4
- {wisp_python-0.9.1 → wisp_python-0.10.0}/pyproject.toml +6 -1
- {wisp_python-0.9.1 → wisp_python-0.10.0}/src/wisp/server/cli.py +10 -2
- {wisp_python-0.9.1 → wisp_python-0.10.0}/src/wisp/server/net.py +13 -1
- {wisp_python-0.9.1 → wisp_python-0.10.0/src/wisp_python.egg-info}/PKG-INFO +13 -5
- {wisp_python-0.9.1 → wisp_python-0.10.0}/src/wisp_python.egg-info/SOURCES.txt +0 -1
- {wisp_python-0.9.1 → wisp_python-0.10.0}/src/wisp_python.egg-info/requires.txt +3 -0
- wisp_python-0.9.1/src/wisp/server/warp.py +0 -0
- {wisp_python-0.9.1 → wisp_python-0.10.0}/LICENSE +0 -0
- {wisp_python-0.9.1 → wisp_python-0.10.0}/LICENSE_third_party.md +0 -0
- {wisp_python-0.9.1 → wisp_python-0.10.0}/setup.cfg +0 -0
- {wisp_python-0.9.1 → wisp_python-0.10.0}/src/wisp/__init__.py +0 -0
- {wisp_python-0.9.1 → wisp_python-0.10.0}/src/wisp/server/__init__.py +0 -0
- {wisp_python-0.9.1 → wisp_python-0.10.0}/src/wisp/server/__main__.py +0 -0
- {wisp_python-0.9.1 → wisp_python-0.10.0}/src/wisp/server/connection.py +0 -0
- {wisp_python-0.9.1 → wisp_python-0.10.0}/src/wisp/server/http.py +0 -0
- {wisp_python-0.9.1 → wisp_python-0.10.0}/src/wisp/server/ratelimit.py +0 -0
- {wisp_python-0.9.1 → wisp_python-0.10.0}/src/wisp/util.py +0 -0
- {wisp_python-0.9.1 → wisp_python-0.10.0}/src/wisp_python.egg-info/dependency_links.txt +0 -0
- {wisp_python-0.9.1 → wisp_python-0.10.0}/src/wisp_python.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wisp-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.0
|
|
4
4
|
Summary: An implementation of a Wisp proxy server in Python
|
|
5
5
|
Author: ading2210
|
|
6
6
|
License-Expression: AGPL-3.0-or-later
|
|
@@ -17,6 +17,8 @@ Requires-Dist: asyncudp
|
|
|
17
17
|
Requires-Dist: python-socks[asyncio]
|
|
18
18
|
Requires-Dist: uvloop; sys_platform != "win32" and sys_platform != "cygwin"
|
|
19
19
|
Requires-Dist: winloop; sys_platform == "win32" or sys_platform == "cygwin"
|
|
20
|
+
Provides-Extra: warp
|
|
21
|
+
Requires-Dist: pymasque; extra == "warp"
|
|
20
22
|
Dynamic: license-file
|
|
21
23
|
|
|
22
24
|
# Python Wisp Server
|
|
@@ -38,15 +40,21 @@ Run the following command to install this program:
|
|
|
38
40
|
pip3 install wisp-python
|
|
39
41
|
```
|
|
40
42
|
|
|
43
|
+
To install the Cloudflare Warp proxy feature:
|
|
44
|
+
```
|
|
45
|
+
pip3 install wisp-python[warp]
|
|
46
|
+
```
|
|
47
|
+
This allows you proxy all exit traffic through Cloudflare Warp.
|
|
48
|
+
|
|
41
49
|
## Running the Server:
|
|
42
50
|
For the best performance use [CPython](https://github.com/python/cpython) 3.11 or newer. [PyPy](https://github.com/pypy/pypy) is not recommended as it is a lot slower than CPython here.
|
|
43
51
|
|
|
44
52
|
To start the server, run `python3 -m wisp.server`. The program accepts the following arguments:
|
|
45
53
|
```
|
|
46
|
-
usage: wisp-server-python [-h] [--host HOST] [--port PORT] [--static STATIC] [--limits] [--bandwidth BANDWIDTH] [--connections CONNECTIONS] [--window WINDOW] [--allow-loopback] [--allow-private] [--log-level LOG_LEVEL]
|
|
47
|
-
[--
|
|
54
|
+
usage: wisp-server-python [-h] [--host HOST] [--port PORT] [--static STATIC] [--limits] [--bandwidth BANDWIDTH] [--connections CONNECTIONS] [--window WINDOW] [--allow-loopback] [--allow-private] [--log-level LOG_LEVEL] [--threads THREADS] [--proxy PROXY]
|
|
55
|
+
[--block-udp] [--block-tcp]
|
|
48
56
|
|
|
49
|
-
A Wisp server implementation, written in Python (v0.
|
|
57
|
+
A Wisp server implementation, written in Python (v0.10.0)
|
|
50
58
|
|
|
51
59
|
options:
|
|
52
60
|
-h, --help show this help message and exit
|
|
@@ -64,7 +72,7 @@ options:
|
|
|
64
72
|
--log-level LOG_LEVEL
|
|
65
73
|
The log level (either debug, info, warning, error, or critical).
|
|
66
74
|
--threads THREADS The number of threads to run the server on. By default it uses all CPU cores. (Linux only)
|
|
67
|
-
--proxy PROXY The url of the socks5h, socks5, sock4a, socks4 or http proxy to use.
|
|
75
|
+
--proxy PROXY The url of the socks5h, socks5, sock4a, socks4 or http proxy to use. Set this to 'warp' to use Cloudflare Warp as a proxy.
|
|
68
76
|
--block-udp Block UDP streams.
|
|
69
77
|
--block-tcp Block TCP streams.
|
|
70
78
|
```
|
|
@@ -17,15 +17,21 @@ Run the following command to install this program:
|
|
|
17
17
|
pip3 install wisp-python
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
To install the Cloudflare Warp proxy feature:
|
|
21
|
+
```
|
|
22
|
+
pip3 install wisp-python[warp]
|
|
23
|
+
```
|
|
24
|
+
This allows you proxy all exit traffic through Cloudflare Warp.
|
|
25
|
+
|
|
20
26
|
## Running the Server:
|
|
21
27
|
For the best performance use [CPython](https://github.com/python/cpython) 3.11 or newer. [PyPy](https://github.com/pypy/pypy) is not recommended as it is a lot slower than CPython here.
|
|
22
28
|
|
|
23
29
|
To start the server, run `python3 -m wisp.server`. The program accepts the following arguments:
|
|
24
30
|
```
|
|
25
|
-
usage: wisp-server-python [-h] [--host HOST] [--port PORT] [--static STATIC] [--limits] [--bandwidth BANDWIDTH] [--connections CONNECTIONS] [--window WINDOW] [--allow-loopback] [--allow-private] [--log-level LOG_LEVEL]
|
|
26
|
-
[--
|
|
31
|
+
usage: wisp-server-python [-h] [--host HOST] [--port PORT] [--static STATIC] [--limits] [--bandwidth BANDWIDTH] [--connections CONNECTIONS] [--window WINDOW] [--allow-loopback] [--allow-private] [--log-level LOG_LEVEL] [--threads THREADS] [--proxy PROXY]
|
|
32
|
+
[--block-udp] [--block-tcp]
|
|
27
33
|
|
|
28
|
-
A Wisp server implementation, written in Python (v0.
|
|
34
|
+
A Wisp server implementation, written in Python (v0.10.0)
|
|
29
35
|
|
|
30
36
|
options:
|
|
31
37
|
-h, --help show this help message and exit
|
|
@@ -43,7 +49,7 @@ options:
|
|
|
43
49
|
--log-level LOG_LEVEL
|
|
44
50
|
The log level (either debug, info, warning, error, or critical).
|
|
45
51
|
--threads THREADS The number of threads to run the server on. By default it uses all CPU cores. (Linux only)
|
|
46
|
-
--proxy PROXY The url of the socks5h, socks5, sock4a, socks4 or http proxy to use.
|
|
52
|
+
--proxy PROXY The url of the socks5h, socks5, sock4a, socks4 or http proxy to use. Set this to 'warp' to use Cloudflare Warp as a proxy.
|
|
47
53
|
--block-udp Block UDP streams.
|
|
48
54
|
--block-tcp Block TCP streams.
|
|
49
55
|
```
|
|
@@ -11,7 +11,7 @@ package-dir = {"" = "src"}
|
|
|
11
11
|
|
|
12
12
|
[project]
|
|
13
13
|
name = "wisp-python"
|
|
14
|
-
version = "0.
|
|
14
|
+
version = "0.10.0"
|
|
15
15
|
license = "AGPL-3.0-or-later"
|
|
16
16
|
authors = [
|
|
17
17
|
{name="ading2210"},
|
|
@@ -31,6 +31,11 @@ dependencies = [
|
|
|
31
31
|
"winloop; sys_platform == 'win32' or sys_platform == 'cygwin'"
|
|
32
32
|
]
|
|
33
33
|
|
|
34
|
+
[project.optional-dependencies]
|
|
35
|
+
warp = [
|
|
36
|
+
"pymasque"
|
|
37
|
+
]
|
|
38
|
+
|
|
34
39
|
[project.urls]
|
|
35
40
|
Homepage = "https://github.com/MercuryWorkshop/wisp-server-python"
|
|
36
41
|
Issues = "https://github.com/MercuryWorkshop/wisp-server-python/issues"
|
|
@@ -23,6 +23,12 @@ except ImportError:
|
|
|
23
23
|
except ImportError:
|
|
24
24
|
event_loop = "asyncio"
|
|
25
25
|
|
|
26
|
+
try:
|
|
27
|
+
import pymasque
|
|
28
|
+
has_pymasque = True
|
|
29
|
+
except ImportError:
|
|
30
|
+
has_pymasque = False
|
|
31
|
+
|
|
26
32
|
import wisp
|
|
27
33
|
from wisp.server import http
|
|
28
34
|
from wisp.server import net
|
|
@@ -86,7 +92,7 @@ def main():
|
|
|
86
92
|
parser.add_argument("--allow-private", action="store_true", help="Allow connections to private IP addresses.")
|
|
87
93
|
parser.add_argument("--log-level", default="info", help="The log level (either debug, info, warning, error, or critical).")
|
|
88
94
|
parser.add_argument("--threads", default=0, help="The number of threads to run the server on. By default it uses all CPU cores. (Linux only)")
|
|
89
|
-
parser.add_argument("--proxy", default=None, help="The url of the socks5h, socks5, sock4a, socks4 or http proxy to use.")
|
|
95
|
+
parser.add_argument("--proxy", default=None, help="The url of the socks5h, socks5, sock4a, socks4 or http proxy to use. Set this to 'warp' to use Cloudflare Warp as a proxy.")
|
|
90
96
|
parser.add_argument("--block-udp", action="store_true", help="Block UDP streams.")
|
|
91
97
|
parser.add_argument("--block-tcp", action="store_true", help="Block TCP streams.")
|
|
92
98
|
args = parser.parse_args()
|
|
@@ -96,8 +102,10 @@ def main():
|
|
|
96
102
|
level=getattr(logging, args.log_level.upper()),
|
|
97
103
|
datefmt="%Y/%m/%d - %H:%M:%S"
|
|
98
104
|
)
|
|
99
|
-
|
|
100
105
|
logging.info(f"running wisp-server-python v{wisp.version} (async)")
|
|
106
|
+
|
|
107
|
+
if args.proxy and args.proxy == "warp" and has_pymasque == False:
|
|
108
|
+
raise ImportError("warp proxy was selected by pymasque is not installed. run 'pip install wisp-python[warp]' to install it")
|
|
101
109
|
if args.static:
|
|
102
110
|
static_path = pathlib.Path(args.static).resolve()
|
|
103
111
|
logging.info(f"serving static files from {static_path}")
|
|
@@ -4,6 +4,10 @@ import ipaddress
|
|
|
4
4
|
|
|
5
5
|
import asyncudp
|
|
6
6
|
from python_socks.async_.asyncio import Proxy
|
|
7
|
+
try:
|
|
8
|
+
import pymasque
|
|
9
|
+
except ImportError:
|
|
10
|
+
pass
|
|
7
11
|
|
|
8
12
|
#various network utilities and wrappers
|
|
9
13
|
|
|
@@ -15,6 +19,7 @@ block_tcp = False
|
|
|
15
19
|
|
|
16
20
|
proxy_url = None
|
|
17
21
|
proxy_dns = False
|
|
22
|
+
warp = None
|
|
18
23
|
|
|
19
24
|
def reuse_port_supported():
|
|
20
25
|
return hasattr(socket, "SO_REUSEPORT")
|
|
@@ -69,7 +74,14 @@ class TCPConnection:
|
|
|
69
74
|
raise TypeError("TCP connection blocked.")
|
|
70
75
|
|
|
71
76
|
addr_str = await validate_hostname(self.hostname, self.port, 0x01)
|
|
72
|
-
if proxy_url:
|
|
77
|
+
if proxy_url == "warp":
|
|
78
|
+
global warp
|
|
79
|
+
if warp is None:
|
|
80
|
+
warp = pymasque.WarpConnection()
|
|
81
|
+
stream = await warp.open_stream(self.hostname, self.port)
|
|
82
|
+
await stream.ensure_response()
|
|
83
|
+
self.tcp_reader, self.tcp_writer = stream, stream
|
|
84
|
+
elif proxy_url:
|
|
73
85
|
proxy = Proxy.from_url(proxy_url, rdns=proxy_dns)
|
|
74
86
|
proxy_dest = self.hostname if proxy_dns else addr_str
|
|
75
87
|
sock = await proxy.connect(dest_host=proxy_dest, dest_port=self.port)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wisp-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.0
|
|
4
4
|
Summary: An implementation of a Wisp proxy server in Python
|
|
5
5
|
Author: ading2210
|
|
6
6
|
License-Expression: AGPL-3.0-or-later
|
|
@@ -17,6 +17,8 @@ Requires-Dist: asyncudp
|
|
|
17
17
|
Requires-Dist: python-socks[asyncio]
|
|
18
18
|
Requires-Dist: uvloop; sys_platform != "win32" and sys_platform != "cygwin"
|
|
19
19
|
Requires-Dist: winloop; sys_platform == "win32" or sys_platform == "cygwin"
|
|
20
|
+
Provides-Extra: warp
|
|
21
|
+
Requires-Dist: pymasque; extra == "warp"
|
|
20
22
|
Dynamic: license-file
|
|
21
23
|
|
|
22
24
|
# Python Wisp Server
|
|
@@ -38,15 +40,21 @@ Run the following command to install this program:
|
|
|
38
40
|
pip3 install wisp-python
|
|
39
41
|
```
|
|
40
42
|
|
|
43
|
+
To install the Cloudflare Warp proxy feature:
|
|
44
|
+
```
|
|
45
|
+
pip3 install wisp-python[warp]
|
|
46
|
+
```
|
|
47
|
+
This allows you proxy all exit traffic through Cloudflare Warp.
|
|
48
|
+
|
|
41
49
|
## Running the Server:
|
|
42
50
|
For the best performance use [CPython](https://github.com/python/cpython) 3.11 or newer. [PyPy](https://github.com/pypy/pypy) is not recommended as it is a lot slower than CPython here.
|
|
43
51
|
|
|
44
52
|
To start the server, run `python3 -m wisp.server`. The program accepts the following arguments:
|
|
45
53
|
```
|
|
46
|
-
usage: wisp-server-python [-h] [--host HOST] [--port PORT] [--static STATIC] [--limits] [--bandwidth BANDWIDTH] [--connections CONNECTIONS] [--window WINDOW] [--allow-loopback] [--allow-private] [--log-level LOG_LEVEL]
|
|
47
|
-
[--
|
|
54
|
+
usage: wisp-server-python [-h] [--host HOST] [--port PORT] [--static STATIC] [--limits] [--bandwidth BANDWIDTH] [--connections CONNECTIONS] [--window WINDOW] [--allow-loopback] [--allow-private] [--log-level LOG_LEVEL] [--threads THREADS] [--proxy PROXY]
|
|
55
|
+
[--block-udp] [--block-tcp]
|
|
48
56
|
|
|
49
|
-
A Wisp server implementation, written in Python (v0.
|
|
57
|
+
A Wisp server implementation, written in Python (v0.10.0)
|
|
50
58
|
|
|
51
59
|
options:
|
|
52
60
|
-h, --help show this help message and exit
|
|
@@ -64,7 +72,7 @@ options:
|
|
|
64
72
|
--log-level LOG_LEVEL
|
|
65
73
|
The log level (either debug, info, warning, error, or critical).
|
|
66
74
|
--threads THREADS The number of threads to run the server on. By default it uses all CPU cores. (Linux only)
|
|
67
|
-
--proxy PROXY The url of the socks5h, socks5, sock4a, socks4 or http proxy to use.
|
|
75
|
+
--proxy PROXY The url of the socks5h, socks5, sock4a, socks4 or http proxy to use. Set this to 'warp' to use Cloudflare Warp as a proxy.
|
|
68
76
|
--block-udp Block UDP streams.
|
|
69
77
|
--block-tcp Block TCP streams.
|
|
70
78
|
```
|
|
@@ -11,7 +11,6 @@ src/wisp/server/connection.py
|
|
|
11
11
|
src/wisp/server/http.py
|
|
12
12
|
src/wisp/server/net.py
|
|
13
13
|
src/wisp/server/ratelimit.py
|
|
14
|
-
src/wisp/server/warp.py
|
|
15
14
|
src/wisp_python.egg-info/PKG-INFO
|
|
16
15
|
src/wisp_python.egg-info/SOURCES.txt
|
|
17
16
|
src/wisp_python.egg-info/dependency_links.txt
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|