nodeconfigs

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2022 License: BSD-3-Clause Imports: 17 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DefaultMaxThreads    = 20000   // 单节点最大线程数
	DefaultMaxThreadsMin = 1000    // 单节点最大线程数最小值
	DefaultMaxThreadsMax = 100_000 // 单节点最大线程数最大值

	DefaultTCPMaxConnections      = 100_000 // 单节点TCP最大连接数
	DefaultTCPMaxConnectionsPerIP = 1000    // 单IP最大连接数
	DefaultTCPMinConnectionsPerIP = 5       // 单IP最小连接数

	DefaultTCPNewConnectionsMinutelyRate    = 500 // 单IP连接速率限制(按分钟)
	DefaultTCPNewConnectionsMinMinutelyRate = 3   // 单IP最小连接速率

	DefaultTCPNewConnectionsSecondlyRate    = 300 // 单IP连接速率限制(按秒)
	DefaultTCPNewConnectionsMinSecondlyRate = 3   // 单IP最小连接速率

	DefaultTCPLinger           = 3 // 单节点TCP Linger值
	DefaultTLSHandshakeTimeout = 3 // TLS握手超时时间
)
View Source
const (
	DNSResolverTypeDefault  = "default"
	DNSResolverTypeGoNative = "goNative"
	DNSResolverTypeCGO      = "cgo"
)
View Source
const DefaultProductName = "GoEdge"
View Source
const DefaultTimeZoneLocation = "Asia/Shanghai"

Variables

View Source
var DefaultConfigs = maps.Map{
	"tcpMaxConnections":                DefaultTCPMaxConnections,
	"tcpMaxConnectionsPerIP":           DefaultTCPMaxConnectionsPerIP,
	"tcpMinConnectionsPerIP":           DefaultTCPMinConnectionsPerIP,
	"tcpNewConnectionsMinutelyRate":    DefaultTCPNewConnectionsMinutelyRate,
	"tcpNewConnectionsMinMinutelyRate": DefaultTCPNewConnectionsMinMinutelyRate,
	"tcpNewConnectionsSecondlyRate":    DefaultTCPNewConnectionsSecondlyRate,
	"tcpNewConnectionsMinSecondlyRate": DefaultTCPNewConnectionsMinSecondlyRate,
}
View Source
var DefaultUAMPolicy = &UAMPolicy{
	IsOn:               true,
	AllowSearchEngines: true,
	DenySpiders:        true,
	UITitle:            "",
	UIBody:             "",
}
View Source
var DefaultWebPImagePolicy = &WebPImagePolicy{
	IsOn:         true,
	RequireCache: true,
	MinLength:    shared.NewSizeCapacity(0, shared.SizeCapacityUnitKB),
	MaxLength:    shared.NewSizeCapacity(128, shared.SizeCapacityUnitMB),
}

Functions

func CompareNodeValue

func CompareNodeValue(operator NodeValueOperator, value1 float64, value2 float64) bool

CompareNodeValue 对比值

func FindAllIPAddressThresholdActions

func FindAllIPAddressThresholdActions() []maps.Map

FindAllIPAddressThresholdActions IP相关阈值动作

func FindAllIPAddressThresholdItems

func FindAllIPAddressThresholdItems() []maps.Map

FindAllIPAddressThresholdItems IP相关阈值项目

func FindAllNodeValueItemDefinitions

func FindAllNodeValueItemDefinitions() []*nodeValueItemDefinition

FindAllNodeValueItemDefinitions 获取所有监控项信息

func FindAllNodeValueOperatorDefinitions

func FindAllNodeValueOperatorDefinitions() []*nodeValueOperatorDefinition

FindAllNodeValueOperatorDefinitions 获取所有操作符定义

func FindNodeValueDurationUnitName

func FindNodeValueDurationUnitName(unit NodeValueDurationUnit) string

FindNodeValueDurationUnitName 时间单位名称

func FindNodeValueItemName

