Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDetectKernel = errors.New("cannot detect Kernel support") ErrCreateTun = errors.New("cannot create TUN device") ErrAddLink = errors.New("cannot add Wireguard link") ErrFindLink = errors.New("cannot find link") ErrFindDevice = errors.New("cannot find Wireguard device") ErrUAPISocketOpening = errors.New("cannot open UAPI socket") ErrWgctrlOpen = errors.New("cannot open wgctrl") ErrUAPIListen = errors.New("cannot listen on UAPI socket") ErrAddAddress = errors.New("cannot add address to wireguard interface") ErrConfigure = errors.New("cannot configure wireguard interface") ErrDeviceInfo = errors.New("cannot get wireguard device information") ErrIfaceUp = errors.New("cannot set the interface to UP") ErrRouteAdd = errors.New("cannot add route for interface") ErrDeviceWaited = errors.New("device waited for") ErrKernelSupport = errors.New("kernel does not support Wireguard") )
View Source
var ( ErrInterfaceNameInvalid = errors.New("invalid interface name") ErrPrivateKeyMissing = errors.New("private key is missing") ErrPrivateKeyInvalid = errors.New("cannot parse private key") ErrPublicKeyMissing = errors.New("public key is missing") ErrPublicKeyInvalid = errors.New("cannot parse public key") ErrEndpointAddrMissing = errors.New("endpoint address is missing") ErrEndpointPortMissing = errors.New("endpoint port is missing") ErrAddressMissing = errors.New("interface address is missing") ErrAddressNotValid = errors.New("interface address is not valid") ErrAllowedIPsMissing = errors.New("allowed IPs are missing") ErrAllowedIPNotValid = errors.New("allowed IP is not valid") ErrAllowedIPv6NotSupported = errors.New("allowed IPv6 address not supported") ErrKeepaliveIsNegative = errors.New("keep alive interval is negative") ErrFirewallMarkMissing = errors.New("firewall mark is missing") ErrMTUMissing = errors.New("MTU is missing") ErrImplementationInvalid = errors.New("invalid implementation") )
Functions ¶
This section is empty.
Types ¶
type Linker ¶
type Linker interface { LinkAdd(link netlink.Link) (linkIndex int, err error) LinkList() (links []netlink.Link, err error) LinkByName(name string) (link netlink.Link, err error) LinkSetUp(link netlink.Link) (linkIndex int, err error) LinkSetDown(link netlink.Link) error LinkDel(link netlink.Link) error }
type Settings ¶
type Settings struct { // Interface name for the Wireguard interface. // It defaults to wg0 if unset. InterfaceName string // Private key in base 64 format PrivateKey string // Public key in base 64 format PublicKey string PreSharedKey string // Wireguard server endpoint to connect to. Endpoint netip.AddrPort // Addresses assigned to the client. // Note IPv6 addresses are ignored if IPv6 is not supported. Addresses []netip.Prefix // AllowedIPs is the IP networks to be routed through // the Wireguard interface. // Note IPv6 addresses are ignored if IPv6 is not supported. AllowedIPs []netip.Prefix // PersistentKeepaliveInterval defines the keep alive interval, if not zero. PersistentKeepaliveInterval time.Duration // FirewallMark to be used in routing tables and IP rules. // It defaults to 51820 if left to 0. FirewallMark uint32 // Maximum Transmission Unit (MTU) setting for the network interface. // It defaults to device.DefaultMTU from wireguard-go which is 1420 MTU uint16 // RulePriority is the priority for the rule created with the // FirewallMark. RulePriority int // IPv6 can bet set to true if IPv6 should be handled. // It defaults to false if left unset. IPv6 *bool // Implementation is the implementation to use. // It can be auto, kernelspace or userspace, and defaults to auto. Implementation string }
func (*Settings) SetDefaults ¶
func (s *Settings) SetDefaults()
func (Settings) ToLines ¶
func (s Settings) ToLines(settings ToLinesSettings) (lines []string)
ToLines serializes the settings to a slice of strings for display.
type ToLinesSettings ¶
Click to show internal directories.
Click to hide internal directories.