Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c8dff120a | ||
|
|
df148bf027 | ||
|
|
d5bb623339 | ||
|
|
58ec21d676 | ||
|
|
279e4025fd |
@@ -3154,7 +3154,10 @@
|
|||||||
"responseMessageName": "RPCSuccess",
|
"responseMessageName": "RPCSuccess",
|
||||||
"code": "rpc updateHTTPWebOptimization(UpdateHTTPWebOptimizationRequest) returns (RPCSuccess);",
|
"code": "rpc updateHTTPWebOptimization(UpdateHTTPWebOptimizationRequest) returns (RPCSuccess);",
|
||||||
"doc": "更改页面优化配置",
|
"doc": "更改页面优化配置",
|
||||||
"roles": [],
|
"roles": [
|
||||||
|
"admin",
|
||||||
|
"user"
|
||||||
|
],
|
||||||
"isDeprecated": false
|
"isDeprecated": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -5720,6 +5723,17 @@
|
|||||||
"admin"
|
"admin"
|
||||||
],
|
],
|
||||||
"isDeprecated": false
|
"isDeprecated": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "findNodeTOAConfig",
|
||||||
|
"requestMessageName": "FindNodeTOAConfigRequest",
|
||||||
|
"responseMessageName": "FindNodeTOAConfigResponse",
|
||||||
|
"code": "rpc findNodeTOAConfig(FindNodeTOAConfigRequest) returns (FindNodeTOAConfigResponse);",
|
||||||
|
"doc": "查找节点的TOA配置",
|
||||||
|
"roles": [
|
||||||
|
"node"
|
||||||
|
],
|
||||||
|
"isDeprecated": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"filename": "service_node.proto",
|
"filename": "service_node.proto",
|
||||||
@@ -14045,12 +14059,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "CopyNodeActionsToNodeClusterRequest",
|
"name": "CopyNodeActionsToNodeClusterRequest",
|
||||||
"code": "message CopyNodeActionsToNodeClusterRequest {\n\tint64 nodeId = 1;\n}",
|
"code": "message CopyNodeActionsToNodeClusterRequest {\n\tint64 nodeId = 1; // 节点ID\n}",
|
||||||
"doc": "同步动作设置到集群"
|
"doc": "同步动作设置到集群"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "CopyNodeActionsToNodeGroupRequest",
|
"name": "CopyNodeActionsToNodeGroupRequest",
|
||||||
"code": "message CopyNodeActionsToNodeGroupRequest {\n\tint64 nodeId = 1;\n}",
|
"code": "message CopyNodeActionsToNodeGroupRequest {\n\tint64 nodeId = 1; // 节点ID\n}",
|
||||||
"doc": "同步动作设置到分组"
|
"doc": "同步动作设置到分组"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -19273,31 +19287,16 @@
|
|||||||
"code": "message FindNodeGlobalServerConfigResponse {\n\tbytes globalServerConfigJSON = 1;\n}",
|
"code": "message FindNodeGlobalServerConfigResponse {\n\tbytes globalServerConfigJSON = 1;\n}",
|
||||||
"doc": ""
|
"doc": ""
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "FindNodeHTTP3PoliciesRequest",
|
|
||||||
"code": "message FindNodeHTTP3PoliciesRequest {\n\tint64 nodeId = 1; // 节点ID\n}",
|
|
||||||
"doc": "查找节点的HTTP3策略"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "FindNodeHTTP3PoliciesResponse",
|
"name": "FindNodeHTTP3PoliciesResponse",
|
||||||
"code": "message FindNodeHTTP3PoliciesResponse {\n\trepeated HTTP3Policy http3Policies = 1; // HTTP3策略列表\n\n\n\tmessage HTTP3Policy {\n\t\tint64 nodeClusterId = 1; // 集群ID\n\t\tbytes http3PolicyJSON = 2; // HTTP3策略配置\n\t}\n}",
|
"code": "message FindNodeHTTP3PoliciesResponse {\n\trepeated HTTP3Policy http3Policies = 1; // HTTP3策略列表\n\n\n\tmessage HTTP3Policy {\n\t\tint64 nodeClusterId = 1; // 集群ID\n\t\tbytes http3PolicyJSON = 2; // HTTP3策略配置\n\t}\n}",
|
||||||
"doc": ""
|
"doc": ""
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "FindNodeHTTPCCPoliciesRequest",
|
|
||||||
"code": "message FindNodeHTTPCCPoliciesRequest {\n\tint64 nodeId = 1; // 节点ID\n}",
|
|
||||||
"doc": "查找节点的HTTP CC策略"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "FindNodeHTTPCCPoliciesResponse",
|
"name": "FindNodeHTTPCCPoliciesResponse",
|
||||||
"code": "message FindNodeHTTPCCPoliciesResponse {\n\trepeated HTTPCCPolicy httpCCPolicies = 1; // HTTP CC策略列表\n\n\n\tmessage HTTPCCPolicy {\n\t\tint64 nodeClusterId = 1; // 集群ID\n\t\tbytes httpCCPolicyJSON = 2; // HTTP CC策略配置\n\t}\n}",
|
"code": "message FindNodeHTTPCCPoliciesResponse {\n\trepeated HTTPCCPolicy httpCCPolicies = 1; // HTTP CC策略列表\n\n\n\tmessage HTTPCCPolicy {\n\t\tint64 nodeClusterId = 1; // 集群ID\n\t\tbytes httpCCPolicyJSON = 2; // HTTP CC策略配置\n\t}\n}",
|
||||||
"doc": ""
|
"doc": ""
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "FindNodeHTTPPagesPoliciesRequest",
|
|
||||||
"code": "message FindNodeHTTPPagesPoliciesRequest {\n\tint64 nodeId = 1; // 节点ID\n}",
|
|
||||||
"doc": "查找节点的自定义页面策略"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "FindNodeHTTPPagesPoliciesResponse",
|
"name": "FindNodeHTTPPagesPoliciesResponse",
|
||||||
"code": "message FindNodeHTTPPagesPoliciesResponse {\n\trepeated HTTPPagesPolicy httpPagesPolicies = 1; // 自定义页面策略列表\n\n\n\tmessage HTTPPagesPolicy {\n\t\tint64 nodeClusterId = 1; // 集群ID\n\t\tbytes httpPagesPolicyJSON = 2; // 自定义页面策略配置\n\t}\n}",
|
"code": "message FindNodeHTTPPagesPoliciesResponse {\n\trepeated HTTPPagesPolicy httpPagesPolicies = 1; // 自定义页面策略列表\n\n\n\tmessage HTTPPagesPolicy {\n\t\tint64 nodeClusterId = 1; // 集群ID\n\t\tbytes httpPagesPolicyJSON = 2; // 自定义页面策略配置\n\t}\n}",
|
||||||
@@ -19338,6 +19337,11 @@
|
|||||||
"code": "message FindNodeScheduleInfoResponse {\n\tScheduleInfo scheduleInfo = 1; // 调度信息\n\n\n\tmessage ScheduleInfo {\n\t\tstring offlineDay = 1; // 下线日期,格式YYYYMMDD\n\t\tbool isBackupForCluster = 2; // 是否为集群备份节点\n\t\tbool isBackupForGroup = 3; // 是否为分组备份节点\n\t\trepeated string backupIPs = 4; // 备用IP\n\t\tbytes actionStatusJSON = 5; // 动作状态\n\t}\n}",
|
"code": "message FindNodeScheduleInfoResponse {\n\tScheduleInfo scheduleInfo = 1; // 调度信息\n\n\n\tmessage ScheduleInfo {\n\t\tstring offlineDay = 1; // 下线日期,格式YYYYMMDD\n\t\tbool isBackupForCluster = 2; // 是否为集群备份节点\n\t\tbool isBackupForGroup = 3; // 是否为分组备份节点\n\t\trepeated string backupIPs = 4; // 备用IP\n\t\tbytes actionStatusJSON = 5; // 动作状态\n\t}\n}",
|
||||||
"doc": ""
|
"doc": ""
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "FindNodeTOAConfigResponse",
|
||||||
|
"code": "message FindNodeTOAConfigResponse {\n\tbytes toaJSON = 1; // TOA配置\n}",
|
||||||
|
"doc": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "FindNodeTasksRequest",
|
"name": "FindNodeTasksRequest",
|
||||||
"code": "message FindNodeTasksRequest {\n\tint64 version = 1; // 上一次执行的版本\n}",
|
"code": "message FindNodeTasksRequest {\n\tint64 version = 1; // 上一次执行的版本\n}",
|
||||||
@@ -19348,11 +19352,6 @@
|
|||||||
"code": "message FindNodeTasksResponse {\n\trepeated NodeTask nodeTasks = 1;\n}",
|
"code": "message FindNodeTasksResponse {\n\trepeated NodeTask nodeTasks = 1;\n}",
|
||||||
"doc": ""
|
"doc": ""
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "FindNodeUAMPoliciesRequest",
|
|
||||||
"code": "message FindNodeUAMPoliciesRequest {\n\tint64 nodeId = 1; // 节点ID\n}",
|
|
||||||
"doc": "查找节点的UAM策略"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "FindNodeUAMPoliciesResponse",
|
"name": "FindNodeUAMPoliciesResponse",
|
||||||
"code": "message FindNodeUAMPoliciesResponse {\n\trepeated UAMPolicy uamPolicies = 1; // UAM策略列表\n\n\n\tmessage UAMPolicy {\n\t\tint64 nodeClusterId = 1; // 集群ID\n\t\tbytes uamPolicyJSON = 2; // UAM策略配置\n\t}\n}",
|
"code": "message FindNodeUAMPoliciesResponse {\n\trepeated UAMPolicy uamPolicies = 1; // UAM策略列表\n\n\n\tmessage UAMPolicy {\n\t\tint64 nodeClusterId = 1; // 集群ID\n\t\tbytes uamPolicyJSON = 2; // UAM策略配置\n\t}\n}",
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const (
|
|||||||
DefaultTCPNewConnectionsSecondlyRate = 300 // 单IP连接速率限制(按秒)
|
DefaultTCPNewConnectionsSecondlyRate = 300 // 单IP连接速率限制(按秒)
|
||||||
DefaultTCPNewConnectionsMinSecondlyRate = 3 // 单IP最小连接速率
|
DefaultTCPNewConnectionsMinSecondlyRate = 3 // 单IP最小连接速率
|
||||||
|
|
||||||
DefaultTCPLinger = 3 // 单节点TCP Linger值
|
DefaultTCPLinger = 5 // 单节点TCP Linger值
|
||||||
DefaultTLSHandshakeTimeout = 3 // TLS握手超时时间
|
DefaultTLSHandshakeTimeout = 3 // TLS握手超时时间
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,93 +1,18 @@
|
|||||||
|
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
//go:build !plus
|
||||||
|
|
||||||
package nodeconfigs
|
package nodeconfigs
|
||||||
|
|
||||||
import (
|
// NewTOAConfig 默认的TOA配置
|
||||||
"fmt"
|
func NewTOAConfig() *TOAConfig {
|
||||||
"github.com/iwind/TeaGo/rands"
|
return &TOAConfig{}
|
||||||
"net"
|
|
||||||
)
|
|
||||||
|
|
||||||
// 默认的TOA配置
|
|
||||||
func DefaultTOAConfig() *TOAConfig {
|
|
||||||
return &TOAConfig{
|
|
||||||
IsOn: false,
|
|
||||||
Debug: false,
|
|
||||||
OptionType: 0xfe,
|
|
||||||
MinQueueId: 100,
|
|
||||||
MaxQueueId: 109,
|
|
||||||
AutoSetup: true,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TOA相关配置
|
// TOAConfig TOA相关配置
|
||||||
type TOAConfig struct {
|
type TOAConfig struct {
|
||||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
|
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
|
|
||||||
|
|
||||||
minLocalPort int
|
|
||||||
maxLocalPort int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *TOAConfig) Init() error {
|
func (this *TOAConfig) Init() error {
|
||||||
// LocalPort
|
|
||||||
minPort := this.MinLocalPort
|
|
||||||
maxPort := this.MaxLocalPort
|
|
||||||
if minPort == 0 {
|
|
||||||
minPort = 1025
|
|
||||||
}
|
|
||||||
if maxPort == 0 {
|
|
||||||
maxPort = 65534
|
|
||||||
}
|
|
||||||
if minPort > maxPort {
|
|
||||||
minPort, maxPort = maxPort, minPort
|
|
||||||
}
|
|
||||||
this.minLocalPort = int(minPort)
|
|
||||||
this.maxLocalPort = int(maxPort)
|
|
||||||
|
|
||||||
// QueueId
|
|
||||||
if this.MinQueueId > this.MaxQueueId {
|
|
||||||
this.MinQueueId, this.MaxQueueId = this.MaxQueueId, this.MinQueueId
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sock路径
|
|
||||||
func (this *TOAConfig) SockFile() string {
|
|
||||||
if len(this.SockPath) == 0 {
|
|
||||||
return "/tmp/edge-toa.sock"
|
|
||||||
}
|
|
||||||
return this.SockPath
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取随机端口
|
|
||||||
func (this *TOAConfig) RandLocalPort() uint16 {
|
|
||||||
listener, err := net.Listen("tcp", ":0")
|
|
||||||
if err != nil {
|
|
||||||
return uint16(rands.Int(this.minLocalPort, this.maxLocalPort))
|
|
||||||
}
|
|
||||||
_ = listener.Close()
|
|
||||||
return uint16(listener.Addr().(*net.TCPAddr).Port)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 转换为参数的形式
|
|
||||||
func (this *TOAConfig) AsArgs() (args []string) {
|
|
||||||
args = append(args, "run")
|
|
||||||
args = append(args, "-option-type="+fmt.Sprintf("%d", this.OptionType))
|
|
||||||
args = append(args, "-min-queue-id="+fmt.Sprintf("%d", this.MinQueueId))
|
|
||||||
args = append(args, "-max-queue-id="+fmt.Sprintf("%d", this.MaxQueueId))
|
|
||||||
if this.AutoSetup {
|
|
||||||
args = append(args, "-auto-setup")
|
|
||||||
}
|
|
||||||
if this.Debug {
|
|
||||||
args = append(args, "-debug")
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
package nodeconfigs
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net"
|
|
||||||
"runtime"
|
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestTOAConfig_RandLocalPort(t *testing.T) {
|
|
||||||
{
|
|
||||||
toa := &TOAConfig{}
|
|
||||||
err := toa.Init()
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
t.Log(toa.RandLocalPort())
|
|
||||||
}
|
|
||||||
{
|
|
||||||
toa := &TOAConfig{
|
|
||||||
MinLocalPort: 1,
|
|
||||||
MaxLocalPort: 2,
|
|
||||||
}
|
|
||||||
err := toa.Init()
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
t.Log(toa.RandLocalPort())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestTOAConfig_FreePort(t *testing.T) {
|
|
||||||
before := time.Now()
|
|
||||||
listener, err := net.Listen("tcp", ":0")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
t.Log(listener.Addr())
|
|
||||||
_ = listener.Close()
|
|
||||||
t.Log(time.Since(before).Seconds()*1000, "ms")
|
|
||||||
time.Sleep(30 * time.Second)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
func TestTOAConfig_AsArgs(t *testing.T) {
|
|
||||||
toa := &TOAConfig{
|
|
||||||
IsOn: false,
|
|
||||||
Debug: true,
|
|
||||||
OptionType: 0xfe,
|
|
||||||
MinQueueId: 10,
|
|
||||||
MaxQueueId: 20,
|
|
||||||
AutoSetup: true,
|
|
||||||
MinLocalPort: 0,
|
|
||||||
MaxLocalPort: 0,
|
|
||||||
SockPath: "",
|
|
||||||
ByPassPorts: nil,
|
|
||||||
}
|
|
||||||
err := toa.Init()
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
t.Log(toa.AsArgs())
|
|
||||||
}
|
|
||||||
|
|
||||||
func BenchmarkTOAConfig_RandLocalPort(b *testing.B) {
|
|
||||||
runtime.GOMAXPROCS(1)
|
|
||||||
|
|
||||||
toa := &TOAConfig{
|
|
||||||
MinLocalPort: 1,
|
|
||||||
MaxLocalPort: 2,
|
|
||||||
}
|
|
||||||
_ = toa.Init()
|
|
||||||
|
|
||||||
for i := 0; i < b.N; i++ {
|
|
||||||
_ = toa.RandLocalPort()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -199,6 +199,9 @@ service NodeService {
|
|||||||
|
|
||||||
// 复制动作设置到集群
|
// 复制动作设置到集群
|
||||||
rpc copyNodeActionsToNodeCluster(CopyNodeActionsToNodeClusterRequest) returns (RPCSuccess);
|
rpc copyNodeActionsToNodeCluster(CopyNodeActionsToNodeClusterRequest) returns (RPCSuccess);
|
||||||
|
|
||||||
|
// 查找节点的TOA配置
|
||||||
|
rpc findNodeTOAConfig(FindNodeTOAConfigRequest) returns (FindNodeTOAConfigResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建节点
|
// 创建节点
|
||||||
@@ -695,7 +698,6 @@ message UpdateNodeAPIConfigRequest {
|
|||||||
|
|
||||||
// 查找节点的UAM策略
|
// 查找节点的UAM策略
|
||||||
message FindNodeUAMPoliciesRequest {
|
message FindNodeUAMPoliciesRequest {
|
||||||
int64 nodeId = 1; // 节点ID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message FindNodeUAMPoliciesResponse {
|
message FindNodeUAMPoliciesResponse {
|
||||||
@@ -709,7 +711,6 @@ message FindNodeUAMPoliciesResponse {
|
|||||||
|
|
||||||
// 查找节点的HTTP CC策略
|
// 查找节点的HTTP CC策略
|
||||||
message FindNodeHTTPCCPoliciesRequest {
|
message FindNodeHTTPCCPoliciesRequest {
|
||||||
int64 nodeId = 1; // 节点ID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message FindNodeHTTPCCPoliciesResponse {
|
message FindNodeHTTPCCPoliciesResponse {
|
||||||
@@ -723,7 +724,6 @@ message FindNodeHTTPCCPoliciesResponse {
|
|||||||
|
|
||||||
// 查找节点的HTTP3策略
|
// 查找节点的HTTP3策略
|
||||||
message FindNodeHTTP3PoliciesRequest {
|
message FindNodeHTTP3PoliciesRequest {
|
||||||
int64 nodeId = 1; // 节点ID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message FindNodeHTTP3PoliciesResponse {
|
message FindNodeHTTP3PoliciesResponse {
|
||||||
@@ -737,7 +737,6 @@ message FindNodeHTTP3PoliciesResponse {
|
|||||||
|
|
||||||
// 查找节点的自定义页面策略
|
// 查找节点的自定义页面策略
|
||||||
message FindNodeHTTPPagesPoliciesRequest {
|
message FindNodeHTTPPagesPoliciesRequest {
|
||||||
int64 nodeId = 1; // 节点ID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message FindNodeHTTPPagesPoliciesResponse {
|
message FindNodeHTTPPagesPoliciesResponse {
|
||||||
@@ -803,10 +802,18 @@ message FindAllNodeScheduleInfoWithNodeClusterIdResponse {
|
|||||||
|
|
||||||
// 同步动作设置到分组
|
// 同步动作设置到分组
|
||||||
message CopyNodeActionsToNodeGroupRequest {
|
message CopyNodeActionsToNodeGroupRequest {
|
||||||
int64 nodeId = 1;
|
int64 nodeId = 1; // 节点ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// 同步动作设置到集群
|
// 同步动作设置到集群
|
||||||
message CopyNodeActionsToNodeClusterRequest {
|
message CopyNodeActionsToNodeClusterRequest {
|
||||||
int64 nodeId = 1;
|
int64 nodeId = 1; // 节点ID
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查找节点的TOA配置
|
||||||
|
message FindNodeTOAConfigRequest {
|
||||||
|
}
|
||||||
|
|
||||||
|
message FindNodeTOAConfigResponse {
|
||||||
|
bytes toaJSON = 1; // TOA配置
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,11 @@ func (this *HTTPHeaderPolicy) Init() error {
|
|||||||
|
|
||||||
// IsEmpty 判断是否为空
|
// IsEmpty 判断是否为空
|
||||||
func (this *HTTPHeaderPolicy) IsEmpty() bool {
|
func (this *HTTPHeaderPolicy) IsEmpty() bool {
|
||||||
return len(this.SetHeaders) == 0 && this.Expires == nil && len(this.DeleteHeaders) == 0
|
return len(this.SetHeaders) == 0 &&
|
||||||
|
this.Expires == nil &&
|
||||||
|
len(this.DeleteHeaders) == 0 &&
|
||||||
|
len(this.NonStandardHeaders) == 0 &&
|
||||||
|
(this.CORS == nil || !this.CORS.IsOn)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainsHeader 判断Add和Set中是否包含某个Header
|
// ContainsHeader 判断Add和Set中是否包含某个Header
|
||||||
|
|||||||
@@ -9,5 +9,7 @@ type CheckUpdatesConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewCheckUpdatesConfig() *CheckUpdatesConfig {
|
func NewCheckUpdatesConfig() *CheckUpdatesConfig {
|
||||||
return &CheckUpdatesConfig{}
|
return &CheckUpdatesConfig{
|
||||||
|
AutoCheck: true,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user