Documentation ¶
Index ¶
- Constants
- Variables
- func DisconnectClient(opts *remote.SSHOpts) error
- func EnsureConnection(ctx context.Context, connName string) error
- func GetAllConnStatus() []wshrpc.ConnStatus
- func GetConnectionsFromConfig() ([]string, error)
- func GetConnectionsFromInternalConfig() []string
- func GetConnectionsList() ([]string, error)
- func GetNumSSHHasConnected() int
- func IsWshVersionUpToDate(logCtx context.Context, wshVersionLine string) (bool, string, string, error)
- func WithLockRtn[T any](conn *SSHConn, fn func() T) T
- type SSHConn
- func (conn *SSHConn) ClearWshError()
- func (conn *SSHConn) Close() error
- func (conn *SSHConn) Connect(ctx context.Context, connFlags *wshrpc.ConnKeywords) error
- func (conn *SSHConn) Debugf(ctx context.Context, format string, args ...any)
- func (conn *SSHConn) DeriveConnStatus() wshrpc.ConnStatus
- func (conn *SSHConn) FireConnChangeEvent()
- func (conn *SSHConn) GetClient() *ssh.Client
- func (conn *SSHConn) GetConfigShellPath() string
- func (conn *SSHConn) GetDomainSocketName() string
- func (conn *SSHConn) GetName() string
- func (conn *SSHConn) GetStatus() string
- func (conn *SSHConn) Infof(ctx context.Context, format string, args ...any)
- func (conn *SSHConn) InstallWsh(ctx context.Context, osArchStr string) error
- func (conn *SSHConn) OpenDomainSocketListener(ctx context.Context) error
- func (conn *SSHConn) SetWshError(err error)
- func (conn *SSHConn) StartConnServer(ctx context.Context, afterUpdate bool) (bool, string, string, error)
- func (conn *SSHConn) UpdateWsh(ctx context.Context, clientDisplayName string, remoteInfo *wshrpc.RemoteInfo) error
- func (conn *SSHConn) WaitForConnect(ctx context.Context) error
- func (conn *SSHConn) WithLock(fn func())
- type WshCheckResult
- type WshInstallOpts
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 ¶
Functions ¶
func DisconnectClient ¶
func EnsureConnection ¶
Convenience function for ensuring a connection is established
func GetAllConnStatus ¶
func GetAllConnStatus() []wshrpc.ConnStatus
func GetConnectionsFromInternalConfig ¶ added in v0.10.0
func GetConnectionsFromInternalConfig() []string
func GetConnectionsList ¶
func GetNumSSHHasConnected ¶ added in v0.9.3
func GetNumSSHHasConnected() int
func IsWshVersionUpToDate ¶ added in v0.11.0
func IsWshVersionUpToDate(logCtx context.Context, wshVersionLine string) (bool, string, string, error)
expects the output of `wsh version` which looks like `wsh v0.10.4` or "not-installed os [arch]" returns (up-to-date, semver, osArchStr, error) if not up to date, or error, version might be ""
func WithLockRtn ¶ added in v0.11.0
Types ¶
type SSHConn ¶
type SSHConn struct { Lock *sync.Mutex Status string WshEnabled *atomic.Bool Opts *remote.SSHOpts Client *ssh.Client DomainSockName string // if "", then no domain socket DomainSockListener net.Listener ConnController *ssh.Session Error string WshError string NoWshReason string WshVersion string HasWaiter *atomic.Bool LastConnectTime int64 ActiveConnNum int }
func (*SSHConn) ClearWshError ¶ added in v0.11.0
func (conn *SSHConn) ClearWshError()
func (*SSHConn) DeriveConnStatus ¶
func (conn *SSHConn) DeriveConnStatus() wshrpc.ConnStatus
func (*SSHConn) FireConnChangeEvent ¶
func (conn *SSHConn) FireConnChangeEvent()
func (*SSHConn) GetConfigShellPath ¶ added in v0.11.0
func (*SSHConn) GetDomainSocketName ¶
func (*SSHConn) InstallWsh ¶ added in v0.11.0
func (*SSHConn) OpenDomainSocketListener ¶
func (*SSHConn) SetWshError ¶ added in v0.11.0
func (*SSHConn) StartConnServer ¶
func (conn *SSHConn) StartConnServer(ctx context.Context, afterUpdate bool) (bool, string, string, error)
returns (needsInstall, clientVersion, osArchStr, error) if wsh is not installed, the clientVersion will be "not-installed", and it will also return an osArchStr if clientVersion is set, then no osArchStr will be returned
type WshCheckResult ¶ added in v0.11.0
type WshInstallOpts ¶
Click to show internal directories.
Click to hide internal directories.