netutils

package
v0.0.0-...-ba854f2 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 14 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChooseBindAddress

func ChooseBindAddress(bindAddress net.IP) (net.IP, error)

ChooseBindAddress is used to choose an Host IP address for binding. If bind-address is usable, return it directly If bind-address is not usable (unset, 0.0.0.0, or loopback), we will use the host's default interface.

func ChooseHostInterface

func ChooseHostInterface() (net.IP, error)

ChooseHostInterface is a method used fetch an IP for a daemon. If there is no routing info file, it will choose a global IP from the system interfaces. Otherwise, it will use IPv4 and IPv6 route information to return the IP of the interface with a gateway on it (with priority given to IPv4). For a node with no internet connection, it returns error.

func GetListener

func GetListener(addr string, tlsConfig *tls.Config) (net.Listener, error)

GetListener get a listener for an address.

Types

type AddressFamily

type AddressFamily uint

AddressFamily is the ip address type.

type Route

type Route struct {
	Interface   string
	Destination net.IP
	Gateway     net.IP
	Family      AddressFamily
}

Route contains route information.

type RouteFile

type RouteFile struct {
	// contains filtered or unexported fields
}

RouteFile is the file that contains route information.

Jump to

Keyboard shortcuts

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