mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-15 21:51:23 +08:00
37 lines
546 B
Go
37 lines
546 B
Go
package net
|
|
|
|
import (
|
|
"net"
|
|
)
|
|
|
|
type CustomAddr interface {
|
|
net.Addr
|
|
RawAddr() net.Addr
|
|
}
|
|
|
|
type customAddr struct {
|
|
networkStr string
|
|
addrStr string
|
|
rawAddr net.Addr
|
|
}
|
|
|
|
func (a customAddr) Network() string {
|
|
return a.networkStr
|
|
}
|
|
|
|
func (a customAddr) String() string {
|
|
return a.addrStr
|
|
}
|
|
|
|
func (a customAddr) RawAddr() net.Addr {
|
|
return a.rawAddr
|
|
}
|
|
|
|
func NewCustomAddr(networkStr string, addrStr string, rawAddr net.Addr) CustomAddr {
|
|
return customAddr{
|
|
networkStr: networkStr,
|
|
addrStr: addrStr,
|
|
rawAddr: rawAddr,
|
|
}
|
|
}
|