tunnel

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package tunnel implements TCP/UDP forwarding over WireGuard.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apoxy4To6Range

func Apoxy4To6Range() netip.Prefix

Apoxy4To6Range returns the Unique Local Adddres prefix used by Apoxy for IPv4 to IPv6 translation.

func CreateKernelTunnel added in v0.4.1

func CreateKernelTunnel(
	addr netip.Prefix,
	bind conn.Bind,
	verbose bool,
) (*kernelTunnel, error)

CreateKernelTunnel creates a new kernel tunnel interface (TUN).

func CreateUserspaceTunnel added in v0.4.1

func CreateUserspaceTunnel(
	ctx context.Context,
	addr netip.Addr,
	bind conn.Bind,
	socksPort uint16,
	packetCapturePath string,
	verbose bool,
) (*userspaceTunnel, error)

CreateUserspaceTunnel creates a new user-space WireGuard tunnel.

func NewApoxy4To6Prefix

func NewApoxy4To6Prefix(orgID uuid.UUID, endpoint string) netip.Prefix

NewApoxy4To6Prefix generates a new IPv6 address from the Apoxy4To6Range prefix.

Types

type Tunnel

type Tunnel interface {
	io.Closer
	// Peers returns the public keys of the peers in the tunnel.
	Peers() ([]wireguard.PeerConfig, error)
	// AddPeer adds a new peer to the tunnel.
	AddPeer(peerConf *wireguard.PeerConfig) error
	// RemovePeer removes a peer from the tunnel.
	RemovePeer(publicKey string) error
	// PublicKey returns the public key of this end of the tunnel.
	PublicKey() string
	// InternalAddress returns the internal address of this end of the tunnel.
	InternalAddress() netip.Prefix
	// ListenPort returns the local listen port of this end of the tunnel.
	ListenPort() (uint16, error)
}

Tunnel is a WireGuard tunnel.

Jump to

Keyboard shortcuts

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