mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-17 07:30:25 +08:00
增加UAM(5秒盾)集群设置
This commit is contained in:
5837
build/rpc.json
5837
build/rpc.json
File diff suppressed because it is too large
Load Diff
@@ -78,6 +78,9 @@ type NodeConfig struct {
|
|||||||
// WebP
|
// WebP
|
||||||
WebPImagePolicies map[int64]*WebPImagePolicy `yaml:"webpImagePolicies" json:"webpImagePolicies"` // clusterId => *WebPImagePolicy
|
WebPImagePolicies map[int64]*WebPImagePolicy `yaml:"webpImagePolicies" json:"webpImagePolicies"` // clusterId => *WebPImagePolicy
|
||||||
|
|
||||||
|
// UAM相关配置
|
||||||
|
UAMPolicies map[int64]*UAMPolicy `yaml:"uamPolicies" yaml:"uamPolicies" json:"uamPolicies"` // clusterId => *UAMPolicy
|
||||||
|
|
||||||
// DNS
|
// DNS
|
||||||
DNSResolver *DNSResolverConfig `yaml:"dnsResolver" json:"dnsResolver"`
|
DNSResolver *DNSResolverConfig `yaml:"dnsResolver" json:"dnsResolver"`
|
||||||
|
|
||||||
@@ -310,6 +313,16 @@ func (this *NodeConfig) Init() (err error, serverErrors []*ServerError) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// uam policy
|
||||||
|
if this.UAMPolicies != nil {
|
||||||
|
for _, policy := range this.UAMPolicies {
|
||||||
|
err = policy.Init()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// dns resolver
|
// dns resolver
|
||||||
if this.DNSResolver != nil {
|
if this.DNSResolver != nil {
|
||||||
err = this.DNSResolver.Init()
|
err = this.DNSResolver.Init()
|
||||||
@@ -508,6 +521,14 @@ func (this *NodeConfig) FindWebPImagePolicyWithClusterId(clusterId int64) *WebPI
|
|||||||
return this.WebPImagePolicies[clusterId]
|
return this.WebPImagePolicies[clusterId]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FindUAMPolicyWithClusterId 使用集群ID查找UAM策略
|
||||||
|
func (this *NodeConfig) FindUAMPolicyWithClusterId(clusterId int64) *UAMPolicy {
|
||||||
|
if this.UAMPolicies == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return this.UAMPolicies[clusterId]
|
||||||
|
}
|
||||||
|
|
||||||
// SecretHash 对Id和Secret的Hash计算
|
// SecretHash 对Id和Secret的Hash计算
|
||||||
func (this *NodeConfig) SecretHash() string {
|
func (this *NodeConfig) SecretHash() string {
|
||||||
return this.secretHash
|
return this.secretHash
|
||||||
|
|||||||
28
pkg/nodeconfigs/uam_policy.go
Normal file
28
pkg/nodeconfigs/uam_policy.go
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package nodeconfigs
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
_ = DefaultUAMPolicy.Init()
|
||||||
|
}
|
||||||
|
|
||||||
|
var DefaultUAMPolicy = &UAMPolicy{
|
||||||
|
IsOn: true,
|
||||||
|
AllowSearchEngines: true,
|
||||||
|
DenySpiders: true,
|
||||||
|
UITitle: "",
|
||||||
|
UIBody: "",
|
||||||
|
}
|
||||||
|
|
||||||
|
type UAMPolicy struct {
|
||||||
|
IsOn bool `yaml:"isOn" json:"isOn"`
|
||||||
|
AllowSearchEngines bool `yaml:"allowSearchEngines" json:"allowSearchEngines"` // 直接跳过常见搜索引擎
|
||||||
|
DenySpiders bool `yaml:"denySpiders" json:"denySpiders"` // 拦截常见爬虫
|
||||||
|
|
||||||
|
UITitle string `yaml:"uiTitle" json:"uiTitle"` // 页面标题
|
||||||
|
UIBody string `yaml:"uiBody" json:"uiBody"` // 页面内容
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UAMPolicy) Init() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -123,6 +123,12 @@ service NodeClusterService {
|
|||||||
// 设置集群WebP策略
|
// 设置集群WebP策略
|
||||||
rpc updateNodeClusterWebPPolicy(UpdateNodeClusterWebPPolicyRequest) returns (RPCSuccess);
|
rpc updateNodeClusterWebPPolicy(UpdateNodeClusterWebPPolicyRequest) returns (RPCSuccess);
|
||||||
|
|
||||||
|
// 读取集群的UAM策略
|
||||||
|
rpc findEnabledNodeClusterUAMPolicy(FindEnabledNodeClusterUAMPolicyRequest) returns (FindEnabledNodeClusterUAMPolicyResponse);
|
||||||
|
|
||||||
|
// 设置集群的UAM策略
|
||||||
|
rpc updateNodeClusterUAMPolicy(UpdateNodeClusterUAMPolicyRequest) returns (RPCSuccess);
|
||||||
|
|
||||||
// 获取集群的DDoS设置
|
// 获取集群的DDoS设置
|
||||||
rpc findNodeClusterDDoSProtection(FindNodeClusterDDoSProtectionRequest) returns (FindNodeClusterDDoSProtectionResponse);
|
rpc findNodeClusterDDoSProtection(FindNodeClusterDDoSProtectionRequest) returns (FindNodeClusterDDoSProtectionResponse);
|
||||||
|
|
||||||
@@ -435,6 +441,7 @@ message FindEnabledNodeClusterConfigInfoResponse {
|
|||||||
bool isTOAEnabled = 5;
|
bool isTOAEnabled = 5;
|
||||||
bool hasMetricItems = 6;
|
bool hasMetricItems = 6;
|
||||||
bool webpIsOn = 7;
|
bool webpIsOn = 7;
|
||||||
|
bool uamIsOn = 10;
|
||||||
bool hasSystemServices = 8;
|
bool hasSystemServices = 8;
|
||||||
bool hasDDoSProtection = 9;
|
bool hasDDoSProtection = 9;
|
||||||
}
|
}
|
||||||
@@ -460,6 +467,21 @@ message UpdateNodeClusterWebPPolicyRequest {
|
|||||||
bytes webpPolicyJSON = 2;
|
bytes webpPolicyJSON = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 读取集群的UAM策略
|
||||||
|
message FindEnabledNodeClusterUAMPolicyRequest {
|
||||||
|
int64 nodeClusterId = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FindEnabledNodeClusterUAMPolicyResponse {
|
||||||
|
bytes uamPolicyJSON = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置集群的UAM策略
|
||||||
|
message UpdateNodeClusterUAMPolicyRequest {
|
||||||
|
int64 nodeClusterId = 1;
|
||||||
|
bytes uamPolicyJSON = 2;
|
||||||
|
}
|
||||||
|
|
||||||
// 获取集群的DDoS设置
|
// 获取集群的DDoS设置
|
||||||
message FindNodeClusterDDoSProtectionRequest {
|
message FindNodeClusterDDoSProtectionRequest {
|
||||||
int64 nodeClusterId = 1;
|
int64 nodeClusterId = 1;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
package serverconfigs
|
package serverconfigs
|
||||||
|
|
||||||
|
// UAMConfig UAM配置
|
||||||
type UAMConfig struct {
|
type UAMConfig struct {
|
||||||
IsPrior bool `yaml:"isPrior" json:"isPrior"`
|
IsPrior bool `yaml:"isPrior" json:"isPrior"`
|
||||||
IsOn bool `yaml:"isOn" json:"isOn"`
|
IsOn bool `yaml:"isOn" json:"isOn"`
|
||||||
|
|||||||
Reference in New Issue
Block a user