Skip to content

Commit 567e750

Browse files
authored
fix: Prepend STUN nodes for DERP (#3787)
This makes Tailscale prefer STUN over DERP when possible.
1 parent 9bd83e5 commit 567e750

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tailnet/derpmap.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ func NewDERPMap(ctx context.Context, region *tailcfg.DERPRegion, stunAddrs []str
2424
if err != nil {
2525
return nil, xerrors.Errorf("parse port for %q: %w", stunAddr, err)
2626
}
27-
region.Nodes = append(region.Nodes, &tailcfg.DERPNode{
27+
region.Nodes = append([]*tailcfg.DERPNode{{
2828
Name: fmt.Sprintf("%dstun%d", region.RegionID, index),
2929
RegionID: region.RegionID,
3030
HostName: host,
3131
STUNOnly: true,
3232
STUNPort: port,
33-
})
33+
}}, region.Nodes...)
3434
}
3535

3636
derpMap := &tailcfg.DERPMap{

0 commit comments

Comments
 (0)