netutils

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildInetSocketAddress

func BuildInetSocketAddress(host string, port int) string

BuildInetSocketAddress builds InetSocketAddress

func CheckPortOpen

func CheckPortOpen(host string, port int, timeout time.Duration) bool

CheckPortOpen checks if the specified host and port are open

func CheckPortRangeOpen

func CheckPortRangeOpen(host string, startPort int, endPort int, timeout time.Duration) []int

CheckPortRangeOpen checks which ports are open in the specified host and port range

func GetAllNetworkInterfaces

func GetAllNetworkInterfaces() ([]net.Interface, error)

GetAllNetworkInterfaces gets information about all network interfaces

func GetHostname

func GetHostname() (string, error)

GetHostname gets the local hostname

func GetIPByHost

func GetIPByHost(host string) (string, error)

GetIPByHost gets IP by domain name

func GetLocalIP

func GetLocalIP() (string, error)

GetLocalIP gets the first non-loopback IP address of the local machine

func GetMACAddress

func GetMACAddress() (string, error)

GetMACAddress gets the first MAC address of the local machine

func GetPublicIP

func GetPublicIP() (string, error)

GetPublicIP gets the public IP address

func HideIPPart

func HideIPPart(ip string) (string, error)

HideIPPart hides the last part of an IP address and replaces it with *

func IPv4ToLong

func IPv4ToLong(ip string) (uint32, error)

IPv4ToLong converts an IP address to a long value

func IsInner

func IsInner(start uint32, end uint32, target uint32) bool

IsInner determines whether the long value of an IP is within the specified range

func IsInnerIP

func IsInnerIP(ip string) bool

IsInnerIP determines whether it is an internal IP

func IsUsableLocalPort

func IsUsableLocalPort(port int) bool

IsUsableLocalPort checks if a local port is usable

func IsValidIP

func IsValidIP(ip string) bool

IsValidIP checks if the given string is a valid IP address

func IsValidPort

func IsValidPort(port int) bool

IsValidPort checks if it is a valid port number

func LocalIPv4s

func LocalIPv4s() ([]string, error)

LocalIPv4s gets a list of IP addresses of the local machine

func LongToIPv4

func LongToIPv4(ipLong uint32) string

LongToIPv4 converts a long value to an IPv4 address

func LookupMX

func LookupMX(domain string) ([]*net.MX, error)

LookupMX looks up the MX records for the specified domain name

func Ping

func Ping(host string) (bool, error)

Ping performs a ping operation to check if the target host is reachable

func ResolveDomain

func ResolveDomain(domain string) ([]string, error)

ResolveDomain resolves a domain name and returns the corresponding list of IP addresses

func ToAbsoluteURL

func ToAbsoluteURL(baseURL string, relativeURL string) (string, error)

ToAbsoluteURL converts a relative URL to an absolute URL

Types

This section is empty.

Jump to

Keyboard shortcuts

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