derpmap

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package derpmap provides the tailscale derp map implementation.

Index

Constants

View Source
const (
	TailscaleDERPMapURL = "https://login.tailscale.com/derpmap/default"
	TailescaleRegionKey = "Regions" // key containing the RegionInfo
)

Variables

View Source
var DERPMapRaw embed.FS

Functions

This section is empty.

Types

type DERPMap

type DERPMap map[int]Region

DERPMap is a map of RegionID to Region

var SavedDERPMap DERPMap // SavedDERPMap is the DERP map that is embedded from derpmap.json at compile time

func GetTailcaleDERPMap

func GetTailcaleDERPMap() (DERPMap, error)

GetTailscaleDERPMap fetches the Tailscale public DERP map and loads it into a DERPMap struct

func (DERPMap) GetRegionCodeMapping

func (d DERPMap) GetRegionCodeMapping() map[string]Region

Generates a regionCode: Region mapping for the DERPMap

func (DERPMap) WriteJSON

func (d DERPMap) WriteJSON(path string) error

WriteJSON writes the DERPMap to a JSON file at the given path

type Node

type Node struct {
	Name     string `json:"Name"`
	RegionID int    `json:"RegionID"`
	HostName string `json:"HostName"`
	IPv4     string `json:"IPv4"`
	IPv6     string `json:"IPv6"`
}

Node stores node information pulled from the tailscale public DERP map

type Region

type Region struct {
	RegionID   int    `json:"RegionID"`
	RegionCode string `json:"RegionCode"`
	RegionName string `json:"RegionName"`
	Nodes      []Node `json:"Nodes"`
}

Directories

Path Synopsis
"sync" syncs the tailscale derp map.
"sync" syncs the tailscale derp map.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL