wgproxy

package
v0.77.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: BSD-3-Clause Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KernelFactory

type KernelFactory struct {
	// contains filtered or unexported fields
}

func NewKernelFactory

func NewKernelFactory(wgPort int, mtu uint16) *KernelFactory

func (*KernelFactory) Free

func (w *KernelFactory) Free() error

func (*KernelFactory) GetProxy

func (w *KernelFactory) GetProxy() Proxy

func (*KernelFactory) GetProxyPort added in v0.64.2

func (w *KernelFactory) GetProxyPort() uint16

GetProxyPort returns the eBPF proxy port, or 0 if eBPF is not active.

type Proxy

type Proxy interface {
	AddTurnConn(ctx context.Context, endpoint *net.UDPAddr, remoteConn net.Conn) error
	EndpointAddr() *net.UDPAddr // EndpointAddr returns the address of the WireGuard peer endpoint
	Work()                      // Work start or resume the proxy
	Pause()                     // Pause to forward the packages from remote connection to WireGuard. The opposite way still works.

	//RedirectAs resume the forwarding the packages from relayed connection to WireGuard interface if it was paused
	//and rewrite the src address to the endpoint address.
	//With this logic can avoid the package loss from relayed connections.
	RedirectAs(endpoint *net.UDPAddr)
	CloseConn() error
	SetDisconnectListener(disconnected func())

	// InjectPacket writes a raw packet directly to the remote peer over the underlying transport,
	// bypassing WireGuard. Used to replay the captured lazyconn handshake initiation. Only the
	// kernel-mode proxies act on it; the userspace proxy is a no-op since reinjection is kernel-only.
	InjectPacket(b []byte) error
}

Proxy is a transfer layer between the relayed connection and the WireGuard

type USPFactory

type USPFactory struct {
	// contains filtered or unexported fields
}

func NewUSPFactory

func NewUSPFactory(bind proxyBind.Bind, mtu uint16) *USPFactory

func (*USPFactory) Free

func (w *USPFactory) Free() error

func (*USPFactory) GetProxy

func (w *USPFactory) GetProxy() Proxy

func (*USPFactory) GetProxyPort added in v0.64.2

func (w *USPFactory) GetProxyPort() uint16

GetProxyPort returns 0 as userspace WireGuard doesn't use a separate proxy port.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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