客户端、隧道、域名解析修改接口支持修改流量数据

This commit is contained in:
yisier
2026-08-08 20:13:51 +08:00
parent f91156a0cb
commit 3e9cccb86e
4 changed files with 26 additions and 4 deletions
+2
View File
@@ -2,6 +2,8 @@
- 2026-08-08 v0.26.37
- 修复:
- NPC 安装到系统服务失败 BUG [#338](https://github.com/yisier/nps/issues/338)
- 新增:
- 客户端、隧道、域名解析修改接口支持修改流量数据 [#341](https://github.com/yisier/nps/issues/341)
- 2026-07-12 v0.26.36
- 新增:
+6 -4
View File
@@ -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/
+6
View File
@@ -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")
+12
View File
@@ -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")