Documentation
¶
Overview ¶
Package flight contains shared internal flight state and helpers.
Index ¶
- func AppendConnectionIDExtensions(values []extension.Value, cid []byte, enableRRC bool) []extension.Value
- func CipherSuiteIDs(cipherSuites []dtlsconfig.CipherSuite) []uint16
- func ClientHelloVersions(hello *handshake.MessageClientHello) []protocol.Version
- func CommitSRTP(state *dtlsstate.Common, decision negotiation.SRTPDecision)
- func DefaultCompressionMethods() []*protocol.CompressionMethod
- func FinalizeClientHello(base *handshake.MessageClientHello, cfg *dtlsconfig.HandshakeConfig) (*handshake.MessageClientHello, negotiation.ClientHelloSnapshot, error)
- func FinalizeServerHello(base *handshake.MessageServerHello, ...) (*handshake.MessageServerHello, error)
- func FindCipherSuiteByID(id uint16, suites []dtlsconfig.CipherSuite) (dtlsconfig.CipherSuite, bool)
- func FindMatchingCipherSuite(a, b []dtlsconfig.CipherSuite) (dtlsconfig.CipherSuite, bool)
- func FindMatchingSRTPProfile(a, b []dtlsconfig.SRTPProtectionProfile) (dtlsconfig.SRTPProtectionProfile, bool)
- func SignatureSchemeIDs(algorithms []signaturehash.Algorithm) []uint16
- func SignatureSchemes(ids []uint16) []signaturehash.Algorithm
- func ValidateHookedConnectionIDLength(values []extension.Value, cfg *dtlsconfig.HandshakeConfig, hookConfigured bool) error
- type Cache
- func (h *Cache) DecodeProtectedHandshakeItem(item *HandshakeCacheItem, expectedType handshake.Type, expectedSequence uint16, ...) (*handshake.Handshake, error)
- func (h *Cache) DiscardBefore(epoch uint64, sequence int, isClient bool)
- func (h *Cache) DiscardRemoteAfter(sequence uint16, isClient bool)
- func (h *Cache) Finish12()
- func (h *Cache) FullPullMapItems(startSeq int, cipherSuite dtlsconfig.CipherSuite, ...) HandshakeCachePullResult
- func (h *Cache) FullPullMapOneOfItems(startSeq int, cipherSuite dtlsconfig.CipherSuite, ...) HandshakeCachePullResult
- func (h *Cache) IsClientHelloRetransmit(content []byte) bool
- func (h *Cache) Pull(rules ...HandshakeCachePullRule) []*HandshakeCacheItem
- func (h *Cache) PullAndMerge(rules ...HandshakeCachePullRule) []byte
- func (h *Cache) PullExact(messageSequence uint16, isClient bool) (*HandshakeCacheItem, bool)
- func (h *Cache) PullSequential(startSeq int, rules ...HandshakeCachePullRule) HandshakeCacheItemPullResult
- func (h *Cache) Push(data []byte, epoch uint64, messageSequence uint16, typ handshake.Type, ...)
- func (h *Cache) PushBounded12(data []byte, epoch uint64, sequence uint16, typ handshake.Type, isClient bool) error
- func (h *Cache) SessionHash(hf prf.HashFunc, epoch uint64, additional ...[]byte) ([]byte, error)
- type Conn
- type DecodedHandshakeCacheItem
- type HandshakeCacheDecoder
- type HandshakeCacheItem
- type HandshakeCacheItemPullResult
- type HandshakeCachePullResult
- type HandshakeCachePullRule
- type HandshakeFragment
- type Outbound
- type Protection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendConnectionIDExtensions ¶
func AppendConnectionIDExtensions( values []extension.Value, cid []byte, enableRRC bool, ) []extension.Value
AppendConnectionIDExtensions appends a connection ID and, when enabled, RRC.
func CipherSuiteIDs ¶
func CipherSuiteIDs(cipherSuites []dtlsconfig.CipherSuite) []uint16
func ClientHelloVersions ¶
func ClientHelloVersions(hello *handshake.MessageClientHello) []protocol.Version
ClientHelloVersions returns the offered versions, using the legacy version only when supported_versions is absent.
func CommitSRTP ¶
func CommitSRTP(state *dtlsstate.Common, decision negotiation.SRTPDecision)
CommitSRTP publishes a validated SRTP decision.
func DefaultCompressionMethods ¶
func DefaultCompressionMethods() []*protocol.CompressionMethod
DefaultCompressionMethods returns the supported compression methods.
func FinalizeClientHello ¶
func FinalizeClientHello(base *handshake.MessageClientHello, cfg *dtlsconfig.HandshakeConfig) (*handshake.MessageClientHello, negotiation.ClientHelloSnapshot, error)
FinalizeClientHello applies the hook and prevents it from enabling RRC when the configured CID path-migration policy does not permit RRC.
func FinalizeServerHello ¶
func FinalizeServerHello(base *handshake.MessageServerHello, hook func(handshake.MessageServerHello) handshake.Message, offer negotiation.ClientHelloSnapshot, enableRRC bool) (*handshake.MessageServerHello, error)
FinalizeServerHello applies the hook and prevents it from enabling RRC when the configured CID path-migration policy does not permit RRC.
func FindCipherSuiteByID ¶
func FindCipherSuiteByID(id uint16, suites []dtlsconfig.CipherSuite) (dtlsconfig.CipherSuite, bool)
FindCipherSuiteByID resolves a peer wire identifier to the configured local descriptor / factory.
func FindMatchingCipherSuite ¶
func FindMatchingCipherSuite(a, b []dtlsconfig.CipherSuite) (dtlsconfig.CipherSuite, bool)
func FindMatchingSRTPProfile ¶
func FindMatchingSRTPProfile(a, b []dtlsconfig.SRTPProtectionProfile) (dtlsconfig.SRTPProtectionProfile, bool)
func SignatureSchemeIDs ¶
func SignatureSchemeIDs(algorithms []signaturehash.Algorithm) []uint16
SignatureSchemeIDs converts negotiated signature algorithms to their identifiers for the payload-oriented extension codecs.
func SignatureSchemes ¶
func SignatureSchemes(ids []uint16) []signaturehash.Algorithm
SignatureSchemes converts known identifiers into algorithms used by negotiation. Unknown identifiers remain preserved by the extension value and are ignored here.
func ValidateHookedConnectionIDLength ¶
func ValidateHookedConnectionIDLength(values []extension.Value, cfg *dtlsconfig.HandshakeConfig, hookConfigured bool) error
ValidateHookedConnectionIDLength checks that a hello hook preserves the configured receive-cid length.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) DecodeProtectedHandshakeItem ¶
func (h *Cache) DecodeProtectedHandshakeItem(item *HandshakeCacheItem, expectedType handshake.Type, expectedSequence uint16, decoder HandshakeCacheDecoder) (*handshake.Handshake, error)
DecodeProtectedHandshakeItem decodes and retains one DTLS 1.3 protected handshake message, or returns the retained value by an earlier pull.
func (*Cache) DiscardBefore ¶
func (*Cache) DiscardRemoteAfter ¶
DiscardRemoteAfter removes speculative messages received after the hello that selected DTLS 1.3. They arrived before version-specific epoch checks.
func (*Cache) Finish12 ¶
func (h *Cache) Finish12()
Finish12 freezes the completed transcript while allowing final-flight retransmission.
func (*Cache) FullPullMapItems ¶
func (h *Cache) FullPullMapItems(startSeq int, cipherSuite dtlsconfig.CipherSuite, rules ...HandshakeCachePullRule) HandshakeCachePullResult
func (*Cache) FullPullMapOneOfItems ¶
func (h *Cache) FullPullMapOneOfItems(startSeq int, cipherSuite dtlsconfig.CipherSuite, rules ...HandshakeCachePullRule) HandshakeCachePullResult
FullPullMapOneOfItems decodes exactly one of the allowed messages at startSeq. A different message from the same peer and epoch is an unexpected_message failure.
func (*Cache) IsClientHelloRetransmit ¶
IsClientHelloRetransmit recognizes a complete, unchanged copy of the latest epoch-zero ClientHello, even when its fragmentation differs. Content starts with a handshake header; the caller must check the record epoch and sender.
func (*Cache) Pull ¶
func (h *Cache) Pull(rules ...HandshakeCachePullRule) []*HandshakeCacheItem
Pull returns a list handshakes that match the requested rules. The list will contain null entries for rules that can't be satisfied. Multiple entries may match a rule, but only the last match is returned (ie ClientHello with cookies).
func (*Cache) PullAndMerge ¶
func (h *Cache) PullAndMerge(rules ...HandshakeCachePullRule) []byte
PullAndMerge calls pull and then merges the results, ignoring any null entries.
func (*Cache) PullExact ¶
func (h *Cache) PullExact(messageSequence uint16, isClient bool) (*HandshakeCacheItem, bool)
PullExact returns the handshake message with the requested sequence and sender.
func (*Cache) PullSequential ¶
func (h *Cache) PullSequential( startSeq int, rules ...HandshakeCachePullRule, ) HandshakeCacheItemPullResult
PullSequential selects messages at consecutive sequence numbers. Missing messages are incomplete.
func (*Cache) PushBounded12 ¶
func (h *Cache) PushBounded12(data []byte, epoch uint64, sequence uint16, typ handshake.Type, isClient bool) error
PushBounded12 retains a DTLS 1.2 transcript within a fixed per-connection budget. DTLS 1.3 has a separate post-handshake message lifecycle.
func (*Cache) SessionHash ¶
SessionHash returns the session hash for Extended Master Secret support https://tools.ietf.org/html/draft-ietf-tls-session-hash-06#section-4
type DecodedHandshakeCacheItem ¶
type DecodedHandshakeCacheItem struct {
Raw *HandshakeCacheItem
Parsed *handshake.Handshake
}
DecodedHandshakeCacheItem retains the original cache bytes for the transcript and the single parsed representation used by handshake logic.
func (DecodedHandshakeCacheItem) Validate ¶
func (i DecodedHandshakeCacheItem) Validate() error
Validate checks that the raw and parsed views identify the same complete handshake message.
type HandshakeCacheDecoder ¶
HandshakeCacheDecoder decodes a complete cached handshake message.
type HandshakeCacheItem ¶
type HandshakeCacheItemPullResult ¶
type HandshakeCacheItemPullResult struct {
NextSequence int
Items []*HandshakeCacheItem
Ready bool
// Err always wraps an *alert.Alert.
Err error
}
HandshakeCacheItemPullResult is an ordered cache selection before message payloads are decoded. Items is aligned with the requested pull rules.
type HandshakeCachePullResult ¶
type HandshakeCachePullResult struct {
NextSequence int
Messages map[handshake.Type]handshake.Message
Items []DecodedHandshakeCacheItem
Ready bool
// Err always wraps an *alert.Alert.
Err error
}
HandshakeCachePullResult distinguishes an incomplete flight from a complete malformed message. Err is non-nil only when a selected complete message could not be decoded or failed cache/header validation.
type HandshakeCachePullRule ¶
type HandshakeFragment ¶
type Outbound ¶
type Outbound struct {
Epoch uint64
Content protocol.Content
Protection Protection
TrackACK bool
// HandshakeFragmentOffsets limits a retransmission to offset:length pairs.
HandshakeFragmentOffsets map[uint32]uint32
HandshakeFragments []HandshakeFragment
// CertificateVerifySigner is local-only metadata used to populate an
// outbound CertificateVerify after the handshake messages have been committed.
CertificateVerifySigner crypto.Signer
}
Outbound describes semantic record intent.
type Protection ¶
type Protection uint8
Protection describes the protection required for an outbound record.
const ( ProtectionPlaintext Protection = iota ProtectionCiphertext )