func FindNodeValueItemName(code NodeValueItem) string

FindNodeValueItemName 获取监控项名称

func FindNodeValueItemParamName

func FindNodeValueItemParamName(nodeCode NodeValueItem, paramCode string) string

FindNodeValueItemParamName 获取监控项某个参数的名称

func FindNodeValueOperatorName

func FindNodeValueOperatorName(operator NodeValueOperator) string

FindNodeValueOperatorName 操作符名称

func FindNodeValueSumMethodName

func FindNodeValueSumMethodName(method NodeValueSumMethod) string

FindNodeValueSumMethodName 聚合方法名称

func ResetNodeConfig

func ResetNodeConfig(nodeConfig *NodeConfig)

ResetNodeConfig 重置节点配置

func UnmarshalNodeValue

func UnmarshalNodeValue(valueJSON []byte) string

UnmarshalNodeValue 对值进行解码

Types

type Connectivity

type Connectivity struct {
	CostMs    float64                     `json:"costMs"`    // 平均耗时
	Level     reporterconfigs.ReportLevel `json:"level"`     // 级别
	Percent   float64                     `json:"percent"`   // 连通的百分比,是一个0到100之间的小数
	UpdatedAt int64                       `json:"updatedAt"` // 更新时间
}

Connectivity 连通性状态

type DNSResolverConfig

type DNSResolverConfig struct {
	Type string `yaml:"type" json:"type"` // 使用Go语言内置的DNS解析器
}

func DefaultDNSResolverConfig

func DefaultDNSResolverConfig() *DNSResolverConfig

func (*DNSResolverConfig) Init

func (this *DNSResolverConfig) Init() error

type DNSResolverType

type DNSResolverType = string

type IPAddressThresholdAction

type IPAddressThresholdAction = string

IPAddressThresholdAction 动作

const (
	IPAddressThresholdActionUp      IPAddressThresholdAction = "up"      // 上线
	IPAddressThresholdActionDown    IPAddressThresholdAction = "down"    // 下线
	IPAddressThresholdActionNotify  IPAddressThresholdAction = "notify"  // 通知
	IPAddressThresholdActionSwitch  IPAddressThresholdAction = "switch"  // 切换到备用IP
	IPAddressThresholdActionWebHook IPAddressThresholdAction = "webHook" // 调用外部Webhook
)

type IPAddressThresholdActionConfig

type IPAddressThresholdActionConfig struct {
	Action  string   `json:"action"`
	Options maps.Map `json:"options"`
}

type IPAddressThresholdConfig

type IPAddressThresholdConfig struct {
	Id      int64                             `json:"id"`
	Items   []*IPAddressThresholdItemConfig   `json:"items"`
	Actions []*IPAddressThresholdActionConfig `json:"actions"`
}

IPAddressThresholdConfig 阈值列表

type IPAddressThresholdItem

type IPAddressThresholdItem = string
const (
	IPAddressThresholdItemNodeAvgRequests      IPAddressThresholdItem = "nodeAvgRequests"      // 个
	IPAddressThresholdItemNodeAvgTrafficOut    IPAddressThresholdItem = "nodeAvgTrafficOut"    // 节点下行流量 M
	IPAddressThresholdItemNodeAvgTrafficIn     IPAddressThresholdItem = "nodeAvgTrafficIn"     // 节点上行流量 M
	IPAddressThresholdItemNodeHealthCheck      IPAddressThresholdItem = "nodeHealthCheck"      // 节点健康检查结果
	IPAddressThresholdItemGroupAvgRequests     IPAddressThresholdItem = "groupAvgRequests"     // 个
	IPAddressThresholdItemGroupAvgTrafficIn    IPAddressThresholdItem = "groupAvgTrafficIn"    // 分组上行流量 M
	IPAddressThresholdItemGroupAvgTrafficOut   IPAddressThresholdItem = "groupAvgTrafficOut"   // 分组下行流量 M
	IPAddressThresholdItemClusterAvgRequests   IPAddressThresholdItem = "clusterAvgRequests"   // 个
	IPAddressThresholdItemClusterAvgTrafficIn  IPAddressThresholdItem = "clusterAvgTrafficIn"  // 集群上行流量 M
	IPAddressThresholdItemClusterAvgTrafficOut IPAddressThresholdItem = "clusterAvgTrafficOut" // 集群下行流量 M
	IPAddressThresholdItemConnectivity         IPAddressThresholdItem = "connectivity"         // 0-100
)

