Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00315a8892 | ||
|
|
8be1e9f865 | ||
|
|
c0667e2dca |
@@ -12,8 +12,8 @@
|
||||
## 更新日志
|
||||
|
||||
- 2022-10-30
|
||||
***新增***:在管理面板中新增客户端时,可以多个配置黑名单IP,用于防止被肉鸡扫描端口。
|
||||
***优化***:无论是否注册系统服务,直接执行 nps 时只会读取当前目录下的配置文件。0.26.12 版本还原了注册系统功能,使用方式和以前一样。
|
||||
***新增***:在管理面板中新增客户端时,可以配置多个黑名单IP,用于防止被肉鸡扫描端口或被恶意攻击。
|
||||
***优化***:0.26.12 版本还原了注册系统功能,使用方式和以前一样。无论是否注册了系统服务,直接执行 nps 时只会读取当前目录下的配置文件。
|
||||
|
||||
|
||||
- 2022-10-27
|
||||
|
||||
+2
-9
@@ -40,15 +40,8 @@ func main() {
|
||||
common.PrintVersion()
|
||||
return
|
||||
}
|
||||
|
||||
if len(os.Args) <= 1 {
|
||||
if err := beego.LoadAppConfig("ini", filepath.Join("./", "conf", "nps.conf")); err != nil {
|
||||
log.Fatalln("load config file error", err.Error())
|
||||
}
|
||||
} else {
|
||||
if err := beego.LoadAppConfig("ini", filepath.Join(common.GetRunPath(), "conf", "nps.conf")); err != nil {
|
||||
log.Fatalln("load config file error", err.Error())
|
||||
}
|
||||
if err := beego.LoadAppConfig("ini", filepath.Join(common.GetRunPath(), "conf", "nps.conf")); err != nil {
|
||||
log.Fatalln("load config file error", err.Error())
|
||||
}
|
||||
|
||||
common.InitPProfFromFile()
|
||||
|
||||
+6
-2
@@ -11,8 +11,12 @@ import (
|
||||
//windows system, select the C:\Program Files\nps as config directory if exist, or select ./
|
||||
func GetRunPath() string {
|
||||
var path string
|
||||
if path = GetInstallPath(); !FileExists(path) {
|
||||
return GetAppPath()
|
||||
if len(os.Args) <= 1 {
|
||||
return "./"
|
||||
} else {
|
||||
if path = GetInstallPath(); !FileExists(path) {
|
||||
return GetAppPath()
|
||||
}
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@ func CopyBuffer(dst io.Writer, src io.Reader, flow *file.Flow, task *file.Tunnel
|
||||
}
|
||||
//logs.Info("HTTP Request: " + firstLine[0:strings.Index(firstLine, "\n")])
|
||||
//logs.Info("%s request, method %s, host %s, url %s, remote address %s, target %s", r.URL.Scheme, r.Method, r.Host, r.URL.Path, c.RemoteAddr().String(), lk.Host)
|
||||
|
||||
}
|
||||
|
||||
task.IsHttp = true
|
||||
@@ -78,13 +77,15 @@ func CopyBuffer(dst io.Writer, src io.Reader, flow *file.Flow, task *file.Tunnel
|
||||
nw, ew := dst.Write(buf[0:nr])
|
||||
if nw > 0 {
|
||||
//written += int64(nw)
|
||||
flow.Add(int64(nw), int64(nw))
|
||||
|
||||
// <<20 = 1024 * 1024
|
||||
if flow.FlowLimit > 0 && (flow.FlowLimit<<20) < (flow.ExportFlow+flow.InletFlow) {
|
||||
logs.Info("流量已经超出.........")
|
||||
break
|
||||
if flow != nil {
|
||||
flow.Add(int64(nw), int64(nw))
|
||||
// <<20 = 1024 * 1024
|
||||
if flow.FlowLimit > 0 && (flow.FlowLimit<<20) < (flow.ExportFlow+flow.InletFlow) {
|
||||
logs.Info("流量已经超出.........")
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if ew != nil {
|
||||
err = ew
|
||||
|
||||
Reference in New Issue
Block a user