tunnel

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: GPL-3.0, LGPL-3.0 Imports: 13 Imported by: 0 modules, 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

Overview

Package tunnel manages the sshuttle profiles a site offers.

A profile says which networks to route, through which host, and what to keep off the tunnel. It replaces the per site shell scripts that carried the same arguments, and it resolves network names and the workstation's own address from the configuration instead of hard coding them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// Profiles are the configured tunnels.
	Profiles map[string]v1alpha1.TunnelSpec
	// Networks maps a network name to a CIDR.
	Networks map[string]string
	// Host resolves a role name to the host sshuttle connects to.
	Host func(role string) (host, user string, err error)
	// StateDir holds the process id files.
	StateDir string
	// Binary is the sshuttle to run.
	Binary string
	// Vars are the template values a profile may refer to, such as
	// {workstation.host}.
	Vars map[string]string
}

Manager starts, stops and reports on the tunnels of a site.

func (*Manager) Args

func (m *Manager) Args(name string) ([]string, error)

Args builds the sshuttle argument vector for a profile.

func (*Manager) Names

func (m *Manager) Names() []string

Names lists the configured profiles in sorted order.

func (*Manager) PIDFile

func (m *Manager) PIDFile(name string) string

PIDFile is where a running profile records its process id.

func (*Manager) Start

func (m *Manager) Start(ctx context.Context, name string) error

Start brings a profile up. Starting one that is already running is reported rather than producing a second tunnel for the same networks.

func (*Manager) Status

func (m *Manager) Status() []Status

Status reports every profile and whether it is running.

func (*Manager) Stop

func (m *Manager) Stop(name string) error

Stop brings a profile down.

type Status

type Status struct {
	Name        string `json:"name" yaml:"name"`
	Running     bool   `json:"running" yaml:"running"`
	PID         int    `json:"pid,omitempty" yaml:"pid,omitempty"`
	Remote      string `json:"remote" yaml:"remote"`
	Subnets     string `json:"subnets" yaml:"subnets"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
}

Status describes one profile.

Jump to

Keyboard shortcuts

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