1package proto 2 3import "github.com/pion/stun" 4 5// Data represents DATA attribute. 6// 7// The DATA attribute is present in all Send and Data indications. The 8// value portion of this attribute is variable length and consists of 9// the application data (that is, the data that would immediately follow 10// the UDP header if the data was been sent directly between the client 11// and the peer). 12// 13// RFC 5766 Section 14.4 14type Data []byte 15 16// AddTo adds DATA to message. 17func (d Data) AddTo(m *stun.Message) error { 18 m.Add(stun.AttrData, d) 19 return nil 20} 21 22// GetFrom decodes DATA from message. 23func (d *Data) GetFrom(m *stun.Message) error { 24 v, err := m.Get(stun.AttrData) 25 if err != nil { 26 return err 27 } 28 *d = v 29 return nil 30} 31