mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-03 06:24:03 +08:00
WAF规则集中增加“允许搜索引擎”选项,可以快速允许搜索引擎访问
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
user: root
|
user: root
|
||||||
password: 123456
|
password: 123456
|
||||||
host: 127.0.0.1:3306
|
host: 127.0.0.1:3306
|
||||||
database: db_edge
|
database: db_edge
|
||||||
|
boolFields: [ "uamIsOn", "followPort", "requestHostExcludingPort", "autoRemoteStart", "autoInstallNftables", "enableIPLists", "detectAgents", "checkingPorts", "enableRecordHealthCheck", "offlineIsNotified", "http2Enabled", "http3Enabled", "enableHTTP2", "retry50X", "retry40X", "autoSystemTuning", "disableDefaultDB", "autoTrimDisks", "enableGlobalPages", "ignoreLocal", "ignoreSearchEngine" ]
|
||||||
@@ -99,7 +99,8 @@ func (this *HTTPFirewallRuleSetDAO) ComposeFirewallRuleSet(tx *dbs.Tx, setId int
|
|||||||
config.Description = set.Description
|
config.Description = set.Description
|
||||||
config.Code = set.Code
|
config.Code = set.Code
|
||||||
config.Connector = set.Connector
|
config.Connector = set.Connector
|
||||||
config.IgnoreLocal = set.IgnoreLocal == 1
|
config.IgnoreLocal = set.IgnoreLocal
|
||||||
|
config.IgnoreSearchEngine = set.IgnoreSearchEngine
|
||||||
|
|
||||||
if IsNotNull(set.Rules) {
|
if IsNotNull(set.Rules) {
|
||||||
var ruleRefs = []*firewallconfigs.HTTPFirewallRuleRef{}
|
var ruleRefs = []*firewallconfigs.HTTPFirewallRuleRef{}
|
||||||
@@ -164,6 +165,7 @@ func (this *HTTPFirewallRuleSetDAO) CreateOrUpdateSetFromConfig(tx *dbs.Tx, setC
|
|||||||
op.Description = setConfig.Description
|
op.Description = setConfig.Description
|
||||||
op.Connector = setConfig.Connector
|
op.Connector = setConfig.Connector
|
||||||
op.IgnoreLocal = setConfig.IgnoreLocal
|
op.IgnoreLocal = setConfig.IgnoreLocal
|
||||||
|
op.IgnoreSearchEngine = setConfig.IgnoreSearchEngine
|
||||||
|
|
||||||
if len(setConfig.Actions) == 0 {
|
if len(setConfig.Actions) == 0 {
|
||||||
op.Actions = "[]"
|
op.Actions = "[]"
|
||||||
|
|||||||
@@ -2,41 +2,62 @@ package models
|
|||||||
|
|
||||||
import "github.com/iwind/TeaGo/dbs"
|
import "github.com/iwind/TeaGo/dbs"
|
||||||
|
|
||||||
|
const (
|
||||||
|
HTTPFirewallRuleSetField_Id dbs.FieldName = "id" // ID
|
||||||
|
HTTPFirewallRuleSetField_IsOn dbs.FieldName = "isOn" // 是否启用
|
||||||
|
HTTPFirewallRuleSetField_Code dbs.FieldName = "code" // 代号
|
||||||
|
HTTPFirewallRuleSetField_Name dbs.FieldName = "name" // 名称
|
||||||
|
HTTPFirewallRuleSetField_Description dbs.FieldName = "description" // 描述
|
||||||
|
HTTPFirewallRuleSetField_CreatedAt dbs.FieldName = "createdAt" // 创建时间
|
||||||
|
HTTPFirewallRuleSetField_Rules dbs.FieldName = "rules" // 规则列表
|
||||||
|
HTTPFirewallRuleSetField_Connector dbs.FieldName = "connector" // 规则之间的关系
|
||||||
|
HTTPFirewallRuleSetField_State dbs.FieldName = "state" // 状态
|
||||||
|
HTTPFirewallRuleSetField_AdminId dbs.FieldName = "adminId" // 管理员ID
|
||||||
|
HTTPFirewallRuleSetField_UserId dbs.FieldName = "userId" // 用户ID
|
||||||
|
HTTPFirewallRuleSetField_Action dbs.FieldName = "action" // 执行的动作(过期)
|
||||||
|
HTTPFirewallRuleSetField_ActionOptions dbs.FieldName = "actionOptions" // 动作的选项(过期)
|
||||||
|
HTTPFirewallRuleSetField_Actions dbs.FieldName = "actions" // 一组动作
|
||||||
|
HTTPFirewallRuleSetField_IgnoreLocal dbs.FieldName = "ignoreLocal" // 忽略局域网请求
|
||||||
|
HTTPFirewallRuleSetField_IgnoreSearchEngine dbs.FieldName = "ignoreSearchEngine" // 忽略搜索引擎
|
||||||
|
)
|
||||||
|
|
||||||
// HTTPFirewallRuleSet 防火墙规则集
|
// HTTPFirewallRuleSet 防火墙规则集
|
||||||
type HTTPFirewallRuleSet struct {
|
type HTTPFirewallRuleSet struct {
|
||||||
Id uint32 `field:"id"` // ID
|
Id uint32 `field:"id"` // ID
|
||||||
IsOn bool `field:"isOn"` // 是否启用
|
IsOn bool `field:"isOn"` // 是否启用
|
||||||
Code string `field:"code"` // 代号
|
Code string `field:"code"` // 代号
|
||||||
Name string `field:"name"` // 名称
|
Name string `field:"name"` // 名称
|
||||||
Description string `field:"description"` // 描述
|
Description string `field:"description"` // 描述
|
||||||
CreatedAt uint64 `field:"createdAt"` // 创建时间
|
CreatedAt uint64 `field:"createdAt"` // 创建时间
|
||||||
Rules dbs.JSON `field:"rules"` // 规则列表
|
Rules dbs.JSON `field:"rules"` // 规则列表
|
||||||
Connector string `field:"connector"` // 规则之间的关系
|
Connector string `field:"connector"` // 规则之间的关系
|
||||||
State uint8 `field:"state"` // 状态
|
State uint8 `field:"state"` // 状态
|
||||||
AdminId uint32 `field:"adminId"` // 管理员ID
|
AdminId uint32 `field:"adminId"` // 管理员ID
|
||||||
UserId uint32 `field:"userId"` // 用户ID
|
UserId uint32 `field:"userId"` // 用户ID
|
||||||
Action string `field:"action"` // 执行的动作(过期)
|
Action string `field:"action"` // 执行的动作(过期)
|
||||||
ActionOptions dbs.JSON `field:"actionOptions"` // 动作的选项(过期)
|
ActionOptions dbs.JSON `field:"actionOptions"` // 动作的选项(过期)
|
||||||
Actions dbs.JSON `field:"actions"` // 一组动作
|
Actions dbs.JSON `field:"actions"` // 一组动作
|
||||||
IgnoreLocal uint8 `field:"ignoreLocal"` // 忽略局域网请求
|
IgnoreLocal bool `field:"ignoreLocal"` // 忽略局域网请求
|
||||||
|
IgnoreSearchEngine bool `field:"ignoreSearchEngine"` // 忽略搜索引擎
|
||||||
}
|
}
|
||||||
|
|
||||||
type HTTPFirewallRuleSetOperator struct {
|
type HTTPFirewallRuleSetOperator struct {
|
||||||
Id interface{} // ID
|
Id any // ID
|
||||||
IsOn interface{} // 是否启用
|
IsOn any // 是否启用
|
||||||
Code interface{} // 代号
|
Code any // 代号
|
||||||
Name interface{} // 名称
|
Name any // 名称
|
||||||
Description interface{} // 描述
|
Description any // 描述
|
||||||
CreatedAt interface{} // 创建时间
|
CreatedAt any // 创建时间
|
||||||
Rules interface{} // 规则列表
|
Rules any // 规则列表
|
||||||
Connector interface{} // 规则之间的关系
|
Connector any // 规则之间的关系
|
||||||
State interface{} // 状态
|
State any // 状态
|
||||||
AdminId interface{} // 管理员ID
|
AdminId any // 管理员ID
|
||||||
UserId interface{} // 用户ID
|
UserId any // 用户ID
|
||||||
Action interface{} // 执行的动作(过期)
|
Action any // 执行的动作(过期)
|
||||||
ActionOptions interface{} // 动作的选项(过期)
|
ActionOptions any // 动作的选项(过期)
|
||||||
Actions interface{} // 一组动作
|
Actions any // 一组动作
|
||||||
IgnoreLocal interface{} // 忽略局域网请求
|
IgnoreLocal any // 忽略局域网请求
|
||||||
|
IgnoreSearchEngine any // 忽略搜索引擎
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHTTPFirewallRuleSetOperator() *HTTPFirewallRuleSetOperator {
|
func NewHTTPFirewallRuleSetOperator() *HTTPFirewallRuleSetOperator {
|
||||||
|
|||||||
10912
internal/setup/sql.json
10912
internal/setup/sql.json
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user