mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-11 22:00:27 +08:00
阶段性提交
This commit is contained in:
17
internal/db/models/origin_server_model_ext.go
Normal file
17
internal/db/models/origin_server_model_ext.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user