addr

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2025 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HostColonPortPattern = regexp.MustCompile(`^[-a-zA-Z0-9.]+:\d+$`)

HostColonPortPattern matches "^[-a-zA-Z0-9.]+:\\d+$" e.g. "foo.com.:1234"

Functions

func IsMultiaddr

func IsMultiaddr(addr string) bool

IsMultiaddr returns true if the provided string is a valid multiaddr.

func ParseHostOrURL

func ParseHostOrURL(addr string) (*url.URL, error)

ParseHostOrURL handles "host:port" or a full URL. Standard library net/url.Parse chokes on "host:port".

func ParseHostOrURLOrMultiaddr

func ParseHostOrURLOrMultiaddr(addr string) (string, error)

ParseHostOrURLOrMultiaddr returns an error if it could not parse the provided string as a valid "host:port", full URL, or multiaddr. If no error, it returns a host:port address, or a multiaddr.

Types

This section is empty.

Jump to

Keyboard shortcuts

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