nat

package module
v0.0.0-...-31c0879 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

README

STUN and ICE implementations for the Go programming language.

The code is under Apache License 2.0.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(xchg ExchangeCandidatesFun, initiator bool) (net.Conn, error)

func ConnectOpt

func ConnectOpt(xchg ExchangeCandidatesFun, initiator bool, cfg *Config) (net.Conn, error)

func GatherCandidates

func GatherCandidates(sock *net.UDPConn, ifaces []string, blacklist []*net.IPNet) ([]candidate, error)

Types

type Config

type Config struct {
	// ProbeTimeout is the duration between sending probes.
	ProbeTimeout time.Duration
	// DecisionTime is how much time we wait before checking (on the
	// initiator) all the links that successfully communicated (so they got
	// stun.ClassSuccess in response to a stun.ClassRequest) and deciding
	// which one to use.
	DecisionTime time.Duration
	// PeerDeadline is the duration for which the negotiation must go
	// on. Please note this must be > DecisionTime because after the
	// initiator decided which link to use, we need to have one more
	// complete round-trip (stun.ClassSuccess in response to a
	// stun.ClassRequest) but with UseCandidate set to true.
	PeerDeadline time.Duration
	// Prints all the ongoing handshakes.
	Verbose bool
	// Bind locally to a specific address.
	BindAddress *net.UDPAddr
	// Which interfaces use for ICE.
	UseInterfaces []string
	// Blacklist given addresses for ICE negotiation.
	BlacklistAddresses []*net.IPNet
}

func DefaultConfig

func DefaultConfig() *Config

type Conn

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

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

func (*Conn) Read

func (c *Conn) Read(b []byte) (int, error)

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) error

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

type ExchangeCandidatesFun

type ExchangeCandidatesFun func([]byte) []byte

Directories

Path Synopsis
Package stun implements a subset of the Session Traversal Utilities for NAT (STUN) protocol, described in RFC 5389.
Package stun implements a subset of the Session Traversal Utilities for NAT (STUN) protocol, described in RFC 5389.
stunclient
stunclient is a simple STUN client implementation using the STUN library.
stunclient is a simple STUN client implementation using the STUN library.

Jump to

Keyboard shortcuts

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