|
@@ -21,23 +21,24 @@ import (
|
|
|
)
|
|
|
|
|
|
var (
|
|
|
- serverAddr = flag.String("server", "", "Server addr (ip:port)")
|
|
|
- configPath = flag.String("config", "", "Configuration file path")
|
|
|
- verifyKey = flag.String("vkey", "", "Authentication key")
|
|
|
- logType = flag.String("log", "stdout", "Log output mode(stdout|file)")
|
|
|
- connType = flag.String("type", "tcp", "Connection type with the server(kcp|tcp)")
|
|
|
- proxyUrl = flag.String("proxy", "", "proxy socks5 url(eg:socks5://111:222@127.0.0.1:9007)")
|
|
|
- logLevel = flag.String("log_level", "7", "log level 0~7")
|
|
|
- registerTime = flag.Int("time", 2, "register time long /h")
|
|
|
- localPort = flag.Int("local_port", 2000, "p2p local port")
|
|
|
- password = flag.String("password", "", "p2p password flag")
|
|
|
- target = flag.String("target", "", "p2p target")
|
|
|
- localType = flag.String("local_type", "p2p", "p2p target")
|
|
|
- logPath = flag.String("log_path", "", "npc log path")
|
|
|
- debug = flag.Bool("debug", true, "npc debug")
|
|
|
- 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)")
|
|
|
- ver = flag.Bool("version", false, "show current version")
|
|
|
+ serverAddr = flag.String("server", "", "Server addr (ip:port)")
|
|
|
+ configPath = flag.String("config", "", "Configuration file path")
|
|
|
+ verifyKey = flag.String("vkey", "", "Authentication key")
|
|
|
+ logType = flag.String("log", "stdout", "Log output mode(stdout|file)")
|
|
|
+ connType = flag.String("type", "tcp", "Connection type with the server(kcp|tcp)")
|
|
|
+ proxyUrl = flag.String("proxy", "", "proxy socks5 url(eg:socks5://111:222@127.0.0.1:9007)")
|
|
|
+ logLevel = flag.String("log_level", "7", "log level 0~7")
|
|
|
+ registerTime = flag.Int("time", 2, "register time long /h")
|
|
|
+ localPort = flag.Int("local_port", 2000, "p2p local port")
|
|
|
+ password = flag.String("password", "", "p2p password flag")
|
|
|
+ target = flag.String("target", "", "p2p target")
|
|
|
+ localType = flag.String("local_type", "p2p", "p2p target")
|
|
|
+ logPath = flag.String("log_path", "", "npc log path")
|
|
|
+ debug = flag.Bool("debug", true, "npc debug")
|
|
|
+ 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)")
|
|
|
+ ver = flag.Bool("version", false, "show current version")
|
|
|
+ disconnectTime = flag.Int("disconnect_timeout", 60, "not receiving check packet times, until timeout will disconnect the client")
|
|
|
)
|
|
|
|
|
|
func main() {
|
|
@@ -231,7 +232,7 @@ func run() {
|
|
|
if *verifyKey != "" && *serverAddr != "" && *configPath == "" {
|
|
|
go func() {
|
|
|
for {
|
|
|
- client.NewRPClient(*serverAddr, *verifyKey, *connType, *proxyUrl, nil).Start()
|
|
|
+ client.NewRPClient(*serverAddr, *verifyKey, *connType, *proxyUrl, nil, *disconnectTime).Start()
|
|
|
logs.Info("It will be reconnected in five seconds")
|
|
|
time.Sleep(time.Second * 5)
|
|
|
}
|