mirror of
https://github.com/netbirdio/ice.git
synced 2026-05-22 17:10:58 -07:00
Improve parsing candidates with missing Foundation
Support missing foundation candidates with additional attributes Resolves #390
This commit is contained in:
+3
-3
@@ -424,11 +424,11 @@ func (c *candidateBase) Marshal() string {
|
||||
// UnmarshalCandidate creates a Candidate from its string representation
|
||||
func UnmarshalCandidate(raw string) (Candidate, error) {
|
||||
split := strings.Fields(raw)
|
||||
switch {
|
||||
// Foundation not specified: not RFC 8445 compliant but seen in the wild
|
||||
case len(split) == 7 && raw[0] == ' ':
|
||||
if len(raw) != 0 && raw[0] == ' ' {
|
||||
split = append([]string{" "}, split...)
|
||||
case len(split) < 8:
|
||||
}
|
||||
if len(split) < 8 {
|
||||
return nil, fmt.Errorf("%w (%d)", errAttributeTooShortICECandidate, len(split))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user