qianmo

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: MIT Imports: 4 Imported by: 2

README

阡陌

additional network functions

GitHub GitHub Action Go Report Card Coverage Status GoDoc

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when the requested item is not found.
	ErrNotFound = errors.New("Not found")
	// ErrInvalidParam is returned when the parameter is invalid.
	ErrInvalidParam = errors.New("Invalid parameter")
)

Functions

func GetAddrs added in v0.2.0

func GetAddrs() ([]string, error)

GetAddrs returns all IP addresses.

func GetAllInterfaces added in v0.2.0

func GetAllInterfaces() ([]string, error)

GetInterface returns the interface with the given name or IP address.

func GetFreeTCPPort added in v0.2.1

func GetFreeTCPPort() (int, error)

GetTCPFreePort returns an available TCP port number.

func GetFreeUDPPort added in v0.2.1

func GetFreeUDPPort() (int, error)

GetUDPFreePort returns an available UDP port number.

func GetHostIP added in v0.2.0

func GetHostIP() (string, error)

GetHostIP returns the primary IP address of the host. It returns the first non-loopback IPv4 address if available, otherwise the first non-loopback IPv6 address.

func GetInterfaceByIP added in v0.2.0

func GetInterfaceByIP(ip string) (*net.Interface, error)

GetInterfaceByIP returns the interface with the given IP address.

func GetInterfaceByName added in v0.2.0

func GetInterfaceByName(name string) (*net.Interface, error)

GetInterfaceByName returns the interface with the given name.

func GetNonLoopbackAddrs added in v0.2.0

func GetNonLoopbackAddrs() ([]string, error)

GetNonLoopbackAddrs returns all non-loopback IP addresses.

Types

This section is empty.

Directories

Path Synopsis
examples module

Jump to

Keyboard shortcuts

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