Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAllEndpointsBad = errors.New("spec: all endpoints are bad")
Functions ¶
func PingCommandScorer ¶
PingCommandScorer gives a score of 0 for all reachable (see ping command below) hosts, and an error for unreachable ones. The command used is: ping -c 1 -w 4 -- <endpoint>
Types ¶
type AccessControl ¶
func (AccessControl) Clone ¶
func (a AccessControl) Clone() AccessControl
func (AccessControl) Equal ¶
func (a AccessControl) Equal(b AccessControl) bool
func (AccessControl) Validate ¶
func (a AccessControl) Validate() error
type EndpointScorer ¶
type Network ¶
type Network struct { Name string Devices []NetworkDevice }
func (Network) CensorForDevice ¶
func (n Network) CensorForDevice(censorFor string) NetworkCensored
type NetworkCensored ¶
type NetworkCensored struct { Name string Devices []NetworkDeviceCensored CensoredFor string }
func (NetworkCensored) Equal ¶
func (a NetworkCensored) Equal(b NetworkCensored) bool
func (NetworkCensored) GetDevice ¶
func (nc NetworkCensored) GetDevice(name string) (ndc NetworkDeviceCensored, ok bool)
func (NetworkCensored) GetDeviceIndex ¶
func (nc NetworkCensored) GetDeviceIndex(name string) (i int, ok bool)
func (NetworkCensored) GetForwardersFor ¶
func (nc NetworkCensored) GetForwardersFor(name string) []string
GetForwardersFor returns a list of device names that can forward for the given device, and has a chosen forwarder and endpoint.
type NetworkDevice ¶
type NetworkDevice struct { NetworkDeviceCensored AccessControl }
func (NetworkDevice) Clone ¶
func (nd NetworkDevice) Clone() NetworkDevice
func (NetworkDevice) Equal ¶
func (a NetworkDevice) Equal(b NetworkDevice) bool
func (*NetworkDevice) UnmarshalJSON ¶
func (nd *NetworkDevice) UnmarshalJSON(data []byte) error
type NetworkDeviceCensored ¶
type NetworkDeviceCensored struct { Name string // Endpoints is a unordered list of endpoints on which the peer is available on. Endpoints []string // EndpointChosen is whether the endpoint was chosen. // This value should always be false on the server. ForwarderAndEndpointChosen bool UsesForwarder bool // EndpointChosenIndex is the index of the chosen endpoint. // This value should always be zero on the server. EndpointChosenIndex int // ForwarderChosenIndex is the name of the chosen forwarder. // This value should always be zero on the server. ForwarderChosenIndex int // Addresses is a list of IP networks that this peer represents. Addresses []goal.IPNet // ListenPort is the port that WireGuard will listen on. // Set to 0 to not specify a port. // This can be set by this peer. ListenPort int // This can be set by this peer. PublicKey goal.Key PresharedKey *goal.Key // PersistentKeepalive specifies how often a packet is sent to keep a connection alive. // Set to 0 to disable persistent keepalive. // This can be set by this peer. PersistentKeepalive goal.Duration // TODO: forwarding (keep this commented out for now) // ForwardsFor is the list of devices (in the same network) that this peer has access to, and can fowrard packets to. // Note that IPv6 forwarding is not supported yet. // This can be set by this peer. ForwardsFor []string }
func (*NetworkDeviceCensored) ChooseEndpoint ¶
func (ndc *NetworkDeviceCensored) ChooseEndpoint(score EndpointScorer) error
ChooseEndpoint chooses an endpoint and forwarder using the score function provided. If the score returned is tied, the first endpoint (in NetworkDeviceCensored.Endpoints) is chosen. The score function is run in separate goroutines for each endpoint. If all scorers return an error, a forwarder is chosen instead.
func (NetworkDeviceCensored) Clone ¶
func (ndc NetworkDeviceCensored) Clone() NetworkDeviceCensored
func (NetworkDeviceCensored) Equal ¶
func (a NetworkDeviceCensored) Equal(b NetworkDeviceCensored) bool
func (*NetworkDeviceCensored) UnmarshalJSON ¶
func (ndc *NetworkDeviceCensored) UnmarshalJSON(data []byte) error
type SpecCensored ¶
type SpecCensored struct {
Networks []NetworkCensored
}
func (SpecCensored) CompileMachine ¶
func (SpecCensored) Equal ¶
func (a SpecCensored) Equal(b SpecCensored) bool
func (SpecCensored) GetNetwork ¶
func (s SpecCensored) GetNetwork(name string) (n NetworkCensored, ok bool)
func (SpecCensored) GetNetworkIndex ¶
func (s SpecCensored) GetNetworkIndex(name string) (i int, ok bool)
Click to show internal directories.
Click to hide internal directories.