network

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: AGPL-3.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddIPv4IncludedRoute added in v1.8.0

func AddIPv4IncludedRoute(route IPv4Route)

func AddRouteForNetworkConfig added in v1.8.0

func AddRouteForNetworkConfig(destination string) error

func AddRouteForServerIP added in v1.8.0

func AddRouteForServerIP(serverIP, interfaceName string) error

addRouteForServerIP adds an OS-specific route for the server IP

func AddRoutes added in v1.8.0

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

addRoutes adds routes for each subnet in RemoteSubnets

func ClearNetworkSettings added in v1.8.0

func ClearNetworkSettings()

ClearNetworkSettings clears all network settings

func ConfigureInterface added in v1.8.0

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

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

func DarwinAddRoute added in v1.8.0

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

func DarwinRemoveRoute added in v1.8.0

func DarwinRemoveRoute(destination string) error

func FindUnusedUTUN added in v1.8.0

func FindUnusedUTUN() (string, error)

func GetIncrementor added in v1.8.0

func GetIncrementor() int

func GetJSON added in v1.8.0

func GetJSON() (string, error)

func LinuxAddRoute added in v1.8.0

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

func LinuxRemoveRoute added in v1.8.0

func LinuxRemoveRoute(destination string) error

func RemoveIPv4IncludedRoute added in v1.8.0

func RemoveIPv4IncludedRoute(route IPv4Route)

func RemoveRouteForNetworkConfig added in v1.8.0

func RemoveRouteForNetworkConfig(destination string) error

func RemoveRouteForServerIP added in v1.8.0

func RemoveRouteForServerIP(serverIP string, interfaceName string) error

removeRouteForServerIP removes an OS-specific route for the server IP

func RemoveRoutes added in v1.8.0

func RemoveRoutes(remoteSubnets []string) error

removeRoutesForRemoteSubnets removes routes for each subnet in RemoteSubnets

func SetDNSServers added in v1.8.0

func SetDNSServers(servers []string)

SetDNSServers sets the DNS servers

func SetIPv4ExcludedRoutes added in v1.8.0

func SetIPv4ExcludedRoutes(routes []IPv4Route)

func SetIPv4IncludedRoutes added in v1.8.0

func SetIPv4IncludedRoutes(routes []IPv4Route)

SetIPv4IncludedRoutes sets the included IPv4 routes

func SetIPv4Settings added in v1.8.0

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

SetIPv4Settings sets IPv4 addresses and subnet masks

func SetIPv6ExcludedRoutes added in v1.8.0

func SetIPv6ExcludedRoutes(routes []IPv6Route)

SetIPv6ExcludedRoutes sets the excluded IPv6 routes

func SetIPv6IncludedRoutes added in v1.8.0

func SetIPv6IncludedRoutes(routes []IPv6Route)

SetIPv6IncludedRoutes sets the included IPv6 routes

func SetIPv6Settings added in v1.8.0

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

SetIPv6Settings sets IPv6 addresses and network prefixes

func SetMTU added in v1.8.0

func SetMTU(mtu int)

SetMTU sets the MTU value

func SetTunnelRemoteAddress added in v1.8.0

func SetTunnelRemoteAddress(address string)

SetTunnelRemoteAddress sets the tunnel remote address

func WindowsAddRoute added in v1.8.0

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

func WindowsRemoveRoute added in v1.8.0

func WindowsRemoveRoute(destination string) error

Types

type IPv4Route added in v1.8.0

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 added in v1.8.0

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 added in v1.8.0

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 added in v1.8.0

func GetSettings() NetworkSettings

Jump to

Keyboard shortcuts

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