Added backward compatibility with login_fail_exit
In case both login_fail_exit is defined, a warning will tell to use login_fail_retry. In case login_fail_exit = false and login_fail_retry >= 0, an error will warn about the mismatch.
This commit is contained in:
parent
83039d354b
commit
e8e7fe3afb
@ -37,8 +37,13 @@ tcp_mux = true
|
||||
user = your_name
|
||||
|
||||
# decide if exit program when first login failed, otherwise continuous relogin to frps
|
||||
# default is -1, meaning always retry. 0 exits after first fail, 5 retries 5 times...
|
||||
login_fail_retry = -1
|
||||
# default is true. Will be overridden by login_fail_retry
|
||||
login_fail_exit = true
|
||||
|
||||
# decide if exit program when first login failed, otherwise continuous relogin to frps
|
||||
# default is 0, meaning exits after first failed attempt (and it's equivalent to login_fail_exit = true).
|
||||
# -1 never exits, 5 retries 5 times...
|
||||
login_fail_retry = 0
|
||||
|
||||
# communication protocol used to connect to server
|
||||
# now it supports tcp and kcp and websocket, default is tcp
|
||||
|
@ -66,7 +66,7 @@ func GetDefaultClientConf() *ClientCommonConf {
|
||||
TcpMux: true,
|
||||
User: "",
|
||||
DnsServer: "",
|
||||
LoginFailRetry: -1,
|
||||
LoginFailRetry: 0,
|
||||
Start: make(map[string]struct{}),
|
||||
Protocol: "tcp",
|
||||
HeartBeatInterval: 30,
|
||||
@ -179,13 +179,28 @@ func UnmarshalClientConfFromIni(defaultCfg *ClientCommonConf, content string) (c
|
||||
}
|
||||
}
|
||||
|
||||
if tmpStr, ok = conf.Get("common", "login_fail_exit"); ok {
|
||||
fmt.Println("Parse conf warning: login_fail_exit is deprecated; will be overridden by login_fail_retry if present")
|
||||
if tmpStr == "false" {
|
||||
cfg.LoginFailRetry = -1
|
||||
} else {
|
||||
cfg.LoginFailRetry = 0
|
||||
}
|
||||
}
|
||||
|
||||
if tmpStr, ok = conf.Get("common", "login_fail_retry"); ok {
|
||||
v, err = strconv.ParseInt(tmpStr, 10, 0)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Parse conf error: invalid login_fail_retry")
|
||||
return
|
||||
}
|
||||
cfg.LoginFailRetry = int(v)
|
||||
val := int(v)
|
||||
if cfg.LoginFailRetry == -1 && val >= 0 {
|
||||
err = fmt.Errorf("Parse conf error: cannot have login_fail_exit = false and login_fail_retry >= 0")
|
||||
return
|
||||
} else {
|
||||
cfg.LoginFailRetry = val
|
||||
}
|
||||
}
|
||||
|
||||
if tmpStr, ok = conf.Get("common", "protocol"); ok {
|
||||
|
Loading…
Reference in New Issue
Block a user