1 Star 0 Fork 0

舍语科技__彬仔 / proxynt

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

ProxyNT 是一个反向代理服务器,可以透过NAT和防火墙将本地服务器暴露到公网上

English Readme

内网穿透工具

原理

原理

特性

  1. 随时随地打开浏览器管理端口映射
  2. 公网服务器和内网客户端之间使用 WebSocket 加密传输
  3. 依赖少, 使用 pip一键安装
  4. 稳定, 自动重连, 已在生产环境中使用
  5. 支持限速

常用场景

  1. 在家托管网站服务器
  2. 管理物联网设备

安装

pip install -U proxynt

如果需要安装安卓端 点击

使用示例, 通过 SSH 访问内网机器

假设公网机器的ip是 192.168.9.224

1. 在公网机器上新建config_s.json文件

config_s.json内容:

{
  "port": 18888,
  "password": "helloworld",
  "path": "/websocket_path",
  "admin": {
    "enable": true,  
    "admin_password": "new_password"  
  }
}

然后启动: nt_server -c config_s.json

说明:

  • port: 监听端口
  • password: 连接密码
  • path: websocket路径
  • admin: 管理页配置(非必须)
  • admin.enable: 是否启用管理页
  • admin.admin_password: 管理密码

2. 在需要被访问的内网电脑上新建config_c.json文件

config_c.json内容:

{
  "server": {
    "port": 18888,
    "host": "192.168.9.224",
    "https": false,
    "password": "helloworld",
    "path": "/websocket_path"
  },
  "client_name": "home_pc",
  "client": []
}

然后启动: nt_client -c config_c.json

说明:

  • server: 要连接的服务器端口, ip, 是否是https, 密码, websocket路径
  • client_name: 客户端名称
  • client: 空数组

3. 打开服务端网页 http://192.168.9.224:18888/websocket_path/admin 添加端口:

VWCvq.md.png

说明: 管理页面路径为 websocket路径 + /admin

4. 配置成功, 使用 ssh 连接:

ssh -oPort=12222 test@192.168.9.224

完整配置说明(使用请删除注释)

  • 客户端 config_c.json
{
  "server": {  // 要连接的服务端配置
    "port": 18888,  // 端口
    "host": "192.168.9.224",  // 端ip
    "https": false,  //服务端是否启动https
    "password": "helloworld",  // 密码
    "path": "/websocket_path"  // websocket 路径
  },
  "client": [  // 转发的配置列表(这里可以不填, 在服务端网页上配置)
    {
      "name": "ssh",
      "remote_port": 1222,
      "local_port": 22,
      "local_ip": "127.0.0.1"
    },
    {
      "name": "mongo",
      "remote_port": 1223,
      "local_port": 27017,
      "local_ip": "127.0.0.1"
    }
  ],
  "client_name": "ubuntu1",  // 客户端名称, 要唯一
  "log_file": "/var/log/nt/nt.log"  // 日志路径
}
  • 服务端 config_c.json
{
    "port": 18888,  // 监听端口
    "password": "helloworld",  // 密码
    "path": "/websocket_path",  // websocket路径
    "log_file": "/var/log/nt/nt.log",  // 日志路径
    "admin": {  
        "enable": true,  // 是否启用管理页
        "admin_password": "new_password"  // 管理页密码
    }
}

趋势

Stargazers over time

更新记录

  • 1.1.9: 端口限速
  • 1.1.8: 管理页显示客户端版本
  • 1.1.7: 修复服务端处理重复client_name
  • 1.1.6: 修复客户端 WebSocketException: socket is already opened

TODO

  • ui美化
  • 视频教程
MIT License Copyright (c) 2022 github:sazima Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

端口转发器 展开 收起
Python 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/shanayinghua/proxynt.git
git@gitee.com:shanayinghua/proxynt.git
shanayinghua
proxynt
proxynt
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891