mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-05 23:07:44 +00:00
wgengine/magicsock: update set of DERP nodes
This commit is contained in:
parent
551964c562
commit
848a2bddf0
@ -25,13 +25,17 @@
|
||||
)
|
||||
|
||||
const (
|
||||
derpNYC = 1
|
||||
derpSF = 2
|
||||
derpUSNY = 1
|
||||
derpUSSF = 2
|
||||
derpSG = 3
|
||||
derpDE = 4
|
||||
)
|
||||
|
||||
func init() {
|
||||
addDerper(derpNYC, "derp.tailscale.com")
|
||||
addDerper(derpSF, "derp2.tailscale.com")
|
||||
addDerper(derpUSNY, "derp1.tailscale.com")
|
||||
addDerper(derpUSSF, "derp2.tailscale.com")
|
||||
addDerper(derpSG, "derp3.tailscale.com")
|
||||
addDerper(derpDE, "derp4.tailscale.com")
|
||||
}
|
||||
|
||||
func addDerper(i int, host string) {
|
||||
@ -47,7 +51,7 @@ func addDerper(i int, host string) {
|
||||
}
|
||||
|
||||
// derpHost returns the hostname of a DERP server index (a fake port
|
||||
// number used with derpMagicIP). It always returns a non-empty string.
|
||||
// number used with derpMagicIP).
|
||||
func derpHost(i int) string {
|
||||
if h, ok := derpHostOfIndex[i]; ok {
|
||||
return h
|
||||
@ -55,5 +59,5 @@ func derpHost(i int) string {
|
||||
if 1 <= i && i <= 64<<10 {
|
||||
return fmt.Sprintf("derp%v.tailscale.com", i)
|
||||
}
|
||||
return "derp.tailscale.com"
|
||||
return ""
|
||||
}
|
||||
|
@ -626,6 +626,9 @@ func (c *Conn) derpWriteChanOfAddr(addr *net.UDPAddr) chan<- derpWriteRequest {
|
||||
c.derpCancel = make(map[int]context.CancelFunc)
|
||||
}
|
||||
host := derpHost(addr.Port)
|
||||
if host == "" {
|
||||
return nil
|
||||
}
|
||||
dc, err := derphttp.NewClient(c.privateKey, "https://"+host+"/derp", log.Printf)
|
||||
if err != nil {
|
||||
c.logf("derphttp.NewClient: port %d, host %q invalid? err: %v", addr.Port, host, err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user