net

package
v0.0.0-...-99984a4 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseIPZone

func ParseIPZone(s string) (goNet.IP, string)

ParseIPZone parses s as an IP address, return it and its associated zone identifier (IPv6 only).

Types

type Addr

type Addr struct {
	// contains filtered or unexported fields
}

Addr represents a hostname and an optional port. The port == 0 means no port. For TCP, port number 0 is reserved and cannot be used. For UDP, the source port is optional and 0 means no port.

func MakeAddr

func MakeAddr(scheme, hostname string, port uint16) Addr

MakeAddr set all members.

func MakeHostname

func MakeHostname(hostname string) Addr

MakeHostname set the hostname and no port.

func Parse

func Parse(scheme string, a net.Addr) (Addr, error)

Parse parses the hostname and port number.

func ParseString

func ParseString(scheme, addr string) (Addr, error)

ParseString parses the hostname and port number.

func ParseURL

func ParseURL(url *url.URL) (Addr, error)

ParseURL parses the hostname and port number.

func (Addr) GetHostname

func (a Addr) GetHostname() string

GetHostname returns the hostname

func (Addr) GetPort

func (a Addr) GetPort() uint16

GetPort returns the port.

func (Addr) GetScheme

func (a Addr) GetScheme() string

GetScheme returns the scheme.

func (Addr) RemovePort

func (a Addr) RemovePort() Addr

RemovePort sets the zero value.

func (Addr) RemoveScheme

func (a Addr) RemoveScheme() Addr

RemoveScheme sets the empty value.

func (Addr) SetHostname

func (a Addr) SetHostname(hostname string) Addr

SetHostname sets hostname

func (Addr) SetPort

func (a Addr) SetPort(port uint16) Addr

SetPort changes the port.

func (Addr) SetScheme

func (a Addr) SetScheme(scheme string) Addr

SetScheme changes the scheme.

func (Addr) String

func (a Addr) String() string

String formats the address with the optional port.

func (Addr) URL

func (a Addr) URL() string

URL formats the scheme with address and with the optional port.

Jump to

Keyboard shortcuts

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