MCPcopy Index your code
hub / github.com/GoEdgeLab/EdgeNode / TestIsLocalIP

Function TestIsLocalIP

internal/utils/ip_test.go:9–20  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestIsLocalIP(t *testing.T) {
10 var a = assert.NewAssertion(t)
11 a.IsFalse(utils.IsLocalIP("a"))
12 a.IsFalse(utils.IsLocalIP("1.2.3"))
13 a.IsTrue(utils.IsLocalIP("127.0.0.1"))
14 a.IsTrue(utils.IsLocalIP("192.168.0.1"))
15 a.IsTrue(utils.IsLocalIP("10.0.0.1"))
16 a.IsTrue(utils.IsLocalIP("172.16.0.1"))
17 a.IsTrue(utils.IsLocalIP("::1"))
18 a.IsFalse(utils.IsLocalIP("::1:2:3"))
19 a.IsFalse(utils.IsLocalIP("8.8.8.8"))
20}
21
22func TestIsIPv4(t *testing.T) {
23 var a = assert.NewAssertion(t)

Callers

nothing calls this directly

Calls 1

IsLocalIPFunction · 0.92

Tested by

no test coverage detected