remote

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const CachePathEnv = "SSHQ_PROFILE_CACHE"
View Source
const DefaultTTL = 24 * time.Hour

Variables

This section is empty.

Functions

func DecodeString

func DecodeString(s, enc string) string

DecodeString decodes a buffered string from the given encoding to UTF-8. Used for buffered command output where a streaming DecodingWriter is not available; on decode failure it returns the original string unchanged.

func EncodingByName

func EncodingByName(name string) encoding.Encoding

func NeedsTranscoding

func NeedsTranscoding(p *Profile) bool

func NewDecodingWriter

func NewDecodingWriter(w io.Writer, enc string) io.Writer

func RenderProfileCompact

func RenderProfileCompact(p *Profile) string

func RenderProfilePretty

func RenderProfilePretty(p *Profile) string

Types

type Cache

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

func NewCache

func NewCache(ttl time.Duration, opts ...CacheOption) (*Cache, error)

func (*Cache) Get

func (c *Cache) Get(host, port string) (*Profile, bool)

func (*Cache) Invalidate

func (c *Cache) Invalidate(host, port string)

func (*Cache) Load

func (c *Cache) Load()

func (*Cache) Put

func (c *Cache) Put(host, port string, p *Profile)

func (*Cache) Save

func (c *Cache) Save()

type CacheOption

type CacheOption func(*cacheOptions)

func WithCacheInfo

func WithCacheInfo(info func(string)) CacheOption

func WithCachePath

func WithCachePath(path string) CacheOption

type OS

type OS string
const (
	Linux   OS = "linux"
	Darwin  OS = "darwin"
	FreeBSD OS = "freebsd"
	Windows OS = "windows"
	Unknown OS = "unknown"
)

type Profile

type Profile struct {
	OS             OS     `json:"os"`
	Shell          Shell  `json:"shell"`
	Encoding       string `json:"encoding,omitempty"`
	HomeDir        string `json:"home_dir,omitempty"`
	TempDir        string `json:"temp_dir,omitempty"`
	PowerShellPath string `json:"powershell_path,omitempty"`
	PwshPath       string `json:"pwsh_path,omitempty"`
	DetectedAt     int64  `json:"detected_at"`
}

func Detect

func Detect(ctx context.Context, client *sshclient.Client) (*Profile, error)

func GetProfile

func GetProfile(ctx context.Context, client *sshclient.Client, cache *Cache, host, port string) (*Profile, error)

func (*Profile) Age

func (p *Profile) Age() time.Duration

func (*Profile) InterpreterCmd

func (p *Profile) InterpreterCmd() string

func (*Profile) IsPOSIX

func (p *Profile) IsPOSIX() bool

func (*Profile) IsWindows

func (p *Profile) IsWindows() bool

func (*Profile) NeedsStdinInjection

func (p *Profile) NeedsStdinInjection() bool

type Shell

type Shell string
const (
	Bash       Shell = "bash"
	Ash        Shell = "ash"
	Zsh        Shell = "zsh"
	Sh         Shell = "sh"
	Fish       Shell = "fish"
	Ksh        Shell = "ksh"
	Tcsh       Shell = "tcsh"
	Csh        Shell = "csh"
	PowerShell Shell = "powershell"
	Cmd        Shell = "cmd"
)

Jump to

Keyboard shortcuts

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