network

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressParts

func AddressParts(add string) (string, string)

func GetSourceIP

func GetSourceIP(target string, port int) (net.IP, error)

GetSourceIP returns the ip address used to access target:port If target is the empty string then the default gateway ip is used. If the port is 0, then 80 is used by default.

func HostAddresses

func HostAddresses() ([]string, error)

HostAddresses returns all available ip addresses from all interfaces

func IsAddressReachable

func IsAddressReachable(addr string) bool

func PreferNonPrivateIP

func PreferNonPrivateIP(ips []string) (string, string)

Types

type ListenerTimer

type ListenerTimer struct {
	net.Listener

	C <-chan time.Time
	// contains filtered or unexported fields
}

func NewListenerTimer

func NewListenerTimer(l net.Listener, d time.Duration) *ListenerTimer

func (*ListenerTimer) Accept

func (l *ListenerTimer) Accept() (net.Conn, error)

func (*ListenerTimer) Addr

func (l *ListenerTimer) Addr() net.Addr

func (*ListenerTimer) Close

func (l *ListenerTimer) Close() error

Jump to

Keyboard shortcuts

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