mirror of
https://github.com/ehang-io/nps.git
synced 2025-07-03 04:53:50 +00:00
add print version
This commit is contained in:
parent
f1ae3ca758
commit
b6d6fedca2
@ -37,6 +37,7 @@ var (
|
|||||||
debug = flag.Bool("debug", true, "npc debug")
|
debug = flag.Bool("debug", true, "npc debug")
|
||||||
pprofAddr = flag.String("pprof", "", "PProf debug addr (ip:port)")
|
pprofAddr = flag.String("pprof", "", "PProf debug addr (ip:port)")
|
||||||
stunAddr = flag.String("stun_addr", "stun.stunprotocol.org:3478", "stun server address (eg:stun.stunprotocol.org:3478)")
|
stunAddr = flag.String("stun_addr", "stun.stunprotocol.org:3478", "stun server address (eg:stun.stunprotocol.org:3478)")
|
||||||
|
ver = flag.Bool("version", false, "show current version")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -44,6 +45,10 @@ func main() {
|
|||||||
logs.Reset()
|
logs.Reset()
|
||||||
logs.EnableFuncCallDepth(true)
|
logs.EnableFuncCallDepth(true)
|
||||||
logs.SetLogFuncCallDepth(3)
|
logs.SetLogFuncCallDepth(3)
|
||||||
|
if *ver {
|
||||||
|
common.PrintVersion()
|
||||||
|
return
|
||||||
|
}
|
||||||
if *logPath == "" {
|
if *logPath == "" {
|
||||||
*logPath = common.GetNpcLogPath()
|
*logPath = common.GetNpcLogPath()
|
||||||
}
|
}
|
||||||
|
@ -28,11 +28,16 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
level string
|
level string
|
||||||
|
ver = flag.Bool("version", false, "show current version")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
// init log
|
// init log
|
||||||
|
if *ver {
|
||||||
|
common.PrintVersion()
|
||||||
|
return
|
||||||
|
}
|
||||||
if err := beego.LoadAppConfig("ini", filepath.Join(common.GetRunPath(), "conf", "nps.conf")); err != nil {
|
if err := beego.LoadAppConfig("ini", filepath.Join(common.GetRunPath(), "conf", "nps.conf")); err != nil {
|
||||||
log.Fatalln("load config file error", err.Error())
|
log.Fatalln("load config file error", err.Error())
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,11 @@
|
|||||||
|
|
||||||
如果需要注册到系统服务可查看[注册到系统服务](/use?id=注册到系统服务)
|
如果需要注册到系统服务可查看[注册到系统服务](/use?id=注册到系统服务)
|
||||||
|
|
||||||
|
## 版本检查
|
||||||
|
- 对客户端以及服务的均可以使用参数`-version`打印版本
|
||||||
|
- `nps -version`或`./nps -version`
|
||||||
|
- `npc -version`或`./npc -version`
|
||||||
|
|
||||||
## 配置
|
## 配置
|
||||||
- 客户端连接后,在web中配置对应穿透服务即可
|
- 客户端连接后,在web中配置对应穿透服务即可
|
||||||
- 可以查看[使用示例](/example)
|
- 可以查看[使用示例](/example)
|
||||||
|
@ -2,9 +2,11 @@ package common
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"ehang.io/nps/lib/version"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@ -461,3 +463,7 @@ func GetServerIpByClientIp(clientIp net.IP) string {
|
|||||||
_, ip := GetIntranetIp()
|
_, ip := GetIntranetIp()
|
||||||
return ip
|
return ip
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func PrintVersion() {
|
||||||
|
fmt.Printf("Version: %s\nCore version: %s\nSame core version of client and server can connect each other\n", version.VERSION, version.GetVersion())
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user