Documentation ¶
Index ¶
- Constants
- Variables
- func CheckNodeValueItemParamIsPercent(nodeCode NodeValueItem, paramCode string) bool
- func CompareNodeValue(operator NodeValueOperator, value1 float64, value2 float64) bool
- func FindAllIPAddressThresholdActions() []maps.Map
- func FindAllIPAddressThresholdItems() []maps.Map
- func FindAllNodeValueItemDefinitions() []*nodeValueItemDefinition
- func FindAllNodeValueOperatorDefinitions() []*nodeValueOperatorDefinition
- func FindNodeValueDurationUnitName(unit NodeValueDurationUnit) string
- func FindNodeValueItemName(code NodeValueItem) string
- func FindNodeValueItemParamName(nodeCode NodeValueItem, paramCode string) string
- func FindNodeValueOperatorName(operator NodeValueOperator) string
- func FindNodeValueSumMethodName(method NodeValueSumMethod) string
- func ResetNodeConfig(nodeConfig *NodeConfig)
- func UnmarshalNodeValue(valueJSON []byte) string
- type ClockConfig
- type Connectivity
- type DNSResolverConfig
- type DNSResolverType
- type HTTP3Policy
- type HTTPCCPolicy
- type HTTPPagesPolicy
- type IPAddressThresholdAction
- type IPAddressThresholdActionConfig
- type IPAddressThresholdConfig
- type IPAddressThresholdItem
- type IPAddressThresholdItemConfig
- type NetworkSecurityPolicy
- type NetworkSecurityStatus
- type NodeConfig
- func (this *NodeConfig) AddServer(server *serverconfigs.ServerConfig)
- func (this *NodeConfig) AvailableGroups() []*serverconfigs.ServerAddressGroup
- func (this *NodeConfig) FindAllFirewallPolicies() []*firewallconfigs.HTTPFirewallPolicy
- func (this *NodeConfig) FindAllPlans() map[int64]*serverconfigs.PlanConfig
- func (this *NodeConfig) FindHTTP3PolicyWithClusterId(clusterId int64) *HTTP3Policy
- func (this *NodeConfig) FindHTTP3Ports() (ports []int)
- func (this *NodeConfig) FindHTTPCCPolicyWithClusterId(clusterId int64) *HTTPCCPolicy
- func (this *NodeConfig) FindHTTPPagesPolicyWithClusterId(clusterId int64) *HTTPPagesPolicy
- func (this *NodeConfig) FindOrigin(originId int64) *serverconfigs.OriginConfig
- func (this *NodeConfig) FindPlan(planId int64) *serverconfigs.PlanConfig
- func (this *NodeConfig) FindUAMPolicyWithClusterId(clusterId int64) *UAMPolicy
- func (this *NodeConfig) FindWebPImagePolicyWithClusterId(clusterId int64) *WebPImagePolicy
- func (this *NodeConfig) HTTP3Group() *serverconfigs.ServerAddressGroup
- func (this *NodeConfig) HasConnTimeoutSettings() bool
- func (this *NodeConfig) HasHTTPConnectionMetrics() bool
- func (this *NodeConfig) IPIsAutoAllowed(ip string) bool
- func (this *NodeConfig) Init(ctx context.Context) (err error, serverErrors []*ServerError)
- func (this *NodeConfig) PaddedId() string
- func (this *NodeConfig) RemoveServer(serverId int64)
- func (this *NodeConfig) SYNFloodConfig() *firewallconfigs.SYNFloodConfig
- func (this *NodeConfig) Save() error
- func (this *NodeConfig) SecretHash() string
- func (this *NodeConfig) UpdateCertOCSP(certId int64, ocsp []byte, expiresAt int64)
- func (this *NodeConfig) UpdateHTTP3Policies(policies map[int64]*HTTP3Policy)
- func (this *NodeConfig) UpdateHTTPCCPolicies(policies map[int64]*HTTPCCPolicy)
- func (this *NodeConfig) UpdateHTTPPagesPolicies(policies map[int64]*HTTPPagesPolicy)
- func (this *NodeConfig) UpdatePlans(planMap map[int64]*serverconfigs.PlanConfig)
- func (this *NodeConfig) UpdateUAMPolicies(policies map[int64]*UAMPolicy)
- func (this *NodeConfig) UpdateWebPImagePolicies(policies map[int64]*WebPImagePolicy)
- type NodeIPAddr
- type NodeLevel
- type NodeLogType
- type NodeRole
- type NodeStatus
- type NodeValueDurationUnit
- type NodeValueItem
- type NodeValueOperator
- type NodeValueRange
- type NodeValueSumMethod
- type ParentNodeConfig
- type ProductConfig
- type SSHParams
- type ServerError
- type SystemServiceType
- type SystemdServiceConfig
- type TOAConfig
- type TimeZoneGroup
- type TimeZoneGroupCode
- type TimeZoneLocation
- type UAMPolicy
- type WebPImagePolicy
Constants ¶
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 = 5 // 单节点TCP Linger值 DefaultTLSHandshakeTimeout = 3 // TLS握手超时时间 )
const ( DNSResolverTypeDefault = "default" DNSResolverTypeGoNative = "goNative" DNSResolverTypeCGO = "cgo" )
const DefaultHTTP3Port = 443
const DefaultProductName = "GoEdge"
const DefaultTimeZoneLocation = "Asia/Shanghai"
Variables ¶
var DefaultConfigs = maps.Map{ "tcpMaxConnections": DefaultTCPMaxConnections, "tcpMaxConnectionsPerIP": DefaultTCPMaxConnectionsPerIP, "tcpMinConnectionsPerIP": DefaultTCPMinConnectionsPerIP, "tcpNewConnectionsMinutelyRate": DefaultTCPNewConnectionsMinutelyRate, "tcpNewConnectionsMinMinutelyRate": DefaultTCPNewConnectionsMinMinutelyRate, "tcpNewConnectionsSecondlyRate": DefaultTCPNewConnectionsSecondlyRate, "tcpNewConnectionsMinSecondlyRate": DefaultTCPNewConnectionsMinSecondlyRate, }
var DefaultWebPImagePolicy = NewWebPImagePolicy()
Functions ¶
func CheckNodeValueItemParamIsPercent ¶ added in v1.3.0
func CheckNodeValueItemParamIsPercent(nodeCode NodeValueItem, paramCode string) bool
CheckNodeValueItemParamIsPercent 判断监控项某个参数是否支持百分比
func CompareNodeValue ¶
func CompareNodeValue(operator NodeValueOperator, value1 float64, value2 float64) bool
CompareNodeValue 对比值
func FindAllIPAddressThresholdActions ¶
FindAllIPAddressThresholdActions IP相关阈值动作
func FindAllIPAddressThresholdItems ¶
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 UnmarshalNodeValue ¶
UnmarshalNodeValue 对值进行解码
Types ¶
type ClockConfig ¶ added in v0.5.3
type ClockConfig struct { AutoSync bool `yaml:"autoSync" json:"autoSync"` // 自动尝试同步时钟 Server string `yaml:"server" json:"server"` // 时钟同步服务器 CheckChrony bool `yaml:"checkChrony" json:"checkChrony"` // 检查 chronyd 是否在运行 }
ClockConfig 时钟相关配置
func DefaultClockConfig ¶ added in v0.5.3
func DefaultClockConfig() *ClockConfig
func (*ClockConfig) Init ¶ added in v0.5.3
func (this *ClockConfig) Init() error
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 HTTP3Policy ¶ added in v1.2.0
type HTTP3Policy struct { IsOn bool `yaml:"isOn" json:"isOn"` Port int `yaml:"port" json:"port"` SupportMobileBrowsers bool `yaml:"supportMobileBrowsers" json:"supportMobileBrowsers"` // enable http/3 on common mobile browsers }
func NewHTTP3Policy ¶ added in v1.2.0
func NewHTTP3Policy() *HTTP3Policy
func (*HTTP3Policy) Init ¶ added in v1.2.0
func (this *HTTP3Policy) Init() error
type HTTPCCPolicy ¶ added in v1.1.0
type HTTPCCPolicy struct { IsOn bool `json:"isOn" yaml:"isOn"` Thresholds []*serverconfigs.HTTPCCThreshold `json:"thresholds" yaml:"thresholds"` // 阈值 }
HTTPCCPolicy CC策略
func NewHTTPCCPolicy ¶ added in v1.1.0
func NewHTTPCCPolicy() *HTTPCCPolicy
func (*HTTPCCPolicy) Init ¶ added in v1.1.0
func (this *HTTPCCPolicy) Init() error
type HTTPPagesPolicy ¶ added in v1.1.0
type HTTPPagesPolicy struct { IsOn bool `json:"isOn" yaml:"isOn"` // 是否启用 Pages []*serverconfigs.HTTPPageConfig `json:"pages" yaml:"pages"` // 自定义页面 }
HTTPPagesPolicy 全局的HTTP自定义页面设置
func NewHTTPPagesPolicy ¶ added in v1.1.0
func NewHTTPPagesPolicy() *HTTPPagesPolicy
func (*HTTPPagesPolicy) Init ¶ added in v1.1.0
func (this *HTTPPagesPolicy) Init() error
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 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 NetworkSecurityPolicy ¶ added in v1.3.0
type NetworkSecurityPolicy struct { Status NetworkSecurityStatus `json:"status"` // 启用状态 TCP struct{} `json:"tcp"` // TODO UDP struct{} `json:"udp"` // TODO ICMP struct{} `json:"icmp"` // TODO }
NetworkSecurityPolicy 节点网络安全策略
func NewNetworkSecurityPolicy ¶ added in v1.3.0
func NewNetworkSecurityPolicy() *NetworkSecurityPolicy
func (*NetworkSecurityPolicy) AsJSON ¶ added in v1.3.0
func (this *NetworkSecurityPolicy) AsJSON() ([]byte, error)
func (*NetworkSecurityPolicy) Init ¶ added in v1.3.0
func (this *NetworkSecurityPolicy) Init() error
func (*NetworkSecurityPolicy) IsOn ¶ added in v1.3.0
func (this *NetworkSecurityPolicy) IsOn() bool
func (*NetworkSecurityPolicy) IsSame ¶ added in v1.3.0
func (this *NetworkSecurityPolicy) IsSame(anotherPolicy *NetworkSecurityPolicy) bool
type NetworkSecurityStatus ¶ added in v1.3.0
type NetworkSecurityStatus = string
const ( NetworkSecurityStatusAuto NetworkSecurityStatus = "auto" NetworkSecurityStatusOn NetworkSecurityStatus = "on" NetworkSecurityStatusOff NetworkSecurityStatus = "off" )
type NodeConfig ¶
type NodeConfig struct { Id int64 `yaml:"id" json:"id"` Edition string `yaml:"edition" json:"edition"` 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"` DataMap *shared.DataMap `yaml:"dataMap" json:"dataMap"` UpdatingServerListId int64 `yaml:"updatingServerListId" json:"updatingServerListId"` // 性能 MaxCPU int32 `yaml:"maxCPU" json:"maxCPU"` APINodeAddrs []*serverconfigs.NetworkAddressConfig `yaml:"apiNodeAddrs" json:"apiNodeAddrs"` CacheDiskDir string `yaml:"cacheDiskDir" json:"cacheDiskDir"` // 文件缓存目录 MaxCacheDiskCapacity *shared.SizeCapacity `yaml:"maxCacheDiskCapacity" json:"maxCacheDiskCapacity"` // 文件缓存容量 CacheDiskSubDirs []*serverconfigs.CacheDir `yaml:"cacheDiskSubDirs" json:"cacheDiskSubDirs"` // 其余缓存目录 MaxCacheMemoryCapacity *shared.SizeCapacity `yaml:"maxCacheMemoryCapacity" json:"maxCacheMemoryCapacity"` // 内容缓存容量 MaxThreads int `yaml:"maxThreads" json:"maxThreads"` // 最大线程数 DDoSProtection *ddosconfigs.ProtectionConfig `yaml:"ddosProtection" json:"ddosProtection"` // DDoS防护 EnableIPLists bool `yaml:"enableIPLists" json:"enableIPLists"` // 启用IP名单 // 级别 Level int32 `yaml:"level" json:"level"` ParentNodes map[int64][]*ParentNodeConfig `yaml:"parentNodes" json:"parentNodes"` // clusterId => []*ParentNodeConfig // 全局配置 GlobalServerConfig *serverconfigs.GlobalServerConfig `yaml:"globalServerConfig" json:"globalServerConfig"` // 服务全局配置,用来替代 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"` // 自动开放所需端口 Clock *ClockConfig `yaml:"clock" json:"clock"` // 时钟配置 AutoInstallNftables bool `yaml:"autoInstallNftables" json:"autoInstallNftables"` // 自动安装nftables AutoSystemTuning bool `yaml:"autoSystemTuning" json:"autoSystemTuning"` // 自动调整系统参数 AutoTrimDisks bool `yaml:"autoTrimDisks" json:"autoTrimDisks"` // 自动执行TRIM // 指标 MetricItems []*serverconfigs.MetricItemConfig `yaml:"metricItems" json:"metricItems"` IPAddresses []string `yaml:"ipAddresses" json:"ipAddresses"` // IP地址 AllowedIPs []string `yaml:"allowedIPs" json:"allowedIPs"` // 自动IP白名单 // 脚本 CommonScripts []*serverconfigs.CommonScript `yaml:"commonScripts" json:"commonScripts"` WebPImagePolicies map[int64]*WebPImagePolicy `yaml:"webpImagePolicies" json:"webpImagePolicies"` // WebP相关配置,clusterId => *WebPImagePolicy UAMPolicies map[int64]*UAMPolicy `yaml:"uamPolicies" json:"uamPolicies"` // UAM相关配置,clusterId => *UAMPolicy HTTPCCPolicies map[int64]*HTTPCCPolicy `yaml:"httpCCPolicies" json:"httpCCPolicies"` // CC相关配置, clusterId => *HTTPCCPolicy HTTP3Policies map[int64]*HTTP3Policy `yaml:"http3Policies" json:"http3Policies"` // HTTP3相关配置, clusterId => *HTTP3Policy HTTPPagesPolicies map[int64]*HTTPPagesPolicy `yaml:"httpPagesPolicies" json:"httpPagesPolicies"` // 自定义页面,clusterId => *HTTPPagesPolicy NetworkSecurityPolicy *NetworkSecurityPolicy `yaml:"networkSecurityPolicy" json:"networkSecurityPolicy"` // 网络安全策略 Plans map[int64]*serverconfigs.PlanConfig `yaml:"plans" json:"plans"` // 套餐 plan id => *serverconfigs.PlanConfig // DNS DNSResolver *DNSResolverConfig `yaml:"dnsResolver" json:"dnsResolver"` // Cluster ClusterSecret string `yaml:"clusterSecret" json:"clusterSecret"` // contains filtered or unexported fields }
NodeConfig 边缘节点配置
func CloneNodeConfig ¶
func CloneNodeConfig(nodeConfig *NodeConfig) (*NodeConfig, error)
CloneNodeConfig 复制节点配置
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) FindAllPlans ¶ added in v1.3.3
func (this *NodeConfig) FindAllPlans() map[int64]*serverconfigs.PlanConfig
FindAllPlans 查找所有套餐
func (*NodeConfig) FindHTTP3PolicyWithClusterId ¶ added in v1.2.0
func (this *NodeConfig) FindHTTP3PolicyWithClusterId(clusterId int64) *HTTP3Policy
FindHTTP3PolicyWithClusterId 使用集群ID查找HTTP/3策略
func (*NodeConfig) FindHTTP3Ports ¶ added in v1.2.0
func (this *NodeConfig) FindHTTP3Ports() (ports []int)
FindHTTP3Ports 查询HTTP/3所有端口
func (*NodeConfig) FindHTTPCCPolicyWithClusterId ¶ added in v1.1.0
func (this *NodeConfig) FindHTTPCCPolicyWithClusterId(clusterId int64) *HTTPCCPolicy
FindHTTPCCPolicyWithClusterId 使用集群ID查找CC策略
func (*NodeConfig) FindHTTPPagesPolicyWithClusterId ¶ added in v1.1.0
func (this *NodeConfig) FindHTTPPagesPolicyWithClusterId(clusterId int64) *HTTPPagesPolicy
FindHTTPPagesPolicyWithClusterId 使用集群ID查找自定义页面策略
func (*NodeConfig) FindOrigin ¶
func (this *NodeConfig) FindOrigin(originId int64) *serverconfigs.OriginConfig
FindOrigin 读取源站配置
func (*NodeConfig) FindPlan ¶ added in v1.3.3
func (this *NodeConfig) FindPlan(planId int64) *serverconfigs.PlanConfig
查找单个套餐
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) HTTP3Group ¶ added in v1.2.0
func (this *NodeConfig) HTTP3Group() *serverconfigs.ServerAddressGroup
HTTP3Group HTTP/3网站分组 这里暂时不区分集群
func (*NodeConfig) HasConnTimeoutSettings ¶ added in v1.2.1
func (this *NodeConfig) HasConnTimeoutSettings() bool
HasConnTimeoutSettings 检查是否有连接超时设置
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(ctx context.Context) (err error, serverErrors []*ServerError)
Init 初始化
func (*NodeConfig) RemoveServer ¶
func (this *NodeConfig) RemoveServer(serverId int64)
RemoveServer 删除服务
func (*NodeConfig) SYNFloodConfig ¶
func (this *NodeConfig) SYNFloodConfig() *firewallconfigs.SYNFloodConfig
SYNFloodConfig 获取SYN Flood配置
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
func (*NodeConfig) UpdateHTTP3Policies ¶ added in v1.2.0
func (this *NodeConfig) UpdateHTTP3Policies(policies map[int64]*HTTP3Policy)
UpdateHTTP3Policies 修改集群HTTP/3策略
func (*NodeConfig) UpdateHTTPCCPolicies ¶ added in v1.1.0
func (this *NodeConfig) UpdateHTTPCCPolicies(policies map[int64]*HTTPCCPolicy)
UpdateHTTPCCPolicies 修改集群CC策略
func (*NodeConfig) UpdateHTTPPagesPolicies ¶ added in v1.1.0
func (this *NodeConfig) UpdateHTTPPagesPolicies(policies map[int64]*HTTPPagesPolicy)
UpdateHTTPPagesPolicies 修改集群自定义页面策略
func (*NodeConfig) UpdatePlans ¶ added in v1.3.3
func (this *NodeConfig) UpdatePlans(planMap map[int64]*serverconfigs.PlanConfig)
UpdatePlans 更新套餐
func (*NodeConfig) UpdateUAMPolicies ¶ added in v1.0.0
func (this *NodeConfig) UpdateUAMPolicies(policies map[int64]*UAMPolicy)
UpdateUAMPolicies 修改集群UAM策略
func (*NodeConfig) UpdateWebPImagePolicies ¶ added in v1.3.2
func (this *NodeConfig) UpdateWebPImagePolicies(policies map[int64]*WebPImagePolicy)
UpdateWebPImagePolicies 修改集群WebP策略
type NodeIPAddr ¶
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 ¶
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"` DiskWritingSpeedMB int `json:"diskWritingSpeedMB"` // 硬盘写入速度 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"` // 可执行文件路径 APISuccessPercent float64 `json:"apiSuccessPercent"` // API成功比例 APIAvgCostSeconds float64 `json:"apiAvgCostSeconds"` // API平均耗时 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" // 业务下行流量 NodeValueItemAllTraffic NodeValueItem = "allTraffic" // 所有流量 NodeValueItemConnections NodeValueItem = "connections" // 连接数 NodeValueItemRequests NodeValueItem = "requests" // 请求访问量 NodeValueItemAttackRequests NodeValueItem = "attackRequests" // 攻击请求访问量 NodeValueItemDisk NodeValueItem = "disk" // 磁盘 NodeValueItemCacheDir NodeValueItem = "cacheDir" // 缓存目录 NodeValueItemNetworkPackets NodeValueItem = "networkPackets" // 网络数据包统计 )
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 SSHParams ¶ added in v0.5.6
type SSHParams struct {
Port int `json:"port"`
}
func DefaultSSHParams ¶ added in v0.5.6
func DefaultSSHParams() *SSHParams
type ServerError ¶
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"`
}
TOAConfig TOA相关配置
func (*TOAConfig) RandLocalPort ¶
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"`
}
func NewUAMPolicy ¶ added in v1.2.1
func NewUAMPolicy() *UAMPolicy
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"` // 最大压缩对象 Quality int `yaml:"quality" json:"quality"` // 生成的图片质量:0-100 // contains filtered or unexported fields }
WebPImagePolicy WebP策略
func NewWebPImagePolicy ¶ added in v1.3.2
func NewWebPImagePolicy() *WebPImagePolicy
func (*WebPImagePolicy) Init ¶
func (this *WebPImagePolicy) Init() error
func (*WebPImagePolicy) MaxLengthBytes ¶
func (this *WebPImagePolicy) MaxLengthBytes() int64
func (*WebPImagePolicy) MinLengthBytes ¶
func (this *WebPImagePolicy) MinLengthBytes() int64
Source Files ¶
- clock_config.go
- connectivity.go
- defaults.go
- dns_resolver.go
- http3_policy.go
- http_cc_policy.go
- http_pages_policy.go
- image_webp_policy.go
- networking_security_policy.go
- node_config.go
- node_ip_addr.go
- node_levels.go
- node_log_type.go
- node_parent_config.go
- node_roles.go
- node_status.go
- node_value_item.go
- node_value_thresholds.go
- product_config.go
- service_systemd_config.go
- ssh_params.go
- timezones.go
- toa_config.go
- uam_policy.go