修改反向代理实现方式

This commit is contained in:
GoEdgeLab
2020-09-21 20:21:26 +08:00
parent 8a1cfa92ca
commit 20fafde4ba
7 changed files with 58 additions and 58 deletions

View File

@@ -0,0 +1,17 @@
package models
import (
"encoding/json"
"errors"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
)
// 解析地址
func (this *Origin) 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
}