latency

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package latency tracks the global network connectivity statistics.

Index

Constants

View Source
const (
	StateNameLatency = "network-latency"

	StateKeyLatencyData         = "data"
	StateKeyLatencyEncoding     = "encoding"
	StateKeyLatencyEncodingJSON = "json"
)
View Source
const Name = "network-latency"

Variables

This section is empty.

Functions

func New

Types

type Config

type Config struct {
	Query       query_config.Config `json:"query"`
	RegionCodes []string            `json:"region_codes"`
}

func ParseConfig

func ParseConfig(b any, db *sql.DB) (*Config, error)

func (Config) Validate

func (cfg Config) Validate() error

type Output

type Output struct {
	RegionLatencies []RegionLatency `json:"region_latency"`
}

func ParseOutputJSON

func ParseOutputJSON(data []byte) (*Output, error)

func ParseStateLatency

func ParseStateLatency(m map[string]string) (*Output, error)

func ParseStatesToOutput

func ParseStatesToOutput(states ...components.State) (*Output, error)

func (*Output) JSON

func (o *Output) JSON() ([]byte, error)

func (*Output) States

func (o *Output) States() ([]components.State, error)

type RegionLatency

type RegionLatency struct {
	// RegionID/RegionCode list is available at https://login.tailscale.com/derpmap/default
	RegionID         int           `json:"region_id"`         // RegionID is the DERP region ID
	RegionCode       string        `json:"region_code"`       // RegionCode is the three-letter code for the region
	RegionName       string        `json:"region_name"`       // RegionName is the human-readable name of the region (e.g. "Chicago")
	Latency          time.Duration `json:"latency"`           // Latency is the round-trip time to the region
	LatencyHumanized string        `json:"latency_humanized"` // LatencyHumanized is the human-readable version of the latency, in milliseconds
}

Directories

Path Synopsis
Package derpmap provides the tailscale derp map implementation.
Package derpmap provides the tailscale derp map implementation.
sync
"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