2022-09-05 16:15:09 +00:00
|
|
|
package wireguard
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/netip"
|
|
|
|
|
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)
|
|
|
|
|
2023-12-15 04:49:31 +00:00
|
|
|
type Endpoint netip.AddrPort
|
2022-09-05 16:15:09 +00:00
|
|
|
|
|
|
|
func (e Endpoint) ClearSrc() {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e Endpoint) SrcToString() string {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e Endpoint) DstToString() string {
|
2023-12-15 04:49:31 +00:00
|
|
|
return (netip.AddrPort)(e).String()
|
2022-09-05 16:15:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e Endpoint) DstToBytes() []byte {
|
2023-12-15 04:49:31 +00:00
|
|
|
b, _ := (netip.AddrPort)(e).MarshalBinary()
|
2022-09-05 16:15:09 +00:00
|
|
|
return b
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e Endpoint) DstIP() netip.Addr {
|
2023-12-15 04:49:31 +00:00
|
|
|
return (netip.AddrPort)(e).Addr()
|
2022-09-05 16:15:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e Endpoint) SrcIP() netip.Addr {
|
|
|
|
return netip.Addr{}
|
|
|
|
}
|