{"modulePath":"github.com/windsorcli/cli","version":"v0.7.1","isLatest":false,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package network\n\n## Types\n\n```go\ntype BaseNetworkManager struct {\n\t// contains filtered or unexported fields\n}\n```\nBaseNetworkManager is a concrete implementation of NetworkManager\n\n```go\nfunc NewBaseNetworkManager(injector di.Injector) *BaseNetworkManager\n```\nNewNetworkManager creates a new NetworkManager\n\n```go\nfunc (n *BaseNetworkManager) ConfigureDNS() error\n```\nConfigureDNS sets up DNS using systemd-resolved. If the DNS IP is configured, it ensures systemd-resolved is used by creating a drop-in configuration file. The function checks if /etc/resolv.conf is a symlink to systemd-resolved and restarts the service if necessary. It handles errors at each step to ensure proper DNS configuration.\n\n```go\nfunc (n *BaseNetworkManager) ConfigureGuest() error\n```\nConfigureGuest sets up the guest VM network\n\n```go\nfunc (n *BaseNetworkManager) ConfigureHostRoute() error\n```\nConfigureHostRoute sets up the local development network for Linux\n\n```go\nfunc (n *BaseNetworkManager) Initialize() error\n```\nInitialize resolves dependencies, sorts services, and assigns IPs based on network CIDR\n\n```go\ntype ColimaNetworkManager struct {\n\tBaseNetworkManager\n\t// contains filtered or unexported fields\n}\n```\ncolimaNetworkManager is a concrete implementation of NetworkManager\n\n```go\nfunc NewColimaNetworkManager(injector di.Injector) *ColimaNetworkManager\n```\nNewColimaNetworkManager creates a new ColimaNetworkManager\n\n```go\nfunc (n *ColimaNetworkManager) ConfigureGuest() error\n```\nConfigureGuest sets up forwarding of guest traffic to the container network. It retrieves network CIDR and guest IP from the config, and configures SSH. It identifies the Docker bridge interface and ensures iptables rules are set. If the rule doesn't exist, it adds a new one to allow traffic forwarding.\n\n```go\nfunc (n *ColimaNetworkManager) Initialize() error\n```\nInitialize sets up the ColimaNetworkManager by resolving dependencies for sshClient, shell, and secureShell from the injector.\n\n```go\ntype MockNetworkInterfaceProvider struct {\n\tInterfacesFunc     func() ([]net.Interface, error)\n\tInterfaceAddrsFunc func(iface net.Interface) ([]net.Addr, error)\n}\n```\nMockNetworkInterfaceProvider is a struct that simulates a network interface provider for testing purposes.\n\n```go\nfunc NewMockNetworkInterfaceProvider() *MockNetworkInterfaceProvider\n```\nNewMockNetworkInterfaceProvider creates a new instance of MockNetworkInterfaceProvider with default implementations.\n\n```go\nfunc (m *MockNetworkInterfaceProvider) InterfaceAddrs(iface net.Interface) ([]net.Addr, error)\n```\nInterfaceAddrs calls the custom InterfaceAddrsFunc if provided.\n\n```go\nfunc (m *MockNetworkInterfaceProvider) Interfaces() ([]net.Interface, error)\n```\nInterfaces calls the custom InterfacesFunc if provided.\n\n```go\ntype MockNetworkManager struct {\n\tNetworkManager\n\tInitializeFunc         func() error\n\tConfigureHostRouteFunc func() error\n\tConfigureGuestFunc     func() error\n\tConfigureDNSFunc       func() error\n}\n```\nMockNetworkManager is a struct that simulates a network manager for testing purposes.\n\n```go\nfunc NewMockNetworkManager() *MockNetworkManager\n```\nNewMockNetworkManager creates a new instance of MockNetworkManager.\n\n```go\nfunc (m *MockNetworkManager) ConfigureDNS() error\n```\nConfigureDNS calls the custom ConfigureDNSFunc if provided.\n\n```go\nfunc (m *MockNetworkManager) ConfigureGuest() error\n```\nConfigureGuest calls the custom ConfigureGuestFunc if provided.\n\n```go\nfunc (m *MockNetworkManager) ConfigureHostRoute() error\n```\nConfigureHostRoute calls the custom ConfigureHostRouteFunc if provided.\n\n```go\nfunc (m *MockNetworkManager) Initialize() error\n```\nInitialize calls the custom InitializeFunc if provided.\n\n```go\ntype NetworkInterfaceProvider interface {\n\tInterfaces() ([]net.Interface, error)\n\tInterfaceAddrs(iface net.Interface) ([]net.Addr, error)\n}\n```\nNetworkInterfaceProvider abstracts the system's network interface operations\n\n```go\nfunc NewNetworkInterfaceProvider() NetworkInterfaceProvider\n```\nNewNetworkInterfaceProvider creates a new real implementation of NetworkInterfaceProvider\n\n```go\ntype NetworkManager interface {\n\tInitialize() error\n\tConfigureHostRoute() error\n\tConfigureGuest() error\n\tConfigureDNS() error\n}\n```\nNetworkManager handles configuring the local development network\n\n```go\ntype RealNetworkInterfaceProvider struct{}\n```\nRealNetworkInterfaceProvider is the real implementation of NetworkInterfaceProvider\n\n```go\nfunc (p *RealNetworkInterfaceProvider) InterfaceAddrs(iface net.Interface) ([]net.Addr, error)\n```\nInterfaceAddrs returns the addresses of a network interface\n\n```go\nfunc (p *RealNetworkInterfaceProvider) Interfaces() ([]net.Interface, error)\n```\nInterfaces returns the system's network interfaces\n\n```go\ntype Shims struct {\n\tGoos      func() string\n\tStat      func(string) (os.FileInfo, error)\n\tWriteFile func(string, []byte, os.FileMode) error\n\tReadFile  func(string) ([]byte, error)\n\tReadLink  func(string) (string, error)\n\tMkdirAll  func(string, os.FileMode) error\n}\n```\nShims provides mockable wrappers around system and runtime functions\n\n```go\nfunc NewShims() *Shims\n```\nNewShims creates a new Shims instance with default implementations\n\n","path":"github.com/windsorcli/cli/pkg/network","name":"network","synopsis":"","isRedistributable":true}
