mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-12 11:20:26 +08:00
可以在集群中指定节点时区
This commit is contained in:
@@ -38,6 +38,7 @@ type NodeConfig struct {
|
|||||||
TOA *TOAConfig `yaml:"toa" json:"toa"`
|
TOA *TOAConfig `yaml:"toa" json:"toa"`
|
||||||
SystemServices map[string]maps.Map `yaml:"systemServices" json:"systemServices"` // 系统服务配置 type => params
|
SystemServices map[string]maps.Map `yaml:"systemServices" json:"systemServices"` // 系统服务配置 type => params
|
||||||
FirewallActions []*firewallconfigs.FirewallActionConfig `yaml:"firewallActions" json:"firewallActions"`
|
FirewallActions []*firewallconfigs.FirewallActionConfig `yaml:"firewallActions" json:"firewallActions"`
|
||||||
|
TimeZone string `yaml:"timeZone" json:"timeZone"`
|
||||||
|
|
||||||
MetricItems []*serverconfigs.MetricItemConfig `yaml:"metricItems" json:"metricItems"`
|
MetricItems []*serverconfigs.MetricItemConfig `yaml:"metricItems" json:"metricItems"`
|
||||||
|
|
||||||
|
|||||||
92
pkg/nodeconfigs/timezones.go
Normal file
92
pkg/nodeconfigs/timezones.go
Normal file
File diff suppressed because one or more lines are too long
17
pkg/nodeconfigs/timezones_test.go
Normal file
17
pkg/nodeconfigs/timezones_test.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||||
|
|
||||||
|
package nodeconfigs
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/iwind/TeaGo/logs"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestFindAllTimeZoneLocations(t *testing.T) {
|
||||||
|
var before = time.Now()
|
||||||
|
var locations = FindAllTimeZoneLocations()
|
||||||
|
t.Log(len(locations), "locations")
|
||||||
|
t.Logf("%.2f %s", time.Since(before).Seconds()*1000, "ms")
|
||||||
|
logs.PrintAsJSON(locations, t)
|
||||||
|
}
|
||||||
@@ -42,6 +42,7 @@ type NodeCluster struct {
|
|||||||
HttpCachePolicyId int64 `protobuf:"varint,10,opt,name=httpCachePolicyId,proto3" json:"httpCachePolicyId,omitempty"`
|
HttpCachePolicyId int64 `protobuf:"varint,10,opt,name=httpCachePolicyId,proto3" json:"httpCachePolicyId,omitempty"`
|
||||||
HttpFirewallPolicyId int64 `protobuf:"varint,11,opt,name=httpFirewallPolicyId,proto3" json:"httpFirewallPolicyId,omitempty"`
|
HttpFirewallPolicyId int64 `protobuf:"varint,11,opt,name=httpFirewallPolicyId,proto3" json:"httpFirewallPolicyId,omitempty"`
|
||||||
IsOn bool `protobuf:"varint,12,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
IsOn bool `protobuf:"varint,12,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||||
|
TimeZone string `protobuf:"bytes,13,opt,name=timeZone,proto3" json:"timeZone,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NodeCluster) Reset() {
|
func (x *NodeCluster) Reset() {
|
||||||
@@ -160,12 +161,19 @@ func (x *NodeCluster) GetIsOn() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *NodeCluster) GetTimeZone() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.TimeZone
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
var File_models_model_node_cluster_proto protoreflect.FileDescriptor
|
var File_models_model_node_cluster_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_models_model_node_cluster_proto_rawDesc = []byte{
|
var file_models_model_node_cluster_proto_rawDesc = []byte{
|
||||||
0x0a, 0x1f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
|
0x0a, 0x1f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
|
||||||
0x6f, 0x64, 0x65, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
0x6f, 0x64, 0x65, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xf7, 0x02, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c,
|
0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x93, 0x03, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c,
|
||||||
0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
|
0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
|
||||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65,
|
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65,
|
||||||
@@ -188,8 +196,10 @@ var file_models_model_node_cluster_proto_rawDesc = []byte{
|
|||||||
0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x18,
|
0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x18,
|
||||||
0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x68, 0x74, 0x74, 0x70, 0x46, 0x69, 0x72, 0x65, 0x77,
|
0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x68, 0x74, 0x74, 0x70, 0x46, 0x69, 0x72, 0x65, 0x77,
|
||||||
0x61, 0x6c, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69,
|
0x61, 0x6c, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69,
|
||||||
0x73, 0x4f, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x42,
|
0x73, 0x4f, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12,
|
||||||
0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x1a, 0x0a, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x5a, 0x6f, 0x6e, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28,
|
||||||
|
0x09, 0x52, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x5a, 0x6f, 0x6e, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e,
|
||||||
|
0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -16,4 +16,5 @@ message NodeCluster {
|
|||||||
int64 httpCachePolicyId = 10;
|
int64 httpCachePolicyId = 10;
|
||||||
int64 httpFirewallPolicyId = 11;
|
int64 httpFirewallPolicyId = 11;
|
||||||
bool isOn = 12;
|
bool isOn = 12;
|
||||||
|
string timeZone = 13;
|
||||||
}
|
}
|
||||||
@@ -145,8 +145,7 @@ message UpdateNodeClusterRequest {
|
|||||||
string name = 2;
|
string name = 2;
|
||||||
int64 nodeGrantId = 3;
|
int64 nodeGrantId = 3;
|
||||||
string installDir = 4;
|
string installDir = 4;
|
||||||
int64 httpCachePolicyId = 5;
|
string timeZone = 5;
|
||||||
int64 httpFirewallPolicyId = 6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除集群
|
// 删除集群
|
||||||
|
|||||||
Reference in New Issue
Block a user