Documentation ¶
Overview ¶
Package stun represents the attributes defined in the STUN RFC Standard.
Index ¶
- Constants
- Variables
- func NewErrorCodeAttribute() stun.Attribute
- func NewFingerprintAttribute() stun.Attribute
- func NewMappedAddressAttribute() stun.Attribute
- func NewMessageIntegrityAttribute() stun.Attribute
- func NewNonceAttribute() stun.Attribute
- func NewRealmAttribute() stun.Attribute
- func NewSoftwareAttribute() stun.Attribute
- func NewUnknownAttributesAttribute() stun.Attribute
- func NewUsernameAttribute() stun.Attribute
- func NewXorMappedAddressAttribute() stun.Attribute
- func XorAddressData(h *XorMappedAddressAttribute, msg *stun.Message) ([]byte, error)
- type ErrorCodeAttribute
- func (h *ErrorCodeAttribute) Decode(data []byte, length uint16, _ *stun.Parser) error
- func (h *ErrorCodeAttribute) Encode(msg *stun.Message) ([]byte, error)
- func (h *ErrorCodeAttribute) Error() int
- func (h *ErrorCodeAttribute) Length(_ *stun.Message) uint16
- func (h ErrorCodeAttribute) String() string
- func (h *ErrorCodeAttribute) Type() stun.AttributeType
- type FingerprintAttribute
- type MappedAddressAttribute
- type MessageIntegrityAttribute
- type NonceAttribute
- type RealmAttribute
- type SoftwareAttribute
- type UnknownAttributesAttribute
- func (h *UnknownAttributesAttribute) Decode(data []byte, length uint16, _ *stun.Parser) error
- func (h *UnknownAttributesAttribute) Encode(msg *stun.Message) ([]byte, error)
- func (h *UnknownAttributesAttribute) Length(_ *stun.Message) uint16
- func (h *UnknownAttributesAttribute) Type() stun.AttributeType
- type UsernameAttribute
- type XorMappedAddressAttribute
- func (h *XorMappedAddressAttribute) Decode(data []byte, _ uint16, p *stun.Parser) error
- func (h *XorMappedAddressAttribute) Encode(msg *stun.Message) ([]byte, error)
- func (h *XorMappedAddressAttribute) Length(_ *stun.Message) uint16
- func (h XorMappedAddressAttribute) String() string
- func (h *XorMappedAddressAttribute) Type() stun.AttributeType
Constants ¶
View Source
const (
ErrorCode stun.AttributeType = 0x9
)
View Source
const (
Fingerprint stun.AttributeType = 0x8028
)
View Source
const (
MappedAddress stun.AttributeType = 0x1
)
View Source
const (
MessageIntegrity stun.AttributeType = 0x8
)
View Source
const (
Nonce stun.AttributeType = 0x15
)
View Source
const (
Realm stun.AttributeType = 0x14
)
View Source
const (
Software stun.AttributeType = 0x8022
)
View Source
const (
UnknownAttributes stun.AttributeType = 0xA
)
View Source
const (
Username stun.AttributeType = 0x6
)
View Source
const (
XorMappedAddress stun.AttributeType = 0x20
)
Variables ¶
View Source
var ( // StunAttributes represents the AttributeSet of STUN defined attributes for // use when parsing STUN messages. StunAttributes = stun.AttributeSet{ ErrorCode: NewErrorCodeAttribute, Fingerprint: NewFingerprintAttribute, MappedAddress: NewMappedAddressAttribute, MessageIntegrity: NewMessageIntegrityAttribute, Nonce: NewNonceAttribute, Realm: NewRealmAttribute, Software: NewSoftwareAttribute, UnknownAttributes: NewUnknownAttributesAttribute, Username: NewUsernameAttribute, XorMappedAddress: NewXorMappedAddressAttribute, } )
Functions ¶
func NewErrorCodeAttribute ¶
func NewErrorCodeAttribute() stun.Attribute
func NewFingerprintAttribute ¶
func NewFingerprintAttribute() stun.Attribute
func NewMappedAddressAttribute ¶
func NewMappedAddressAttribute() stun.Attribute
func NewMessageIntegrityAttribute ¶
func NewMessageIntegrityAttribute() stun.Attribute
func NewNonceAttribute ¶
func NewNonceAttribute() stun.Attribute
func NewRealmAttribute ¶
func NewRealmAttribute() stun.Attribute
func NewSoftwareAttribute ¶
func NewSoftwareAttribute() stun.Attribute
func NewUnknownAttributesAttribute ¶
func NewUnknownAttributesAttribute() stun.Attribute
func NewUsernameAttribute ¶
func NewUsernameAttribute() stun.Attribute
func NewXorMappedAddressAttribute ¶
func NewXorMappedAddressAttribute() stun.Attribute
func XorAddressData ¶
func XorAddressData(h *XorMappedAddressAttribute, msg *stun.Message) ([]byte, error)
Types ¶
type ErrorCodeAttribute ¶
ErrorCodeAttribute is present in Error Repsonse messages, and indicates why the server was unable to complete a request.
func GetError ¶
func GetError(msg *stun.Message) *ErrorCodeAttribute
func (*ErrorCodeAttribute) Decode ¶
func (h *ErrorCodeAttribute) Decode(data []byte, length uint16, _ *stun.Parser) error
func (*ErrorCodeAttribute) Encode ¶
func (h *ErrorCodeAttribute) Encode(msg *stun.Message) ([]byte, error)
func (*ErrorCodeAttribute) Error ¶
func (h *ErrorCodeAttribute) Error() int
func (*ErrorCodeAttribute) Length ¶
func (h *ErrorCodeAttribute) Length(_ *stun.Message) uint16
func (ErrorCodeAttribute) String ¶
func (h ErrorCodeAttribute) String() string
func (*ErrorCodeAttribute) Type ¶
func (h *ErrorCodeAttribute) Type() stun.AttributeType
type FingerprintAttribute ¶
type FingerprintAttribute struct {
CRC uint32
}
func (*FingerprintAttribute) Decode ¶
func (h *FingerprintAttribute) Decode(data []byte, length uint16, p *stun.Parser) error
func (*FingerprintAttribute) Encode ¶
func (h *FingerprintAttribute) Encode(msg *stun.Message) ([]byte, error)
func (*FingerprintAttribute) Length ¶
func (h *FingerprintAttribute) Length(_ *stun.Message) uint16
func (*FingerprintAttribute) Type ¶
func (h *FingerprintAttribute) Type() stun.AttributeType
type MappedAddressAttribute ¶
func (*MappedAddressAttribute) Decode ¶
func (h *MappedAddressAttribute) Decode(data []byte, _ uint16, _ *stun.Parser) error
func (*MappedAddressAttribute) Encode ¶
func (h *MappedAddressAttribute) Encode(msg *stun.Message) ([]byte, error)
func (*MappedAddressAttribute) Length ¶
func (h *MappedAddressAttribute) Length(_ *stun.Message) uint16
func (*MappedAddressAttribute) Type ¶
func (h *MappedAddressAttribute) Type() stun.AttributeType
type MessageIntegrityAttribute ¶
type MessageIntegrityAttribute struct { }
func (*MessageIntegrityAttribute) Decode ¶
func (h *MessageIntegrityAttribute) Decode(data []byte, length uint16, p *stun.Parser) error
func (*MessageIntegrityAttribute) Encode ¶
func (h *MessageIntegrityAttribute) Encode(msg *stun.Message) ([]byte, error)
func (*MessageIntegrityAttribute) Length ¶
func (h *MessageIntegrityAttribute) Length(_ *stun.Message) uint16
func (*MessageIntegrityAttribute) Type ¶
func (h *MessageIntegrityAttribute) Type() stun.AttributeType
type NonceAttribute ¶
type NonceAttribute struct { }
func (*NonceAttribute) Decode ¶
func (h *NonceAttribute) Decode(data []byte, length uint16, p *stun.Parser) error
func (*NonceAttribute) Encode ¶
func (h *NonceAttribute) Encode(msg *stun.Message) ([]byte, error)
func (*NonceAttribute) Length ¶
func (h *NonceAttribute) Length(msg *stun.Message) uint16
func (*NonceAttribute) Type ¶
func (h *NonceAttribute) Type() stun.AttributeType
type RealmAttribute ¶
type RealmAttribute struct { }
func (*RealmAttribute) Decode ¶
func (h *RealmAttribute) Decode(data []byte, length uint16, p *stun.Parser) error
func (*RealmAttribute) Encode ¶
func (h *RealmAttribute) Encode(msg *stun.Message) ([]byte, error)
func (*RealmAttribute) Length ¶
func (h *RealmAttribute) Length(msg *stun.Message) uint16
func (*RealmAttribute) Type ¶
func (h *RealmAttribute) Type() stun.AttributeType
type SoftwareAttribute ¶
type SoftwareAttribute struct {
Software string
}
func (*SoftwareAttribute) Decode ¶
func (h *SoftwareAttribute) Decode(data []byte, length uint16, _ *stun.Parser) error
func (*SoftwareAttribute) Encode ¶
func (h *SoftwareAttribute) Encode(msg *stun.Message) ([]byte, error)
func (*SoftwareAttribute) Length ¶
func (h *SoftwareAttribute) Length(_ *stun.Message) uint16
func (*SoftwareAttribute) Type ¶
func (h *SoftwareAttribute) Type() stun.AttributeType
type UnknownAttributesAttribute ¶
type UnknownAttributesAttribute struct {
Attributes []uint16
}
func (*UnknownAttributesAttribute) Decode ¶
func (h *UnknownAttributesAttribute) Decode(data []byte, length uint16, _ *stun.Parser) error
func (*UnknownAttributesAttribute) Encode ¶
func (h *UnknownAttributesAttribute) Encode(msg *stun.Message) ([]byte, error)
func (*UnknownAttributesAttribute) Length ¶
func (h *UnknownAttributesAttribute) Length(_ *stun.Message) uint16
func (*UnknownAttributesAttribute) Type ¶
func (h *UnknownAttributesAttribute) Type() stun.AttributeType
type UsernameAttribute ¶
type UsernameAttribute struct { }
func (*UsernameAttribute) Decode ¶
func (h *UsernameAttribute) Decode(data []byte, length uint16, p *stun.Parser) error
func (*UsernameAttribute) Encode ¶
func (h *UsernameAttribute) Encode(msg *stun.Message) ([]byte, error)
func (*UsernameAttribute) Length ¶
func (h *UsernameAttribute) Length(msg *stun.Message) uint16
func (*UsernameAttribute) Type ¶
func (h *UsernameAttribute) Type() stun.AttributeType
type XorMappedAddressAttribute ¶
func (*XorMappedAddressAttribute) Decode ¶
func (h *XorMappedAddressAttribute) Decode(data []byte, _ uint16, p *stun.Parser) error
func (*XorMappedAddressAttribute) Encode ¶
func (h *XorMappedAddressAttribute) Encode(msg *stun.Message) ([]byte, error)
func (*XorMappedAddressAttribute) Length ¶
func (h *XorMappedAddressAttribute) Length(_ *stun.Message) uint16
func (XorMappedAddressAttribute) String ¶
func (h XorMappedAddressAttribute) String() string
func (*XorMappedAddressAttribute) Type ¶
func (h *XorMappedAddressAttribute) Type() stun.AttributeType
Click to show internal directories.
Click to hide internal directories.