conncontroller

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Status_Init         = "init"
	Status_Connecting   = "connecting"
	Status_Connected    = "connected"
	Status_Disconnected = "disconnected"
	Status_Error        = "error"
)
View Source
const DefaultConnectionTimeout = 60 * time.Second

Variables

This section is empty.

Functions

func DisconnectClient

func DisconnectClient(opts *remote.SSHOpts) error

func EnsureConnection

func EnsureConnection(ctx context.Context, connName string) error

Convenience function for ensuring a connection is established

func GetAllConnStatus

func GetAllConnStatus() []wshrpc.ConnStatus

func GetConnectionsFromConfig

func GetConnectionsFromConfig() ([]string, error)

func GetConnectionsList

func GetConnectionsList() ([]string, error)

Types

type SSHConn

type SSHConn struct {
	Lock               *sync.Mutex
	Status             string
	Opts               *remote.SSHOpts
	Client             *ssh.Client
	SockName           string
	DomainSockListener net.Listener
	ConnController     *ssh.Session
	Error              string
	HasWaiter          *atomic.Bool
	LastConnectTime    int64
	ActiveConnNum      int
}

func GetConn

func GetConn(ctx context.Context, opts *remote.SSHOpts, shouldConnect bool) *SSHConn

func (*SSHConn) CheckAndInstallWsh

func (conn *SSHConn) CheckAndInstallWsh(ctx context.Context, clientDisplayName string, opts *WshInstallOpts) error

func (*SSHConn) Close

func (conn *SSHConn) Close() error

func (*SSHConn) Connect

func (conn *SSHConn) Connect(ctx context.Context) error

does not return an error since that error is stored inside of SSHConn

func (*SSHConn) DeriveConnStatus

func (conn *SSHConn) DeriveConnStatus() wshrpc.ConnStatus

func (*SSHConn) FireConnChangeEvent

func (conn *SSHConn) FireConnChangeEvent()

func (*SSHConn) GetClient

func (conn *SSHConn) GetClient() *ssh.Client

func (*SSHConn) GetDomainSocketName

func (conn *SSHConn) GetDomainSocketName() string

func (*SSHConn) GetName

func (conn *SSHConn) GetName() string

func (*SSHConn) GetStatus

func (conn *SSHConn) GetStatus() string

func (*SSHConn) OpenDomainSocketListener

func (conn *SSHConn) OpenDomainSocketListener() error

func (*SSHConn) Reconnect

func (conn *SSHConn) Reconnect(ctx context.Context) error

func (*SSHConn) StartConnServer

func (conn *SSHConn) StartConnServer() error

func (*SSHConn) WaitForConnect

func (conn *SSHConn) WaitForConnect(ctx context.Context) error

func (*SSHConn) WithLock

func (conn *SSHConn) WithLock(fn func())

type WshInstallOpts

type WshInstallOpts struct {
	Force        bool
	NoUserPrompt bool
}

Jump to

Keyboard shortcuts

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