Documentation
¶
Overview ¶
Package protocol provides the DTLS wire format
Index ¶
- Constants
- func CompressionMethods() map[CompressionMethodID]*CompressionMethod
- func EncodeCompressionMethods(c []*CompressionMethod) []byte
- func IsDTLS13Ciphertext(ct ContentType) bool
- type ACK
- type ApplicationData
- type ChangeCipherSpec
- type CompressionMethod
- type CompressionMethodID
- type Content
- type ContentType
- type RecordNumber
- type ReturnRoutabilityCheck
- type ReturnRoutabilityCheckMessageType
- type Version
Constants ¶
const ReturnRoutabilityCheckCookieLength = 8
ReturnRoutabilityCheckCookieLength is the wire size of an RRC cookie. https://datatracker.ietf.org/doc/html/rfc9853#section-4
Variables ¶
This section is empty.
Functions ¶
func CompressionMethods ¶
func CompressionMethods() map[CompressionMethodID]*CompressionMethod
CompressionMethods returns all supported CompressionMethods.
func EncodeCompressionMethods ¶
func EncodeCompressionMethods(c []*CompressionMethod) []byte
EncodeCompressionMethods the given compression methods.
func IsDTLS13Ciphertext ¶
func IsDTLS13Ciphertext(ct ContentType) bool
Types ¶
type ACK ¶
type ACK struct {
// Records is the list of RecordNumbers being acknowledged.
Records []RecordNumber
}
ACK is the DTLS 1.3 content type used to acknowledge receipt of handshake records.
https://datatracker.ietf.org/doc/html/rfc9147#section-7
func (ACK) ContentType ¶
func (a ACK) ContentType() ContentType
ContentType returns the content type for ACK records (26).
func (*ACK) MarshalSize ¶
MarshalSize returns the minimal size required for MarshalTo.
type ApplicationData ¶
type ApplicationData struct {
Data []byte
}
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
func (ApplicationData) ContentType ¶
func (a ApplicationData) ContentType() ContentType
ContentType returns the ContentType of this content.
func (*ApplicationData) Marshal ¶
func (a *ApplicationData) Marshal() ([]byte, error)
Marshal encodes the ApplicationData to binary.
func (ApplicationData) MarshalSize ¶
func (a ApplicationData) MarshalSize() int
MarshalSize returns the size required for MarshalTo.
func (*ApplicationData) MarshalTo ¶
func (a *ApplicationData) MarshalTo(out []byte) (int, error)
MarshalTo encodes the ApplicationData to binary into a pre-allocated buffer.
func (*ApplicationData) Unmarshal ¶
func (a *ApplicationData) Unmarshal(data []byte) error
Unmarshal populates the ApplicationData from binary.
type ChangeCipherSpec ¶
type ChangeCipherSpec struct{}
ChangeCipherSpec protocol exists to signal transitions in ciphering strategies. The protocol consists of a single message, which is encrypted and compressed under the current (not the pending) connection state. The message consists of a single byte of value 1. https://tools.ietf.org/html/rfc5246#section-7.1
func (ChangeCipherSpec) ContentType ¶
func (c ChangeCipherSpec) ContentType() ContentType
ContentType returns the ContentType of this content.
func (*ChangeCipherSpec) Marshal ¶
func (c *ChangeCipherSpec) Marshal() ([]byte, error)
Marshal encodes the ChangeCipherSpec to binary.
func (ChangeCipherSpec) MarshalSize ¶
func (c ChangeCipherSpec) MarshalSize() int
MarshalSize returns the minimal buffer size required for MarshalTo.
func (*ChangeCipherSpec) MarshalTo ¶
func (c *ChangeCipherSpec) MarshalTo(out []byte) (int, error)
MarshalTo encodes the ChangeCipherSpec to binary into a pre-allocated buffer.
func (*ChangeCipherSpec) Unmarshal ¶
func (c *ChangeCipherSpec) Unmarshal(data []byte) error
Unmarshal populates the ChangeCipherSpec from binary.
type CompressionMethod ¶
type CompressionMethod struct {
ID CompressionMethodID
}
CompressionMethod represents a TLS Compression Method.
func DecodeCompressionMethods ¶
func DecodeCompressionMethods(buf []byte) ([]*CompressionMethod, error)
DecodeCompressionMethods the given compression methods.
type CompressionMethodID ¶
type CompressionMethodID byte
CompressionMethodID is the ID for a CompressionMethod.
type Content ¶
type Content interface {
ContentType() ContentType
Marshal() ([]byte, error)
MarshalTo([]byte) (int, error)
MarshalSize() int
Unmarshal(data []byte) error
}
Content is the top level distinguisher for a DTLS Datagram.
type ContentType ¶
type ContentType uint8
ContentType represents the IANA Registered ContentTypes
https://tools.ietf.org/html/rfc4346#section-6.2.1
const ( ContentTypeChangeCipherSpec ContentType = 20 ContentTypeAlert ContentType = 21 ContentTypeHandshake ContentType = 22 ContentTypeApplicationData ContentType = 23 ContentTypeConnectionID ContentType = 25 ContentTypeACK ContentType = 26 ContentTypeReturnRoutabilityCheck ContentType = 27 )
ContentType enums.
type RecordNumber ¶
RecordNumber identifies a specific DTLS record by its epoch and sequence number. The 128-bit value matches the unpacked RecordNumber structure from RFC 9147 Section 4.2.
type ReturnRoutabilityCheck ¶
type ReturnRoutabilityCheck struct {
MessageType ReturnRoutabilityCheckMessageType
Cookie [ReturnRoutabilityCheckCookieLength]byte
}
ReturnRoutabilityCheck carries an RRC path validation message.
func (ReturnRoutabilityCheck) ContentType ¶
func (r ReturnRoutabilityCheck) ContentType() ContentType
ContentType returns the RRC content type (27).
func (*ReturnRoutabilityCheck) Marshal ¶
func (r *ReturnRoutabilityCheck) Marshal() ([]byte, error)
Marshal encodes to wire format.
func (*ReturnRoutabilityCheck) MarshalSize ¶
func (r *ReturnRoutabilityCheck) MarshalSize() int
MarshalSize returns the minimal size required for MarshalTo.
func (*ReturnRoutabilityCheck) MarshalTo ¶
func (r *ReturnRoutabilityCheck) MarshalTo(out []byte) (int, error)
MarshalTo encodes to wire format into a pre-allocated buffer.
func (*ReturnRoutabilityCheck) Unmarshal ¶
func (r *ReturnRoutabilityCheck) Unmarshal(data []byte) error
Unmarshal decodes an RRC message.
type ReturnRoutabilityCheckMessageType ¶
type ReturnRoutabilityCheckMessageType uint8
ReturnRoutabilityCheckMessageType identifies an RFC 9853 RRC message.
const ( ReturnRoutabilityCheckPathChallenge ReturnRoutabilityCheckMessageType = iota ReturnRoutabilityCheckPathResponse ReturnRoutabilityCheckPathDrop )
Return Routability Check message types (rrc_msg_type). https://datatracker.ietf.org/doc/html/rfc9853#section-4
type Version ¶
type Version uint16
Version represents a DTLS protocol version.
func VersionFromBytes ¶
VersionFromBytes constructs a Version from major/minor bytes.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package alert implements TLS alert protocol https://tools.ietf.org/html/rfc5246#section-7.2
|
Package alert implements TLS alert protocol https://tools.ietf.org/html/rfc5246#section-7.2 |
|
Package extension provides TLS extension framing and payload codecs.
|
Package extension provides TLS extension framing and payload codecs. |
|
dtls12
Package dtls12 implements extension payloads specific to DTLS 1.2.
|
Package dtls12 implements extension payloads specific to DTLS 1.2. |
|
dtls13
Package dtls13 implements extension payloads specific to DTLS 1.3.
|
Package dtls13 implements extension payloads specific to DTLS 1.3. |
|
Package handshake provides the DTLS wire protocol for handshakes
|
Package handshake provides the DTLS wire protocol for handshakes |
|
Package recordlayer frames, inspects, and encodes DTLS wire records.
|
Package recordlayer frames, inspects, and encodes DTLS wire records. |