AddToWithType adds a Nomination attribute to a STUN message using a specific attribute type.
(m *stun.Message, attrType stun.AttrType)
| 51 | |
| 52 | // AddToWithType adds a Nomination attribute to a STUN message using a specific attribute type. |
| 53 | func (a NominationAttribute) AddToWithType(m *stun.Message, attrType stun.AttrType) error { |
| 54 | // Store as 4 bytes with first byte as 0 |
| 55 | v := make([]byte, 4) |
| 56 | v[1] = byte(a.Value >> 16) //nolint:gosec |
| 57 | v[2] = byte(a.Value >> 8) //nolint:gosec |
| 58 | v[3] = byte(a.Value) //nolint:gosec |
| 59 | |
| 60 | m.Add(attrType, v) |
| 61 | |
| 62 | return nil |
| 63 | } |
| 64 | |
| 65 | // String returns string representation of the nomination attribute. |
| 66 | func (a NominationAttribute) String() string { |
no outgoing calls