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

Function TestIPList_ContainsExpires

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

Source from the content-addressed store, hash-verified

73}
74
75func TestIPList_ContainsExpires(t *testing.T) {
76 var list = waf.NewIPList(waf.IPListTypeDeny)
77
78 for i := 0; i < 1_0000; i++ {
79 list.Add(waf.IPTypeAll, firewallconfigs.FirewallScopeGlobal, 1, "192.168.1."+strconv.Itoa(i), time.Now().Unix()+3600)
80 }
81 // list.RemoveIP("192.168.1.100", 1, false)
82 for _, ip := range []string{"192.168.1.100", "192.168.2.100"} {
83 expiresAt, ok := list.ContainsExpires(waf.IPTypeAll, firewallconfigs.FirewallScopeGlobal, 1, ip)
84 t.Log(ok, expiresAt, timeutil.FormatTime("Y-m-d H:i:s", expiresAt))
85 }
86}
87
88func TestIPList_Save(t *testing.T) {
89 var a = assert.NewAssertion(t)

Callers

nothing calls this directly

Calls 5

NewIPListFunction · 0.92
UnixMethod · 0.80
LogMethod · 0.80
AddMethod · 0.65
ContainsExpiresMethod · 0.45

Tested by

no test coverage detected