Skip to content

Add DTLS 1.3 Unified Header#793

Open
theodorsm wants to merge 5 commits intomainfrom
theodorsm/record_layer_13
Open

Add DTLS 1.3 Unified Header#793
theodorsm wants to merge 5 commits intomainfrom
theodorsm/record_layer_13

Conversation

@theodorsm
Copy link
Copy Markdown
Member

Description

This PR implements the new DTLS 1.3 Unified Header that is part of the new record layer encoding.

https://datatracker.ietf.org/doc/html/rfc9147#name-the-dtls-record-layer:

    0 1 2 3 4 5 6 7
    +-+-+-+-+-+-+-+-+
    |0|0|1|C|S|L|E E|
    +-+-+-+-+-+-+-+-+
    | Connection ID |   Legend:
    | (if any,      |
    /  length as    /   C   - Connection ID (CID) present
    |  negotiated)  |   S   - Sequence number length
    +-+-+-+-+-+-+-+-+   L   - Length present
    |  8 or 16 bit  |   E   - Epoch
    |Sequence Number|
    +-+-+-+-+-+-+-+-+
    | 16 bit Length |
    | (if present)  |
    +-+-+-+-+-+-+-+-+

Reference issue

Partly fixes #755

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 5, 2026

Codecov Report

❌ Patch coverage is 69.23077% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.31%. Comparing base (fd27a52) to head (00ca5b2).

Files with missing lines Patch % Lines
pkg/protocol/recordlayer/header_13.go 74.54% 7 Missing and 7 partials ⚠️
pkg/protocol/recordlayer/header.go 52.38% 7 Missing and 3 partials ⚠️

❌ Your patch check has failed because the patch coverage (69.23%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #793      +/-   ##
==========================================
- Coverage   82.44%   82.31%   -0.14%     
==========================================
  Files         121      123       +2     
  Lines        6928     7005      +77     
==========================================
+ Hits         5712     5766      +54     
- Misses        805      819      +14     
- Partials      411      420       +9     
Flag Coverage Δ
go 82.31% <69.23%> (-0.14%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@theodorsm theodorsm force-pushed the theodorsm/record_layer_13 branch from c26fc58 to 8043e6f Compare April 13, 2026 16:00
@theodorsm theodorsm force-pushed the theodorsm/record_layer_13 branch from 8043e6f to ec6817e Compare April 13, 2026 18:43
@theodorsm theodorsm marked this pull request as ready for review April 13, 2026 20:56
}

h.ContentType = protocol.ContentType(data[0])
if protocol.IsDTLS13Ciphertext(h.ContentType) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, we should also check if we have enabled DTLS 1.3 before parsing and returning something that would be unvalid for DTLS 1.2. Tied to TODOs in #738

@theodorsm theodorsm requested a review from JoTurk April 14, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DTLS 1.3 record layer encoding

1 participant