ipnstate

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: BSD-3-Clause Imports: 12 Imported by: 62

Documentation

Overview

Package ipnstate captures the entire state of the Tailscale network.

It's a leaf package so ipn, wgengine, and magicsock can all depend on it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerStatus

type PeerStatus struct {
	PublicKey key.Public
	HostName  string // HostInfo's Hostname (not a DNS name or necessarily unique)
	DNSName   string
	OS        string // HostInfo.OS
	UserID    tailcfg.UserID

	TailAddr string // Tailscale IP

	// Endpoints:
	Addrs   []string
	CurAddr string // one of Addrs, or unique if roaming
	Relay   string // DERP region

	RxBytes       int64
	TxBytes       int64
	Created       time.Time // time registered with tailcontrol
	LastWrite     time.Time // time last packet sent
	LastSeen      time.Time // last seen to tailcontrol
	LastHandshake time.Time // with local wireguard
	KeepAlive     bool

	// InNetworkMap means that this peer was seen in our latest network map.
	// In theory, all of InNetworkMap and InMagicSock and InEngine should all be true.
	InNetworkMap bool

	// InMagicSock means that this peer is being tracked by magicsock.
	// In theory, all of InNetworkMap and InMagicSock and InEngine should all be true.
	InMagicSock bool

	// InEngine means that this peer is tracked by the wireguard engine.
	// In theory, all of InNetworkMap and InMagicSock and InEngine should all be true.
	InEngine bool
}

func (*PeerStatus) SimpleHostName

func (ps *PeerStatus) SimpleHostName() string

SimpleHostName returns a potentially simplified version of ps.HostName for display purposes.

type PingResult added in v1.2.0

type PingResult struct {
	IP       string // ping destination
	NodeIP   string // Tailscale IP of node handling IP (different for subnet routers)
	NodeName string // DNS name base or (possibly not unique) hostname

	Err            string
	LatencySeconds float64

	Endpoint string // ip:port if direct UDP was used

	DERPRegionID   int    // non-zero if DERP was used
	DERPRegionCode string // three-letter airport/region code if DERP was used

}

PingResult contains response information for the "tailscale ping" subcommand, saying how Tailscale can reach a Tailscale IP or subnet-routed IP.

type Status

type Status struct {
	BackendState string
	TailscaleIPs []netaddr.IP // Tailscale IP(s) assigned to this node
	Self         *PeerStatus

	Peer map[key.Public]*PeerStatus
	User map[tailcfg.UserID]tailcfg.UserProfile
}

Status represents the entire state of the IPN network.

func (*Status) Peers

func (s *Status) Peers() []key.Public

func (*Status) WriteHTML

func (st *Status) WriteHTML(w io.Writer)

type StatusBuilder

type StatusBuilder struct {
	// contains filtered or unexported fields
}

func (*StatusBuilder) AddPeer

func (sb *StatusBuilder) AddPeer(peer key.Public, st *PeerStatus)

AddPeer adds a peer node to the status.

Its PeerStatus is mixed with any previous status already added.

func (*StatusBuilder) AddTailscaleIP added in v1.0.0

func (sb *StatusBuilder) AddTailscaleIP(ip netaddr.IP)

AddIP adds a Tailscale IP address to the status.

func (*StatusBuilder) AddUser

func (sb *StatusBuilder) AddUser(id tailcfg.UserID, up tailcfg.UserProfile)

AddUser adds a user profile to the status.

func (*StatusBuilder) SetBackendState added in v1.2.0

func (sb *StatusBuilder) SetBackendState(v string)

func (*StatusBuilder) SetSelfStatus added in v1.2.0

func (sb *StatusBuilder) SetSelfStatus(ss *PeerStatus)

SetSelfStatus sets the status of the local machine.

func (*StatusBuilder) Status

func (sb *StatusBuilder) Status() *Status

type StatusUpdater

type StatusUpdater interface {
	UpdateStatus(*StatusBuilder)
}

Jump to

Keyboard shortcuts

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