nat

package
v0.0.0-...-8e2bdd7 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2014 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

The NAT package is responsible for

  • obtaining a pair of public IP and port that can be announced to external nodes and can be used for sending traffic to this node.
  • keep that NAT traversal mechanism active, either by sending keepalives or by notifying the corresponding service about our interest in keeping it active.

Index

Constants

View Source
const LOG_MODULE = "divs"
View Source
const STUN_SERVICE_ADDRESS = "stun.ekiga.net:3478"

default STUN server:port

Variables

View Source
var ERR_COULD_NOT_OBTAIN_NAT = errors.New("Could not obtain a valid IP/port")

Could not obtain a valid IP/port with NAT

View Source
var ERR_COULD_NOT_OBTAIN_STUN = fmt.Errorf("Could not obtain a valid IP/port with STUN")

could not obtain a NAT mapping with STUN

View Source
var ERR_COULD_NOT_OBTAIN_UPNP = fmt.Errorf("Could not obtain a valid IP/port with UPNP")

Functions

func GetStun

func GetStun(defaultIp net.IP, defaultPort int) (net.IP, int, error)

try to obtain an external IP address and (optionally) port

func GetUpnp

func GetUpnp(defaultIp net.IP, defaultPort int) (net.IP, int, error)

get an external IP and port with UpnP

func NewExternal

func NewExternal(addr interface{}) (interface{}, error)

Obtain a new external address, returning a UDP or TCP address depending on the default value provided.

func NewExternalTCP

func NewExternalTCP(tcpAddr net.TCPAddr) (net.TCPAddr, error)

Obtain a new external TCP address, providing a default value

func NewExternalTCPAddr

func NewExternalTCPAddr(addr string) (net.TCPAddr, error)

Obtain a new external TCP address, providing the default value as a string

func NewExternalUDP

func NewExternalUDP(udpAddr net.UDPAddr) (net.UDPAddr, error)

Obtain a new external UDP address, providing a default value

func NewExternalUDPAddr

func NewExternalUDPAddr(addr string) (net.UDPAddr, error)

Obtain a new external UDP address, providing the default value as a string

Types

This section is empty.

Jump to

Keyboard shortcuts

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