节点可以单独设置所使用的API节点地址

This commit is contained in:
刘祥超
2022-11-21 19:55:01 +08:00
parent 991e08fa71
commit d6f311e057
6 changed files with 144 additions and 0 deletions

View File

@@ -137,6 +137,7 @@ func (this *Node) HasDDoSProtection() bool {
return false
}
// DecodeMaxCacheDiskCapacity 解析硬盘容量
func (this *Node) DecodeMaxCacheDiskCapacity() *shared.SizeCapacity {
if this.MaxCacheDiskCapacity.IsNull() {
return nil
@@ -147,6 +148,7 @@ func (this *Node) DecodeMaxCacheDiskCapacity() *shared.SizeCapacity {
return capacity
}
// DecodeMaxCacheMemoryCapacity 解析内存容量
func (this *Node) DecodeMaxCacheMemoryCapacity() *shared.SizeCapacity {
if this.MaxCacheMemoryCapacity.IsNull() {
return nil
@@ -171,6 +173,7 @@ func (this *Node) DecodeDNSResolver() *nodeconfigs.DNSResolverConfig {
return resolverConfig
}
// DecodeLnAddrs 解析Ln地址
func (this *Node) DecodeLnAddrs() []string {
if IsNull(this.LnAddrs) {
return nil
@@ -184,6 +187,7 @@ func (this *Node) DecodeLnAddrs() []string {
return result
}
// DecodeCacheDiskSubDirs 解析缓存目录
func (this *Node) DecodeCacheDiskSubDirs() []*serverconfigs.CacheDir {
if IsNull(this.CacheDiskSubDirs) {
return nil
@@ -196,3 +200,17 @@ func (this *Node) DecodeCacheDiskSubDirs() []*serverconfigs.CacheDir {
}
return result
}
// DecodeAPINodeAddrs 解析API节点地址
func (this *Node) DecodeAPINodeAddrs() []*serverconfigs.NetworkAddressConfig {
var result = []*serverconfigs.NetworkAddressConfig{}
if IsNull(this.ApiNodeAddrs) {
return result
}
err := json.Unmarshal(this.ApiNodeAddrs, &result)
if err != nil {
remotelogs.Error("Node.DecodeAPINodeAddrs", err.Error())
}
return result
}