Skip to content

Commit fbaf0f0

Browse files
committed
Add STUN attributes for DTLS-in-STUN (SPED)
aѕ defined in https://www.iana.org/assignments/stun-parameters/stun-parameters.xml The name drops the META which is likely to happen after standardization.
1 parent 488a5a8 commit fbaf0f0

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

attributes.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ const (
120120
AttrAlternateDomain AttrType = 0x8003 // ALTERNATE-DOMAIN
121121
)
122122

123+
// Attributes from SPED.
124+
const (
125+
AttrDtlsInStun AttrType = 0xC070
126+
AttrDtlsInStunAck AttrType = 0xC071
127+
)
128+
123129
// Value returns uint16 representation of attribute type.
124130
func (t AttrType) Value() uint16 {
125131
return uint16(t)
@@ -158,6 +164,8 @@ func attrNames() map[AttrType]string {
158164
AttrUserhash: "USERHASH",
159165
AttrPasswordAlgorithms: "PASSWORD-ALGORITHMS",
160166
AttrAlternateDomain: "ALTERNATE-DOMAIN",
167+
AttrDtlsInStun: "DTLS-IN-STUN",
168+
AttrDtlsInStunAck: "DTLS-IN-STUN-ACKNOWLEDGEMENT",
161169
}
162170
}
163171

@@ -257,7 +265,7 @@ func nearestPaddedValueLength(l int) int {
257265
return n
258266
}
259267

260-
// This method converts uint16 vlue to AttrType. If it finds an old attribute
268+
// This method converts an uint16 value to AttrType. If it finds an old attribute
261269
// type value, it also translates it to the new value to enable backward
262270
// compatibility. (See: https://github.com/pion/stun/issues/21)
263271
func compatAttrType(val uint16) AttrType {

testdata/stun-parameters-4.csv

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,7 @@ Value,Name,Reference
8080
0xC05D,GOOG-DELTA-ACK,[Jonas_Oreland]
8181
0xC05E-0xC05F,Unassigned,
8282
0xC060,GOOG-MESSAGE-INTEGRITY-32,[Jonas_Oreland]
83-
0xC061-0xFFFF,Unassigned,
83+
0xC061-0xC06F,Unassigned,
84+
0xC070,DTLS-IN-STUN,[Philipp_Hancke]
85+
0xC071,DTLS-IN-STUN-ACKNOWLEDGEMENT,[Philipp_Hancke]
86+
0xC072-0xFFFF,Unassigned,

0 commit comments

Comments
 (0)