47 lines
1.6 KiB
Go
47 lines
1.6 KiB
Go
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
|
//go:build plus
|
|
|
|
package nodeconfigs
|
|
|
|
import "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs"
|
|
|
|
func NewUAMPolicy() *UAMPolicy {
|
|
var policy = &UAMPolicy{
|
|
IsOn: true,
|
|
AllowSearchEngines: true,
|
|
IncludeSubdomains: true,
|
|
DenySpiders: true,
|
|
MaxFails: 30,
|
|
BlockSeconds: 1800,
|
|
UITitle: "",
|
|
UIBody: "",
|
|
KeyLife: 3600,
|
|
}
|
|
|
|
policy.Firewall.Scope = firewallconfigs.FirewallScopeGlobal
|
|
return policy
|
|
}
|
|
|
|
type UAMPolicy struct {
|
|
IsOn bool `yaml:"isOn" json:"isOn"`
|
|
AllowSearchEngines bool `yaml:"allowSearchEngines" json:"allowSearchEngines"` // 直接跳过常见搜索引擎
|
|
DenySpiders bool `yaml:"denySpiders" json:"denySpiders"` // 拦截常见爬虫
|
|
MaxFails int `yaml:"maxFails" json:"maxFails"` // 失败尝试次数
|
|
BlockSeconds int `yaml:"blockSeconds" json:"blockSeconds"` // 失败拦截秒数
|
|
IncludeSubdomains bool `yaml:"includeSubdomains" json:"includeSubdomains"` // 是否包含子域名
|
|
|
|
UITitle string `yaml:"uiTitle" json:"uiTitle"` // 页面标题
|
|
UIBody string `yaml:"uiBody" json:"uiBody"` // 页面内容
|
|
|
|
KeyLife int `yaml:"keyLife" json:"keyLife"` // Key有效期
|
|
|
|
// 防火墙策略
|
|
Firewall struct {
|
|
Scope firewallconfigs.FirewallScope `json:"scope" yaml:"scope"`
|
|
} `json:"firewall" yaml:"firewall"`
|
|
}
|
|
|
|
func (this *UAMPolicy) Init() error {
|
|
return nil
|
|
}
|