fix: Prepend STUN nodes for DERP (#3787)

This makes Tailscale prefer STUN over DERP when possible.
This commit is contained in:
Kyle Carberry 2022-08-31 21:21:21 -05:00 committed by GitHub
parent 9bd83e5ec7
commit 567e750659
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -24,13 +24,13 @@ func NewDERPMap(ctx context.Context, region *tailcfg.DERPRegion, stunAddrs []str
if err != nil {
return nil, xerrors.Errorf("parse port for %q: %w", stunAddr, err)
}
region.Nodes = append(region.Nodes, &tailcfg.DERPNode{
region.Nodes = append([]*tailcfg.DERPNode{{
Name: fmt.Sprintf("%dstun%d", region.RegionID, index),
RegionID: region.RegionID,
HostName: host,
STUNOnly: true,
STUNPort: port,
})
}}, region.Nodes...)
}
derpMap := &tailcfg.DERPMap{