Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalizeLocation ¶
CanonicalizeLocation returns a lowercase, no-space representation of the passed string.
Types ¶
type Bridge ¶
type Bridge struct { // Any authentication method needed for connect to the bridge, `none` // otherwise. Auth string `json:"auth,omitempty"` // An experimental bridge flags any bridge that, for whatever reason, // is not deemed stable. The expectation is that clients have to opt-in to // experimental bridges (and gateways too). Experimental bool `json:"experimental,omitempty"` // Healthy indicates whether this bridge can be used normally. Healthy bool `json:"healthy"` // Host is a unique identifier for the bridge. Host string `json:"host,omitempty"` // IPAddr is the IPv4 address IPAddr string `json:"ip_addr"` // IP6Addr is the IPv6 address IP6Addr string `json:"ip6_addr"` // Load is the fractional load - but for now menshen agent is not measuring // load in the bridges. Load float32 `json:"load"` // Location refers to the location to which this bridge points to Location string `json:"location"` // Overloaded should be set to true if the fractional load is above threshold. Overloaded bool `json:"overloaded"` // For some protocols (like hopping) port is undefined. Port int `json:"port"` // TCP, UDP or KCP. This was called "protocol" before. Transport string `json:"transport"` // Type of bridge. Type string `json:"type"` // Options contain the map of options that will be passed to the client. It usually // contains authentication credentials. Options map[string]any `json:"options"` // Bucket is a "bucket" tag that connotes a resource group that a user may or may not // have access to. An empty bucket string implies that it is open access Bucket string `json:"bucket"` }
Bridge is a (encrypted) proxy that is configured to connect to a Gateway.
type EIPService ¶
type EIPService struct { Serial int `json:"serial"` Version int `json:"version"` Auth string `json:"auth"` Locations any `json:"locations"` OpenVPNConfig map[string]any `json:"openvpn_configuration"` }
EIPService describes the serialization of a service description format used by LEAP.
type EIPServiceV3 ¶
type EIPServiceV3 struct { Serial int `json:"serial"` Version int `json:"version"` Gateways []struct { Host string `json:"host"` IPAddr string `json:"ip_address"` Location string `json:"location"` Capabilities struct { Transport []struct { Type string `json:"type"` Protocols []string `json:"protocols"` Ports []string `json:"ports"` Options map[string]any `json:"options"` } `json:"transport"` } `json:"capabilities"` } Locations map[string]map[string]string `json:"locations"` OpenVPNConfig map[string]any `json:"openvpn_configuration"` }
EIPServiceV3 describes the JSON serialization of the legacy EIP Service format (v3).
type EndpointFilter ¶
EndpointFilter is a function (parametrized for Gateway or Bridge) that takes a pointer to Endpoint and returns bool. It is used to pass filtering functions around.
type Gateway ¶
type Gateway struct { // An experimental gateway flags any gateway that, for whatever reason, // is not deemed stable. The expectation is that clients have to opt-in to // experimental gateways (and bridges too). Experimental bool `json:"experimental"` // Not used now - we could potentially flag gateways that are planned // to undergo maintenance mode some time in advance. // We can also automatically flag as not healthy gateways that appear // not to be routing to the internet. Healthy bool `json:"healthy"` // Host is a unique identifier for the gateway host. It does not need to resolve, since // we're not using DNS to resolve the gateways. Host string `json:"host"` // IPAddr is the IPv4 address IPAddr string `json:"ip_addr"` // IP6Addr is the IPv6 address IP6Addr string `json:"ip6_addr"` // Load is the fractional load received from the menshen agent. For the // time being it is a synthethic metric that takes into account number of clients // and network information for the node. Load float64 `json:"load"` // Location is the canonical label for the location of the gateway. Location string `json:"location"` // Overloaded should be set to true if the fractional load is above threshold. Overloaded bool `json:"overloaded"` // List of ports this gateway is listening on. The order of the ports is used // for load balancing the gateway. The client should use the ports in the order // it receives them (first port in the list is the preferred port) Ports []int `json:"ports"` // TCP, UDP or KCP. This was called "protocol" in previous versions of the API. Transport string `json:"transport"` // Type is the type of gateway. The only valid type as of 2023 is openvpn. Type string `json:"type"` // Bucket is a "bucket" tag that connotes a resource group that a user may or may not // have access to. An empty bucket string implies that it is open access Bucket string `json:"bucket"` }
Gateway is the main endpoint for the tunneling protocol.
type Location ¶
type Location struct { // CountryCode is the two-character country ISO identifier (uppercase). CountryCode string `json:"country_code"` // DisplayName is the user-facing string for a given location. DisplayName string `json:"display_name"` // Any location that has at least one bridge configured will set this to true. HasBridges bool `json:"has_bridges"` // TODO Not used right now, but intended to signal when a location has all of their // nodes overwhelmed. Healthy bool `json:"healthy"` // Hemisphere is a legacy label for a gateway. The rationale was once // intended to be to allocate gateways for an hemisphere with certain // regional "fairness", even if they're geographically located in a // different region. We might want to set this on the Gateway or Bridge, not in the // Location itself... Hemisphere string `json:"hemisphere"` // Label is the short representation of a location, used internally. Label string `json:"label"` // Lat is the latitude for the location. Lat string `json:"lat"` // Lon is the longitude for the location. Lon string `json:"lon"` // Region is the continental region this gateway is assigned to. Not used at the moment, // intended to use a label from the 7-continent model. Region string `json:"region"` // Timezone is the TZ for the location (-1, 0, +1, ...) Timezone string `json:"timezone"` }
Click to show internal directories.
Click to hide internal directories.