mirror of
https://github.com/coder/coder.git
synced 2025-07-08 11:39:50 +00:00
fix: change servertailnet to register the DERP dialer before setting DERP map (#12137)
I noticed a possible race where tailnet.Conn can try to dial the embedded region before we've set our custom dialer that send the DERP in-memory. This closes that race and adds a test case for servertailnet with no STUN and an embedded relay
This commit is contained in:
@ -116,9 +116,6 @@ func NewConn(options *Options) (conn *Conn, err error) {
|
||||
if len(options.Addresses) == 0 {
|
||||
return nil, xerrors.New("At least one IP range must be provided")
|
||||
}
|
||||
if options.DERPMap == nil {
|
||||
return nil, xerrors.New("DERPMap must be provided")
|
||||
}
|
||||
|
||||
nodePrivateKey := key.NewNode()
|
||||
var nodeID tailcfg.NodeID
|
||||
@ -219,7 +216,9 @@ func NewConn(options *Options) (conn *Conn, err error) {
|
||||
magicConn.DiscoPublicKey(),
|
||||
)
|
||||
cfgMaps.setAddresses(options.Addresses)
|
||||
cfgMaps.setDERPMap(options.DERPMap)
|
||||
if options.DERPMap != nil {
|
||||
cfgMaps.setDERPMap(options.DERPMap)
|
||||
}
|
||||
cfgMaps.setBlockEndpoints(options.BlockEndpoints)
|
||||
|
||||
nodeUp := newNodeUpdater(
|
||||
|
Reference in New Issue
Block a user