wireguard

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2026 License: AGPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateInterfaceName

func CalculateInterfaceName(name string) (tunName string)

func KernelTunSupported

func KernelTunSupported() (bool, error)

Types

type Handler

type Handler struct {
	HandlerSettings
	// contains filtered or unexported fields
}

Handler is an outbound connection that silently swallow the entire payload.

func New

func New(settings HandlerSettings) (*Handler, error)

New creates a new wireguard handler.

func (*Handler) Close

func (h *Handler) Close() (err error)

func (*Handler) HandleFlow

func (h *Handler) HandleFlow(ctx context.Context, destination net.Destination, rw buf.ReaderWriter) error

Process implements OutboundHandler.Dispatch().

func (*Handler) HandlePacketConn

func (h *Handler) HandlePacketConn(ctx context.Context, dst net.Destination,
	pc udp.PacketReaderWriter) error

func (*Handler) Tag

func (h *Handler) Tag() string

type HandlerSettings

type HandlerSettings struct {
	Name string
	Conf *wireguard.DeviceConfig
	// used to resolve request addresses
	DnsForRequestAddress i.IPResolver
	DnsForEndpoint       i.IPResolver
	// control how to resolve peer's endpoint
	Strategy domain.DomainStrategy
	Dialer   i.Dialer
}

type Tunnel

type Tunnel interface {
	BuildDevice(ipc string, bind conn.Bind) error
	DialContextTCPAddrPort(ctx context.Context, addr netip.AddrPort) (net.Conn, error)
	DialUDPAddrPort(laddr, raddr netip.AddrPort) (net.Conn, error)
	Close() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL