Documentation
¶
Overview ¶
Package system contains utilities for managing network interfaces on the system.
Index ¶
Constants ¶
View Source
const DefaultMTU = 1420
DefaultMTU is the default MTU for wireguard interfaces. TODO: Try to determine this automatically.
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.https://kind.sigs.k8s.io/
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
// Link returns the underlying net.Interface.
Link() (*net.Interface, error)
// HardwareAddr returns the hardware address of the interface.
HardwareAddr() (net.HardwareAddr, 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
// NetNs is the network namespace to create the interface in.
// This is only supported on Linux.
NetNs 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 buffers contains facilities for changing system buffer sizes.
|
Package buffers contains facilities for changing system buffer sizes. |
|
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.