2022-09-05 16:15:09 +00:00
|
|
|
package wireguard
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/netip"
|
|
|
|
|
|
|
|
M "github.com/sagernet/sing/common/metadata"
|
2022-11-07 08:35:15 +00:00
|
|
|
"github.com/sagernet/wireguard-go/conn"
|
2022-09-05 16:15:09 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var _ conn.Endpoint = (*Endpoint)(nil)
|
|
|
|
|
|
|
|
type Endpoint M.Socksaddr
|
|
|
|
|
|
|
|
func (e Endpoint) ClearSrc() {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e Endpoint) SrcToString() string {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e Endpoint) DstToString() string {
|
|
|
|
return (M.Socksaddr)(e).String()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e Endpoint) DstToBytes() []byte {
|
|
|
|
b, _ := (M.Socksaddr)(e).AddrPort().MarshalBinary()
|
|
|
|
return b
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e Endpoint) DstIP() netip.Addr {
|
|
|
|
return (M.Socksaddr)(e).Addr
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e Endpoint) SrcIP() netip.Addr {
|
|
|
|
return netip.Addr{}
|
|
|
|
}
|