dontfrag.go 461 B

123456789101112131415161718
  1. package proto
  2. import "github.com/pion/stun"
  3. // DontFragmentAttr represents DONT-FRAGMENT attribute.
  4. type DontFragmentAttr struct{}
  5. // AddTo adds DONT-FRAGMENT attribute to message.
  6. func (DontFragmentAttr) AddTo(m *stun.Message) error {
  7. m.Add(stun.AttrDontFragment, nil)
  8. return nil
  9. }
  10. // IsSet returns true if DONT-FRAGMENT attribute is set.
  11. func (DontFragmentAttr) IsSet(m *stun.Message) bool {
  12. _, err := m.Get(stun.AttrDontFragment)
  13. return err == nil
  14. }