wisp-python 0.8.0__py3-none-any.whl → 0.8.1__py3-none-any.whl

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/server/cli.py CHANGED
@@ -48,6 +48,8 @@ def main():
48
48
  parser.add_argument("--log-level", default="info", help="The log level (either debug, info, warning, error, or critical).")
49
49
  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)")
50
50
  parser.add_argument("--proxy", default=None, help="The url of the socks5h, socks5, sock4a, socks4 or http proxy to use.")
51
+ parser.add_argument("--block-udp", action="store_true", help="Block UDP streams.")
52
+ parser.add_argument("--block-tcp", action="store_true", help="Block TCP streams.")
51
53
  args = parser.parse_args()
52
54
 
53
55
  logging.basicConfig(
wisp/server/http.py CHANGED
@@ -86,6 +86,8 @@ async def main(args):
86
86
 
87
87
  net.block_loopback = not args.allow_loopback
88
88
  net.block_private = not args.allow_private
89
+ net.block_udp = args.block_udp
90
+ net.block_tcp = args.block_tcp
89
91
 
90
92
  limit_task = asyncio.create_task(ratelimit.reset_limits_timer())
91
93
  ws_logger = logging.getLogger("websockets")
wisp/server/net.py CHANGED
@@ -10,6 +10,8 @@ from python_socks.async_.asyncio import Proxy
10
10
  tcp_size = 64*1024
11
11
  block_loopback = False
12
12
  block_private = False
13
+ block_udp = False
14
+ block_tcp = False
13
15
 
14
16
  proxy_url = None
15
17
  proxy_dns = False
@@ -62,6 +64,9 @@ class TCPConnection:
62
64
  self.tcp_reader = None
63
65
 
64
66
  async def connect(self):
67
+ if block_tcp:
68
+ raise TypeError("TCP connection blocked.")
69
+
65
70
  addr_str = await validate_hostname(self.hostname, self.port, 0x01)
66
71
  if proxy_url:
67
72
  proxy = Proxy.from_url(proxy_url, rdns=proxy_dns)
@@ -99,8 +104,11 @@ class UDPConnection:
99
104
  self.socket = None
100
105
 
101
106
  async def connect(self):
107
+ if block_udp:
108
+ raise TypeError("UDP connection blocked.")
102
109
  if proxy_url:
103
110
  raise NotImplementedError("SOCKS/HTTP proxy is not supported for UDP.")
111
+
104
112
  addr_str = await validate_hostname(self.hostname, self.port, 0x02)
105
113
  self.socket = await asyncudp.create_socket(remote_addr=(addr_str, self.port))
106
114
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wisp-python
3
- Version: 0.8.0
3
+ Version: 0.8.1
4
4
  Summary: An implementation of a Wisp proxy server in Python
5
5
  Author: ading2210
6
6
  Project-URL: Homepage, https://github.com/MercuryWorkshop/wisp-server-python
@@ -42,10 +42,10 @@ For the best performance use [CPython](https://github.com/python/cpython) 3.11 o
42
42
 
43
43
  To start the server, run `python3 -m wisp.server`. The program accepts the following arguments:
44
44
  ```
45
- usage: wisp-server-python [-h] [--host HOST] [--port PORT] [--static STATIC] [--limits] [--bandwidth BANDWIDTH] [--connections CONNECTIONS] [--window WINDOW] [--allow-loopback] [--allow-private]
46
- [--log-level LOG_LEVEL] [--threads THREADS] [--proxy PROXY]
45
+ 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]
46
+ [--threads THREADS] [--proxy PROXY] [--block-udp] [--block-tcp]
47
47
 
48
- A Wisp server implementation, written in Python (v0.8.0)
48
+ A Wisp server implementation, written in Python (v0.8.1)
49
49
 
50
50
  options:
51
51
  -h, --help show this help message and exit
@@ -64,6 +64,8 @@ options:
64
64
  The log level (either debug, info, warning, error, or critical).
65
65
  --threads THREADS The number of threads to run the server on. By default it uses all CPU cores. (Linux only)
66
66
  --proxy PROXY The url of the socks5h, socks5, sock4a, socks4 or http proxy to use.
67
+ --block-udp Block UDP streams.
68
+ --block-tcp Block TCP streams.
67
69
  ```
68
70
 
69
71
  ## Roadmap:
@@ -76,7 +78,7 @@ options:
76
78
  ## Copyright:
77
79
  This repository is licensed under the GNU AGPL v3.
78
80
 
79
- A few third party libraries are used. See [`LICENSE_third_party.md`](https://github.com/MercuryWorkshop/wisp-server-python/blob/main/LICENSE).
81
+ A few third party libraries are used. See [`LICENSE_third_party.md`](https://github.com/MercuryWorkshop/wisp-server-python/blob/main/LICENSE_third_party.md).
80
82
 
81
83
  ### Copyright Notice:
82
84
  ```
@@ -0,0 +1,15 @@
1
+ wisp/__init__.py,sha256=02Fv0s_jJG8U4y5B6AzKPIOzxAuqJyY_So8Guz5bdTk,75
2
+ wisp/util.py,sha256=AU7si8VwJqS8Dwc1PT2pu_f_9Y32GQxivRYwJ3-U0YQ,144
3
+ wisp/server/__init__.py,sha256=LmgQ1nTlnqcTPqRJVc1NGapV9qVR-BK8iPVUMSJ74Qs,102
4
+ wisp/server/__main__.py,sha256=zhDqmhOY9HgHx-BOq-kU5IoxZCMJwt_PEEEISaZr9Mk,68
5
+ wisp/server/cli.py,sha256=4cCcs9rDkELPcufVMbdJ3DATJ7z7ThnEAX9sJ8IEWFo,3526
6
+ wisp/server/connection.py,sha256=V_Skmmsvn30lQKY5w9x2rJQFR_FsA3lngNDpaYOfX6U,7669
7
+ wisp/server/http.py,sha256=wEEpxhiodf6E4cacuRYm-WAzp7wZDqDloeESfjSSPu4,3460
8
+ wisp/server/net.py,sha256=w7XTCB4mmOP4BlgT6zl59_z1HFK_4mVBbh6CNF962t4,3353
9
+ wisp/server/ratelimit.py,sha256=cic_rlBaM-tp6kJaSz4ITGvUbsX4JLSGSUgF5cPO0FY,1926
10
+ wisp_python-0.8.1.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
11
+ wisp_python-0.8.1.dist-info/licenses/LICENSE_third_party.md,sha256=_YgCpygAXxOtr7gpjRTv7W1DTqZU_f7IMwjdPvw4VxY,15360
12
+ wisp_python-0.8.1.dist-info/METADATA,sha256=AJU5q3pErKxxYJJQycdSstzA9_ahtVyRWoeURv_tgjg,4184
13
+ wisp_python-0.8.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
+ wisp_python-0.8.1.dist-info/top_level.txt,sha256=sv0LDAu8cHUc3_VTsCKfXU-6B9HdV4dW22ubeW8KPVs,5
15
+ wisp_python-0.8.1.dist-info/RECORD,,
@@ -1,15 +0,0 @@
1
- wisp/__init__.py,sha256=02Fv0s_jJG8U4y5B6AzKPIOzxAuqJyY_So8Guz5bdTk,75
2
- wisp/util.py,sha256=AU7si8VwJqS8Dwc1PT2pu_f_9Y32GQxivRYwJ3-U0YQ,144
3
- wisp/server/__init__.py,sha256=LmgQ1nTlnqcTPqRJVc1NGapV9qVR-BK8iPVUMSJ74Qs,102
4
- wisp/server/__main__.py,sha256=zhDqmhOY9HgHx-BOq-kU5IoxZCMJwt_PEEEISaZr9Mk,68
5
- wisp/server/cli.py,sha256=HU7ujypsFoP7JnZyy_56ZLlPvYNSxPPMyCVzmYDxabk,3356
6
- wisp/server/connection.py,sha256=V_Skmmsvn30lQKY5w9x2rJQFR_FsA3lngNDpaYOfX6U,7669
7
- wisp/server/http.py,sha256=58rMjYygIko364nvGSXMA7v5gmj4sNSecBYFJWTEVVs,3394
8
- wisp/server/net.py,sha256=yNDjw8FHA-0IgSI4c_6s2td38wd74PtV2W_gOZA3u-g,3181
9
- wisp/server/ratelimit.py,sha256=cic_rlBaM-tp6kJaSz4ITGvUbsX4JLSGSUgF5cPO0FY,1926
10
- wisp_python-0.8.0.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
11
- wisp_python-0.8.0.dist-info/licenses/LICENSE_third_party.md,sha256=_YgCpygAXxOtr7gpjRTv7W1DTqZU_f7IMwjdPvw4VxY,15360
12
- wisp_python-0.8.0.dist-info/METADATA,sha256=GZmYPhNuPJNjouQ1VO5u4x6b3laFfmA0kBI65_oExdc,4055
13
- wisp_python-0.8.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
- wisp_python-0.8.0.dist-info/top_level.txt,sha256=sv0LDAu8cHUc3_VTsCKfXU-6B9HdV4dW22ubeW8KPVs,5
15
- wisp_python-0.8.0.dist-info/RECORD,,