mirror of
https://github.com/waku-org/go-multiaddr.git
synced 2025-02-23 03:28:12 +00:00
add test
This commit is contained in:
parent
984c8ac58b
commit
49e7bdea20
27
private_test.go
Normal file
27
private_test.go
Normal file
@ -0,0 +1,27 @@
|
||||
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!")
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user