diff --git a/internal/db/models/http_firewall_rule_set_dao.go b/internal/db/models/http_firewall_rule_set_dao.go index a4a0dec6..67b8a6b0 100644 --- a/internal/db/models/http_firewall_rule_set_dao.go +++ b/internal/db/models/http_firewall_rule_set_dao.go @@ -99,6 +99,7 @@ func (this *HTTPFirewallRuleSetDAO) ComposeFirewallRuleSet(tx *dbs.Tx, setId int config.Description = set.Description config.Code = set.Code config.Connector = set.Connector + config.IgnoreLocal = set.IgnoreLocal == 1 if IsNotNull(set.Rules) { ruleRefs := []*firewallconfigs.HTTPFirewallRuleRef{} @@ -139,6 +140,7 @@ func (this *HTTPFirewallRuleSetDAO) CreateOrUpdateSetFromConfig(tx *dbs.Tx, setC op.Name = setConfig.Name op.Description = setConfig.Description op.Connector = setConfig.Connector + op.IgnoreLocal = setConfig.IgnoreLocal if len(setConfig.Actions) == 0 { op.Actions = "[]" diff --git a/internal/db/models/http_firewall_rule_set_model.go b/internal/db/models/http_firewall_rule_set_model.go index ae6b0521..58372a58 100644 --- a/internal/db/models/http_firewall_rule_set_model.go +++ b/internal/db/models/http_firewall_rule_set_model.go @@ -16,6 +16,7 @@ type HTTPFirewallRuleSet struct { Action string `field:"action"` // 执行的动作(过期) ActionOptions string `field:"actionOptions"` // 动作的选项(过期) Actions string `field:"actions"` // 一组动作 + IgnoreLocal uint8 `field:"ignoreLocal"` // 忽略局域网请求 } type HTTPFirewallRuleSetOperator struct { @@ -33,6 +34,7 @@ type HTTPFirewallRuleSetOperator struct { Action interface{} // 执行的动作(过期) ActionOptions interface{} // 动作的选项(过期) Actions interface{} // 一组动作 + IgnoreLocal interface{} // 忽略局域网请求 } func NewHTTPFirewallRuleSetOperator() *HTTPFirewallRuleSetOperator { diff --git a/internal/rpc/services/service_http_firewall_rule_set.go b/internal/rpc/services/service_http_firewall_rule_set.go index 74287604..1504a254 100644 --- a/internal/rpc/services/service_http_firewall_rule_set.go +++ b/internal/rpc/services/service_http_firewall_rule_set.go @@ -8,12 +8,12 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" ) -// 规则集相关服务 +// HTTPFirewallRuleSetService 规则集相关服务 type HTTPFirewallRuleSetService struct { BaseService } -// 根据配置创建规则集 +// CreateOrUpdateHTTPFirewallRuleSetFromConfig 根据配置创建规则集 func (this *HTTPFirewallRuleSetService) CreateOrUpdateHTTPFirewallRuleSetFromConfig(ctx context.Context, req *pb.CreateOrUpdateHTTPFirewallRuleSetFromConfigRequest) (*pb.CreateOrUpdateHTTPFirewallRuleSetFromConfigResponse, error) { // 校验请求 _, userId, err := this.ValidateAdminAndUser(ctx, 0, 0) @@ -44,7 +44,7 @@ func (this *HTTPFirewallRuleSetService) CreateOrUpdateHTTPFirewallRuleSetFromCon return &pb.CreateOrUpdateHTTPFirewallRuleSetFromConfigResponse{FirewallRuleSetId: setId}, nil } -// 修改是否开启 +// UpdateHTTPFirewallRuleSetIsOn 修改是否开启 func (this *HTTPFirewallRuleSetService) UpdateHTTPFirewallRuleSetIsOn(ctx context.Context, req *pb.UpdateHTTPFirewallRuleSetIsOnRequest) (*pb.RPCSuccess, error) { // 校验请求 _, userId, err := this.ValidateAdminAndUser(ctx, 0, 0) @@ -69,7 +69,7 @@ func (this *HTTPFirewallRuleSetService) UpdateHTTPFirewallRuleSetIsOn(ctx contex return this.Success() } -// 查找规则集配置 +// FindEnabledHTTPFirewallRuleSetConfig 查找规则集配置 func (this *HTTPFirewallRuleSetService) FindEnabledHTTPFirewallRuleSetConfig(ctx context.Context, req *pb.FindEnabledHTTPFirewallRuleSetConfigRequest) (*pb.FindEnabledHTTPFirewallRuleSetConfigResponse, error) { // 校验请求 _, userId, err := this.ValidateAdminAndUser(ctx, 0, 0) @@ -100,7 +100,7 @@ func (this *HTTPFirewallRuleSetService) FindEnabledHTTPFirewallRuleSetConfig(ctx return &pb.FindEnabledHTTPFirewallRuleSetConfigResponse{FirewallRuleSetJSON: configJSON}, nil } -// 查找规则集 +// FindEnabledHTTPFirewallRuleSet 查找规则集 func (this *HTTPFirewallRuleSetService) FindEnabledHTTPFirewallRuleSet(ctx context.Context, req *pb.FindEnabledHTTPFirewallRuleSetRequest) (*pb.FindEnabledHTTPFirewallRuleSetResponse, error) { // 校验请求 _, userId, err := this.ValidateAdminAndUser(ctx, 0, 0)