Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a51d6bc50a | ||
|
|
43144804c7 | ||
|
|
dfe4748e97 | ||
|
|
30af159034 | ||
|
|
8819907be5 | ||
|
|
af4be7f130 | ||
|
|
0e6cc0f40f |
@@ -1,31 +1,53 @@
|
||||
# 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`
|
||||
|
||||

|
||||
|
||||
***客户端启动/安装:*** `./npc(.exe)`
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
# 更新日志
|
||||
|
||||
- 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)
|
||||
- 域名解析中,主机url点击无法跳转非80端口 [311](https://github.com/yisier/nps/issues/311)
|
||||
- 新增的主机配置页面,客户端ID异常 [#310](https://github.com/yisier/nps/issues/310)
|
||||
- 自动 HTTPS(301) 按照 `https_proxy_port` 配置的端口号跳转
|
||||
|
||||
|
||||
- 2026-01-24 v0.26.29
|
||||
新增:
|
||||
GUI 客户端,基于 Wails 开发,[点击查看了解更多](https://github.com/yisier/nps/blob/master/cmd/npc/npc-gui/README.md),需要 WebView2 运行时,可通过两种方式添加客户端。
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#/bash/sh
|
||||
export VERSION=0.26.29
|
||||
export VERSION=0.26.31
|
||||
export GOPROXY=direct
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
},
|
||||
"info": {
|
||||
"productName": "NPS Client",
|
||||
"productVersion": "0.26.29",
|
||||
"productVersion": "0.26.31",
|
||||
"companyName": "NPS",
|
||||
"copyright": "Copyright © 2026 NPS"
|
||||
},
|
||||
|
||||
+1
-1
@@ -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,6 +1,6 @@
|
||||
package version
|
||||
|
||||
const VERSION = "0.26.29"
|
||||
const VERSION = "0.26.31"
|
||||
|
||||
// Compulsory minimum version, Minimum downward compatibility to this version
|
||||
func GetVersion() string {
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"ehang.io/nps/lib/goroutine"
|
||||
"ehang.io/nps/server/connection"
|
||||
"encoding/json"
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"io"
|
||||
"net"
|
||||
@@ -113,7 +114,7 @@ func (s *httpServer) handleTunneling(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// 自动 http 301 https
|
||||
if host.AutoHttps && r.TLS == nil {
|
||||
http.Redirect(w, r, "https://"+r.Host+r.RequestURI, http.StatusMovedPermanently)
|
||||
http.Redirect(w, r, "https://"+host.Host+":"+beego.AppConfig.String("https_proxy_port"), http.StatusMovedPermanently)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -99,8 +99,8 @@ func NewHttpReverseProxy(s *httpServer) *HttpReverseProxy {
|
||||
local, _ := net.ResolveTCPAddr("tcp", "127.0.0.1")
|
||||
proxy := NewReverseProxy(&httputil.ReverseProxy{
|
||||
Director: func(r *http.Request) {
|
||||
host := r.Context().Value("host").(*file.Host)
|
||||
common.ChangeHostAndHeader(r, host.HostChange, host.HeaderChange, "")
|
||||
//host := r.Context().Value("host").(*file.Host)
|
||||
//common.ChangeHostAndHeader(r, host.HostChange, host.HeaderChange, "")
|
||||
},
|
||||
Transport: &http.Transport{
|
||||
ResponseHeaderTimeout: rp.responseHeaderTimeout,
|
||||
|
||||
@@ -65,6 +65,10 @@ func (s *BaseController) Prepare() {
|
||||
s.Data["allow_tunnel_num_limit"], _ = beego.AppConfig.Bool("allow_tunnel_num_limit")
|
||||
s.Data["allow_local_proxy"], _ = beego.AppConfig.Bool("allow_local_proxy")
|
||||
s.Data["allow_user_change_username"], _ = beego.AppConfig.Bool("allow_user_change_username")
|
||||
httpPort := beego.AppConfig.String("http_proxy_port")
|
||||
if httpPort != "80" {
|
||||
s.Data["http_proxy_port"] = ":" + beego.AppConfig.String("http_proxy_port")
|
||||
}
|
||||
}
|
||||
|
||||
// 加载模板
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -187,6 +187,7 @@
|
||||
var option = "<option value=\"" + data.rows[i].Id + "\"";
|
||||
option += ">" + data.rows[i].Id + '-' + data.rows[i].Remark + "</option>"; //动态添加数据
|
||||
$("select[name='client_id']").append(option);
|
||||
$("select[name='client_id']").find("option[value='{{.client_id}}']").attr("selected", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
halign: 'center',
|
||||
visible: true,//false表示不显示
|
||||
formatter: function (value, row, index) {
|
||||
return "<a href='http://" + row.Host + "' target='_blank'>" + row.Host + "</a>"
|
||||
return "<a href='http://" + row.Host + '{{.http_proxy_port}}' + "' target='_blank'>" + row.Host + '{{.http_proxy_port}}' + "</a>"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user