type IPAddressThresholdItemConfig

type IPAddressThresholdItemConfig struct {
	Item         IPAddressThresholdItem `json:"item"`
	Operator     NodeValueOperator      `json:"operator"`
	Value        float64                `json:"value"`
	Duration     int                    `json:"duration"`
	DurationUnit NodeValueDurationUnit  `json:"durationUnit"`
	Options      maps.Map               `json:"options"` // 附加选项
}

IPAddressThresholdItemConfig 阈值项目

type NodeConfig

type NodeConfig struct {
	Id           int64                         `yaml:"id" json:"id"`
	NodeId       string                        `yaml:"nodeId" json:"nodeId"`
	Secret       string                        `yaml:"secret" json:"secret"`
	IsOn         bool                          `yaml:"isOn" json:"isOn"`
	Servers      []*serverconfigs.ServerConfig `yaml:"servers" json:"servers"`
	SupportCNAME bool                          `yaml:"supportCNAME" json:"supportCNAME"`
	Version      int64                         `yaml:"version" json:"version"`
	Name         string                        `yaml:"name" json:"name"`
	GroupId      int64                         `yaml:"groupId" json:"groupId"`
	RegionId     int64                         `yaml:"regionId" json:"regionId"`
	OCSPVersion  int64                         `yaml:"ocspVersion" json:"ocspVersion"`

	// 性能
	MaxCPU                 int32                         `yaml:"maxCPU" json:"maxCPU"`
	CacheDiskDir           string                        `yaml:"cacheDiskDir" json:"cacheDiskDir"`                     // 文件缓存目录
	MaxCacheDiskCapacity   *shared.SizeCapacity          `yaml:"maxCacheDiskCapacity" json:"maxCacheDiskCapacity"`     // 文件缓存容量
	MaxCacheMemoryCapacity *shared.SizeCapacity          `yaml:"maxCacheMemoryCapacity" json:"maxCacheMemoryCapacity"` // 内容缓存容量
	MaxThreads             int                           `yaml:"maxThreads" json:"maxThreads"`                         // 最大线程数
	DDoSProtection         *ddosconfigs.ProtectionConfig `yaml:"ddosProtection" json:"ddosProtection"`

	// 级别
	Level       int32                         `yaml:"level" json:"level"`
	ParentNodes map[int64][]*ParentNodeConfig `yaml:"parentNodes" json:"parentNodes"` // clusterId => []*ParentNodeConfig

	// 全局配置
	GlobalConfig  *serverconfigs.GlobalConfig `yaml:"globalConfig" json:"globalConfig"` // 全局配置
	ProductConfig *ProductConfig              `yaml:"productConfig" json:"productConfig"`

	// 集群统一配置
	HTTPFirewallPolicies []*firewallconfigs.HTTPFirewallPolicy   `yaml:"httpFirewallPolicies" json:"httpFirewallPolicies"`
	HTTPCachePolicies    []*serverconfigs.HTTPCachePolicy        `yaml:"httpCachePolicies" json:"httpCachePolicies"`
	TOA                  *TOAConfig                              `yaml:"toa" json:"toa"`
	SystemServices       map[string]maps.Map                     `yaml:"systemServices" json:"systemServices"` // 系统服务配置 type => params
	FirewallActions      []*firewallconfigs.FirewallActionConfig `yaml:"firewallActions" json:"firewallActions"`
	TimeZone             string                                  `yaml:"timeZone" json:"timeZone"`
	AutoOpenPorts        bool                                    `yaml:"autoOpenPorts" json:"autoOpenPorts"`

	// 指标
	MetricItems []*serverconfigs.MetricItemConfig `yaml:"metricItems" json:"metricItems"`

	// 自动白名单
	AllowedIPs []string `yaml:"allowedIPs" json:"allowedIPs"`

	// 脚本
	CommonScripts []*serverconfigs.CommonScript `yaml:"commonScripts" json:"commonScripts"`

	// WebP
	WebPImagePolicies map[int64]*WebPImagePolicy `yaml:"webpImagePolicies" json:"webpImagePolicies"` // clusterId => *WebPImagePolicy

	// UAM相关配置
	UAMPolicies map[int64]*UAMPolicy `yaml:"uamPolicies" yaml:"uamPolicies" json:"uamPolicies"` // clusterId => *UAMPolicy

	// DNS
	DNSResolver *DNSResolverConfig `yaml:"dnsResolver" json:"dnsResolver"`
	// contains filtered or unexported fields
}

