Make STUN server configurable

This commit is contained in:
Juan Font Alonso 2022-03-06 17:00:56 +01:00
parent dc909ba6d7
commit eb500155e8
4 changed files with 33 additions and 5 deletions

6
app.go
View file

@ -121,6 +121,8 @@ type OIDCConfig struct {
type DERPConfig struct {
ServerEnabled bool
STUNEnabled bool
STUNAddr string
URLs []url.URL
Paths []string
AutoUpdate bool
@ -497,8 +499,10 @@ func (h *Headscale) Serve() error {
h.DERPMap = GetDERPMap(h.cfg.DERP)
if h.cfg.DERP.ServerEnabled {
go h.ServeSTUN()
h.DERPMap.Regions[h.DERPServer.region.RegionID] = &h.DERPServer.region
if h.cfg.DERP.STUNEnabled {
go h.ServeSTUN()
}
}
if h.cfg.DERP.AutoUpdate {