tunnel

package
v0.0.0-...-5eba11c Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package tunnel provides an extension over standard library's net.Interface type.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when no tunnel matches the search parameters.
	ErrNotFound = errors.New("tunnel not found")
)

Functions

This section is empty.

Types

type Statistics

type Statistics struct {
	Tx uint64
	Rx uint64
}

Statistics defines what information can be collected about the tunnel

type T

type T interface {
	Interface() net.Interface
	IPs() []netip.Addr
	TransferRates() (Statistics, error)
}

T describes tunnel behavior probably needs a better name, though

type Tunnel

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

Tunnel encrypts and decrypts network traffic.

func Find

func Find(ipAddrs ...netip.Addr) (Tunnel, error)

Find a tunnel with given IPs.

func New

func New(iface net.Interface, ips []netip.Addr) *Tunnel

func (*Tunnel) AddAddrs

func (t *Tunnel) AddAddrs() error

AddAddrs to a tunnel interface.

func (*Tunnel) DelAddrs

func (t *Tunnel) DelAddrs() error

DelAddrs from a tunnel interface.

func (*Tunnel) IPs

func (t *Tunnel) IPs() []netip.Addr

IPs attached to the tunnel.

func (*Tunnel) Interface

func (t *Tunnel) Interface() net.Interface

Interface returns the underlying network interface.

func (Tunnel) TransferRates

func (t Tunnel) TransferRates() (Statistics, error)

TransferRates collects data transfer statistics.

func (*Tunnel) Up

func (t *Tunnel) Up() error

Up sets tunnel state to up.

Jump to

Keyboard shortcuts

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