Documentation ¶
Overview ¶
Package device wraps the wgctrl library with concurrency safety and dirty tracking to simplify interactions from the wirelink server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device wraps a WgClient and an associated device name
func New ¶
New creates a new device from an already open control interface. The Close() method of the returned Device will be a no-op.
func Take ¶
Take is the same as New, except that it takes ownership of the control interface if initialization is successful.
func (*Device) Close ¶
Close closes the underlying control interface, if the Device owns it. It is not safe to call Close if other goroutines using the device are active.
func (*Device) ConfigureDevice ¶
ConfigureDevice wraps the underlying wgctrl method
func (*Device) Dirty ¶
func (d *Device) Dirty()
Dirty marks the device state dirty forcing the next read to refresh the data.
func (*Device) EnsurePeersAutoIP ¶
EnsurePeersAutoIP 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
func (*Device) State ¶
State gets the current device state. It will attempt to refresh it if dirty. If refresh fails, it will return the last state along with the refresh error. The returned state will never be nil, because New/Open will refuse to create a Device if they cannot read an initial state.