mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-09 01:40:31 +08:00
添加 github.com/pion/dtls 代码
This commit is contained in:
26
dtls-2.0.9/pkg/protocol/application_data.go
Normal file
26
dtls-2.0.9/pkg/protocol/application_data.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package protocol
|
||||
|
||||
// ApplicationData messages are carried by the record layer and are
|
||||
// fragmented, compressed, and encrypted based on the current connection
|
||||
// state. The messages are treated as transparent data to the record
|
||||
// layer.
|
||||
// https://tools.ietf.org/html/rfc5246#section-10
|
||||
type ApplicationData struct {
|
||||
Data []byte
|
||||
}
|
||||
|
||||
// ContentType returns the ContentType of this content
|
||||
func (a ApplicationData) ContentType() ContentType {
|
||||
return ContentTypeApplicationData
|
||||
}
|
||||
|
||||
// Marshal encodes the ApplicationData to binary
|
||||
func (a *ApplicationData) Marshal() ([]byte, error) {
|
||||
return append([]byte{}, a.Data...), nil
|
||||
}
|
||||
|
||||
// Unmarshal populates the ApplicationData from binary
|
||||
func (a *ApplicationData) Unmarshal(data []byte) error {
|
||||
a.Data = append([]byte{}, data...)
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user