Skip to content

Commit ab6e243

Browse files
committed
Parse Candidate Extensions (RFC5245)
- Rewrote `UnmarshalCandidate` to better align with RFC5245. - Added Candidate `Extensions` and `GetExtension`. - Updated `Equal` and `Marshal` to accommodate these changes. - New Type `CandidateExtension` to handle.
1 parent abdc0ca commit ab6e243

File tree

4 files changed

+1221
-58
lines changed

4 files changed

+1221
-58
lines changed

candidate.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,28 @@ type Candidate interface {
5252
// candidate, which is useful for diagnostics and other purposes
5353
RelatedAddress() *CandidateRelatedAddress
5454

55+
// Extensions returns a copy of all extension attributes associated with the ICECandidate.
56+
// In the order of insertion, *(key value).
57+
// Extension attributes are defined in RFC 5245, Section 15.1:
58+
// https://datatracker.ietf.org/doc/html/rfc5245#section-15.1
59+
//.
60+
Extensions() []CandidateExtension
61+
62+
// GetExtension returns the value of the extension attribute associated with the ICECandidate.
63+
// Extension attributes are defined in RFC 5245, Section 15.1:
64+
// https://datatracker.ietf.org/doc/html/rfc5245#section-15.1
65+
//.
66+
GetExtension(key string) (value CandidateExtension, ok bool)
67+
5568
String() string
5669
Type() CandidateType
5770
TCPType() TCPType
5871

5972
Equal(other Candidate) bool
6073

74+
// DeepEqual same as Equal, But it also compares the candidate extensions.
75+
DeepEqual(other Candidate) bool
76+
6177
Marshal() string
6278

6379
addr() net.Addr

0 commit comments

Comments
 (0)