mirror of
https://github.com/gravitl/netmaker.git
synced 2024-09-20 15:26:04 +08:00
add turn port to server config
This commit is contained in:
parent
f54ae9ae8f
commit
5153c471d8
|
@ -31,6 +31,7 @@ services:
|
|||
DEFAULT_PROXY_MODE: "off"
|
||||
TURN_SERVER_HOST: "turn.NETMAKER_BASE_DOMAIN"
|
||||
TURN_SERVER_API_HOST: "https://api.turn.NETMAKER_BASE_DOMAIN"
|
||||
TURN_PORT: "3479"
|
||||
ports:
|
||||
- "3478:3478/udp"
|
||||
netmaker-ui:
|
||||
|
|
|
@ -242,6 +242,7 @@ type ServerConfig struct {
|
|||
TrafficKey []byte `yaml:"traffickey"`
|
||||
TurnDomain string `yaml:"turn_domain"`
|
||||
TurnApiDomain string `yaml:"turn_api_domain"`
|
||||
TurnPort int `yaml:"turn_port"`
|
||||
}
|
||||
|
||||
// User.NameInCharset - returns if name is in charset below or not
|
||||
|
|
|
@ -104,6 +104,7 @@ func GetServerInfo() models.ServerConfig {
|
|||
cfg.StunList = GetStunList()
|
||||
cfg.TurnDomain = GetTurnHost()
|
||||
cfg.TurnApiDomain = GetTurnApiHost()
|
||||
cfg.TurnPort = GetTurnPort()
|
||||
return cfg
|
||||
}
|
||||
|
||||
|
@ -649,6 +650,20 @@ func GetStunPort() int {
|
|||
return port
|
||||
}
|
||||
|
||||
// GetTurnPort - Get the port to run the turn server on
|
||||
func GetTurnPort() int {
|
||||
port := 3479 //default
|
||||
if os.Getenv("TURN_PORT") != "" {
|
||||
portInt, err := strconv.Atoi(os.Getenv("TURN_PORT"))
|
||||
if err == nil {
|
||||
port = portInt
|
||||
}
|
||||
} else if config.Config.Server.TurnPort != 0 {
|
||||
port = config.Config.Server.TurnPort
|
||||
}
|
||||
return port
|
||||
}
|
||||
|
||||
// IsProxyEnabled - is proxy on or off
|
||||
func IsProxyEnabled() bool {
|
||||
var enabled = false //default
|
||||
|
|
|
@ -16,7 +16,7 @@ func Init(r *gin.Engine) *gin.Engine {
|
|||
|
||||
func registerRoutes(r *gin.RouterGroup) {
|
||||
r.POST("/host/register", host.Register)
|
||||
r.DELETE("/host/unregister", host.Remove)
|
||||
r.DELETE("/host/deregister", host.Remove)
|
||||
r.GET("/status", status)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue