mirror of
https://github.com/logos-messaging/go-multiaddr.git
synced 2026-01-02 13:03:11 +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) {
|
||||
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