tunnel

package
v0.0.0-...-6d4f3c0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package tunnel opens a tunnel using provided server and tunnel configuration and keeps it until something will break it or close it. As soon as the tunnel closed, it returns a signal to executing the routine using the channel flag.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFullKeyPath

func GetFullKeyPath(keyPath string) string

func NewSshConfig

func NewSshConfig(serverConfig config.Server) (*ssh.ClientConfig, error)

Types

type State

type State int
const (
	Starting State = iota
	Started
	Stopped
)

type Stats

type Stats struct {
	*sync.Mutex
	State State

	TxCount             int64
	RxCount             int64
	TxSpeed             int64
	RxSpeed             int64
	ConnQty             int64
	UpdateStatsCallback func(stats *Stats)
	// contains filtered or unexported fields
}

func NewStats

func NewStats(state State, updateStatsCallback func(stats *Stats)) *Stats

func (*Stats) AddConnQty

func (s *Stats) AddConnQty()

func (*Stats) AddRxCount

func (s *Stats) AddRxCount(count int64)

func (*Stats) AddTxCount

func (s *Stats) AddTxCount(count int64)

func (*Stats) InitSpeedCalculation

func (s *Stats) InitSpeedCalculation()

func (*Stats) SetConnQty

func (s *Stats) SetConnQty(qty int64)

func (*Stats) SubConnQty

func (s *Stats) SubConnQty()

func (*Stats) UpdateState

func (s *Stats) UpdateState(state State)

type Tunnel

type Tunnel struct {
	*sync.Mutex

	ServerConfig config.Server
	TunnelConfig config.Tunnel
	LoggerCh     chan string
	StatsCh      chan *Stats
	// contains filtered or unexported fields
}

func NewTunnel

func NewTunnel(appRuntime runtime.ApplicationRuntime, serverConfig config.Server, tunnelConfig config.Tunnel) *Tunnel

func (*Tunnel) GetTunnelId

func (t *Tunnel) GetTunnelId() string

func (*Tunnel) Init

func (t *Tunnel) Init(runtime runtime.ApplicationRuntime)

func (*Tunnel) Start

func (t *Tunnel) Start() error

Jump to

Keyboard shortcuts

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