mirror of
https://github.com/fatedier/frp.git
synced 2024-12-12 17:50:51 +01:00
added heartbeat conf
This commit is contained in:
parent
299bd7b5cb
commit
e26285eefc
@ -22,6 +22,11 @@ auth_token = 123
|
|||||||
# for privilege mode
|
# for privilege mode
|
||||||
privilege_token = 12345678
|
privilege_token = 12345678
|
||||||
|
|
||||||
|
# [optional] heartbeat conf
|
||||||
|
# heartbeat_interval default value is 20, heartbeat_timeout default value is 90
|
||||||
|
heartbeat_interval = 20
|
||||||
|
heartbeat_timeout = 90
|
||||||
|
|
||||||
|
|
||||||
# ssh is the proxy name same as server's configuration
|
# ssh is the proxy name same as server's configuration
|
||||||
[ssh]
|
[ssh]
|
||||||
|
@ -30,6 +30,10 @@ log_max_days = 3
|
|||||||
privilege_mode = true
|
privilege_mode = true
|
||||||
privilege_token = 12345678
|
privilege_token = 12345678
|
||||||
|
|
||||||
|
# [optional]heartbeat conf
|
||||||
|
# heartbeat_timeout default value is 90
|
||||||
|
heartbeat_timeout = 90
|
||||||
|
|
||||||
# only allow frpc to bind ports you list, if you set nothing, there won't be any limit
|
# only allow frpc to bind ports you list, if you set nothing, there won't be any limit
|
||||||
privilege_allow_ports = 2000-3000,3001,3003,4000-50000
|
privilege_allow_ports = 2000-3000,3001,3003,4000-50000
|
||||||
|
|
||||||
|
@ -98,6 +98,34 @@ func LoadConf(confFile string) (err error) {
|
|||||||
authToken = tmpStr
|
authToken = tmpStr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tmpStr, ok = conf.Get("common", "heartbeat_timeout")
|
||||||
|
if ok {
|
||||||
|
v, err := strconv.ParseInt(tmpStr, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Parse conf error: heartbeat_timeout is incorrect")
|
||||||
|
} else {
|
||||||
|
HeartBeatTimeout = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpStr, ok = conf.Get("common", "heartbeat_interval")
|
||||||
|
if ok {
|
||||||
|
v, err := strconv.ParseInt(tmpStr, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Parse conf error: heartbeat_interval is incorrect")
|
||||||
|
} else {
|
||||||
|
HeartBeatInterval = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if HeartBeatInterval <= 0 {
|
||||||
|
return fmt.Errorf("Parse conf error: heartbeat_interval is incorrect")
|
||||||
|
}
|
||||||
|
|
||||||
|
if HeartBeatTimeout < HeartBeatInterval {
|
||||||
|
return fmt.Errorf("Parse conf error: heartbeat_timeout is incorrect, heartbeat_timeout is less than heartbeat_interval")
|
||||||
|
}
|
||||||
|
|
||||||
// proxies
|
// proxies
|
||||||
for name, section := range conf {
|
for name, section := range conf {
|
||||||
if name != "common" {
|
if name != "common" {
|
||||||
|
@ -237,6 +237,16 @@ func loadCommonConf(confFile string) error {
|
|||||||
if ok {
|
if ok {
|
||||||
SubDomainHost = strings.ToLower(strings.TrimSpace(SubDomainHost))
|
SubDomainHost = strings.ToLower(strings.TrimSpace(SubDomainHost))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tmpStr, ok = conf.Get("common", "heartbeat_timeout")
|
||||||
|
if ok {
|
||||||
|
v, err := strconv.ParseInt(tmpStr, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Parse conf error: heartbeat_timeout is incorrect")
|
||||||
|
} else {
|
||||||
|
HeartBeatTimeout = v
|
||||||
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user