proxynt 2.0.32__tar.gz → 2.0.38__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.
- {proxynt-2.0.32 → proxynt-2.0.38}/PKG-INFO +1 -1
- {proxynt-2.0.32 → proxynt-2.0.38}/constant/system_constant.py +1 -1
- {proxynt-2.0.32 → proxynt-2.0.38}/proxynt.egg-info/PKG-INFO +1 -1
- proxynt-2.0.38/proxynt.egg-info/requires.txt +15 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/websocket_handler.py +15 -6
- {proxynt-2.0.32 → proxynt-2.0.38}/setup.py +2 -1
- proxynt-2.0.32/proxynt.egg-info/requires.txt +0 -12
- {proxynt-2.0.32 → proxynt-2.0.38}/LICENSE +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/MANIFEST.in +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/__init__.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/client/__init__.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/client/abstract_tunnel.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/client/clear_nonce_task.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/client/heart_beat_task.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/client/kcp_tunnel_impl.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/client/n4_tunnel_manager.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/client/quic_tunnel_impl.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/client/tcp_forward_client.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/client/tunnel_protocol.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/client/udp_forward_client.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/__init__.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/cert_utils.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/crypto/__init__.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/crypto/table.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/encrypt_utils.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/kcp.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/logger_factory.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/n4_protocol.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/n4_punch.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/nat_serialization.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/pool.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/register_append_data.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/speed_limit.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/__init__.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/_abnf.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/_app.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/_cookiejar.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/_core.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/_exceptions.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/_handshake.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/_http.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/_logging.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/_socket.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/_ssl_compat.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/_url.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/_utils.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/_wsdump.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/tests/__init__.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/tests/echo-server.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/tests/test_abnf.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/tests/test_app.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/tests/test_cookiejar.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/tests/test_http.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/tests/test_url.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/common/websocket/tests/test_websocket.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/constant/__init__.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/constant/message_type_constnat.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/context/__init__.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/context/context_utils.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/entity/__init__.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/entity/client_config_entity.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/entity/message/__init__.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/entity/message/message_entity.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/entity/message/push_config_entity.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/entity/message/tcp_over_websocket_message.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/entity/server_config_entity.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/exceptions/__init__.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/exceptions/duplicated_name.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/exceptions/invalid_password.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/exceptions/replay_error.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/exceptions/signature_error.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/p2ptest/__init__.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/p2ptest/client.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/p2ptest/n4.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/proxynt.egg-info/SOURCES.txt +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/proxynt.egg-info/dependency_links.txt +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/proxynt.egg-info/entry_points.txt +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/proxynt.egg-info/top_level.txt +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/run_client.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/run_server.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/__init__.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/admin_http_handler.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/n4.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/n4_signal_service.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/task/__init__.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/task/check_cookie_task.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/task/clear_nonce_task.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/task/heart_beat_task.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/tcp_forward_client.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/template/__init__.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/template/base.html +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/template/css/fonts/element-icons.woff +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/template/css/index.css +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/template/ele_index.html +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/template/js/axios.min.js +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/template/js/index.js +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/template/js/vue.min.js +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/template/login.html +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/server/udp_forward_client.py +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/setup.cfg +0 -0
- {proxynt-2.0.32 → proxynt-2.0.38}/test_exchange.py +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
tornado
|
|
2
|
+
typing_extensions
|
|
3
|
+
xxhash>=3.0.0
|
|
4
|
+
|
|
5
|
+
[:sys_platform != "win32" and python_version < "3.7"]
|
|
6
|
+
uvloop<0.15
|
|
7
|
+
|
|
8
|
+
[:sys_platform != "win32" and python_version >= "3.7"]
|
|
9
|
+
uvloop==0.22.0
|
|
10
|
+
|
|
11
|
+
[:sys_platform == "win32"]
|
|
12
|
+
winloop>=0.1.0
|
|
13
|
+
|
|
14
|
+
[snappy]
|
|
15
|
+
python-snappy
|
|
@@ -54,7 +54,14 @@ class MyWebSocketaHandler(WebSocketHandler):
|
|
|
54
54
|
# 客户端到客户端转发路由状态
|
|
55
55
|
# uid → (source_handler, target_handler, rule_name, protocol, target_ip_port)
|
|
56
56
|
c2c_uid_to_routing: Dict[bytes, Tuple['MyWebSocketaHandler', 'MyWebSocketaHandler', str, str, str]] = {}
|
|
57
|
-
|
|
57
|
+
_c2c_lock: Lock = None
|
|
58
|
+
|
|
59
|
+
def get_c2c_lock(self):
|
|
60
|
+
if self._c2c_lock is not None:
|
|
61
|
+
return self._c2c_lock
|
|
62
|
+
self._c2c_lock = Lock()
|
|
63
|
+
return self._c2c_lock
|
|
64
|
+
|
|
58
65
|
|
|
59
66
|
def open(self, *args: str, **kwargs: str):
|
|
60
67
|
self.lock = Lock()
|
|
@@ -135,7 +142,7 @@ class MyWebSocketaHandler(WebSocketHandler):
|
|
|
135
142
|
if not is_c2c:
|
|
136
143
|
conn = tcp_forward_client.uid_to_connection.get(uid)
|
|
137
144
|
if not conn or conn.socket_server.websocket_handler != self:
|
|
138
|
-
LoggerFactory.get_logger().
|
|
145
|
+
LoggerFactory.get_logger().debug(f"Security Alert: Client {self.client_name} tried to inject TCP data to UID {uid.hex()} belonging to another client/session.")
|
|
139
146
|
return
|
|
140
147
|
|
|
141
148
|
if is_c2c:
|
|
@@ -160,7 +167,7 @@ class MyWebSocketaHandler(WebSocketHandler):
|
|
|
160
167
|
)
|
|
161
168
|
|
|
162
169
|
if not data['data']:
|
|
163
|
-
async with self.
|
|
170
|
+
async with self.get_c2c_lock():
|
|
164
171
|
self.c2c_uid_to_routing.pop(uid, None)
|
|
165
172
|
LoggerFactory.get_logger().info(f'C2C 连接关闭 UID: {uid.hex()}')
|
|
166
173
|
else:
|
|
@@ -364,7 +371,7 @@ class MyWebSocketaHandler(WebSocketHandler):
|
|
|
364
371
|
source_handler.compress_support),
|
|
365
372
|
binary=True
|
|
366
373
|
)
|
|
367
|
-
async with self.
|
|
374
|
+
async with self.get_c2c_lock():
|
|
368
375
|
self.c2c_uid_to_routing.pop(uid, None)
|
|
369
376
|
LoggerFactory.get_logger().info(f'C2C 连接失败并已清理 UID: {uid.hex()}')
|
|
370
377
|
elif uid in tcp_forward_client.uid_to_connection:
|
|
@@ -386,6 +393,8 @@ class MyWebSocketaHandler(WebSocketHandler):
|
|
|
386
393
|
await self._send_connection_failed(uid, source_rule_name)
|
|
387
394
|
return
|
|
388
395
|
|
|
396
|
+
LoggerFactory.get_logger().info(f'C2C rule found: {source_rule_name}, speed_limit: {rule.get("speed_limit", 0.0)} MB/s')
|
|
397
|
+
|
|
389
398
|
if target_client not in self.client_name_to_handler:
|
|
390
399
|
LoggerFactory.get_logger().warn(f'Target client offline: {target_client}')
|
|
391
400
|
await self._send_connection_failed(uid, source_rule_name)
|
|
@@ -414,7 +423,7 @@ class MyWebSocketaHandler(WebSocketHandler):
|
|
|
414
423
|
ip_port = f"{target_service_config['local_ip']}:{target_service_config['local_port']}"
|
|
415
424
|
service_name = target_service
|
|
416
425
|
|
|
417
|
-
async with self.
|
|
426
|
+
async with self.get_c2c_lock():
|
|
418
427
|
self.c2c_uid_to_routing[uid] = (self, target_handler, source_rule_name, protocol, ip_port)
|
|
419
428
|
|
|
420
429
|
# Try P2P if both clients support it AND rule allows it (only for TCP)
|
|
@@ -528,7 +537,7 @@ class MyWebSocketaHandler(WebSocketHandler):
|
|
|
528
537
|
await UdpForwardClient.get_instance().close_by_client_name(self.client_name)
|
|
529
538
|
|
|
530
539
|
# 清理 C2C 连接
|
|
531
|
-
async with self.
|
|
540
|
+
async with self.get_c2c_lock():
|
|
532
541
|
uids_to_remove = []
|
|
533
542
|
for uid, (source_handler, target_handler, rule_name, protocol, _) in list(self.c2c_uid_to_routing.items()):
|
|
534
543
|
if source_handler == self or target_handler == self:
|
|
@@ -31,8 +31,9 @@ setuptools.setup(
|
|
|
31
31
|
|
|
32
32
|
install_requires=['tornado',
|
|
33
33
|
'typing_extensions',
|
|
34
|
-
'uvloop>=0.14.0; sys_platform != "win32"',
|
|
35
34
|
'winloop>=0.1.0; sys_platform == "win32"',
|
|
35
|
+
'uvloop==0.22.0; sys_platform != "win32" and python_version >= "3.7"',
|
|
36
|
+
'uvloop<0.15; sys_platform != "win32" and python_version < "3.7"',
|
|
36
37
|
'xxhash>=3.0.0',
|
|
37
38
|
],
|
|
38
39
|
extras_require={
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|