Documentation ¶
Index ¶
- Constants
- Variables
- func CpWshToRemote(ctx context.Context, client *wsl.Distro, clientOs string, clientArch string) error
- func DisconnectClient(connName string) error
- func EnsureConnection(ctx context.Context, connName string) error
- func GetAllConnStatus() []wshrpc.ConnStatus
- func GetClientPlatform(ctx context.Context, shell genconn.ShellClient) (string, string, error)
- func GetClientPlatformFromOsArchStr(ctx context.Context, osArchStr string) (string, string, error)
- func GetNumWSLHasConnected() int
- func IsPowershell(shellPath string) bool
- func WithLockRtn[T any](conn *WslConn, fn func() T) T
- type CancellableCmd
- type WshCheckResult
- type WshInstallOpts
- type WslConn
- func (conn *WslConn) ClearWshError()
- func (conn *WslConn) Close() error
- func (conn *WslConn) Connect(ctx context.Context) error
- func (conn *WslConn) Debugf(ctx context.Context, format string, args ...any)
- func (conn *WslConn) DeriveConnStatus() wshrpc.ConnStatus
- func (conn *WslConn) FireConnChangeEvent()
- func (conn *WslConn) GetClient() *wsl.Distro
- func (conn *WslConn) GetConfigShellPath() string
- func (conn *WslConn) GetDomainSocketName() string
- func (conn *WslConn) GetName() string
- func (conn *WslConn) GetStatus() string
- func (conn *WslConn) Infof(ctx context.Context, format string, args ...any)
- func (conn *WslConn) InstallWsh(ctx context.Context, osArchStr string) error
- func (conn *WslConn) OpenDomainSocketListener(ctx context.Context) error
- func (conn *WslConn) Reconnect(ctx context.Context) error
- func (conn *WslConn) SetWshError(err error)
- func (conn *WslConn) StartConnServer(ctx context.Context, afterUpdate bool) (bool, string, string, error)
- func (conn *WslConn) UpdateWsh(ctx context.Context, clientDisplayName string, remoteInfo *wshrpc.RemoteInfo) error
- func (conn *WslConn) WaitForConnect(ctx context.Context) error
- func (conn *WslConn) WithLock(fn func())
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 CpWshToRemote ¶
func DisconnectClient ¶
func EnsureConnection ¶
Convenience function for ensuring a connection is established
func GetAllConnStatus ¶
func GetAllConnStatus() []wshrpc.ConnStatus
func GetClientPlatform ¶
returns (os, arch, error) guaranteed to return a supported platform
func GetNumWSLHasConnected ¶
func GetNumWSLHasConnected() int
func IsPowershell ¶
func WithLockRtn ¶
Types ¶
type CancellableCmd ¶
type WshCheckResult ¶
type WshInstallOpts ¶
type WslConn ¶
type WslConn struct { Lock *sync.Mutex Status string WshEnabled *atomic.Bool Name wsl.WslName Client *wsl.Distro DomainSockName string // if "", then no domain socket DomainSockListener net.Listener ConnController *wsl.WslCmd Error string WshError string NoWshReason string WshVersion string HasWaiter *atomic.Bool LastConnectTime int64 ActiveConnNum int // contains filtered or unexported fields }
func GetWslConn ¶
func (*WslConn) ClearWshError ¶
func (conn *WslConn) ClearWshError()
func (*WslConn) DeriveConnStatus ¶
func (conn *WslConn) DeriveConnStatus() wshrpc.ConnStatus
func (*WslConn) FireConnChangeEvent ¶
func (conn *WslConn) FireConnChangeEvent()
func (*WslConn) GetConfigShellPath ¶
func (*WslConn) GetDomainSocketName ¶
func (*WslConn) InstallWsh ¶
func (*WslConn) OpenDomainSocketListener ¶
*
- This function is does not set a listener for WslConn
- It is still required in order to set SockName
*
func (*WslConn) SetWshError ¶
func (*WslConn) StartConnServer ¶
func (conn *WslConn) 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
Click to show internal directories.
Click to hide internal directories.