阶段性提交

This commit is contained in:
GoEdgeLab
2020-09-13 20:37:28 +08:00
parent 84868c1a0b
commit dc79c661d7
89 changed files with 1364 additions and 12899 deletions

View File

@@ -0,0 +1,17 @@
package models
import (
"encoding/json"
"errors"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
)
// 解析地址
func (this *OriginServer) DecodeAddr() (*serverconfigs.NetworkAddressConfig, error) {
if len(this.Addr) == 0 || this.Addr == "null" {
return nil, errors.New("addr is empty")
}
addr := &serverconfigs.NetworkAddressConfig{}
err := json.Unmarshal([]byte(this.Addr), addr)
return addr, err
}