netutil

package
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAvailablePortForAddress

func GetAvailablePortForAddress(address string) (int32, error)

GetAvailablePortForAddress returns an open port on the specified address

func GetOutboundIP

func GetOutboundIP() net.IP

GetOutboundIP gets the locally preferred outbound IP address

From https://stackoverflow.com/questions/23558425/how-do-i-get-the-local-ip-address-in-go

func ValidateDomainName

func ValidateDomainName(value string) error

ValidateDomainName validates the string value as a domain name

func ValidateHttpUrl

func ValidateHttpUrl(
	value string,
	requireSecureConnection bool,
	fetchContent bool,
) error

ValidateHttpUrl validates a URL for an HTTP scheme

Types

type IpMetadata

type IpMetadata struct {
	City    *string
	Country *string
}

func GetIpMetadata

func GetIpMetadata(ctx context.Context, db *maxminddb.Reader, ip string) (*IpMetadata, error)

GetIpMetadata gets metadata about an IP. Information is provided on a best-effort basis.

Jump to

Keyboard shortcuts

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