Commit 115f321e authored by Steven Allen's avatar Steven Allen

test to make sure we only consider addresses that *start* with IP addresses

(would have failed with ValueForProtocol)
parent 0425819f
......@@ -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*")
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment