Skip to content

Add DTLS-in-STUN (SPED) attributes#861

Merged
fippo merged 2 commits intopion:masterfrom
fippo:sped-attributes
Jan 29, 2026
Merged

Add DTLS-in-STUN (SPED) attributes#861
fippo merged 2 commits intopion:masterfrom
fippo:sped-attributes

Conversation

@fippo
Copy link
Contributor

@fippo fippo commented Dec 29, 2025

defined in pion/stun#260

@codecov
Copy link

codecov bot commented Jan 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.39%. Comparing base (91a3151) to head (2a77adf).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #861      +/-   ##
==========================================
- Coverage   88.47%   88.39%   -0.09%     
==========================================
  Files          43       44       +1     
  Lines        5512     5540      +28     
==========================================
+ Hits         4877     4897      +20     
- Misses        441      446       +5     
- Partials      194      197       +3     
Flag Coverage Δ
go 88.39% <100.00%> (-0.09%) ⬇️

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.

@fippo fippo marked this pull request as ready for review January 6, 2026 08:33
// of DTLS packets (embedded in STUN or without embedding).
type DtlsInStunAckAttribute []uint32

// Acks are 32 bit values, the attribute can carry up to four of these.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we have consensus on the maximum length to put in the spec but this matches what is currently in libwebrtc.

@fippo fippo requested review from JoTurk and Sean-Der January 29, 2026 09:03
Copy link
Member

@JoTurk JoTurk left a comment

Choose a reason for hiding this comment

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

Hello, All of our stun attributes serialization/deserialization helpers live in stun, why this live in ice and not stun? i think if we move them to stun we can merge that right away, unless there is something i'm missing.

@fippo
Copy link
Contributor Author

fippo commented Jan 29, 2026

We have priority.go (priority), icecontrol.go (controlled/controlling) and usecandidate.go (use-candidate) in this repo though.
Which makes sense, ICE is an extension of STUN and these are just the attributes mentioned in https://www.rfc-editor.org/rfc/rfc5245#section-19. sped is similar in that respect.

Copy link
Member

@JoTurk JoTurk left a comment

Choose a reason for hiding this comment

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

We have priority.go (priority), icecontrol.go (controlled/controlling) and usecandidate.go (use-candidate) in this repo though.

All of these examples are from the library transition d895187#diff-034522ab4c2a896e9b3be8605c36afbb252cbc0648ff9f1378227a484ab34fda I think the reason they were added here was because of the STUN library transition, and this was to make it possible to swap from gortc/stun to pion/stun attributes without a breaking change.
But we also added nomination attribute few month ago which i kinda regret. This is the reason for my comment.

ice/renomination.go

Lines 71 to 86 in 91a3151

func Nomination(value uint32) NominationAttribute {
return NominationAttribute{Value: value}
}
// NominationSetter is a STUN setter for nomination attribute with configurable type.
type NominationSetter struct {
Value uint32
AttrType stun.AttrType
}
// AddTo adds a Nomination attribute to a STUN message using the configured attribute type.
func (n NominationSetter) AddTo(m *stun.Message) error {
attr := NominationAttribute{Value: n.Value}
return attr.AddToWithType(m, n.AttrType)
}

The way i see it, is that that the user shouldn't not add another dependency to use attributes helpers, and we should have them in one place in case we wanted to change the interface (like we did to all of our rtp extensions few weeks ago pion/rtp#344)

but i guess we can change this later in the next ICE major release, I'll added it to the issue.
Go ahead with the merge.

@fippo fippo merged commit 7aa0886 into pion:master Jan 29, 2026
18 checks passed
@fippo fippo deleted the sped-attributes branch January 29, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants