mirror of https://github.com/qwqdanchun/nps.git
print log when run with nps
This commit is contained in:
parent
2faff58341
commit
e9580e939b
|
@ -25,7 +25,7 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
level string
|
||||
level string
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -57,6 +57,12 @@ func main() {
|
|||
Description: "一款轻量级、功能强大的内网穿透代理服务器。支持tcp、udp流量转发,支持内网http代理、内网socks5代理,同时支持snappy压缩、站点保护、加密传输、多路复用、header修改等。支持web图形化管理,集成多用户模式。",
|
||||
Option: options,
|
||||
}
|
||||
svcConfig.Arguments = append(svcConfig.Arguments, "service")
|
||||
if len(os.Args) > 1 && os.Args[1] == "service" {
|
||||
logs.SetLogger(logs.AdapterFile, `{"level":`+level+`,"filename":"`+logPath+`","daily":false,"maxlines":100000,"color":true}`)
|
||||
} else {
|
||||
logs.SetLogger(logs.AdapterConsole, `{"level":`+level+`,"color":true}`)
|
||||
}
|
||||
if !common.IsWindows() {
|
||||
svcConfig.Dependencies = []string{
|
||||
"Requires=network.target",
|
||||
|
@ -69,8 +75,7 @@ func main() {
|
|||
logs.Error(err)
|
||||
return
|
||||
}
|
||||
logs.SetLogger(logs.AdapterConsole, `{"level":`+level+`,"color":true}`)
|
||||
if len(os.Args) > 1 {
|
||||
if len(os.Args) > 1 && os.Args[1] != "service" {
|
||||
switch os.Args[1] {
|
||||
case "reload":
|
||||
daemon.InitDaemon("nps", common.GetRunPath(), common.GetTmpPath())
|
||||
|
@ -93,7 +98,6 @@ func main() {
|
|||
}
|
||||
return
|
||||
case "start", "restart", "stop", "uninstall":
|
||||
logs.SetLogger(logs.AdapterFile, `{"level":`+level+`,"filename":"`+logPath+`","daily":false,"maxlines":100000,"color":true}`)
|
||||
err := service.Control(s, os.Args[1])
|
||||
if err != nil {
|
||||
logs.Error("Valid actions: %q\n", service.ControlAction, err.Error())
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
停止和重启可用,stop和restart
|
||||
|
||||
**如果发现没有启动成功,可以使用`nps(.exe) debug`运行调试,或查看日志**(Windows日志文件位于当前运行目录下,linux和darwin位于/var/log/nps.log)
|
||||
**如果发现没有启动成功,可以使用`nps(.exe) stop`,然后运行`nps.(exe)`运行调试,或查看日志**(Windows日志文件位于当前运行目录下,linux和darwin位于/var/log/nps.log)
|
||||
- 访问服务端ip:web服务端口(默认为8080)
|
||||
- 使用用户名和密码登陆(默认admin/123,正式使用一定要更改)
|
||||
- 创建客户端
|
||||
|
|
Loading…
Reference in New Issue