Documentation ¶
Overview ¶
Package central contains Central configuration for Nodes and CSes.
Index ¶
- Constants
- func AllowedByAny(sa SRVAllowable, a2s []SRVAllowance) bool
- func IPNetSubsetOf(subset, superset net.IPNet) bool
- func IPNetSubsetOfAny(subset net.IPNet, supersets []IPNet) bool
- func Same(a []IPNet, b []IPNet) bool
- func Same2(a map[string]*Peer, b map[string]*Peer) bool
- func ToIPNets(is2 []IPNet) []net.IPNet
- type CanSee
- type Config
- type Duration
- type IPNet
- type Network
- type Peer
- type SRV
- type SRVAllowable
- type SRVAllowance
Constants ¶
View Source
const ( DNone = 0x0 DNetwork = 0x1 DIPs = 0x2 DKeys = 0x8 DPeer = 0x4 DSRVs = 0x10 )
Variables ¶
This section is empty.
Functions ¶
func AllowedByAny ¶
func AllowedByAny(sa SRVAllowable, a2s []SRVAllowance) bool
func IPNetSubsetOf ¶
Types ¶
type Duration ¶
Duration is a encoding-friendly time.Duration.
func (*Duration) MarshalJSON ¶
MarshalJSON implements yaml.Marshaler.
func (*Duration) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Duration) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler.
type IPNet ¶
IPNet is a YAML- and JSON- friendly net.IPNet. TODO: move to package util
func (IPNet) MarshalJSON ¶
MarshalJSON implements yaml.Marshaler.
func (IPNet) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler.
func (*IPNet) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*IPNet) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler.
type Network ¶
type Network struct { Desynced int Name string IPs []IPNet `yaml:"ips" json:"ips"` Peers map[string]*Peer `yaml:"peers" json:"peers"` Me string `yaml:"me" json:"me"` Keepalive Duration `yaml:"keepalive" json:"keepalive"` ListenPort int `yaml:"listenPort" json:"listenPort"` // lock is only for myPrivKey. MyPrivKey *wgtypes.Key `json:"myPrivKey"` }
Network configures a CN.
type Peer ¶
type Peer struct { Desynced int // SyncedPeers is for internal use by the cs package. // In the cs package, it's used to track which peers have been synced with changes. SyncedPeers []string Name string `yaml:"name" json:"name"` Host string `yaml:"host" json:"host"` AlternativeHosts []string `yaml:"hosts" json:"hosts"` AllowedIPs []IPNet `yaml:"allowedIPs" json:"allowedIPs"` CanForward bool `yaml:"canForward" json:"canForward"` // CanSee determines whether this Peer can see anything (nil) or specfic peers only (non-nil). CanSee *CanSee `yaml:"canSee" json:"canSee"` AllowedSRVs []SRVAllowance `yaml:"allowedSRVs" json:"allowedSRVs"` PubKey wgtypes.Key ForwardingPeers []string SRVs []SRV }
Peer configures a peer.
type SRVAllowable ¶
type SRVAllowable interface { // AllowedBy returns nil this is allowed by the SRVAllowance, and a non-nil error otherwise. AllowedBy(SRVAllowance) error }
type SRVAllowance ¶
type SRVAllowance struct { Service string `yaml:"service"` ServiceAny bool `yaml:"serviceAny"` PriorityMin uint16 `yaml:"priorityMin"` PriorityMax uint16 `yaml:"priorityMax"` WeightMin uint16 `yaml:"weightMin"` WeightMax uint16 `yaml:"weightMax"` }
func (SRVAllowance) AllowedBy ¶
func (a SRVAllowance) AllowedBy(a2 SRVAllowance) error
Click to show internal directories.
Click to hide internal directories.