mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-09 21:36:09 +08:00
adding StunList
This commit is contained in:
parent
d19f292e6c
commit
4ff135e196
6 changed files with 55 additions and 54 deletions
|
@ -14,6 +14,7 @@ services:
|
|||
EMQX_REST_ENDPOINT: "http://mq:18083"
|
||||
SERVER_NAME: "NETMAKER_BASE_DOMAIN"
|
||||
STUN_DOMAIN: "stun.NETMAKER_BASE_DOMAIN"
|
||||
STUN_LIST: "stun.NETMAKER_BASE_DOMAIN:3478,stun1.netmaker.io:3478,stun2.netmaker.io:3478,stun1.l.google.com:19302,stun2.l.google.com:19302"
|
||||
SERVER_HOST: "SERVER_PUBLIC_IP"
|
||||
SERVER_API_CONN_STRING: "api.NETMAKER_BASE_DOMAIN:443"
|
||||
COREDNS_ADDR: "SERVER_PUBLIC_IP"
|
||||
|
|
|
@ -14,6 +14,7 @@ services:
|
|||
EMQX_REST_ENDPOINT: "http://mq:18083"
|
||||
SERVER_NAME: "NETMAKER_BASE_DOMAIN"
|
||||
STUN_DOMAIN: "stun.NETMAKER_BASE_DOMAIN"
|
||||
STUN_LIST: "stun.NETMAKER_BASE_DOMAIN:3478,stun1.netmaker.io:3478,stun2.netmaker.io:3478,stun1.l.google.com:19302,stun2.l.google.com:19302"
|
||||
SERVER_HOST: "SERVER_PUBLIC_IP"
|
||||
SERVER_API_CONN_STRING: "api.NETMAKER_BASE_DOMAIN:443"
|
||||
COREDNS_ADDR: "SERVER_PUBLIC_IP"
|
||||
|
|
|
@ -11,7 +11,7 @@ services:
|
|||
environment:
|
||||
BROKER_ENDPOINT: "wss://broker.NETMAKER_BASE_DOMAIN"
|
||||
SERVER_NAME: "NETMAKER_BASE_DOMAIN"
|
||||
STUN_DOMAIN: "stun.NETMAKER_BASE_DOMAIN"
|
||||
STUN_LIST: "stun.NETMAKER_BASE_DOMAIN:3478,stun1.netmaker.io:3478,stun2.netmaker.io:3478,stun1.l.google.com:19302,stun2.l.google.com:19302"
|
||||
SERVER_HOST: "SERVER_PUBLIC_IP"
|
||||
SERVER_API_CONN_STRING: "api.NETMAKER_BASE_DOMAIN:443"
|
||||
COREDNS_ADDR: "SERVER_PUBLIC_IP"
|
||||
|
@ -24,7 +24,6 @@ services:
|
|||
DATABASE: "sqlite"
|
||||
NODE_ID: "netmaker-server-1"
|
||||
SERVER_BROKER_ENDPOINT: "ws://mq:1883"
|
||||
STUN_PORT: "3478"
|
||||
VERBOSITY: "1"
|
||||
MQ_PASSWORD: "REPLACE_MQ_PASSWORD"
|
||||
MQ_USERNAME: "REPLACE_MQ_USERNAME"
|
||||
|
|
|
@ -72,7 +72,7 @@ type ServerConfig struct {
|
|||
NetmakerAccountID string `yaml:"netmaker_account_id"`
|
||||
IsEE string `yaml:"is_ee"`
|
||||
StunPort int `yaml:"stun_port"`
|
||||
StunHost string `yaml:"stun_host"`
|
||||
StunList string `yaml:"stun_list"`
|
||||
Proxy string `yaml:"proxy"`
|
||||
}
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ type ServerConfig struct {
|
|||
Broker string `yaml:"broker"`
|
||||
Is_EE bool `yaml:"isee"`
|
||||
StunPort int `yaml:"stun_port"`
|
||||
StunHost string `yaml:"stun_host"`
|
||||
StunList string `yaml:"stun_list"`
|
||||
TrafficKey []byte `yaml:"traffickey"`
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,8 @@ func GetServerConfig() config.ServerConfig {
|
|||
cfg.AllowedOrigin = GetAllowedOrigin()
|
||||
cfg.RestBackend = "off"
|
||||
cfg.NodeID = GetNodeID()
|
||||
cfg.StunHost = GetStunAddr()
|
||||
cfg.StunPort = GetStunPort()
|
||||
cfg.StunList = GetStunList()
|
||||
cfg.BrokerType = GetBrokerType()
|
||||
cfg.EmqxRestEndpoint = GetEmqxRestEndpoint()
|
||||
if IsRestBackend() {
|
||||
|
@ -99,8 +99,8 @@ func GetServerInfo() models.ServerConfig {
|
|||
}
|
||||
cfg.Version = GetVersion()
|
||||
cfg.Is_EE = Is_EE
|
||||
cfg.StunHost = GetStunAddr()
|
||||
cfg.StunPort = GetStunPort()
|
||||
cfg.StunList = GetStunList()
|
||||
|
||||
return cfg
|
||||
}
|
||||
|
@ -178,14 +178,14 @@ func GetAPIPort() string {
|
|||
}
|
||||
|
||||
// GetStunAddr - gets the stun host address
|
||||
func GetStunAddr() string {
|
||||
stunAddr := ""
|
||||
if os.Getenv("STUN_DOMAIN") != "" {
|
||||
stunAddr = os.Getenv("STUN_DOMAIN")
|
||||
} else if config.Config.Server.StunHost != "" {
|
||||
stunAddr = config.Config.Server.StunHost
|
||||
func GetStunList() 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 stunAddr
|
||||
return stunList
|
||||
}
|
||||
|
||||
// GetCoreDNSAddr - gets the core dns address
|
||||
|
|
Loading…
Add table
Reference in a new issue