MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestIPList_Contains

Function TestIPList_Contains

internal/waf/ip_list_test.go:58–73  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

56}
57
58func TestIPList_Contains(t *testing.T) {
59 var a = assert.NewAssertion(t)
60
61 var list = waf.NewIPList(waf.IPListTypeDeny)
62
63 for i := 0; i < 1_0000; i++ {
64 list.Add(waf.IPTypeAll, firewallconfigs.FirewallScopeGlobal, 1, "192.168.1."+strconv.Itoa(i), time.Now().Unix()+3600)
65 }
66 //list.RemoveIP("192.168.1.100")
67 {
68 a.IsTrue(list.Contains(waf.IPTypeAll, firewallconfigs.FirewallScopeGlobal, 1, "192.168.1.100"))
69 }
70 {
71 a.IsFalse(list.Contains(waf.IPTypeAll, firewallconfigs.FirewallScopeGlobal, 1, "192.168.2.100"))
72 }
73}
74
75func TestIPList_ContainsExpires(t *testing.T) {
76 var list = waf.NewIPList(waf.IPListTypeDeny)

Callers

nothing calls this directly

Calls 4

NewIPListFunction · 0.92
UnixMethod · 0.80
AddMethod · 0.65
ContainsMethod · 0.45

Tested by

no test coverage detected