Compare commits

..
6 Commits
Author SHA1 Message Date
yisier a51d6bc50a v0.26.31 2026-03-23 17:03:28 +08:00
yisier 43144804c7 v0.26.31 2026-03-23 17:02:32 +08:00
yisier dfe4748e97 TCP隧道增加Basic认证 2026-03-23 16:43:29 +08:00
yisier 30af159034 新增隧道出现secret mode keys must be unique 2026-03-23 15:37:11 +08:00
yisier 8819907be5 域名解析记录开关功能 2026-03-23 15:16:29 +08:00
yisier af4be7f130 readme 2026-03-13 11:38:53 +08:00
8 changed files with 90 additions and 16 deletions
+26 -12
View File
@@ -1,31 +1,45 @@
# NPS
[新特性文档](https://dqg9t9eulqq.feishu.cn/wiki/FmVVwDcEGiTZxekYJl5ccuFanlg?from=from_copylink)
[新特性文档](https://dqg9t9eulqq.feishu.cn/wiki/FmVVwDcEGiTZxekYJl5ccuFanlg?from=from_copylink)
[原版文档](https://ehang.io/nps/documents)
# 说明
由于nps已经停更多年,存留了不少bug和未完善的功能。
此版本基于 nps 0.26.10的基础上二次开发而来。
### 交流
聊天灌水QQ群:619833483,热心群主可提供免费远程协助👍👍👍
***DockerHub***: [NPS](https://hub.docker.com/r/yisier1/nps) [NPC](https://hub.docker.com/r/yisier1/npc)
***宝塔面板***:[宝塔面板 Docker](docs/bt.md)
# 交流群
聊天灌水QQ群:619833483(2000人群),770569342
# 广告
[NPS云穿透](https://natnps.com/register?utm_from=MQ==),免费4M带宽,2条隧道;6.8元12M带宽,10条隧道;13.8元24M带宽,20条隧道。
雨云,500M带宽服务器;云服务器15元起,[专属连接,首月5折](https://www.rainyun.com/MjY0MzY1_)。
# 提示
强烈推荐使用无配置文件模式启动客户端(删除掉npc.exe 目录下的`conf`文件夹即可),所有数据应该在服务端保存和配置,而客户端只做连接转发。客户端配置文件对小白极不友好,配置繁琐,容易出错。
0.26.21 版本后的客户端,无需再通过命令行方式启动、安装、卸载客户端,直接双击运行,按照提示输入指令即可完成,非常方便。
# 广告
[NPS云穿透](https://natnps.com/register?utm_from=MQ==),免费3M带宽,2条隧道;6.8元12M带宽,10条隧道;13.8元24M带宽,20条隧道。
雨云,500M带宽服务器;云服务器15元起,[专属连接,首月5折](https://www.rainyun.com/MjY0MzY1_)。
# 快速上手
***服务端启动/安装:***`./npc(.exe) -server`
![img.png](image/new/server.png)
***客户端启动/安装:*** `./npc(.exe)`
![image](image/new/cmd.png)
# 更新日志
- 2026-03-23 v0.26.31
- 新增:
- 域名解析记录开关功能 [#314](https://github.com/yisier/nps/issues/314)
- TCP隧道增加Basic认证 [306](https://github.com/yisier/nps/issues/306)
- 修复:
- 新增隧道出现secret mode keys must be unique [301](https://github.com/yisier/nps/issues/301)
- 2026-03-12 v0.26.30
修复:
- http 协议 websocket 错误,感谢[xiaozonglong](https://github.com/xiaozonglong) 提供的 home assistant 环境 ,[#268](https://github.com/yisier/nps/issues/268),[#296](https://github.com/yisier/nps/issues/296)
+1 -1
View File
@@ -1,5 +1,5 @@
#/bash/sh
export VERSION=0.26.30
export VERSION=0.26.31
export GOPROXY=direct
sudo apt-get update
+1 -1
View File
@@ -14,7 +14,7 @@
},
"info": {
"productName": "NPS Client",
"productVersion": "0.26.30",
"productVersion": "0.26.31",
"companyName": "NPS",
"copyright": "Copyright © 2026 NPS"
},
+1 -1
View File
@@ -96,7 +96,7 @@ func (s *DbUtils) GetIdByVerifyKey(vKey string, addr string) (id int, err error)
func (s *DbUtils) NewTask(t *Tunnel) (err error) {
s.JsonDb.Tasks.Range(func(key, value interface{}) bool {
v := value.(*Tunnel)
if (v.Mode == "secret" || v.Mode == "p2p") && v.Password == t.Password {
if (v.Mode == "secret" || v.Mode == "p2p") && v.Password == t.Password && t.Password != "" {
err = errors.New(fmt.Sprintf("secret mode keys %s must be unique", t.Password))
return false
}
+1 -1
View File
@@ -1,6 +1,6 @@
package version
const VERSION = "0.26.30"
const VERSION = "0.26.31"
// Compulsory minimum version, Minimum downward compatibility to this version
func GetVersion() string {
+17
View File
@@ -9,6 +9,7 @@ import (
"net/http"
"path/filepath"
"strconv"
"time"
"ehang.io/nps/bridge"
"ehang.io/nps/lib/common"
@@ -107,6 +108,22 @@ func ProcessTunnel(c *conn.Conn, s *TunnelModeServer) error {
return err
}
if s.task.Client.Cnf.U != "" && s.task.Client.Cnf.P != "" {
c.Conn.SetReadDeadline(time.Now().Add(time.Millisecond * 200))
_, _, rb, err, r := c.GetHost()
c.Conn.SetReadDeadline(time.Time{})
if err == nil && !common.CheckAuth(r, s.task.Client.Cnf.U, s.task.Client.Cnf.P) {
c.Write([]byte(common.UnauthorizedBytes))
c.Close()
return errors.New("401 Unauthorized")
}
if err == nil {
return s.DealClient(c, s.task.Client, targetAddr, rb, common.CONN_TCP,
nil, s.task.Client.Flow, s.task.Target.LocalProxy, s.task)
}
}
return s.DealClient(c, s.task.Client, targetAddr, nil, common.CONN_TCP, nil, s.task.Client.Flow, s.task.Target.LocalProxy, s.task)
}
+20
View File
@@ -301,6 +301,26 @@ func (s *IndexController) DelHost() {
s.AjaxOk("delete success")
}
func (s *IndexController) HostStop() {
id := s.GetIntNoErr("id")
if h, err := file.GetDb().GetHostById(id); err != nil {
s.AjaxErr("stop error")
} else {
h.IsClose = true
}
s.AjaxOk("stop success")
}
func (s *IndexController) HostStart() {
id := s.GetIntNoErr("id")
if h, err := file.GetDb().GetHostById(id); err != nil {
s.AjaxErr("start error")
} else {
h.IsClose = false
}
s.AjaxOk("start success")
}
func (s *IndexController) AddHost() {
if s.Ctx.Request.Method == "GET" {
s.Data["client_id"] = s.getEscapeString("client_id")
+23
View File
@@ -136,6 +136,20 @@
halign: 'center',
visible: true//false表示不显示
},
{
field: 'IsClose',//域值
title: '<span langtag="word-status"></span>',//内容
align: 'center',
halign: 'center',
visible: true,//false表示不显示
formatter: function (value, row, index) {
if (!value) {
return '<span class="badge badge-primary" langtag="word-open"></span>'
} else {
return '<span class="badge badge-badge" langtag="word-close"></span>'
}
}
},
{
field: '',//域值
title: '<span langtag="word-clientstatus"></span>',//内容
@@ -159,6 +173,15 @@
visible: true,//false表示不显示
formatter: function (value, row, index) {
btn_group = '<div class="btn-group">'
if (!row.IsClose) {
btn_group += "<a onclick=\"submitform('stop', '{{.web_base_url}}/index/hoststop', {'id':" + row.Id
btn_group += '})" class="btn btn-outline btn-warning"><i class="fa fa-pause"></i></a>'
} else {
btn_group += "<a onclick=\"submitform('start', '{{.web_base_url}}/index/hoststart', {\'id\':" + row.Id
btn_group += '})" class="btn btn-outline btn-primary"><i class="fa fa-play"></i></a>'
}
btn_group += "<a onclick=\"submitform('delete', '{{.web_base_url}}/index/delhost', {'id':" + row.Id
btn_group += '})" class="btn btn-outline btn-danger"><i class="fa fa-trash"></i></a>'
btn_group += '<a href="{{.web_base_url}}/index/edithost?id=' + row.Id