tunnel

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 21 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(
	ctx context.Context,
	projectID uuid.UUID,
	endpoint string,
) (*kernelTunnel, error)

CreateKernelTunnel creates a new kernel tunnel interface (WireGuard).

func CreateUserspaceTunnel added in v0.4.1

func CreateUserspaceTunnel(
	ctx context.Context,
	projectID uuid.UUID,
	endpoint string,
	socksPort uint16,
	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
	// 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
	// ExternalAddress returns the external address of this end of the tunnel.
	ExternalAddress() netip.AddrPort
	// 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
}

Tunnel is a WireGuard tunnel.

Jump to

Keyboard shortcuts

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