Documentation ¶
Index ¶
Constants ¶
View Source
const ( Request byte = iota Indication Success Error )
View Source
const ( Binding uint16 )
View Source
const ( MappedAddressCode uint16 ResponseAddressCode ChangeAddressCode SourceAddressCode ChangedAddressCode UsernameCode PasswordCode MessageIntegrityCode ErrorCode UnknownAttributesCode ReflectedFromCode )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AttributeValue ¶
type AttributeValue interface {
Bytes() []byte
}
type MappedAddressAttr ¶
func (MappedAddressAttr) Bytes ¶
func (m MappedAddressAttr) Bytes() []byte
type StunAttribute ¶
type StunAttribute struct { // 16 bit Type Type uint16 // 16 bit length Length int // Variable Length Attribute Attr AttributeValue }
func MappedAddress ¶
func MappedAddress(address string, port int) StunAttribute
func ParseAttr ¶
func ParseAttr(bytes []byte) (StunAttribute, int)
func (StunAttribute) Bytes ¶
func (a StunAttribute) Bytes() []byte
type StunMessage ¶
type StunMessage struct { // 14 bit message type: 12 bit Method + 2 bit Class encoding // +--+--+-+-+-+-+-+-+-+-+-+-+-+-+ // |M |M |M|M|M|C|M|M|M|C|M|M|M|M| // |11|10|9|8|7|1|6|5|4|0|3|2|1|0| // +--+--+-+-+-+-+-+-+-+-+-+-+-+-+ Method uint16 Class byte // Message Length: 16 bits Length int // Magic Cookie: always 0x2112A442 in network order Cookie []byte // Transaction ID: Random 96 bits TransID []byte Attrs []StunAttribute }
func ParseMessage ¶
func ParseMessage(bytes []byte) StunMessage
func SendMessage ¶
func SendMessage(m StunMessage, local, remote string) StunMessage
func (*StunMessage) AddAttribute ¶
func (m *StunMessage) AddAttribute(attr StunAttribute)
func (StunMessage) Bytes ¶
func (h StunMessage) Bytes() []byte
Click to show internal directories.
Click to hide internal directories.