proxynt 2.0.60__tar.gz → 2.0.61rc1__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.60 → proxynt-2.0.61rc1}/PKG-INFO +1 -1
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/client/tcp_forward_client.py +18 -1
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/constant/system_constant.py +1 -1
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/proxynt.egg-info/PKG-INFO +1 -1
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/proxynt.egg-info/SOURCES.txt +0 -36
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/server/tcp_forward_client.py +26 -10
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/server/websocket_handler.py +3 -1
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/common/websocket2/compliance/autobahn-test-report-Feb-03-2021.html +0 -5923
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/base.html +0 -38
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/css/fonts/element-icons.woff +0 -0
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/css/index.css +0 -1
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/ele_index.html +0 -624
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/js/axios.min.js +0 -3
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/js/index.js +0 -1
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/js/vue.min.js +0 -6
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/login.html +0 -54
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/common/websocket2/compliance/autobahn-test-report-Feb-03-2021.html +0 -5923
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/server/template/base.html +0 -38
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/server/template/css/fonts/element-icons.woff +0 -0
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/server/template/css/index.css +0 -1
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/server/template/ele_index.html +0 -624
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/server/template/js/axios.min.js +0 -3
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/server/template/js/index.js +0 -1
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/server/template/js/vue.min.js +0 -6
- proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/server/template/login.html +0 -54
- proxynt-2.0.60/build/lib/proxynt/common/websocket2/compliance/autobahn-test-report-Feb-03-2021.html +0 -5923
- proxynt-2.0.60/build/lib/proxynt/server/template/base.html +0 -38
- proxynt-2.0.60/build/lib/proxynt/server/template/css/fonts/element-icons.woff +0 -0
- proxynt-2.0.60/build/lib/proxynt/server/template/css/index.css +0 -1
- proxynt-2.0.60/build/lib/proxynt/server/template/ele_index.html +0 -624
- proxynt-2.0.60/build/lib/proxynt/server/template/js/axios.min.js +0 -3
- proxynt-2.0.60/build/lib/proxynt/server/template/js/index.js +0 -1
- proxynt-2.0.60/build/lib/proxynt/server/template/js/vue.min.js +0 -6
- proxynt-2.0.60/build/lib/proxynt/server/template/login.html +0 -54
- proxynt-2.0.60/common/websocket2/compliance/autobahn-test-report-Feb-03-2021.html +0 -5923
- proxynt-2.0.60/server/template/base.html +0 -38
- proxynt-2.0.60/server/template/css/fonts/element-icons.woff +0 -0
- proxynt-2.0.60/server/template/css/index.css +0 -1
- proxynt-2.0.60/server/template/ele_index.html +0 -624
- proxynt-2.0.60/server/template/js/axios.min.js +0 -3
- proxynt-2.0.60/server/template/js/index.js +0 -1
- proxynt-2.0.60/server/template/js/vue.min.js +0 -6
- proxynt-2.0.60/server/template/login.html +0 -54
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/LICENSE +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/MANIFEST.in +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/__init__.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/client/__init__.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/client/abstract_tunnel.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/client/clear_nonce_task.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/client/heart_beat_task.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/client/kcp_tunnel_impl.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/client/n4_tunnel_manager.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/client/quic_tunnel_impl.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/client/tunnel_protocol.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/client/udp_forward_client.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/__init__.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/cert_utils.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/crypto/__init__.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/crypto/table.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/encrypt_utils.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/kcp.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/logger_factory.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/n4_protocol.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/n4_punch.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/nat_serialization.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/nat_serialization_v1.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/nat_serialization_v2.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/pool.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/register_append_data.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/speed_limit.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/__init__.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/_abnf.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/_app.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/_cookiejar.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/_core.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/_dispatcher.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/_exceptions.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/_handshake.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/_http.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/_logging.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/_socket.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/_ssl_compat.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/_url.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/_utils.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/_wsdump.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/__init__.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/echo-server.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/test_abnf.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/test_app.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/test_cookiejar.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/test_dispatcher.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/test_handshake_large_response.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/test_http.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/test_large_payloads.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/test_logging_helpers.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/test_reconnect_bad_fd.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/test_socket.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/test_socket_bugs.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/test_ssl_compat.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/test_ssl_edge_cases.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/test_url.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/test_utils.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket/tests/test_websocket.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/__init__.py +0 -0
- {proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt → proxynt-2.0.61rc1}/common/websocket2/compliance/autobahn-test-report-Feb-03-2021.html +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/setup.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/__init__.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/_abnf.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/_app.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/_cookiejar.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/_core.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/_dispatcher.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/_exceptions.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/_handshake.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/_http.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/_logging.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/_socket.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/_ssl_compat.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/_url.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/_utils.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/_wsdump.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/__init__.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/echo-server.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/test_abnf.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/test_app.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/test_cookiejar.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/test_dispatcher.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/test_handshake_large_response.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/test_http.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/test_large_payloads.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/test_logging_helpers.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/test_reconnect_bad_fd.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/test_socket.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/test_socket_bugs.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/test_ssl_compat.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/test_ssl_edge_cases.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/test_url.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/test_utils.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/common/websocket2/websocket/tests/test_websocket.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/constant/__init__.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/constant/message_type_constnat.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/context/__init__.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/context/context_utils.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/entity/__init__.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/entity/client_config_entity.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/entity/message/__init__.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/entity/message/message_entity.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/entity/message/push_config_entity.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/entity/message/tcp_over_websocket_message.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/entity/server_config_entity.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/exceptions/__init__.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/exceptions/duplicated_name.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/exceptions/invalid_password.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/exceptions/replay_error.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/exceptions/signature_error.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/p2ptest/__init__.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/p2ptest/client.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/p2ptest/n4.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/proxynt.egg-info/dependency_links.txt +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/proxynt.egg-info/entry_points.txt +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/proxynt.egg-info/requires.txt +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/proxynt.egg-info/top_level.txt +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/run_client.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/run_server.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/server/__init__.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/server/admin_http_handler.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/server/n4.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/server/n4_signal_service.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/server/task/__init__.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/server/task/check_cookie_task.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/server/task/clear_nonce_task.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/server/task/heart_beat_task.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/server/template/__init__.py +0 -0
- {proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt → proxynt-2.0.61rc1}/server/template/base.html +0 -0
- {proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt → proxynt-2.0.61rc1}/server/template/css/fonts/element-icons.woff +0 -0
- {proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt → proxynt-2.0.61rc1}/server/template/css/index.css +0 -0
- {proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt → proxynt-2.0.61rc1}/server/template/ele_index.html +0 -0
- {proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt → proxynt-2.0.61rc1}/server/template/js/axios.min.js +0 -0
- {proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt → proxynt-2.0.61rc1}/server/template/js/index.js +0 -0
- {proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt → proxynt-2.0.61rc1}/server/template/js/vue.min.js +0 -0
- {proxynt-2.0.60/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt → proxynt-2.0.61rc1}/server/template/login.html +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/server/udp_forward_client.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/setup.cfg +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/setup.py +0 -0
- {proxynt-2.0.60 → proxynt-2.0.61rc1}/test_exchange.py +0 -0
|
@@ -24,6 +24,9 @@ class PrivateSocketConnection:
|
|
|
24
24
|
self.uid: bytes = uid
|
|
25
25
|
self.socket: socket.socket = s
|
|
26
26
|
self.name: str = name
|
|
27
|
+
self.bytes_recv: int = 0
|
|
28
|
+
self.bytes_sent: int = 0
|
|
29
|
+
self.create_time: float = time.time()
|
|
27
30
|
|
|
28
31
|
|
|
29
32
|
class TcpForwardClient:
|
|
@@ -170,8 +173,17 @@ class TcpForwardClient:
|
|
|
170
173
|
|
|
171
174
|
try:
|
|
172
175
|
recv = each.recv(data.read_size)
|
|
173
|
-
except OSError:
|
|
176
|
+
except OSError as e:
|
|
177
|
+
LoggerFactory.get_logger().info('recv error uid: %s, %s: %s (errno=%s), sent=%d recv=%d, alive=%.3fs' % (
|
|
178
|
+
connection.uid.hex(), type(e).__name__, e, getattr(e, 'errno', None),
|
|
179
|
+
connection.bytes_sent, connection.bytes_recv, time.time() - connection.create_time))
|
|
174
180
|
recv = b''
|
|
181
|
+
else:
|
|
182
|
+
if recv:
|
|
183
|
+
connection.bytes_recv += len(recv)
|
|
184
|
+
else:
|
|
185
|
+
LoggerFactory.get_logger().info('recv EOF from local uid: %s, sent=%d recv=%d, alive=%.3fs' % (
|
|
186
|
+
connection.uid.hex(), connection.bytes_sent, connection.bytes_recv, time.time() - connection.create_time))
|
|
175
187
|
|
|
176
188
|
if data.speed_limiter and recv:
|
|
177
189
|
wait_time = data.speed_limiter.acquire(len(recv))
|
|
@@ -227,6 +239,7 @@ class TcpForwardClient:
|
|
|
227
239
|
ip, port = ip_port.split(':')
|
|
228
240
|
try:
|
|
229
241
|
s.connect((ip, int(port)))
|
|
242
|
+
LoggerFactory.get_logger().info('connected uid: %s, local %s -> %s' % (uid.hex(), s.getsockname(), ip_port))
|
|
230
243
|
|
|
231
244
|
confirm_message: MessageEntity = {
|
|
232
245
|
'type_': MessageTypeConstant.CONNECT_CONFIRMED,
|
|
@@ -286,6 +299,8 @@ class TcpForwardClient:
|
|
|
286
299
|
LoggerFactory.get_logger().info('Closing socket %s' % socket_client)
|
|
287
300
|
if socket_client in self.socket_to_socket_connection:
|
|
288
301
|
connection: PrivateSocketConnection = self.socket_to_socket_connection.pop(socket_client)
|
|
302
|
+
LoggerFactory.get_logger().info('close uid: %s, sent=%d recv=%d, alive=%.3fs' % (
|
|
303
|
+
connection.uid.hex(), connection.bytes_sent, connection.bytes_recv, time.time() - connection.create_time))
|
|
289
304
|
self.socket_event_loop.unregister(socket_client)
|
|
290
305
|
try:
|
|
291
306
|
socket_client.shutdown(socket.SHUT_RDWR)
|
|
@@ -369,7 +384,9 @@ class TcpForwardClient:
|
|
|
369
384
|
s.settimeout(30)
|
|
370
385
|
s.sendall(msg)
|
|
371
386
|
s.settimeout(None)
|
|
387
|
+
connection.bytes_sent += len(msg)
|
|
372
388
|
if not msg:
|
|
389
|
+
LoggerFactory.get_logger().info('server requested close uid: %s' % connection.uid.hex())
|
|
373
390
|
self.close_connection(s)
|
|
374
391
|
except socket.timeout:
|
|
375
392
|
LoggerFactory.get_logger().warning('sendall timeout, closing uid: %s' % connection.uid.hex())
|
|
@@ -5,42 +5,6 @@ setup.py
|
|
|
5
5
|
./run_client.py
|
|
6
6
|
./run_server.py
|
|
7
7
|
./test_exchange.py
|
|
8
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/common/websocket2/compliance/autobahn-test-report-Feb-03-2021.html
|
|
9
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/base.html
|
|
10
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/ele_index.html
|
|
11
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/login.html
|
|
12
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/css/index.css
|
|
13
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/css/fonts/element-icons.woff
|
|
14
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/js/axios.min.js
|
|
15
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/js/index.js
|
|
16
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/js/vue.min.js
|
|
17
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/common/websocket2/compliance/autobahn-test-report-Feb-03-2021.html
|
|
18
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/base.html
|
|
19
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/ele_index.html
|
|
20
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/login.html
|
|
21
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/css/index.css
|
|
22
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/css/fonts/element-icons.woff
|
|
23
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/js/axios.min.js
|
|
24
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/js/index.js
|
|
25
|
-
./build/lib/proxynt/build/lib/proxynt/build/lib/proxynt/server/template/js/vue.min.js
|
|
26
|
-
./build/lib/proxynt/build/lib/proxynt/common/websocket2/compliance/autobahn-test-report-Feb-03-2021.html
|
|
27
|
-
./build/lib/proxynt/build/lib/proxynt/server/template/base.html
|
|
28
|
-
./build/lib/proxynt/build/lib/proxynt/server/template/ele_index.html
|
|
29
|
-
./build/lib/proxynt/build/lib/proxynt/server/template/login.html
|
|
30
|
-
./build/lib/proxynt/build/lib/proxynt/server/template/css/index.css
|
|
31
|
-
./build/lib/proxynt/build/lib/proxynt/server/template/css/fonts/element-icons.woff
|
|
32
|
-
./build/lib/proxynt/build/lib/proxynt/server/template/js/axios.min.js
|
|
33
|
-
./build/lib/proxynt/build/lib/proxynt/server/template/js/index.js
|
|
34
|
-
./build/lib/proxynt/build/lib/proxynt/server/template/js/vue.min.js
|
|
35
|
-
./build/lib/proxynt/common/websocket2/compliance/autobahn-test-report-Feb-03-2021.html
|
|
36
|
-
./build/lib/proxynt/server/template/base.html
|
|
37
|
-
./build/lib/proxynt/server/template/ele_index.html
|
|
38
|
-
./build/lib/proxynt/server/template/login.html
|
|
39
|
-
./build/lib/proxynt/server/template/css/index.css
|
|
40
|
-
./build/lib/proxynt/server/template/css/fonts/element-icons.woff
|
|
41
|
-
./build/lib/proxynt/server/template/js/axios.min.js
|
|
42
|
-
./build/lib/proxynt/server/template/js/index.js
|
|
43
|
-
./build/lib/proxynt/server/template/js/vue.min.js
|
|
44
8
|
./client/__init__.py
|
|
45
9
|
./client/abstract_tunnel.py
|
|
46
10
|
./client/clear_nonce_task.py
|
|
@@ -59,6 +59,13 @@ class PublicSocketConnection:
|
|
|
59
59
|
self.connect_requested = False # Whether REQUEST_TO_CONNECT has been sent
|
|
60
60
|
self.early_data_buffer = [] # Buffer early data (data received before connection confirmation)
|
|
61
61
|
self.max_early_data_packets = 65536 * 4 # Maximum buffered packets
|
|
62
|
+
self.bytes_from_public: int = 0
|
|
63
|
+
self.bytes_to_public: int = 0
|
|
64
|
+
self.create_time: float = time.time()
|
|
65
|
+
|
|
66
|
+
def stats(self) -> str:
|
|
67
|
+
return (f'from_public={self.bytes_from_public} to_public={self.bytes_to_public} '
|
|
68
|
+
f'confirmed={self.connection_confirmed} alive={time.time() - self.create_time:.3f}s')
|
|
62
69
|
|
|
63
70
|
def __str__(self):
|
|
64
71
|
return f'{self.uid}_{self.socket}_{self.socket_server.name}'
|
|
@@ -128,14 +135,21 @@ class TcpForwardClient:
|
|
|
128
135
|
def handle_message(self, each: socket.socket, data: ResisterAppendData):
|
|
129
136
|
# 发送到websocket
|
|
130
137
|
each: socket.socket
|
|
138
|
+
recv_error = None
|
|
131
139
|
try:
|
|
132
140
|
recv = each.recv(data.read_size)
|
|
133
|
-
except ConnectionResetError:
|
|
141
|
+
except ConnectionResetError as e:
|
|
134
142
|
recv = b''
|
|
143
|
+
recv_error = e
|
|
135
144
|
# client = self.uid_to_client[uid]
|
|
136
145
|
if each not in self.socket_to_connection:
|
|
137
146
|
return
|
|
138
147
|
socket_connection = self.socket_to_connection[each]
|
|
148
|
+
if recv:
|
|
149
|
+
socket_connection.bytes_from_public += len(recv)
|
|
150
|
+
else:
|
|
151
|
+
LoggerFactory.get_logger().info(
|
|
152
|
+
f'public side closed uid: {socket_connection.uid.hex()}, error: {recv_error}, {socket_connection.stats()}')
|
|
139
153
|
|
|
140
154
|
# Optimistic send mode: buffer data if connection not confirmed
|
|
141
155
|
if socket_connection.optimistic_mode and not socket_connection.connection_confirmed:
|
|
@@ -204,10 +218,10 @@ class TcpForwardClient:
|
|
|
204
218
|
client.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
|
205
219
|
except OSError:
|
|
206
220
|
return
|
|
207
|
-
LoggerFactory.get_logger().info(f'Received connection from: {address}')
|
|
208
221
|
server = self.listen_socket_to_public_server[server_socket]
|
|
209
222
|
# Current server client also corresponds to a client connecting to internal network service
|
|
210
223
|
uid = os.urandom(4)
|
|
224
|
+
LoggerFactory.get_logger().info(f'Received connection from: {address}, uid: {uid.hex()}, name: {server.name}')
|
|
211
225
|
client_socket_connection = PublicSocketConnection(uid, client, server)
|
|
212
226
|
self.uid_to_connection[uid] = client_socket_connection
|
|
213
227
|
self.socket_to_connection[client] = client_socket_connection
|
|
@@ -246,22 +260,24 @@ class TcpForwardClient:
|
|
|
246
260
|
try:
|
|
247
261
|
await asyncio.wait_for(asyncio.get_event_loop().sock_sendall(socket_client, message), timeout=30)
|
|
248
262
|
except asyncio.TimeoutError:
|
|
249
|
-
LoggerFactory.get_logger().warn(f"Socket send timeout for {uid}, closing connection")
|
|
250
|
-
asyncio.ensure_future(self.close_connection_async(connection))
|
|
263
|
+
LoggerFactory.get_logger().warn(f"Socket send timeout for {uid.hex()}, closing connection")
|
|
264
|
+
asyncio.ensure_future(self.close_connection_async(connection, 'send timeout'))
|
|
251
265
|
return
|
|
252
266
|
except OSError as e:
|
|
253
|
-
LoggerFactory.get_logger().warn(f'{uid} os error: {e}')
|
|
254
|
-
asyncio.ensure_future(self.close_connection_async(connection))
|
|
267
|
+
LoggerFactory.get_logger().warn(f'{uid.hex()} os error: {e}')
|
|
268
|
+
asyncio.ensure_future(self.close_connection_async(connection, f'send os error: {e}'))
|
|
255
269
|
return
|
|
270
|
+
connection.bytes_to_public += len(message)
|
|
256
271
|
if not message:
|
|
257
|
-
asyncio.ensure_future(self.close_connection_async(connection))
|
|
272
|
+
asyncio.ensure_future(self.close_connection_async(connection, 'client reported inner close'))
|
|
258
273
|
if LoggerFactory.get_logger().isEnabledFor(logging.DEBUG):
|
|
259
274
|
LoggerFactory.get_logger().debug(f'send to socket cost time {time.time() - send_start_time}')
|
|
260
275
|
|
|
261
|
-
async def close_connection_async(self, connection: PublicSocketConnection):
|
|
276
|
+
async def close_connection_async(self, connection: PublicSocketConnection, reason: str = ''):
|
|
262
277
|
"""Asynchronously close connection to avoid blocking in event loop"""
|
|
263
278
|
try:
|
|
264
|
-
LoggerFactory.get_logger().info(
|
|
279
|
+
LoggerFactory.get_logger().info(
|
|
280
|
+
f'Async closing connection {connection.uid.hex()}, reason: {reason}, {connection.stats()}')
|
|
265
281
|
uid = connection.uid
|
|
266
282
|
if uid not in self.uid_to_connection:
|
|
267
283
|
return
|
|
@@ -286,7 +302,7 @@ class TcpForwardClient:
|
|
|
286
302
|
|
|
287
303
|
def close_connection(self, connection: PublicSocketConnection):
|
|
288
304
|
try:
|
|
289
|
-
LoggerFactory.get_logger().info(f'Closing connection {connection.uid}')
|
|
305
|
+
LoggerFactory.get_logger().info(f'Closing connection {connection.uid.hex()}, {connection.stats()}')
|
|
290
306
|
uid = connection.uid
|
|
291
307
|
if uid not in self.uid_to_connection:
|
|
292
308
|
return
|
|
@@ -358,6 +358,8 @@ class MyWebSocketaHandler(WebSocketHandler):
|
|
|
358
358
|
elif uid in tcp_forward_client.uid_to_connection:
|
|
359
359
|
connection = tcp_forward_client.uid_to_connection[uid]
|
|
360
360
|
connection.connection_confirmed = True
|
|
361
|
+
LoggerFactory.get_logger().info(
|
|
362
|
+
f'connect confirmed uid: {uid.hex()}, flushing {sum(len(b) for b in connection.early_data_buffer)} bytes, {connection.stats()}')
|
|
361
363
|
|
|
362
364
|
for buffered_data in connection.early_data_buffer:
|
|
363
365
|
if buffered_data:
|
|
@@ -391,7 +393,7 @@ class MyWebSocketaHandler(WebSocketHandler):
|
|
|
391
393
|
LoggerFactory.get_logger().info(f'C2C 连接失败并已清理 UID: {uid.hex()}')
|
|
392
394
|
elif uid in tcp_forward_client.uid_to_connection:
|
|
393
395
|
connection = tcp_forward_client.uid_to_connection[uid]
|
|
394
|
-
await tcp_forward_client.close_connection_async(connection)
|
|
396
|
+
await tcp_forward_client.close_connection_async(connection, 'client CONNECT_FAILED')
|
|
395
397
|
|
|
396
398
|
# Client-to-client forward request
|
|
397
399
|
elif message_dict['type_'] == MessageTypeConstant.CLIENT_TO_CLIENT_FORWARD:
|