From 449f7af43b1e6bc0f50f941a4fd51a22d4bbd30f Mon Sep 17 00:00:00 2001 From: Sean DuBois Date: Sat, 12 Sep 2020 21:44:47 -0700 Subject: [PATCH] Assume mDNS candidates are UDPv4 until parsed Otherwise we are unable to handle remote candidates --- candidate_host.go | 3 +++ candidate_test.go | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/candidate_host.go b/candidate_host.go index 2a56dde..c7d3266 100644 --- a/candidate_host.go +++ b/candidate_host.go @@ -51,6 +51,9 @@ func NewCandidateHost(config *CandidateHostConfig) (*CandidateHost, error) { if err := c.setIP(ip); err != nil { return nil, err } + } else { + // Until mDNS candidate is resolved assume it is UDPv4 + c.candidateBase.networkType = NetworkTypeUDP4 } return c, nil diff --git a/candidate_test.go b/candidate_test.go index 857cd50..c06885b 100644 --- a/candidate_test.go +++ b/candidate_test.go @@ -274,6 +274,16 @@ func TestCandidateMarshal(t *testing.T) { "1052353102 1 tcp 2128609279 192.168.0.196 0 typ host tcptype active", false, }, + {&CandidateHost{ + candidateBase{ + networkType: NetworkTypeUDP4, + candidateType: CandidateTypeHost, + address: "e2494022-4d9a-4c1e-a750-cc48d4f8d6ee.local", + port: 60542, + }, + "", + }, + "1380287402 1 udp 2130706431 e2494022-4d9a-4c1e-a750-cc48d4f8d6ee.local 60542 typ host", false}, // Invalid candidates {nil, "", true},