Help us shape the future of Go! Take the 2026 Go Developer Survey

tun

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2025 License: MIT, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TunRegistry

func TunRegistry() *registry.Registry

TunRegistry returns a singleton instance of Registry

Types

type Tunnel

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

Tunnel object

func NewTunnel

func NewTunnel(sshConn *sshc.SshConnection, conf *TunnelConf, stoppable bool) *Tunnel

NewTunnel builds a Tunnel object

func (*Tunnel) GetActiveClientsCount

func (t *Tunnel) GetActiveClientsCount() int

GetActiveClientsCount returns how many clients are actually using the tunnel

func (*Tunnel) GetCurrentBytesPerSecond

func (t *Tunnel) GetCurrentBytesPerSecond() int64

GetsCurrentBytesPerSecond return the current tunnel throughput

func (*Tunnel) GetEndpoint

func (t *Tunnel) GetEndpoint() utils.Endpoint

GetEndpoint returns the tunnel endpoint

func (*Tunnel) GetIsListenerLocal

func (t *Tunnel) GetIsListenerLocal() bool

GetIsListenerLocal return true if it is a forward tunnel. In a forward tunnel a socket listener is started on the local (rospo) machine and all the connections are forwarded to the remote endpoint. In a NON forward tunnel, the listener is started on the remote machine instead. When a client connects to the remote listener the connection is forwarded on the local endpoint

func (*Tunnel) GetListenerAddr

func (t *Tunnel) GetListenerAddr() net.Addr

GetListenerAddr returns the tunnel listener network address

func (*Tunnel) IsStoppable

func (t *Tunnel) IsStoppable() bool

IsStoppable return true if the tunnel can be stopped calling the Stop method. False if not

func (*Tunnel) Start

func (t *Tunnel) Start()

Start activates the tunnel connections

func (*Tunnel) Stop

func (t *Tunnel) Stop()

Stop ends the tunnel

type TunnelConf

type TunnelConf struct {
	//// Tunnel conf
	Remote string `yaml:"remote" json:"remote"`
	Local  string `yaml:"local" json:"local"`
	// indicates if it is a forward or reverse tunnel
	Forward bool `yaml:"forward" json:"forward"`
	// use a dedicated ssh client. if nil use the global one
	SshClientConf *sshc.SshClientConf `yaml:"sshclient" json:"sshclient"`
}

TunnelConf is a struct that holds the tunnel configuration

func (*TunnelConf) GetLocalEndpoint

func (c *TunnelConf) GetLocalEndpoint() *utils.Endpoint

GetLocalEndpoint Builds a locale endpoint object from the Local string

func (*TunnelConf) GetRemotEndpoint

func (c *TunnelConf) GetRemotEndpoint() *utils.Endpoint

GetRemotEndpoint Builds a remote endpoint object from the Remote string

Jump to

Keyboard shortcuts

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