Documentation ¶
Overview ¶
Package stun implements a subset of the Session Traversal Utilities for NAT (STUN) protocol, described in RFC 5389. Notably absent is support for long-term credentials.
Index ¶
- Constants
- func BindRequest(tid []byte, macKey []byte, compat bool, useCandidate bool) ([]byte, error)
- func BindResponse(tid []byte, addr *net.UDPAddr, macKey []byte, compat bool) ([]byte, error)
- func RandomTid() ([]byte, error)
- type BadMac
- type Class
- type MalformedPacket
- type Method
- type MissingMac
- type Packet
- type PacketError
- type UnverifiableMac
Constants ¶
const ( ClassRequest = iota ClassIndication ClassSuccess ClassError MethodBinding = 1 )
Possible classes and methods for a STUN packet.
Variables ¶
This section is empty.
Functions ¶
func BindRequest ¶
BindRequest constructs and returns a Binding Request STUN packet.
tid must be 12 bytes long. If a macKey is provided, the returned packet is signed.
func BindResponse ¶
BindResponse constructs and returns a Binding Success STUN packet.
tid must be 12 bytes long. If a macKey is provided, the returned packet is signed.
Types ¶
type BadMac ¶
type BadMac struct{}
A BadMac error is returned by ParsePacket when a structurally sound STUN packet is received with a signature not matching the provided macKey.
type MalformedPacket ¶
type MalformedPacket struct{}
A MalformedPacket error is returned by ParsePacket when it encounters structural malformations in the STUN packet.
On a network endpoing where STUN coexists with another protocol, this error can be used to differentiate STUN and non-STUN traffic.
func (MalformedPacket) Error ¶
func (m MalformedPacket) Error() string
type MissingMac ¶
type MissingMac struct{}
A MissingMac error is returned by ParsePacket when it receives a valid but unsigned STUN packet where it expected a signed packet.
func (MissingMac) Error ¶
func (m MissingMac) Error() string
type Packet ¶
type Packet struct { Class Class Method Method Tid [12]byte Addr *net.UDPAddr HasMac bool Software string UseCandidate bool Error *PacketError Alternate *net.UDPAddr }
A Packet presents select information about a STUN packet.
type PacketError ¶
A PacketError describes an error returned by a STUN server.
func (PacketError) Error ¶
func (p PacketError) Error() string
type UnverifiableMac ¶
type UnverifiableMac struct{}
An UnverifiableMac error is returned by ParsePacket when it encounters a valid and signed STUN packet, and no macKey was provided.
func (UnverifiableMac) Error ¶
func (u UnverifiableMac) Error() string
Directories ¶
Path | Synopsis |
---|---|
stunclient is a simple STUN client implementation using the STUN library.
|
stunclient is a simple STUN client implementation using the STUN library. |