NodeConfig 边缘节点配置

func CloneNodeConfig

func CloneNodeConfig(nodeConfig *NodeConfig) (*NodeConfig, error)

CloneNodeConfig 复制节点配置

func SharedNodeConfig

func SharedNodeConfig() (*NodeConfig, error)

SharedNodeConfig 取得当前节点配置单例

func (*NodeConfig) AddServer

func (this *NodeConfig) AddServer(server *serverconfigs.ServerConfig)

AddServer 添加服务

func (*NodeConfig) AvailableGroups

func (this *NodeConfig) AvailableGroups() []*serverconfigs.ServerAddressGroup

AvailableGroups 根据网络地址和协议分组

func (*NodeConfig) FindAllFirewallPolicies

func (this *NodeConfig) FindAllFirewallPolicies() []*firewallconfigs.HTTPFirewallPolicy

FindAllFirewallPolicies 获取所有的防火墙策略

func (*NodeConfig) FindOrigin

func (this *NodeConfig) FindOrigin(originId int64) *serverconfigs.OriginConfig

FindOrigin 读取源站配置

func (*NodeConfig) FindUAMPolicyWithClusterId added in v0.4.9

func (this *NodeConfig) FindUAMPolicyWithClusterId(clusterId int64) *UAMPolicy

FindUAMPolicyWithClusterId 使用集群ID查找UAM策略

func (*NodeConfig) FindWebPImagePolicyWithClusterId

func (this *NodeConfig) FindWebPImagePolicyWithClusterId(clusterId int64) *WebPImagePolicy

FindWebPImagePolicyWithClusterId 使用集群ID查找WebP策略

func (*NodeConfig) HasHTTPConnectionMetrics

func (this *NodeConfig) HasHTTPConnectionMetrics() bool

HasHTTPConnectionMetrics 是否含有HTTP连接数的指标

func (*NodeConfig) IPIsAutoAllowed

func (this *NodeConfig) IPIsAutoAllowed(ip string) bool

IPIsAutoAllowed 检查是否自动允许某个IP

func (*NodeConfig) Init

func (this *NodeConfig) Init() (err error, serverErrors []*ServerError)

Init 初始化

func (*NodeConfig) PaddedId

func (this *NodeConfig) PaddedId() string

PaddedId 获取填充后的ID

func (*NodeConfig) RemoveServer

func (this *NodeConfig) RemoveServer(serverId int64)

RemoveServer 删除服务

func (*NodeConfig) SYNFloodConfig

func (this *NodeConfig) SYNFloodConfig() *firewallconfigs.SYNFloodConfig

SYNFloodConfig 获取SYN Flood配置

func (*NodeConfig) Save

func (this *NodeConfig) Save() error

Save 写入到文件

func (*NodeConfig) SecretHash

func (this *NodeConfig) SecretHash() string

SecretHash 对Id和Secret的Hash计算

