mirror of
https://github.com/pion/ice.git
synced 2025-11-03 11:21:26 +08:00
IpMapper return locIP if corresponding map not set
If we only set v4 or v6 NAT1to1Mapping, then findExternalIP will failed for the unset ip mapper, the gahter will complain 1:1 NAT mapping is enabled but no external IP is found, cause that candidate for udp can't be gathered.
This commit is contained in:
@@ -289,8 +289,9 @@ func TestExternalIPMapper(t *testing.T) {
|
||||
assert.NoError(t, err, "should succeed")
|
||||
|
||||
// attempt to find IPv6 that does not exist in the map
|
||||
_, err = m.findExternalIP("fe80::1")
|
||||
assert.Error(t, err, "should fail")
|
||||
extIP, err := m.findExternalIP("fe80::1")
|
||||
assert.NoError(t, err, "should succeed")
|
||||
assert.Equal(t, "fe80::1", extIP.String(), "should match")
|
||||
|
||||
m, err = newExternalIPMapper(CandidateTypeUnspecified, []string{
|
||||
"2200::1",
|
||||
@@ -298,7 +299,8 @@ func TestExternalIPMapper(t *testing.T) {
|
||||
assert.NoError(t, err, "should succeed")
|
||||
|
||||
// attempt to find IPv4 that does not exist in the map
|
||||
_, err = m.findExternalIP("10.0.0.1")
|
||||
assert.Error(t, err, "should fail")
|
||||
extIP, err = m.findExternalIP("10.0.0.1")
|
||||
assert.NoError(t, err, "should succeed")
|
||||
assert.Equal(t, "10.0.0.1", extIP.String(), "should match")
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user