2020-03-09 22:20:33 +00:00
|
|
|
// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// Package derpmap contains information about Tailscale.com's production DERP nodes.
|
|
|
|
package derpmap
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2020-05-17 16:51:38 +00:00
|
|
|
"strings"
|
2020-05-03 20:58:39 +00:00
|
|
|
|
2020-05-17 16:51:38 +00:00
|
|
|
"tailscale.com/tailcfg"
|
2020-03-09 22:20:33 +00:00
|
|
|
)
|
|
|
|
|
2020-05-17 16:51:38 +00:00
|
|
|
func derpNode(suffix, v4, v6 string) *tailcfg.DERPNode {
|
|
|
|
return &tailcfg.DERPNode{
|
|
|
|
Name: suffix, // updated later
|
|
|
|
RegionID: 0, // updated later
|
|
|
|
IPv4: v4,
|
|
|
|
IPv6: v6,
|
2020-03-09 22:20:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-14 20:20:25 +00:00
|
|
|
func derpRegion(id int, code, name string, nodes ...*tailcfg.DERPNode) *tailcfg.DERPRegion {
|
2020-05-17 16:51:38 +00:00
|
|
|
region := &tailcfg.DERPRegion{
|
|
|
|
RegionID: id,
|
2020-08-14 19:57:11 +00:00
|
|
|
RegionName: name,
|
2020-05-17 16:51:38 +00:00
|
|
|
RegionCode: code,
|
|
|
|
Nodes: nodes,
|
2020-03-09 22:20:33 +00:00
|
|
|
}
|
2020-05-17 16:51:38 +00:00
|
|
|
for _, n := range nodes {
|
|
|
|
n.Name = fmt.Sprintf("%d%s", id, n.Name)
|
|
|
|
n.RegionID = id
|
|
|
|
n.HostName = fmt.Sprintf("derp%s.tailscale.com", strings.TrimSuffix(n.Name, "a"))
|
2020-05-05 05:06:02 +00:00
|
|
|
}
|
2020-05-17 16:51:38 +00:00
|
|
|
return region
|
2020-05-05 05:06:02 +00:00
|
|
|
}
|
|
|
|
|
2020-05-17 16:51:38 +00:00
|
|
|
// Prod returns Tailscale's map of relay servers.
|
|
|
|
//
|
|
|
|
// This list is only used by cmd/tailscale's netcheck subcommand. In
|
|
|
|
// normal operation the Tailscale nodes get this sent to them from the
|
|
|
|
// control server.
|
|
|
|
//
|
|
|
|
// This list is subject to change and should not be relied on.
|
|
|
|
func Prod() *tailcfg.DERPMap {
|
|
|
|
return &tailcfg.DERPMap{
|
|
|
|
Regions: map[int]*tailcfg.DERPRegion{
|
2020-08-14 19:57:11 +00:00
|
|
|
1: derpRegion(1, "nyc", "New York City",
|
2020-05-17 16:51:38 +00:00
|
|
|
derpNode("a", "159.89.225.99", "2604:a880:400:d1::828:b001"),
|
|
|
|
),
|
2020-08-14 19:57:11 +00:00
|
|
|
2: derpRegion(2, "sfo", "San Francisco",
|
2020-05-17 16:51:38 +00:00
|
|
|
derpNode("a", "167.172.206.31", "2604:a880:2:d1::c5:7001"),
|
|
|
|
),
|
2020-08-14 19:57:11 +00:00
|
|
|
3: derpRegion(3, "sin", "Singapore",
|
2020-05-17 16:51:38 +00:00
|
|
|
derpNode("a", "68.183.179.66", "2400:6180:0:d1::67d:8001"),
|
|
|
|
),
|
2020-08-14 19:57:11 +00:00
|
|
|
4: derpRegion(4, "fra", "Frankfurt",
|
2020-05-17 16:51:38 +00:00
|
|
|
derpNode("a", "167.172.182.26", "2a03:b0c0:3:e0::36e:9001"),
|
|
|
|
),
|
2020-08-14 19:57:11 +00:00
|
|
|
5: derpRegion(5, "syd", "Sydney",
|
2020-05-17 16:51:38 +00:00
|
|
|
derpNode("a", "103.43.75.49", "2001:19f0:5801:10b7:5400:2ff:feaa:284c"),
|
|
|
|
),
|
2020-08-14 20:29:14 +00:00
|
|
|
6: derpRegion(6, "blr", "Bangalore",
|
|
|
|
derpNode("a", "68.183.90.120", "2400:6180:100:d0::982:d001"),
|
|
|
|
),
|
|
|
|
7: derpRegion(7, "tok", "Tokyo",
|
|
|
|
derpNode("a", "167.179.89.145", "2401:c080:1000:467f:5400:2ff:feee:22aa"),
|
|
|
|
),
|
2020-05-17 16:51:38 +00:00
|
|
|
},
|
2020-03-09 22:20:33 +00:00
|
|
|
}
|
|
|
|
}
|