{"id":51237039,"url":"https://github.com/sazima/proxynt","last_synced_at":"2026-06-28T21:09:53.227Z","repository":{"id":64914648,"uuid":"541562993","full_name":"sazima/proxynt","owner":"sazima","description":" 内网穿透工具 基于Python/WebSocket实现, Expose your local services to the internet.","archived":false,"fork":false,"pushed_at":"2026-05-23T14:08:02.000Z","size":1011,"stargazers_count":171,"open_issues_count":0,"forks_count":43,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-05-23T16:10:52.606Z","etag":null,"topics":["proxynt","python","ssh","tcp-tunnel","websocket","websockets"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/proxynt/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sazima.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-09-26T11:59:36.000Z","updated_at":"2026-05-23T14:08:07.000Z","dependencies_parsed_at":"2022-12-18T09:34:41.926Z","dependency_job_id":"2620c5e2-bd0a-4c60-9a7d-e21f5d97d0c1","html_url":"https://github.com/sazima/proxynt","commit_stats":{"total_commits":186,"total_committers":2,"mean_commits":93.0,"dds":"0.016129032258064502","last_synced_commit":"db8a8fbf2fb8b92657234f4303eb28660eb5f5b4"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sazima/proxynt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sazima%2Fproxynt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sazima%2Fproxynt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sazima%2Fproxynt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sazima%2Fproxynt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sazima","download_url":"https://codeload.github.com/sazima/proxynt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sazima%2Fproxynt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34903911,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["proxynt","python","ssh","tcp-tunnel","websocket","websockets"],"created_at":"2026-06-28T21:09:52.517Z","updated_at":"2026-06-28T21:09:53.219Z","avatar_url":"https://github.com/sazima.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"ProxyNT 是一个反向代理服务器，可以透过NAT和防火墙将本地服务器暴露到公网上\n\n## [English Readme](./readme_en.md)\n# 内网穿透工具\n- github: https://github.com/sazima/proxynt\n- gitee: https://gitee.com/sazima1/proxynt\n\n## 原理\n\n![原理](./preview.png)\n\n## 特性\n\n1. 随时随地打开浏览器管理端口映射\n2. 公网服务器和内网客户端之间使用 WebSocket 加密传输\n3. 依赖少, 使用 pip一键安装\n4. 稳定, 自动重连, 已在生产环境中使用\n5. 支持限速\n6. 支持 TCP 和 `UDP 协议\n7. 支持客户端到客户端（C2C）转发，无需在目标端暴露公网端口\n\n## 常用场景\n1. 在家托管网站服务器\n2. 管理物联网设备\n3. 远程访问家里/公司的其他内网机器（C2C 转发）\n4. 多地内网设备互联互通\n\n## 安装\n\n```\npip install -U proxynt\n```\n如果需要安装安卓端 [点击](https://github.com/sazima/proxynt_android)\n\n## 使用教程\n\n假设公网服务器的 IP 是 `43.144.9.224`\n\n### 准备工作\n\n**1. 在公网服务器上启动服务端**\n\n创建 `config_s.json`：\n```json\n{\n  \"port\": 18888,\n  \"path\": \"/websocket_path\",\n  \"password\": \"helloworld\",\n  \"admin\": {\n    \"enable\": true,\n    \"admin_password\": \"admin123\"\n  }\n}\n```\n\n启动服务端：\n```bash\nnt_server -c config_s.json\n```\n\n---\n\n## 示例一、将端口暴露在公网\n\n适用场景：让公网上的任何人都能访问你的内网服务（如个人网站、远程桌面等）\n\n**步骤 1：在内网机器上启动客户端**\n\n创建 `config_c.json`：\n```json\n{\n  \"server\": {\n    \"url\": \"ws://43.144.9.224:18888/websocket_path\",\n    \"password\": \"helloworld\"\n  },\n  \"client_name\": \"home_pc\"\n}\n```\n\n启动客户端：\n```bash\nnt_client -c config_c.json\n```\n\n**步骤 2：Web 界面配置端口映射**\n\n1. 打开浏览器访问：`http://43.144.9.224:18888/websocket_path/admin`\n2. 输入管理密码 `admin123` 登录\n3. 找到客户端 `home_pc`，点击\"转发配置\"按钮\n4. 填写配置：\n   - 名称：ssh\n   - 远程端口：12222\n   - 本地 IP：127.0.0.1\n   - 本地端口：22\n   - 协议：TCP\n5. 点击确定\n\n**步骤 3：通过公网访问**\n\n现在任何人都可以通过公网 IP 访问你的内网服务：\n```bash\nssh -p 12222 user@43.144.9.224\n```\n\n---\n\n## 示例二、安全地访问内网服务（无需暴露公网端口）\n\n适用场景：在办公室访问家里的电脑，或让朋友访问你的内网服务，但不想暴露在公网上\n\n**原理**：访问者和服务提供者都运行客户端，通过服务器建立安全连接\n\n**示例**：在办公室（机器 A）访问家里（机器 B）的 SSH\n\n**步骤 1：两台机器都启动客户端**\n\n机器 A（办公室）的 `config_c.json`：\n```json\n{\n  \"server\": {\n    \"url\": \"ws://43.144.9.224:18888/websocket_path\",\n    \"password\": \"helloworld\"\n  },\n  \"client_name\": \"office_pc\"\n}\n```\n\n机器 B（家里）的 `config_c.json`：\n```json\n{\n  \"server\": {\n    \"url\": \"ws://43.144.9.224:18888/websocket_path\",\n    \"password\": \"helloworld\"\n  },\n  \"client_name\": \"home_pc\"\n}\n```\n\n两台机器都启动客户端：\n```bash\nnt_client -c config_c.json\n```\n\n**步骤 2：Web 界面配置 C2C 规则**\n\n1. 打开管理页面：`http://43.144.9.224:18888/websocket_path/admin`\n2. 点击任一客户端右侧的\"C2C 规则\"按钮\n![img.png](config1.png)\n3. 填写配置：\n   - 规则名称: 随便， 比如: abc\n   - 源客户端：office_pc（访问方）\n   - 目标客户端：home_pc（被访问方）\n   - 连接模式：直连模式\n   - 目标 IP：127.0.0.1\n   - 目标端口：22\n   - 本地 IP：127.0.0.1\n   - 本地端口：12222\n   - 协议：TCP\n4. 点击确定\n\n**步骤 3：在办公室访问家里的电脑**\n\n在办公室（机器 A）上：\n```bash\nssh -p 12222 user@127.0.0.1\n```\n\n就可以安全地访问家里电脑的 SSH 了！\n\n**特点**：\n- ✅ 家里电脑无需暴露任何公网端口\n- ✅ 只有你能访问，其他人无法访问\n\n\n## 高级配置参考\n\n大部分功能都可以通过 Web 界面配置，以下是完整的配置文件参考（适用于需要通过配置文件管理的场景）。\n\n\u003cdetails\u003e\n\u003csummary\u003e点击展开查看完整配置示例\u003c/summary\u003e\n\n### 客户端配置 (config_c.json)\n```json\n{\n  \"server\": {\n    \"url\": \"ws://43.144.9.224:18888/websocket_path\",\n    \"password\": \"helloworld\"\n  },\n  \"client_name\": \"my_computer\",\n  \"log_file\": \"/var/log/nt/nt.log\"\n}\n```\n\n**说明**：\n- `server.url`: 服务器 WebSocket 地址（ws:// 或 wss://）\n- `server.password`: 连接密码\n- `client_name`: 客户端名称（必须唯一）\n- `log_file`: 日志文件路径（可选）\n- 端口映射建议在 Web 界面配置，无需写在配置文件中\n\n### 服务端配置 (config_s.json)\n```json\n{\n  \"port\": 18888,\n  \"password\": \"helloworld\",\n  \"path\": \"/websocket_path\",\n  \"log_file\": \"/var/log/nt/nt.log\",\n  \"admin\": {\n    \"enable\": true,\n    \"admin_password\": \"admin123\"\n  }\n}\n```\n\n**说明**：\n- `port`: 监听端口\n- `password`: 连接密码\n- `path`: WebSocket 路径\n- `admin.enable`: 是否启用 Web 管理界面\n- `admin.admin_password`: 管理界面密码\n- C2C 规则建议在 Web 界面配置，无需写在配置文件中\n\n\u003c/details\u003e\n\n## 趋势\n\n[![Stargazers over time](https://starchart.cc/sazima/proxynt.svg)](https://starchart.cc/sazima/proxynt)\n\n\n## 更新记录\n- 2.0.59.rc2: UDP 接收改用 select 监听降低 CPU 占用；服务端消息处理增加背压控制；客户端 sendall 增加超时；修复 send_lock 内存泄漏和竞争条件\n- 2.0.59.rc1: SelectPool 改用单线程 modify 事件掩码模式，去除线程池和锁，修复 socket 丢失注册导致连接冻结的问题\n- 2.0.2: 新增 C2C 直连模式，无需在目标端暴露端口\n- 2.0.1: 支持客户端到客户端（C2C）转发\n- 2.0.0: 支持 UDP 协议转发\n- 1.1.9: 端口限速\n- 1.1.8: 管理页显示客户端版本\n- 1.1.7: 修复服务端处理重复client_name\n- 1.1.6: 修复客户端 WebSocketException: socket is already opened","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsazima%2Fproxynt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsazima%2Fproxynt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsazima%2Fproxynt/lists"}