Documentation
¶
Index ¶
- func EnsureAllowedIPs(ctrl *wgctrl.Client, deviceName string, peer *wgtypes.Peer, facts []*fact.Fact) (added int, err error)
- func EnsurePeerAutoIP(ctrl *wgctrl.Client, dev *wgtypes.Device) (int, error)
- func OnlyAutoIP(ctrl *wgctrl.Client, deviceName string, peer *wgtypes.Peer) (bool, error)
- type Manager
- type PeerConfigState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureAllowedIPs ¶
func EnsureAllowedIPs(ctrl *wgctrl.Client, deviceName string, peer *wgtypes.Peer, facts []*fact.Fact) (added int, err error)
EnsureAllowedIPs updates the device config if needed to add all the AllowedIPs from the facts to the peer
func EnsurePeerAutoIP ¶
EnsurePeerAutoIP updates the config of the device, if needed, to ensure all peers have their IPv6-LL IP listed in their AllowedIPs. It returns the number of peers modified and any error that happens
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is a wrapper for applying local configuration changes
func NewManager ¶
NewManager instantiates a new Manager object with its own netlink handle
type PeerConfigState ¶
type PeerConfigState struct {
// contains filtered or unexported fields
}
PeerConfigState stores state to remember peer info so we can cycle through configurations effectively
func (*PeerConfigState) IsHealthy ¶
func (pcs *PeerConfigState) IsHealthy() bool
IsHealthy returns if the peer looked healthy on the last call to `Update`
func (*PeerConfigState) NextEndpoint ¶
func (pcs *PeerConfigState) NextEndpoint(peerFacts []*fact.Fact) *net.UDPAddr
NextEndpoint recommends the next endpoint to try configuring on the peer, if any, based on the available facts (assumed to all be about the peer!) Note that this does _not_ embed the logic for whether a new endpoint _should_ be attempted (i.e. it doesn't call `TimeForNextEndpoint` internally).
func (*PeerConfigState) TimeForNextEndpoint ¶
func (pcs *PeerConfigState) TimeForNextEndpoint() bool
TimeForNextEndpoint returns if we should try another endpoint for the peer (or if we should wait for the current endpoint to test out)
func (*PeerConfigState) Update ¶
func (pcs *PeerConfigState) Update(peer *wgtypes.Peer) *PeerConfigState
Update refreshes the PeerConfigState with new data from the wireguard device. NOTE: It is safe to call this on a `nil` pointer, it will return a new state