Documentation ¶
Overview ¶
Package conn implements WireGuard's network connections.
Index ¶
- Constants
- type Bind
- type BindSocketToInterface
- type Endpoint
- type IPv4Source
- type IPv6Source
- type NativeEndpoint
- func (end *NativeEndpoint) ClearDst()
- func (end *NativeEndpoint) ClearSrc()
- func (endpoint *NativeEndpoint) Dst4() *unix.SockaddrInet4
- func (end *NativeEndpoint) DstIP() net.IP
- func (end *NativeEndpoint) DstToBytes() []byte
- func (end *NativeEndpoint) DstToString() string
- func (endpoint *NativeEndpoint) IsV6() bool
- func (endpoint *NativeEndpoint) Src4() *IPv4Source
- func (end *NativeEndpoint) SrcIP() net.IP
- func (end *NativeEndpoint) SrcToString() string
- type PeekLookAtSocketFd
Constants ¶
View Source
const (
FD_ERR = -1
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bind ¶
type Bind interface { // LastMark reports the last mark set for this Bind. LastMark() uint32 // SetMark sets the mark for each packet sent through this Bind. // This mark is passed to the kernel as the socket option SO_MARK. SetMark(mark uint32) error // ReceiveIPv6 reads an IPv6 UDP packet into b. // // It reports the number of bytes read, n, // the packet source address ep, // and any error. ReceiveIPv6(buff []byte) (n int, ep Endpoint, err error) // ReceiveIPv4 reads an IPv4 UDP packet into b. // // It reports the number of bytes read, n, // the packet source address ep, // and any error. ReceiveIPv4(b []byte) (n int, ep Endpoint, err error) // Send writes a packet b to address ep. Send(b []byte, ep Endpoint) error // Close closes the Bind connection. Close() error }
A Bind listens on a port for both IPv6 and IPv4 UDP traffic.
A Bind interface may also be a PeekLookAtSocketFd or BindSocketToInterface, depending on the platform-specific implementation.
type BindSocketToInterface ¶
type BindSocketToInterface interface { BindSocketToInterface4(interfaceIndex uint32, blackhole bool) error BindSocketToInterface6(interfaceIndex uint32, blackhole bool) error }
BindSocketToInterface is implemented by Bind objects that support being tied to a single network interface. Used by wireguard-windows.
type Endpoint ¶
type Endpoint interface { ClearSrc() // clears the source address SrcToString() string // returns the local source address (ip:port) DstToString() string // returns the destination address (ip:port) DstToBytes() []byte // used for mac2 cookie calculations DstIP() net.IP SrcIP() net.IP }
An Endpoint maintains the source/destination caching for a peer.
dst : the remote address of a peer ("endpoint" in uapi terminology) src : the local address from which datagrams originate going to the peer
func CreateEndpoint ¶
type IPv4Source ¶
type IPv6Source ¶
type IPv6Source struct {
// contains filtered or unexported fields
}
type NativeEndpoint ¶
func (*NativeEndpoint) ClearDst ¶
func (end *NativeEndpoint) ClearDst()
func (*NativeEndpoint) ClearSrc ¶
func (end *NativeEndpoint) ClearSrc()
func (*NativeEndpoint) Dst4 ¶
func (endpoint *NativeEndpoint) Dst4() *unix.SockaddrInet4
func (*NativeEndpoint) DstIP ¶
func (end *NativeEndpoint) DstIP() net.IP
func (*NativeEndpoint) DstToBytes ¶
func (end *NativeEndpoint) DstToBytes() []byte
func (*NativeEndpoint) DstToString ¶
func (end *NativeEndpoint) DstToString() string
func (*NativeEndpoint) IsV6 ¶
func (endpoint *NativeEndpoint) IsV6() bool
func (*NativeEndpoint) Src4 ¶
func (endpoint *NativeEndpoint) Src4() *IPv4Source
func (*NativeEndpoint) SrcIP ¶
func (end *NativeEndpoint) SrcIP() net.IP
func (*NativeEndpoint) SrcToString ¶
func (end *NativeEndpoint) SrcToString() string
Click to show internal directories.
Click to hide internal directories.