natt

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: MIT Imports: 19 Imported by: 0

README

go-libp2p-natt

Documentation

Index

Constants

View Source
const (
	TraversalPMP       = "pmp"
	TraversalHolePunch = "punching"
	TraversalHW        = "highway"
	TraversalNone      = "none"
)

Variables

View Source
var (
	//ErrShouldHaveIPAddress ...
	ErrShouldHaveIPAddress = errors.New("error machine should have an assigned IP address")
	//ErrNoNATDeviceFound ...
	ErrNoNATDeviceFound = errors.New("error no NAT devices found")
	//ErrCreatingHost ...
	ErrCreatingHost = errors.New("error creating host")
	//ErrCantUpdateBroadcastAddress ...
	ErrCantUpdateBroadcastAddress = errors.New("error cant update broadcast address")
	//ErrCantConnectToNATDiscoverAddress ...
	ErrCantConnectToNATDiscoverAddress = errors.New("error cant connect to NAT discover address")
	// ErrNoMapping signals no mapping exists for an address
	ErrNoMapping = errors.New("mapping not established")
	// ErrCantGetExternalAddress ...
	ErrCantGetExternalAddress = errors.New("error cant get external address")
)

Functions

func GetOutboundIP

func GetOutboundIP() net.IP

Get preferred outbound ip of this machine

Types

type Host

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

func CreateHost

func CreateHost(identityKey crypto.PrivKey, port int, NATdiscoverAddr string) (*Host, error)

func (*Host) ConnectPeer

func (h *Host) ConnectPeer(peerAddr string) error

func (*Host) GetBroadcastAddrInfo

func (h *Host) GetBroadcastAddrInfo() string

func (*Host) GetHost

func (h *Host) GetHost() host.Host

func (*Host) GetHostID

func (h *Host) GetHostID() peer.ID

func (*Host) GetInternalPort

func (h *Host) GetInternalPort() int

func (*Host) GetNATType

func (h *Host) GetNATType() network.Reachability

func (*Host) Quit

func (h *Host) Quit()

type TraversalMethod added in v0.0.7

type TraversalMethod string

Jump to

Keyboard shortcuts

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