False positive on code example
Closed this issue · 1 comments
ernado commented
Example:
// Message represents a single STUN packet. It uses aggressive internal
// buffering to enable zero-allocation encoding and decoding,
// so there are some usage constraints:
//
// Message, its fields, results of m.Get or any attribute a.GetFrom
// are valid only until Message.Raw is not modified.
//
// Usage:
// var m Message
// if err := m.Build(TransactionID, BindingRequest, Fingerprint); err != nil {
// panic(err)
// }
// You can call Build on zero value, and m.Raw will contain on-the-wire
// representation of Message. To decode message from byte slice, use Decode:
// var m Message
// if err := Decode(buf, &m); err != nil {
// panic(err)
// }
type Message struct {
Type MessageType
Length uint32 // len(Raw) not including header
TransactionID [TransactionIDSize]byte
Attributes Attributes
Raw []byte
}
Link:
https://github.com/gortc/stun/blob/92b10056f1fb672e9d12471a517faddbc4841221/message.go#L62-L86
tetafro commented
Yep, there was an issue, thanks for reporting.
Fixed in v0.3.4.