addr

package
v1.0.176 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseUrl

func BaseUrl(rawurl string) (addr string, err error)

http://:80

func DialIP added in v0.0.11

func DialIP(network, address string, timeout time.Duration) (net.IP, error)

DialIP returns the local IP to in Dial.

func ExceptInterfaceNameFilter added in v0.0.150

func ExceptInterfaceNameFilter(names ...string) func(iface net.Interface) bool

ExceptInterfaceNameFilter you can specify which interface _not_ to listen on

func ExpectInterfaceNameFilter added in v0.0.150

func ExpectInterfaceNameFilter(names ...string) func(iface net.Interface) bool

ExpectInterfaceNameFilter If you want to listen specified interfaces (and the loopback) give the name of the interface (eg eth0) here.

func ListenIP added in v0.0.10

func ListenIP(filters ...func(iface net.Interface) bool) (net.IP, error)

ListenIP returns the IP to bind to in Listen. It tries to find an IP that can be used by other machines to reach this machine. filters is interface filters any return false if the interface is _not_ to listen on

func LocalIPAddrByTcp

func LocalIPAddrByTcp(addr string) (string, error)

func LocalIPAddrByUDPMulticast

func LocalIPAddrByUDPMulticast() (string, error)

func RoutedInterfaceNameFilter added in v0.0.150

func RoutedInterfaceNameFilter() func(iface net.Interface) bool

RoutedInterfaceNameFilter returns a network interface that can route IP traffic and satisfies flags.

The provided network must be "ip", "ip4" or "ip6".

func ScoreAddr added in v0.0.127

func ScoreAddr(iface net.Interface, addr net.Addr) (int, net.IP)

ScoreAddr scores how likely the given addr is to be a remote address and returns the IP to use when listening. Any address which receives a negative score should not be used. Scores are calculated as: -1 for any unknown IP addreseses. +300 for IPv4 addresses +100 for non-local addresses, extra +100 for "up" interfaces. +100 for routable addresses -50 for local mac addr.

func ServeIP added in v0.0.11

func ServeIP(networks, addresses []string, timeout time.Duration) (net.IP, error)

ServeIP returns the IP to bind to in Listen. It tries to find an IP that can be used by other machines to reach this machine. Order is by DialIP and ListenIP

Types

This section is empty.

Jump to

Keyboard shortcuts

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