endpoint

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPort = 80

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Host string `json:"host"`
	Port int    `json:"port"`
	Raw  string `json:"raw,omitempty"`
}

Endpoint represents a canonical host:port pair.

func Parse

func Parse(raw string) (*Endpoint, error)

Parse splits a raw endpoint string into host and port. Bare hosts default to port 80.

func ParseWithDefault

func ParseWithDefault(raw string, defaultPort int) (*Endpoint, error)

ParseWithDefault splits raw into host and port, applying defaultPort to bare hosts when > 0.

func (Endpoint) IsIP

func (e Endpoint) IsIP() bool

IsIP reports whether the host is an IP address.

func (Endpoint) Normalize

func (e Endpoint) Normalize() string

Normalize returns a canonical comparison key.

func (Endpoint) String

func (e Endpoint) String() string

String returns the endpoint in host:port format.

Jump to

Keyboard shortcuts

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