MCPcopy Index your code
hub / github.com/djylb/nps

github.com/djylb/nps @v0.34.7

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.34.7 ↗ · + Follow
3,693 symbols 13,566 edges 176 files 193 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

NPS 内网穿透 (全修)

GitHub Stars GitHub Forks Release GitHub All Releases

GitHub 点击右上角 ⭐ Star 以支持我在空闲时间继续开发

由于 GitHub 限制浏览器语言为中文(Accept-Language=zh-CN) 访问 *.githubusercontent.com ,图标可能无法正常显示。


简介

NPS 是一款轻量高效的内网穿透代理服务器,支持多种协议(TCP、UDP、HTTP、HTTPS、SOCKS5 等)转发。它提供直观的 Web 管理界面,使得内网资源能安全、便捷地在外网访问,同时满足多种复杂场景的需求。

由于NPS停更已久,本仓库整合社区更新二次开发而来。

NPS Web UI


主要特性

  • 多协议支持
    TCP/UDP 转发、HTTP/HTTPS 转发、HTTP/SOCKS5 代理、P2P 模式、Proxy Protocol支持、HTTP/3支持等,满足各种内网访问场景。

  • 跨平台部署
    支持 Linux、Windows 等主流平台,可轻松安装为系统服务。

  • Web 管理界面
    实时监控流量、连接情况以及客户端状态,操作简单直观。

  • 安全与扩展
    内置加密传输、流量限制、到期限制、证书管理续签等多重功能,保障数据安全。

  • 多连接协议
    支持 TCP、KCP、TLS、QUIC、WS、WSS 协议连接服务器。


安装与使用

更多详细配置请参考 文档(部分内容可能未更新)。

Android | OpenWrt

Docker 部署

DockerHubNPS NPC

GHCRNPS NPC

有真实IP获取需求可配合 mmproxy 使用。例如:SSH

NPS 服务端

docker pull duan2001/nps
docker run -d --restart=always --name nps --net=host -v $(pwd)/conf:/conf -v /etc/localtime:/etc/localtime:ro duan2001/nps

提示: NPS 安装完成后,请先修改 nps.conf(如监听端口、Web 管理账号等)再启动服务。

NPC 客户端

docker pull duan2001/npc
docker run -d --restart=always --name npc --net=host duan2001/npc -server=xxx:123,yyy:456 -vkey=key1,key2 -type=tls,tcp -log=off

提示: -server-vkey-type 等参数请从 NPS Web 管理端的客户端页面复制,避免手动填写错误。

服务端安装

Linux

# 安装(默认配置路径:/etc/nps/;二进制文件路径:/usr/bin/)
wget -qO- https://fastly.jsdelivr.net/gh/djylb/nps@master/install.sh | sudo sh -s nps
nps install
nps start|stop|restart|uninstall

# 更新
nps update && nps restart

提示: 首次安装后请先编辑 /etc/nps/nps.conf,确认配置无误后再执行 nps start

Windows

Windows 7 用户请使用 old 结尾版本 64 / 32

.\nps.exe install
.\nps.exe start|stop|restart|uninstall

# 更新
.\nps.exe stop
.\nps-update.exe update
.\nps.exe start

客户端安装

Linux

wget -qO- https://fastly.jsdelivr.net/gh/djylb/nps@master/install.sh | sudo sh -s npc
/usr/bin/npc install -server=xxx:123,yyy:456 -vkey=xxx,yyy -type=tls -log=off
npc start|stop|restart|uninstall

# 更新
npc update && npc restart

提示: npc install 命令中的参数请以 NPS Web 管理端客户端页面生成的命令为准。

Windows

Windows 7 用户请使用 old 结尾版本 64 / 32

.\npc.exe install -server="xxx:123,yyy:456" -vkey="xxx,yyy" -type="tls,tcp" -log="off"
.\npc.exe start|stop|restart|uninstall

# 更新
.\npc.exe stop
.\npc-update.exe update
.\npc.exe start

提示: 客户端支持同时连接多个服务器,示例:
npc -server=xxx:123,yyy:456,zzz:789 -vkey=key1,key2,key3 -type=tcp,tls
这里 xxx:123 使用 tcp, yyy:456zzz:789 使用tls

如需连接旧版本服务器请添加 -proto_version=0


Extension points exported contracts — how you extend this code

Closer (Interface)
------------------------------ P2PManager ------------------------------ [38 implementers]
client/local.go
Service (Interface)
(no doc) [10 implementers]
server/proxy/base.go
Dialer (Interface)
(no doc) [3 implementers]
server/tool/tunnel.go
Key (Interface)
A Key may be any value that is comparable. See http://golang.org/ref/spec#Comparison_operators
lib/cache/lru.go
NetPackager (Interface)
(no doc) [2 implementers]
lib/common/netpackager.go
Option (FuncType)
(no doc)
lib/conn/link.go
NetBridge (Interface)
(no doc) [2 implementers]
server/proxy/base.go

Core symbols most depended-on inside this repo

push
called by 707
lib/mux/queue.go
add
called by 295
lib/mux/rate.go
Close
called by 246
client/local.go
String
called by 211
lib/common/netpackager.go
Error
called by 172
lib/logs/logger.go
New
called by 150
lib/mux/conn.go
Now
called by 123
lib/rate/rate.go
GetDb
called by 121
lib/file/db.go

Shape

Function 2,843
Method 691
Struct 146
Interface 6
TypeAlias 4
FuncType 3

Languages

TypeScript57%
Go43%

Modules by API surface

web/static/js/echarts.min.js1,492 symbols
web/static/js/bootstrap-table.min.js160 symbols
web/static/js/bootstrap-table-cookie.min.js101 symbols
web/static/js/jquery-3.7.1.min.js80 symbols
web/static/js/fontawesome.min.js69 symbols
web/static/js/bootstrap-table-locale-all.min.js68 symbols
lib/mux/conn.go52 symbols
lib/common/addr.go52 symbols
web/static/js/popper.min.js50 symbols
bridge/client.go41 symbols
lib/mux/queue.go40 symbols
lib/conn/conn.go40 symbols

For agents

$ claude mcp add nps \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact