Documentation ¶
Overview ¶
Package netutil contains network-related utility functions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DNSTracker ¶ added in v0.12.0
DNSTracker is a closure that persists state for
tracking changes in the DNS resolution of a target dns name returns true if the DNS name resolution has changed If there is a lookup problem, we pretend nothing has changed
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 NormalizeIP ¶ added in v0.12.0
NormalizeIP normalizes loopback addresses to avoid spurious errors when communicating to different representations of the loopback.
Note: this also maps IPv6 localhost to IPv4 localhost, as TabletManagerClient.GetReplicas() (the only place this function is used on) will return only IPv4 addresses.
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.