Documentation ¶
Overview ¶
Package netutil contains network-related utility functions.
Index ¶
- func FullyQualifiedHostname() (string, error)
- func FullyQualifiedHostnameOrPanic() string
- func JoinHostPort(host string, port int32) string
- func ResolveIPv4Addrs(addr string) ([]string, error)
- func SortRfc2782(srvs []*net.SRV)
- func SplitHostPort(addr string) (string, int, error)
- type ConnWithTimeouts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FullyQualifiedHostname ¶
FullyQualifiedHostname returns the FQDN of the machine.
func FullyQualifiedHostnameOrPanic ¶
func FullyQualifiedHostnameOrPanic() string
FullyQualifiedHostnameOrPanic is the same as FullyQualifiedHostname but panics in case of an error.
func JoinHostPort ¶
JoinHostPort is an extension to net.JoinHostPort that also formats the integer port.
func ResolveIPv4Addrs ¶
ResolveIPv4Addrs resolves the address:port part into IP address:port pairs
func SortRfc2782 ¶
SortRfc2782 reorders SRV records as specified in RFC 2782.
Types ¶
type ConnWithTimeouts ¶
A ConnWithTimeouts is a wrapper to net.Comm that allows to set a read and write timeouts.
func NewConnWithTimeouts ¶
func NewConnWithTimeouts(conn net.Conn, readTimeout time.Duration, writeTimeout time.Duration) ConnWithTimeouts
NewConnWithTimeouts wraps a net.Conn with read and write deadilnes.
func (ConnWithTimeouts) Read ¶
func (c ConnWithTimeouts) Read(b []byte) (int, error)
Read sets a read deadilne and delegates to conn.Read.
func (ConnWithTimeouts) SetDeadline ¶
func (c ConnWithTimeouts) SetDeadline(t time.Time) error
SetDeadline implements the Conn SetDeadline method.
func (ConnWithTimeouts) SetReadDeadline ¶
func (c ConnWithTimeouts) SetReadDeadline(t time.Time) error
SetReadDeadline implements the Conn SetReadDeadline method.
func (ConnWithTimeouts) SetWriteDeadline ¶
func (c ConnWithTimeouts) SetWriteDeadline(t time.Time) error
SetWriteDeadline implements the Conn SetWriteDeadline method.