summaryrefslogtreecommitdiff
path: root/vendor/github.com/pion/turn/v2/internal/proto/dontfrag.go
blob: eb4d8caf834ea8febd03339344a95bcf4527eaf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package proto

import "github.com/pion/stun"

// DontFragmentAttr represents DONT-FRAGMENT attribute.
type DontFragmentAttr struct{}

// AddTo adds DONT-FRAGMENT attribute to message.
func (DontFragmentAttr) AddTo(m *stun.Message) error {
	m.Add(stun.AttrDontFragment, nil)
	return nil
}

// IsSet returns true if DONT-FRAGMENT attribute is set.
func (DontFragmentAttr) IsSet(m *stun.Message) bool {
	_, err := m.Get(stun.AttrDontFragment)
	return err == nil
}