stun

package
v0.0.0-...-65db379 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2013 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

go-stun is a STUN (RFC 3489 and RFC 5389) client implementation in golang.

It is extremely easy to use -- just one line of code.

nat, host, err := stun.Discover()

More details please go to `example.go`.

Index

Constants

View Source
const (
	DefaultServerHost   = "provserver.televolution.net"
	DefaultServerPort   = 3478
	DefaultSoftwareName = "StunClient"
)
View Source
const (
	NAT_ERROR = iota
	NAT_UNKNOWN
	NAT_NONE
	NAT_BLOCKED
	NAT_FULL
	NAT_SYMETRIC
	NAT_RESTRICTED
	NAT_PORT_RESTRICTED
	NAT_SYMETRIC_UDP_FIREWALL
)

Variables

This section is empty.

Functions

func SetServerAddr

func SetServerAddr(address string)

SetServerAddr allows user to set the transport layer STUN server address

func SetServerHost

func SetServerHost(host string, port int) error

SetServerHost allows user to set the STUN hostname and port

func SetSoftwareName

func SetSoftwareName(name string)

SetSoftwareName allows user to set the name of her software

Types

type Host

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

func Discover

func Discover() (int, *Host, error)

Discover contacts the STUN server and gets the response of NAT type, host for UDP punching

func (*Host) Family

func (h *Host) Family() uint16

func (*Host) Ip

func (h *Host) Ip() string

func (*Host) Port

func (h *Host) Port() uint16

func (*Host) TransportAddr

func (h *Host) TransportAddr() string

Jump to

Keyboard shortcuts

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