Documentation ¶
Overview ¶
Package system contains utilities for managing network interfaces on the system.
Index ¶
Constants ¶
View Source
const DefaultMTU = 1350
DefaultMTU is the default MTU for wireguard interfaces.
View Source
const MaxMTU = 1500
MaxMTU is the maximum MTU for wireguard interfaces.
Variables ¶
This section is empty.
Functions ¶
func IsInterfaceNotExists ¶
IsInterfaceNotExists returns true if the given error is an interface not exists error.
func IsRouteExists ¶
IsRouteExists returns true if the given error is a route exists error.
Types ¶
type Interface ¶
type Interface interface { // Name returns the real name of the interface. Name() string // AddressV4 should return the current private IPv4 address of this interface. AddressV4() netip.Prefix // AddressV6 should return the current private IPv6 address of this interface. AddressV6() netip.Prefix // Up activates the interface. Up(context.Context) error // Down deactivates the interface. Down(context.Context) error // Destroy destroys the interface. Destroy(context.Context) error // AddRoute adds a route for the given network. AddRoute(context.Context, netip.Prefix) error // RemoveRoute removes the route for the given network. RemoveRoute(context.Context, netip.Prefix) error }
Interface represents an underlying machine network interface for use with wireguard.
type Options ¶
type Options struct { // Name is the name of the interface. Name string // AddressV4 is the private IPv4 network of this interface. AddressV4 netip.Prefix // AddressV6 is the private IPv6 network of this interface. AddressV6 netip.Prefix // ForceTUN forces the use of a TUN interface. ForceTUN bool // MTU is the MTU of the interface. If unset, it will be automatically // detected from the host. MTU uint32 // DisableIPv4 disables IPv4 on the interface. DisableIPv4 bool // DisableIPv6 disables IPv6 on the interface. DisableIPv6 bool }
Options represents the options for creating a new interface.
Directories ¶
Path | Synopsis |
---|---|
Package dns contains utility functions for DNS.
|
Package dns contains utility functions for DNS. |
Package firewall contains an interface for interacting with the system firewall.
|
Package firewall contains an interface for interacting with the system firewall. |
Click to show internal directories.
Click to hide internal directories.