From e9caba4e0377e5f063120662ad424e36f34e8e57 Mon Sep 17 00:00:00 2001 From: Sean DuBois Date: Wed, 15 Dec 2021 12:13:30 -0500 Subject: [PATCH] Expose ErrUnknownCandidateTyp Expose this error so pion/webrtc can handle gracefully. rfc8839#section-5.1 specifies that a WebRTC Agent MUST ignore any name/value pairs it doesn't understand. Relates to pion/webrtc#1949 --- candidate_base.go | 2 +- errors.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/candidate_base.go b/candidate_base.go index 63231e6..e66c91d 100644 --- a/candidate_base.go +++ b/candidate_base.go @@ -496,5 +496,5 @@ func UnmarshalCandidate(raw string) (Candidate, error) { default: } - return nil, fmt.Errorf("%w (%s)", errUnknownCandidateTyp, typ) + return nil, fmt.Errorf("%w (%s)", ErrUnknownCandidateTyp, typ) } diff --git a/errors.go b/errors.go index 530b179..03a6a8e 100644 --- a/errors.go +++ b/errors.go @@ -109,6 +109,9 @@ var ( // ErrTCPRemoteAddrAlreadyExists indicates we already have the connection with same remote addr. ErrTCPRemoteAddrAlreadyExists = errors.New("conn with same remote addr already exists") + // ErrUnknownCandidateTyp indicates that a candidate had a unknown type value. + ErrUnknownCandidateTyp = errors.New("unknown candidate typ") + errSendPacket = errors.New("failed to send packet") errAttributeTooShortICECandidate = errors.New("attribute not long enough to be ICE candidate") errParseComponent = errors.New("could not parse component") @@ -116,7 +119,6 @@ var ( errParsePort = errors.New("could not parse port") errParseRelatedAddr = errors.New("could not parse related addresses") errParseTypType = errors.New("could not parse typtype") - errUnknownCandidateTyp = errors.New("unknown candidate typ") errGetXorMappedAddrResponse = errors.New("failed to get XOR-MAPPED-ADDRESS response") errConnectionAddrAlreadyExist = errors.New("connection with same remote address already exists") errReadingStreamingPacket = errors.New("error reading streaming packet")