mirror of
https://github.com/logos-messaging/go-multiaddr.git
synced 2026-01-11 01:13:13 +00:00
test to make sure we only consider addresses that *start* with IP addresses
(would have failed with ValueForProtocol)
This commit is contained in:
parent
0425819f0e
commit
115f321e21
@ -32,4 +32,17 @@ func TestIsPublicAddr(t *testing.T) {
|
|||||||
if IsPrivateAddr(a) {
|
if IsPrivateAddr(a) {
|
||||||
t.Fatal("1.1.1.1 is not a private address!")
|
t.Fatal("1.1.1.1 is not a private address!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a, err = ma.NewMultiaddr("/tcp/80/ip4/1.1.1.1")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if IsPublicAddr(a) {
|
||||||
|
t.Fatal("shouldn't consider an address that starts with /tcp/ as *public*")
|
||||||
|
}
|
||||||
|
|
||||||
|
if IsPrivateAddr(a) {
|
||||||
|
t.Fatal("shouldn't consider an address that starts with /tcp/ as *private*")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user