func (*NodeConfig) UpdateCertOCSP

func (this *NodeConfig) UpdateCertOCSP(certId int64, ocsp []byte, expiresAt int64)

UpdateCertOCSP 修改证书OCSP

type NodeIPAddr

type NodeIPAddr struct {
	Id        int64  `json:"id"`
	Name      string `json:"name"`
	IP        string `json:"ip"`
	IsOn      bool   `json:"isOn"`
	IsUp      bool   `json:"isUp"`
	CanAccess bool   `json:"canAccess"`
}

type NodeLevel

type NodeLevel struct {
	Name        string `yaml:"name" json:"name"`
	Code        int    `yaml:"code" json:"code"`
	Description string `yaml:"description" json:"description"`
}

func FindAllNodeLevels

func FindAllNodeLevels() []*NodeLevel

func FindNodeLevel

func FindNodeLevel(level int) *NodeLevel

type NodeLogType

type NodeLogType = string
const (
	NodeLogTypeListenAddressFailed    NodeLogType = "listenAddressFailed"
	NodeLogTypeServerConfigInitFailed NodeLogType = "serverConfigInitFailed"
	NodeLogTypeRunScriptFailed        NodeLogType = "runScriptFailed"
	NodeLogTypeScriptConsoleLog       NodeLogType = "scriptConsoleLog"
)

type NodeRole

type NodeRole = string
const (
	NodeRoleAdmin     NodeRole = "admin"
	NodeRoleUser      NodeRole = "user"
	NodeRoleProvider  NodeRole = "provider"
	NodeRoleAPI       NodeRole = "api"
	NodeRoleDatabase  NodeRole = "database"
	NodeRoleLog       NodeRole = "log"
	NodeRoleDNS       NodeRole = "dns"
	NodeRoleMonitor   NodeRole = "monitor"
	NodeRoleNode      NodeRole = "node"
	NodeRoleCluster   NodeRole = "cluster"
	NodeRoleAuthority NodeRole = "authority"
	NodeRoleReport    NodeRole = "report"
)

type NodeStatus

type NodeStatus struct {
	BuildVersion     string `json:"buildVersion"`     // 编译版本
	BuildVersionCode uint32 `json:"buildVersionCode"` // 版本数字
	ConfigVersion    int64  `json:"configVersion"`    // 节点配置版本

	OS                    string  `json:"os"`
	Arch                  string  `json:"arch"`
	Hostname              string  `json:"hostname"`
	HostIP                string  `json:"hostIP"`
	CPUUsage              float64 `json:"cpuUsage"`
	CPULogicalCount       int     `json:"cpuLogicalCount"`
	CPUPhysicalCount      int     `json:"cpuPhysicalCount"`
	MemoryUsage           float64 `json:"memoryUsage"`
	MemoryTotal           uint64  `json:"memoryTotal"`
	DiskUsage             float64 `json:"diskUsage"`
	DiskMaxUsage          float64 `json:"diskMaxUsage"`
	DiskMaxUsagePartition string  `json:"diskMaxUsagePartition"`
	DiskTotal             uint64  `json:"diskTotal"`
	UpdatedAt             int64   `json:"updatedAt"`
	Timestamp             int64   `json:"timestamp"` // 当前节点时间戳
	Load1m                float64 `json:"load1m"`
	Load5m                float64 `json:"load5m"`
	Load15m               float64 `json:"load15m"`
	ConnectionCount       int     `json:"connectionCount"` // 连接数
	ExePath               string  `json:"exePath"`         // 可执行文件路径

	TrafficInBytes  uint64 `json:"trafficInBytes"`
	TrafficOutBytes uint64 `json:"trafficOutBytes"`

	CacheTotalDiskSize   int64 `json:"cacheTotalDiskSize"`
	CacheTotalMemorySize int64 `json:"cacheTotalMemorySize"`

	LocalFirewallName string `json:"localFirewallName"`

	IsActive bool   `json:"isActive"`
	Error    string `json:"error"`
}

