mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-26 08:53:05 +00:00
Make STUN server mandatory if DERP embedded is enabled
This commit is contained in:
parent
8f5875efe4
commit
2e6687209b
3 changed files with 11 additions and 12 deletions
|
@ -124,8 +124,11 @@ func GetDERPConfig() headscale.DERPConfig {
|
|||
serverRegionID := viper.GetInt("derp.server.region_id")
|
||||
serverRegionCode := viper.GetString("derp.server.region_code")
|
||||
serverRegionName := viper.GetString("derp.server.region_name")
|
||||
stunEnabled := viper.GetBool("derp.server.stun.enabled")
|
||||
stunAddr := viper.GetString("derp.server.stun.listen_addr")
|
||||
stunAddr := viper.GetString("derp.server.stun_listen_addr")
|
||||
|
||||
if serverEnabled && stunAddr == "" {
|
||||
log.Fatal().Msg("derp.server.stun_listen_addr must be set if derp.server.enabled is true")
|
||||
}
|
||||
|
||||
urlStrs := viper.GetStringSlice("derp.urls")
|
||||
|
||||
|
@ -152,7 +155,6 @@ func GetDERPConfig() headscale.DERPConfig {
|
|||
ServerRegionID: serverRegionID,
|
||||
ServerRegionCode: serverRegionCode,
|
||||
ServerRegionName: serverRegionName,
|
||||
STUNEnabled: stunEnabled,
|
||||
STUNAddr: stunAddr,
|
||||
URLs: urls,
|
||||
Paths: paths,
|
||||
|
|
|
@ -69,14 +69,12 @@ derp:
|
|||
region_code: "headscale"
|
||||
region_name: "Headscale Embedded DERP"
|
||||
|
||||
# Enabled by default when embedded DERP is enabled. Listens in UDP at the configured address for STUN connections
|
||||
# to help on NAT traversal.
|
||||
# If DERP is enabled, but STUN is disabled you still need to input an external STUN server in the listen_addr field.
|
||||
|
||||
# Listens in UDP at the configured address for STUN connections to help on NAT traversal.
|
||||
# When the embedded DERP server is enabled stun_listen_addr MUST be defined.
|
||||
#
|
||||
# For more details on how this works, check this great article: https://tailscale.com/blog/how-tailscale-works/
|
||||
stun:
|
||||
enabled: true
|
||||
listen_addr: "0.0.0.0:3478"
|
||||
stun_listen_addr: "0.0.0.0:3478"
|
||||
|
||||
# List of externally available DERP maps encoded in JSON
|
||||
urls:
|
||||
|
|
|
@ -24,6 +24,5 @@ derp:
|
|||
region_id: 999
|
||||
region_code: "headscale"
|
||||
region_name: "Headscale Embedded DERP"
|
||||
stun:
|
||||
enabled: true
|
||||
listen_addr: "0.0.0.0:3478"
|
||||
|
||||
stun_listen_addr: "0.0.0.0:3478"
|
||||
|
|
Loading…
Reference in a new issue