network

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddIPv4IncludedRoute

func AddIPv4IncludedRoute(route IPv4Route)

func AddRouteForNetworkConfig

func AddRouteForNetworkConfig(destination string) error

func AddRouteForServerIP

func AddRouteForServerIP(serverIP, interfaceName string) error

addRouteForServerIP adds an OS-specific route for the server IP

func AddRoutes

func AddRoutes(remoteSubnets []string, interfaceName string) error

addRoutes adds routes for each subnet in RemoteSubnets

func ClearNetworkSettings

func ClearNetworkSettings()

ClearNetworkSettings clears all network settings

func ConfigureInterface

func ConfigureInterface(interfaceName string, tunnelIp string, mtu int) error

ConfigureInterface configures a network interface with an IP address and brings it up

func DarwinAddRoute

func DarwinAddRoute(destination string, gateway string, interfaceName string) error

func DarwinRemoveRoute

func DarwinRemoveRoute(destination string) error

func FindUnusedUTUN

func FindUnusedUTUN() (string, error)

func GetIncrementor

func GetIncrementor() int

func GetJSON

func GetJSON() (string, error)

func LinuxAddRoute

func LinuxAddRoute(destination string, gateway string, interfaceName string) error

func LinuxRemoveRoute

func LinuxRemoveRoute(destination string) error

func RemoveIPv4IncludedRoute

func RemoveIPv4IncludedRoute(route IPv4Route)

func RemoveRouteForNetworkConfig

func RemoveRouteForNetworkConfig(destination string) error

func RemoveRouteForServerIP

func RemoveRouteForServerIP(serverIP string, interfaceName string) error

removeRouteForServerIP removes an OS-specific route for the server IP

func RemoveRoutes

func RemoveRoutes(remoteSubnets []string) error

removeRoutesForRemoteSubnets removes routes for each subnet in RemoteSubnets

func SetDNSServers

func SetDNSServers(servers []string)

SetDNSServers sets the DNS servers

func SetIPv4ExcludedRoutes

func SetIPv4ExcludedRoutes(routes []IPv4Route)

func SetIPv4IncludedRoutes

func SetIPv4IncludedRoutes(routes []IPv4Route)

SetIPv4IncludedRoutes sets the included IPv4 routes

func SetIPv4Settings

func SetIPv4Settings(addresses []string, subnetMasks []string)

SetIPv4Settings sets IPv4 addresses and subnet masks

func SetIPv6ExcludedRoutes

func SetIPv6ExcludedRoutes(routes []IPv6Route)

SetIPv6ExcludedRoutes sets the excluded IPv6 routes

func SetIPv6IncludedRoutes

func SetIPv6IncludedRoutes(routes []IPv6Route)

SetIPv6IncludedRoutes sets the included IPv6 routes

func SetIPv6Settings

func SetIPv6Settings(addresses []string, networkPrefixes []string)

SetIPv6Settings sets IPv6 addresses and network prefixes

func SetMTU

func SetMTU(mtu int)

SetMTU sets the MTU value

func SetTunnelRemoteAddress

func SetTunnelRemoteAddress(address string)

SetTunnelRemoteAddress sets the tunnel remote address

func WindowsAddRoute

func WindowsAddRoute(destination string, gateway string, interfaceName string) error

func WindowsRemoveRoute

func WindowsRemoveRoute(destination string) error

Types

type IPv4Route

type IPv4Route struct {
	DestinationAddress string `json:"destination_address"`
	SubnetMask         string `json:"subnet_mask,omitempty"`
	GatewayAddress     string `json:"gateway_address,omitempty"`
	IsDefault          bool   `json:"is_default,omitempty"`
}

IPv4Route represents an IPv4 route

type IPv6Route

type IPv6Route struct {
	DestinationAddress  string `json:"destination_address"`
	NetworkPrefixLength int    `json:"network_prefix_length,omitempty"`
	GatewayAddress      string `json:"gateway_address,omitempty"`
	IsDefault           bool   `json:"is_default,omitempty"`
}

IPv6Route represents an IPv6 route

type NetworkSettings

type NetworkSettings struct {
	TunnelRemoteAddress string      `json:"tunnel_remote_address,omitempty"`
	MTU                 *int        `json:"mtu,omitempty"`
	DNSServers          []string    `json:"dns_servers,omitempty"`
	IPv4Addresses       []string    `json:"ipv4_addresses,omitempty"`
	IPv4SubnetMasks     []string    `json:"ipv4_subnet_masks,omitempty"`
	IPv4IncludedRoutes  []IPv4Route `json:"ipv4_included_routes,omitempty"`
	IPv4ExcludedRoutes  []IPv4Route `json:"ipv4_excluded_routes,omitempty"`
	IPv6Addresses       []string    `json:"ipv6_addresses,omitempty"`
	IPv6NetworkPrefixes []string    `json:"ipv6_network_prefixes,omitempty"`
	IPv6IncludedRoutes  []IPv6Route `json:"ipv6_included_routes,omitempty"`
	IPv6ExcludedRoutes  []IPv6Route `json:"ipv6_excluded_routes,omitempty"`
}

NetworkSettings represents the network configuration for the tunnel

func GetSettings

func GetSettings() NetworkSettings

Jump to

Keyboard shortcuts

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