Skip to content

std/net

import "github.com/eugenioenko/goalchemy/std/net"

Package net provides the host and port helpers of Go’s net package: JoinHostPort, SplitHostPort and AddrError. Dialing, listening and name resolution are not provided.

func JoinHostPort(host, port string) string

JoinHostPort combines host and port into a network address of the form “host:port”. If host contains a colon, as found in literal IPv6 addresses, then JoinHostPort returns “[host]:port”.

func SplitHostPort(hostport string) (host, port string, err error)

SplitHostPort splits a network address of the form “host:port”, “host%zone:port”, “[host]:port” or “[host%zone]:port” into host or host%zone and port. A literal IPv6 address in hostport must be enclosed in square brackets, as in “[::1]:80”, “[::1%lo0]:80”.

type AddrError struct {
Err string
Addr string
}

AddrError reports an error with an address, as net.AddrError does.

func (e *AddrError) Error() string
func (e *AddrError) Temporary() bool
func (e *AddrError) Timeout() bool