实现IP名单管理
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package firewallconfigs
|
||||
|
||||
import "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/ipconfigs"
|
||||
|
||||
type HTTPFirewallInboundConfig struct {
|
||||
IsOn bool `yaml:"isOn" json:"isOn"`
|
||||
GroupRefs []*HTTPFirewallRuleGroupRef `yaml:"groupRefs" json:"groupRefs"`
|
||||
@@ -7,6 +9,11 @@ type HTTPFirewallInboundConfig struct {
|
||||
|
||||
// 地区相关
|
||||
Region *HTTPFirewallRegionConfig `yaml:"region" json:"region"`
|
||||
|
||||
// IP名单
|
||||
WhiteListRef *ipconfigs.IPListRef `yaml:"whiteListRef" json:"whiteListRef"`
|
||||
BlackListRef *ipconfigs.IPListRef `yaml:"blackListRef" json:"blackListRef"`
|
||||
GreyListRef *ipconfigs.IPListRef `yaml:"greyListRef" json:"greyListRef"`
|
||||
}
|
||||
|
||||
// 初始化
|
||||
|
||||
13
pkg/serverconfigs/ipconfigs/ip_list_config.go
Normal file
13
pkg/serverconfigs/ipconfigs/ip_list_config.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package ipconfigs
|
||||
|
||||
import "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||
|
||||
// IP名单配置
|
||||
type IPListConfig struct {
|
||||
Id int64 `yaml:"id" json:"id"` // ID
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
|
||||
Version int64 `yaml:"version" json:"version"` // 版本号
|
||||
Timeout *shared.TimeDuration `yaml:"timeout" json:"timeout"` // 默认超时时间
|
||||
Code string `yaml:"code" json:"code"` // 代号
|
||||
Type string `yaml:"type" json:"type"` // 类型
|
||||
}
|
||||
7
pkg/serverconfigs/ipconfigs/ip_list_ref.go
Normal file
7
pkg/serverconfigs/ipconfigs/ip_list_ref.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package ipconfigs
|
||||
|
||||
// IP名单引用
|
||||
type IPListRef struct {
|
||||
IsOn bool `yaml:"isOn" json:"isOn"`
|
||||
ListId int64 `yaml:"listId" json:"listId"`
|
||||
}
|
||||
26
pkg/serverconfigs/ipconfigs/ip_list_types.go
Normal file
26
pkg/serverconfigs/ipconfigs/ip_list_types.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package ipconfigs
|
||||
|
||||
import "github.com/iwind/TeaGo/maps"
|
||||
|
||||
type IPListType = string
|
||||
|
||||
const (
|
||||
IPListTypeWhite IPListType = "white"
|
||||
IPListTypeBlack IPListType = "black"
|
||||
IPListTypeGrey IPListType = "grey"
|
||||
)
|
||||
|
||||
var IPListTypes = []maps.Map{
|
||||
{
|
||||
"name": "白名单",
|
||||
"code": IPListTypeWhite,
|
||||
},
|
||||
{
|
||||
"name": "黑名单",
|
||||
"code": IPListTypeBlack,
|
||||
},
|
||||
{
|
||||
"name": "灰名单",
|
||||
"code": IPListTypeGrey,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user