sing-box/transport/wireguard/endpoint.go

36 lines
563 B
Go
Raw Normal View History

2022-09-05 16:15:09 +00:00
package wireguard
import (
"net/netip"
"github.com/sagernet/wireguard-go/conn"
2022-09-05 16:15:09 +00:00
)
var _ conn.Endpoint = (*Endpoint)(nil)
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 {
return (netip.AddrPort)(e).String()
2022-09-05 16:15:09 +00:00
}
func (e Endpoint) DstToBytes() []byte {
b, _ := (netip.AddrPort)(e).MarshalBinary()
2022-09-05 16:15:09 +00:00
return b
}
func (e Endpoint) DstIP() netip.Addr {
return (netip.AddrPort)(e).Addr()
2022-09-05 16:15:09 +00:00
}
func (e Endpoint) SrcIP() netip.Addr {
return netip.Addr{}
}