Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd16ce6659 | ||
|
|
16381ce7e0 | ||
|
|
3e9cccb86e | ||
|
|
f91156a0cb |
@@ -1,6 +1,6 @@
|
||||
# NPS
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#/bash/sh
|
||||
export VERSION=0.26.33
|
||||
export VERSION=0.26.37
|
||||
export GOPROXY=direct
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
},
|
||||
"info": {
|
||||
"productName": "NPS Client",
|
||||
"productVersion": "0.26.33",
|
||||
"productVersion": "0.26.37",
|
||||
"companyName": "NPS",
|
||||
"copyright": "Copyright © 2026 NPS"
|
||||
},
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
# 更新日志
|
||||
- 2026-08-08 v0.26.37
|
||||
- 修复:
|
||||
- NPC 安装到系统服务失败 BUG [#338](https://github.com/yisier/nps/issues/338)
|
||||
- 隧道实际未运行但面板提示「启动成功」、运行状态始终为关闭的问题 [#339](https://github.com/yisier/nps/issues/339)
|
||||
- 配置 `allow_ports` 后随机生成端口问题 [#339](https://github.com/yisier/nps/issues/339)
|
||||
- Web 面板`languages.xml`使用 NPS 版本号作为缓存标识 [#342](https://github.com/yisier/nps/issues/342)
|
||||
- 新增:
|
||||
- 客户端、隧道、域名解析修改接口支持修改流量数据 [#341](https://github.com/yisier/nps/issues/341)
|
||||
|
||||
- 2026-07-12 v0.26.36
|
||||
- 新增:
|
||||
- 新增客户端内网地址上报功能,客户端列表展示 npc 内网地址 [#333](https://github.com/yisier/nps/issues/333)
|
||||
|
||||
@@ -103,6 +103,8 @@ POST /client/edit/
|
||||
| ipwhitepass | IP 白名单授权密码 |
|
||||
| ipwhitelist | 白名单 IP 列表,`\r\n` 分隔 |
|
||||
| expire_time | 到期时间,格式同新增接口 |
|
||||
| flow_inlet | 入口流量,单位字节,传入则覆盖原值(留空不修改) |
|
||||
| flow_export | 出口流量,单位字节,传入则覆盖原值(留空不修改) |
|
||||
|
||||
---
|
||||
|
||||
@@ -219,6 +221,8 @@ POST /index/edit/
|
||||
| local_path | 本地文件路径 |
|
||||
| strip_pre | URL 前缀去除 |
|
||||
| proto_version | 协议版本 |
|
||||
| flow_inlet | 入口流量,单位字节,传入则覆盖原值(留空不修改) |
|
||||
| flow_export | 出口流量,单位字节,传入则覆盖原值(留空不修改) |
|
||||
|
||||
---
|
||||
|
||||
@@ -331,10 +335,8 @@ POST /index/edithost/
|
||||
| key_file_path | HTTPS 证书私钥文本或路径 |
|
||||
| cert_file_path | HTTPS 证书文件文本或路径 |
|
||||
| AutoHttps | 是否自动 HTTPS |
|
||||
|
||||
---
|
||||
|
||||
### 停止域名解析
|
||||
| flow_inlet | 入口流量,单位字节,传入则覆盖原值(留空不修改) |
|
||||
| flow_export | 出口流量,单位字节,传入则覆盖原值(留空不修改) |
|
||||
|
||||
```
|
||||
POST /index/hoststop/
|
||||
|
||||
@@ -407,6 +407,13 @@ func replaceExecutable(srcBin, destBin string) error {
|
||||
if _, err := os.Stat(srcBin); err != nil {
|
||||
return fmt.Errorf("源文件不存在: %s: %w", srcBin, err)
|
||||
}
|
||||
if dstFi, err := os.Stat(destBin); err == nil {
|
||||
if srcFi, err := os.Stat(srcBin); err == nil {
|
||||
if os.SameFile(srcFi, dstFi) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
if err := os.MkdirAll(filepath.Dir(destBin), 0755); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package version
|
||||
|
||||
const VERSION = "0.26.36"
|
||||
const VERSION = "0.26.37"
|
||||
|
||||
// Compulsory minimum version, Minimum downward compatibility to this version
|
||||
func GetVersion() string {
|
||||
|
||||
+7
-5
@@ -259,13 +259,15 @@ func AddTask(t *file.Tunnel) error {
|
||||
|
||||
// start task
|
||||
func StartTask(id int) error {
|
||||
if t, err := file.GetDb().GetTask(id); err != nil {
|
||||
t, err := file.GetDb().GetTask(id)
|
||||
if err != nil {
|
||||
return err
|
||||
} else {
|
||||
AddTask(t)
|
||||
t.Status = true
|
||||
file.GetDb().UpdateTask(t)
|
||||
}
|
||||
if err := AddTask(t); err != nil {
|
||||
return err
|
||||
}
|
||||
t.Status = true
|
||||
file.GetDb().UpdateTask(t)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,20 @@ func TestServerPort(p int, m string) (b bool) {
|
||||
}
|
||||
|
||||
func GenerateServerPort(m string) int {
|
||||
// allow_ports 已配置:在允许范围内随机选取,打乱顺序后逐个尝试以避免重复命中已占用端口
|
||||
if len(ports) != 0 {
|
||||
shuffled := make([]int, len(ports))
|
||||
copy(shuffled, ports)
|
||||
rand.Shuffle(len(shuffled), func(i, j int) {
|
||||
shuffled[i], shuffled[j] = shuffled[j], shuffled[i]
|
||||
})
|
||||
for _, p := range shuffled {
|
||||
if TestServerPort(p, m) {
|
||||
return p
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
for i := 0; i < 1000; i++ {
|
||||
//生成随机数 1024 - 65535
|
||||
serverPort := rand.Intn(65535)
|
||||
|
||||
@@ -134,6 +134,12 @@ func (s *ClientController) Edit() {
|
||||
c.MaxConn = s.GetIntNoErr("max_conn")
|
||||
c.MaxTunnelNum = s.GetIntNoErr("max_tunnel")
|
||||
}
|
||||
if s.GetString("flow_inlet") != "" {
|
||||
c.Flow.InletFlow = int64(s.GetIntNoErr("flow_inlet"))
|
||||
}
|
||||
if s.GetString("flow_export") != "" {
|
||||
c.Flow.ExportFlow = int64(s.GetIntNoErr("flow_export"))
|
||||
}
|
||||
c.Remark = s.getEscapeString("remark")
|
||||
c.Cnf.U = s.getEscapeString("u")
|
||||
c.Cnf.P = s.getEscapeString("p")
|
||||
|
||||
@@ -218,7 +218,7 @@ func (s *IndexController) Edit() {
|
||||
t.Port = tool.GenerateServerPort(t.Mode)
|
||||
}
|
||||
|
||||
if !tool.TestServerPort(s.GetIntNoErr("port"), t.Mode) {
|
||||
if !tool.TestServerPort(t.Port, t.Mode) {
|
||||
s.AjaxErr("The port cannot be opened because it may has been occupied or is no longer allowed.")
|
||||
return
|
||||
}
|
||||
@@ -233,6 +233,12 @@ func (s *IndexController) Edit() {
|
||||
t.StripPre = s.getEscapeString("strip_pre")
|
||||
t.Remark = s.getEscapeString("remark")
|
||||
t.Target.LocalProxy = s.GetBoolNoErr("local_proxy")
|
||||
if s.GetString("flow_inlet") != "" {
|
||||
t.Flow.InletFlow = int64(s.GetIntNoErr("flow_inlet"))
|
||||
}
|
||||
if s.GetString("flow_export") != "" {
|
||||
t.Flow.ExportFlow = int64(s.GetIntNoErr("flow_export"))
|
||||
}
|
||||
file.GetDb().UpdateTask(t)
|
||||
server.StopServer(t.Id)
|
||||
server.StartTask(t.Id)
|
||||
@@ -409,6 +415,12 @@ func (s *IndexController) EditHost() {
|
||||
h.AutoHttps = false
|
||||
}
|
||||
|
||||
if s.GetString("flow_inlet") != "" {
|
||||
h.Flow.InletFlow = int64(s.GetIntNoErr("flow_inlet"))
|
||||
}
|
||||
if s.GetString("flow_export") != "" {
|
||||
h.Flow.ExportFlow = int64(s.GetIntNoErr("flow_export"))
|
||||
}
|
||||
file.GetDb().JsonDb.StoreHostToJsonFile()
|
||||
}
|
||||
s.AjaxOk("modified success")
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"ehang.io/nps/lib/common"
|
||||
"ehang.io/nps/lib/file"
|
||||
"ehang.io/nps/lib/version"
|
||||
"ehang.io/nps/server"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
@@ -41,6 +42,7 @@ func (self *LoginController) Index() {
|
||||
self.Data["web_base_url"] = webBaseUrl
|
||||
self.Data["register_allow"], _ = beego.AppConfig.Bool("allow_user_register")
|
||||
self.Data["captcha_open"], _ = beego.AppConfig.Bool("open_captcha")
|
||||
self.Data["version"] = version.VERSION
|
||||
self.TplName = "login/index.html"
|
||||
}
|
||||
|
||||
@@ -125,6 +127,7 @@ func (self *LoginController) doLogin(username, password string, explicit bool) b
|
||||
func (self *LoginController) Register() {
|
||||
if self.Ctx.Request.Method == "GET" {
|
||||
self.Data["web_base_url"] = beego.AppConfig.String("web_base_url")
|
||||
self.Data["version"] = version.VERSION
|
||||
self.TplName = "login/register.html"
|
||||
} else {
|
||||
if b, err := beego.AppConfig.Bool("allow_user_register"); err != nil || !b {
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
$.fn.cloudLang = function () {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: window.nps.web_base_url + '/static/page/languages.xml?v=202512051',
|
||||
url: window.nps.web_base_url + '/static/page/languages.xml?v=' + window.nps.version,
|
||||
dataType: 'xml',
|
||||
success: function (xml) {
|
||||
languages['content'] = xml2json($(xml).children())['content'];
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
window.nps = {"web_base_url": {{.web_base_url}} }
|
||||
window.nps = {"web_base_url": {{.web_base_url}}, "version": "{{.version}}" }
|
||||
|
||||
// Login Page Flipbox control
|
||||
function login() {
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<div><strong langtag="word-copyright"></strong> <span langtag="application"></span> © 2018-2019</div>
|
||||
</div>
|
||||
<script>
|
||||
window.nps = { "web_base_url": {{.web_base_url}} }
|
||||
window.nps = { "web_base_url": {{.web_base_url}}, "version": "{{.version}}" }
|
||||
function register() {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
</html>
|
||||
|
||||
<script>
|
||||
window.nps = { "web_base_url": {{.web_base_url}} }
|
||||
window.nps = { "web_base_url": {{.web_base_url}}, "version": "{{.version}}" }
|
||||
/* googleTranslateElementInit()
|
||||
|
||||
function googleTranslateElementInit() {
|
||||
|
||||
Reference in New Issue
Block a user