NodeStatus 节点状态

type NodeValueDurationUnit

type NodeValueDurationUnit = string

NodeValueDurationUnit 时间单位

const (
	NodeValueDurationUnitMinute NodeValueDurationUnit = "minute"
)

type NodeValueItem

type NodeValueItem = string

NodeValueItem 监控项

const (
	NodeValueItemCPU            NodeValueItem = "cpu"            // CPU
	NodeValueItemMemory         NodeValueItem = "memory"         // 内存
	NodeValueItemLoad           NodeValueItem = "load"           // 负载
	NodeValueItemTrafficIn      NodeValueItem = "trafficIn"      // 上行流量
	NodeValueItemTrafficOut     NodeValueItem = "trafficOut"     // 下行流量
	NodeValueItemConnections    NodeValueItem = "connections"    // 连接数
	NodeValueItemRequests       NodeValueItem = "requests"       // 请求访问量
	NodeValueItemAttackRequests NodeValueItem = "attackRequests" // 攻击请求访问量
	NodeValueItemDisk           NodeValueItem = "disk"           // 磁盘
	NodeValueItemCacheDir       NodeValueItem = "cacheDir"       // 缓存目录
)

type NodeValueOperator

type NodeValueOperator = string

NodeValueOperator 操作符

const (
	NodeValueOperatorGt  NodeValueOperator = "gt"  // 大于
	NodeValueOperatorGte NodeValueOperator = "gte" // 大于等于
	NodeValueOperatorLt  NodeValueOperator = "lt"  // 小于
	NodeValueOperatorLte NodeValueOperator = "lte" // 小于等于
	NodeValueOperatorEq  NodeValueOperator = "eq"  // 等于
	NodeValueOperatorNeq NodeValueOperator = "neq" // 不等于
)

type NodeValueRange

type NodeValueRange = string

NodeValueRange 值范围

const (
	NodeValueRangeMinute NodeValueRange = "minute"
)

type NodeValueSumMethod

type NodeValueSumMethod = string

NodeValueSumMethod 聚合方法

const (
	NodeValueSumMethodSum NodeValueSumMethod = "sum" // 相加
	NodeValueSumMethodAvg NodeValueSumMethod = "avg" // 平均
)

type ParentNodeConfig

type ParentNodeConfig struct {
	Id         int64    `yaml:"id" json:"id"`
	Addrs      []string `yaml:"addrs" json:"addrs"`
	SecretHash string   `yaml:"secretHash" json:"secretHash"`
}

ParentNodeConfig 父级节点配置

type ProductConfig

type ProductConfig struct {
	Name    string `yaml:"name" json:"name"`
	Version string `yaml:"version" json:"version"`
}

ProductConfig 产品相关设置

type ServerError

type ServerError struct {
	Id      int64
	Message string
}

func NewServerError

func NewServerError(serverId int64, message string) *ServerError

type SystemServiceType

type SystemServiceType = string
const (
	// TODO 需要支持supervisor等常用daemon管理工具
	SystemServiceTypeSystemd SystemServiceType = "systemd"
)

type SystemdServiceConfig

type SystemdServiceConfig struct {
	IsOn             bool   `yaml:"isOn" json:"isOn"`                         // 是否启用
	Provides         string `yaml:"provides" json:"provides"`                 // 提供者,可以是服务名
	ShortDescription string `yaml:"shortDescription" json:"shortDescription"` // 短描述
	Description      string `yaml:"description" json:"description"`           // 长描述
	ExecPath         string `yaml:"execPath" json:"execPath"`                 // 可执行文件的路径
}

Systemd配置

type TOAConfig

