github.com/wormhole-foundation/wormhole-explorer/common@v0.0.0-20240604151348-09585b5b97c5/utils/ip_test.go (about) 1 package utils 2 3 import ( 4 "testing" 5 6 "github.com/test-go/testify/assert" 7 ) 8 9 func TestIsPrivateIPAsString(t *testing.T) { 10 11 is := IsPrivateIPAsString("127.0.0.1") 12 13 assert.Equal(t, true, is) 14 15 is = IsPrivateIPAsString("10.0.1.8") 16 17 assert.Equal(t, true, is) 18 19 is = IsPrivateIPAsString("200.121.10.92") 20 21 assert.Equal(t, false, is) 22 }