mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-07 18:50:27 +08:00
增加IP动作
This commit is contained in:
56
internal/iplibrary/action_manager_test.go
Normal file
56
internal/iplibrary/action_manager_test.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package iplibrary
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestActionManager_UpdateActions(t *testing.T) {
|
||||
manager := NewActionManager()
|
||||
manager.UpdateActions([]*firewallconfigs.FirewallActionConfig{
|
||||
{
|
||||
Id: 1,
|
||||
Type: "ipset",
|
||||
Params: maps.Map{
|
||||
"whiteName": "edge-white-list",
|
||||
"blackName": "edge-black-list",
|
||||
},
|
||||
},
|
||||
})
|
||||
t.Log("===config===")
|
||||
for _, c := range manager.configMap {
|
||||
t.Log(c.Id, c.Type)
|
||||
}
|
||||
t.Log("===instance===")
|
||||
for id, c := range manager.instanceMap {
|
||||
t.Log(id, c)
|
||||
}
|
||||
|
||||
manager.UpdateActions([]*firewallconfigs.FirewallActionConfig{
|
||||
{
|
||||
Id: 1,
|
||||
Type: "ipset",
|
||||
Params: maps.Map{
|
||||
"whiteName": "edge-white-list",
|
||||
"blackName": "edge-black-list",
|
||||
},
|
||||
},
|
||||
{
|
||||
Id: 2,
|
||||
Type: "iptables",
|
||||
Params: maps.Map{
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
t.Log("===config===")
|
||||
for _, c := range manager.configMap {
|
||||
t.Log(c.Id, c.Type)
|
||||
}
|
||||
t.Log("===instance===")
|
||||
for id, c := range manager.instanceMap {
|
||||
t.Logf("%d: %#v", id, c)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user