peerexchange

package
v0.2.6-beta.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GroupKey

func GroupKey(na net.IP) string

GroupKey returns a string representing the network group an address is part of. This is the /16 for IPv4, the /32 (/36 for he.net) for IPv6, the string "localNode" for a localNode address, the string "tor:key" where key is the /4 of the onion address for Tor address, and the string "unroutable" for an unroutable address.

func IsIPv4

func IsIPv4(na net.IP) bool

IsIPv4 returns whether or not the given address is an IPv4 address.

func IsLocal

func IsLocal(na net.IP) bool

IsLocal returns whether or not the given address is a localNode address.

func IsOnionCatTor

func IsOnionCatTor(na net.IP) bool

IsOnionCatTor returns whether or not the passed address is in the IPv6 range used by bitcoin to support Tor (fd87:d87e:eb43::/48). Note that this range is the same range used by OnionCat, which is part of the RFC4193 unique localNode IPv6 range.

func IsRFC1918

func IsRFC1918(na net.IP) bool

IsRFC1918 returns whether or not the passed address is part of the IPv4 private network address space as defined by RFC1918 (10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16).

func IsRFC2544

func IsRFC2544(na net.IP) bool

IsRFC2544 returns whether or not the passed address is part of the IPv4 address space as defined by RFC2544 (198.18.0.0/15).

func IsRFC3849

func IsRFC3849(na net.IP) bool

IsRFC3849 returns whether or not the passed address is part of the IPv6 documentation range as defined by RFC3849 (2001:DB8::/32).

func IsRFC3927

func IsRFC3927(na net.IP) bool

IsRFC3927 returns whether or not the passed address is part of the IPv4 autoconfiguration range as defined by RFC3927 (169.254.0.0/16).

func IsRFC3964

func IsRFC3964(na net.IP) bool

IsRFC3964 returns whether or not the passed address is part of the IPv6 to IPv4 encapsulation range as defined by RFC3964 (2002::/16).

func IsRFC4193

func IsRFC4193(na net.IP) bool

IsRFC4193 returns whether or not the passed address is part of the IPv6 unique localNode range as defined by RFC4193 (FC00::/7).

func IsRFC4380

func IsRFC4380(na net.IP) bool

IsRFC4380 returns whether or not the passed address is part of the IPv6 teredo tunneling over UDP range as defined by RFC4380 (2001::/32).

func IsRFC4843

func IsRFC4843(na net.IP) bool

IsRFC4843 returns whether or not the passed address is part of the IPv6 ORCHID range as defined by RFC4843 (2001:10::/28).

func IsRFC4862

func IsRFC4862(na net.IP) bool

IsRFC4862 returns whether or not the passed address is part of the IPv6 stateless address autoconfiguration range as defined by RFC4862 (FE80::/64).

func IsRFC5737

func IsRFC5737(na net.IP) bool

IsRFC5737 returns whether or not the passed address is part of the IPv4 documentation address space as defined by RFC5737 (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24).

func IsRFC6052

func IsRFC6052(na net.IP) bool

IsRFC6052 returns whether or not the passed address is part of the IPv6 well-known prefix range as defined by RFC6052 (64:FF9B::/96).

func IsRFC6145

func IsRFC6145(na net.IP) bool

IsRFC6145 returns whether or not the passed address is part of the IPv6 to IPv4 translated address range as defined by RFC6145 (::FFFF:0:0:0/96).

func IsRFC6598

func IsRFC6598(na net.IP) bool

IsRFC6598 returns whether or not the passed address is part of the IPv4 shared address space specified by RFC6598 (100.64.0.0/10).

func IsRoutable

func IsRoutable(na net.IP) bool

IsRoutable returns whether or not the passed address is routable over the public internet. This is true as long as the address is valid and is not in any reserved ranges.

func IsValid

func IsValid(na net.IP) bool

IsValid returns whether or not the passed address is valid. The address is considered invalid under the following circumstances: IPv4: It is either a zero or all bits set address. IPv6: It is either a zero or RFC3849 documentation address.

Types

type Config

type Config struct {
	Bootnodes []string
	DataDir   string
}

Config for Discovery.

type Discovery

type Discovery struct {
	// contains filtered or unexported fields
}

Discovery is struct that holds the protocol components, the protocol definition, the addr book data structure and more.

func New

func New(logger log.Log, h host.Host, config Config) (*Discovery, error)

New creates a Discovery instance.

func (*Discovery) Bootstrap

func (d *Discovery) Bootstrap(ctx context.Context) error

Bootstrap runs a refresh and tries to get a minimum number of nodes in the addrBook.

func (*Discovery) ExternalPort

func (d *Discovery) ExternalPort() uint16

ExternalPort returns currently configured external port.

func (*Discovery) Stop

func (d *Discovery) Stop()

Stop stops the discovery service.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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