Commit 49e7bdea authored by vyzo's avatar vyzo Committed by Steven Allen

add test

parent 984c8ac5
package manet
import (
"testing"
ma "github.com/multiformats/go-multiaddr"
)
func TestIsPublicAddr(t *testing.T) {
a, err := ma.NewMultiaddr("/ip4/192.168.1.1/tcp/80")
if err != nil {
t.Fatal(err)
}
if IsPublicAddr(a) {
t.Fatal("192.168.1.1 is not a public address!")
}
a, err = ma.NewMultiaddr("/ip4/1.1.1.1/tcp/80")
if err != nil {
t.Fatal(err)
}
if !IsPublicAddr(a) {
t.Fatal("1.1.1.1 is a public address!")
}
}
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