type TOAConfig struct {
	IsOn         bool     `yaml:"isOn" json:"isOn"` // 是否启用
	Debug        bool     `yaml:"debug" json:"debug"`
	OptionType   uint8    `yaml:"optionType" json:"optionType"`
	MinQueueId   uint8    `yaml:"minQueueId" json:"minQueueId"`
	MaxQueueId   uint8    `yaml:"maxQueueId" json:"maxQueueId"`
	AutoSetup    bool     `yaml:"autoSetup" json:"autoSetup"`
	MinLocalPort uint16   `yaml:"minLocalPort" json:"minLocalPort"` // 本地可使用的最小端口 TODO
	MaxLocalPort uint16   `yaml:"maxLocalPort" json:"maxLocalPort"` // 本地可使用的最大端口 TODO
	SockPath     string   `yaml:"sockPath" json:"sockPath"`         // Sock文件路径 TODO
	ByPassPorts  []uint16 `yaml:"byPassPorts" json:"byPassPorts"`   // 忽略的端口 TODO
	// contains filtered or unexported fields
}

TOA相关配置

func DefaultTOAConfig

func DefaultTOAConfig() *TOAConfig

默认的TOA配置

func (*TOAConfig) AsArgs

func (this *TOAConfig) AsArgs() (args []string)

转换为参数的形式

func (*TOAConfig) Init

func (this *TOAConfig) Init() error

func (*TOAConfig) RandLocalPort

func (this *TOAConfig) RandLocalPort() uint16

获取随机端口

func (*TOAConfig) SockFile

func (this *TOAConfig) SockFile() string

Sock路径

type TimeZoneGroup

type TimeZoneGroup struct {
	Name string            `json:"name"`
	Code TimeZoneGroupCode `json:"code"`
}

func FindAllTimeZoneGroups

func FindAllTimeZoneGroups() []*TimeZoneGroup

type TimeZoneGroupCode

type TimeZoneGroupCode = string
const (
	TimeZoneGroupCodeAfrica       TimeZoneGroupCode = "africa"
	TimeZoneGroupCodeEurope       TimeZoneGroupCode = "europe"
	TimeZoneGroupCodeNorthAmerica TimeZoneGroupCode = "northamerica"
	TimeZoneGroupCodeSouthAmerica TimeZoneGroupCode = "southamerica"
	TimeZoneGroupCodeAntarctica   TimeZoneGroupCode = "antarctica"
	TimeZoneGroupCodeAustralasia  TimeZoneGroupCode = "australasia"
	TimeZoneGroupCodeAsia         TimeZoneGroupCode = "asia"
	TimeZoneGroupCodeUTC          TimeZoneGroupCode = "utc"
)

type TimeZoneLocation

type TimeZoneLocation struct {
	Name        string            `json:"name"`
	Offset      string            `json:"offset"`
	Group       TimeZoneGroupCode `json:"group"`
	IsCanonical bool              `json:"isCanonical"`
}

func FindAllTimeZoneLocations

func FindAllTimeZoneLocations() []*TimeZoneLocation

func FindTimeZoneLocation

func FindTimeZoneLocation(name string) *TimeZoneLocation

type UAMPolicy added in v0.4.9

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 (*UAMPolicy) Init added in v0.4.9

func (this *UAMPolicy) Init() error

type WebPImagePolicy

type WebPImagePolicy struct {
	IsOn         bool                 `yaml:"isOn" json:"isOn"`                 // 是否启用
	RequireCache bool                 `yaml:"requireCache" json:"requireCache"` // 需要在缓存条件下进行
	MinLength    *shared.SizeCapacity `yaml:"minLength" json:"minLength"`       // 最小压缩对象比如4m, 24k
	MaxLength    *shared.SizeCapacity `yaml:"maxLength" json:"maxLength"`       // 最大压缩对象
	// contains filtered or unexported fields
}

WebPImagePolicy WebP策略

func (*WebPImagePolicy) Init

func (this *WebPImagePolicy) Init() error

func (*WebPImagePolicy) MaxLengthBytes

func (this *WebPImagePolicy) MaxLengthBytes() int64

func (*WebPImagePolicy) MinLengthBytes

func (this *WebPImagePolicy) MinLengthBytes() int64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL