mirror of
https://github.com/gravitl/netmaker.git
synced 2024-09-20 07:16:06 +08:00
add stunlist string to serverconfig
This commit is contained in:
parent
bf8a5bbc69
commit
dba954c529
|
@ -72,6 +72,7 @@ type ServerConfig struct {
|
|||
NetmakerAccountID string `yaml:"netmaker_account_id"`
|
||||
IsEE string `yaml:"is_ee"`
|
||||
StunPort int `yaml:"stun_port"`
|
||||
StunList string `yaml:"stun_list"`
|
||||
Proxy string `yaml:"proxy"`
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@ func GetServerConfig() config.ServerConfig {
|
|||
cfg.FrontendURL = GetFrontendURL()
|
||||
cfg.Telemetry = Telemetry()
|
||||
cfg.Server = GetServer()
|
||||
cfg.StunList = GetStunListString()
|
||||
cfg.Verbosity = GetVerbosity()
|
||||
cfg.IsEE = "no"
|
||||
if Is_EE {
|
||||
|
@ -188,12 +189,30 @@ func GetStunList() []models.StunServer {
|
|||
Port: 3478,
|
||||
},
|
||||
}
|
||||
parsed := false
|
||||
if os.Getenv("STUN_LIST") != "" {
|
||||
stuns, err := parseStunList(os.Getenv("STUN_LIST"))
|
||||
if err == nil {
|
||||
parsed = true
|
||||
stunList = stuns
|
||||
}
|
||||
}
|
||||
if !parsed && config.Config.Server.StunList != "" {
|
||||
stuns, err := parseStunList(config.Config.Server.StunList)
|
||||
if err == nil {
|
||||
stunList = stuns
|
||||
}
|
||||
}
|
||||
return stunList
|
||||
}
|
||||
|
||||
func GetStunListString() string {
|
||||
stunList := "stun1.netmaker.io:3478,stun2.netmaker.io:3478"
|
||||
if os.Getenv("STUN_LIST") != "" {
|
||||
stunList = os.Getenv("STUN_LIST")
|
||||
} else if config.Config.Server.StunList != "" {
|
||||
stunList = config.Config.Server.StunList
|
||||
}
|
||||
return stunList
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue