addrutil

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: MIT, MIT Imports: 5 Imported by: 0

README

go-addr-util

codecov Travis CI Discourse posts

Address utilities for libp2p swarm.

Table of Contents

Install

make install

Contribute

Feel free to join in. All welcome. Open an issue!

Check out our contributing document for more information on how we work, and about contributing in general. Please be aware that all interactions related to libp2p are subject to the IPFS Code of Conduct.

Small note: If editing the Readme, please conform to the standard-readme specification.

License

MIT © Jeromy Johnson


The last gx published version of this module was: 2.0.11: QmZomXpA4HrYKRV2ftnE5odWMT2JNnhAXTvEyQrzXrnyEX

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddrInList

func AddrInList(addr ma.Multiaddr, list []ma.Multiaddr) bool

AddrInList returns whether or not an address is part of a list. this is useful to check if NAT is happening (or other bugs?)

func AddrIsShareableOnWAN

func AddrIsShareableOnWAN(addr ma.Multiaddr) bool

AddrIsShareableOnWAN returns whether the given address should be shareable on the wide area network (wide internet).

func AddrOverNonLocalIP

func AddrOverNonLocalIP(a ma.Multiaddr) bool

AddrOverNonLocalIP returns whether the addr uses a non-local ip link

func CheckNATWarning

func CheckNATWarning(observed, expected ma.Multiaddr, listen []ma.Multiaddr)

CheckNATWarning checks if our observed addresses differ. if so, informs the user that certain things might not work yet

func FilterAddrs

func FilterAddrs(a []ma.Multiaddr, filters ...func(ma.Multiaddr) bool) []ma.Multiaddr

FilterAddrs is a filter that removes certain addresses, according to the given filters. If all filters return true, the address is kept.

func FilterNeg

func FilterNeg(f func(ma.Multiaddr) bool) func(ma.Multiaddr) bool

FilterNeg returns a negated version of the passed in filter

func InterfaceAddresses

func InterfaceAddresses() ([]ma.Multiaddr, error)

InterfaceAddresses returns a list of addresses associated with local machine Note: we do not return link local addresses. IP loopback is ok, because we may be connecting to other nodes in the same machine.

func IsFDCostlyTransport

func IsFDCostlyTransport(a ma.Multiaddr) bool

IsFDCostlyTransport returns true for transports that require a new file descriptor per connection created

func ResolveUnspecifiedAddress

func ResolveUnspecifiedAddress(resolve ma.Multiaddr, ifaceAddrs []ma.Multiaddr) ([]ma.Multiaddr, error)

ResolveUnspecifiedAddress expands an unspecified ip addresses (/ip4/0.0.0.0, /ip6/::) to use the known local interfaces. If ifaceAddr is nil, we request interface addresses from the network stack. (this is so you can provide a cached value if resolving many addrs)

func ResolveUnspecifiedAddresses

func ResolveUnspecifiedAddresses(unspecAddrs, ifaceAddrs []ma.Multiaddr) ([]ma.Multiaddr, error)

ResolveUnspecifiedAddresses expands unspecified ip addresses (/ip4/0.0.0.0, /ip6/::) to use the known local interfaces.

func Subtract

func Subtract(a, b []ma.Multiaddr) []ma.Multiaddr

Subtract filters out all addrs in b from a

func SubtractFilter

func SubtractFilter(addrs ...ma.Multiaddr) func(ma.Multiaddr) bool

SubtractFilter returns a filter func that filters all of the given addresses

func WANShareableAddrs

func WANShareableAddrs(inp []ma.Multiaddr) []ma.Multiaddr

WANShareableAddrs filters addresses based on whether they're shareable on WAN

Types

This section is empty.

Jump to

Keyboard shortcuts

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