mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 16:00:24 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			18 lines
		
	
	
		
			418 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			418 B
		
	
	
	
		
			Go
		
	
	
	
	
	
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
 | 
						|
}
 |