network

package
v0.0.0-...-da19dc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefaultRoute

func SetDefaultRoute(iface string, gatewayIP net.IP) error

Types

type Network

type Network interface {
	Destroy() error

	Execute(func() error) error

	Connect(iface string, masquerade bool) error
	Disconnect(iface string, masquerade bool) error
}

func NewNetwork

func NewNetwork(opts ...NetworkOption) (Network, error)

type NetworkConfig

type NetworkConfig struct {
	Name        string
	Subnet      *net.IPNet
	GatewayIP   net.IP
	BridgeIP    net.IP
	LinkManager ifc.LinkManager
}

type NetworkOption

type NetworkOption func(*NetworkConfig) error

func WithBridge

func WithBridge(ip net.IP) NetworkOption

func WithGateway

func WithGateway(ip net.IP) NetworkOption

func WithLinkManager

func WithLinkManager(manager ifc.LinkManager) NetworkOption

func WithName

func WithName(name string) NetworkOption

func WithSubnet

func WithSubnet(ipNet *net.IPNet) NetworkOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL