session

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListSerialPorts added in v1.1.0

func ListSerialPorts() ([]string, error)

ListSerialPorts returns the names of available serial ports.

Types

type ConnResolver added in v1.4.0

type ConnResolver func(id string) (ConnectionConfig, bool)

ConnResolver resolves a saved SSH connection by its ID. app.go supplies one backed by the connection store so the tunnel layer can look up the exit connection and recurse its jump hosts without importing the store package.

type ConnectionConfig

type ConnectionConfig struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Type     string `json:"type"`
	Host     string `json:"host"`
	Port     int    `json:"port"`
	User     string `json:"user"`
	AuthType string `json:"authType"`
	// Password is stored in plaintext JSON. Will be migrated to OS keychain in a future iteration.
	Password string  `json:"password,omitempty"`
	KeyPath  string  `json:"keyPath,omitempty"`
	GroupId  *string `json:"groupId,omitempty"`
	// RDP-specific fields
	RdpFixedWidth  int  `json:"rdpFixedWidth,omitempty"`
	RdpFixedHeight int  `json:"rdpFixedHeight,omitempty"`
	RdpSmartSizing bool `json:"rdpSmartSizing"`
	RdpEnableNLA   bool `json:"rdpEnableNLA"`
	// Local terminal shell path
	ShellPath string `json:"shellPath,omitempty"`
	// Working directory for local terminal (defaults to user home directory if empty)
	Cwd string `json:"cwd,omitempty"`
	// Serial port configuration
	SerialPort     string  `json:"serialPort,omitempty"`
	SerialBaudRate int     `json:"serialBaudRate,omitempty"`
	SerialDataBits int     `json:"serialDataBits,omitempty"`
	SerialStopBits float64 `json:"serialStopBits,omitempty"`
	SerialParity   string  `json:"serialParity,omitempty"`
	// Database-specific fields
	DBType   string `json:"dbType,omitempty"`   // "mysql", "postgres", "rqlite", "oracle", "sqlserver"
	DBName   string `json:"dbName,omitempty"`   // default database name
	DBParams string `json:"dbParams,omitempty"` // extra DSN query parameters, e.g. "sslmode=require&connect_timeout=30"
	// SSH post-login script: commands to execute after successful login
	PostLoginScript string `json:"postLoginScript,omitempty"`
	// Post-login expect/send automation: interactive steps executed after login.
	PostLoginExpectSteps []PostLoginExpectStep `json:"postLoginExpectSteps,omitempty"`
	// SSH tunnel: reference to an existing SSH connection used as a jump host.
	// When set, the connection goes through local port forwarding:
	//   127.0.0.1:auto-port → tunnel SSH → target Host:Port
	TunnelSSHConnID   string `json:"tunnelSSHConnId,omitempty"`
	TunnelSSHUser     string `json:"tunnelSSHUser,omitempty"`
	TunnelSSHPassword string `json:"tunnelSSHPassword,omitempty"`
	// SFTP max concurrent transfers (0 = unlimited)
	SftpMaxConcurrency int `json:"sftpMaxConcurrency,omitempty"`
	// FTP-specific fields
	FtpEncryption string `json:"ftpEncryption,omitempty"` // "none"(default) | "auto" | "required"
	FtpPassive    bool   `json:"ftpPassive"`              // passive mode (default true)
	FtpEncoding   string `json:"ftpEncoding,omitempty"`   // "utf-8" | "gbk" | "shift-jis" | "latin-1"
	// SMB-specific fields
	SmbDomain string `json:"smbDomain,omitempty"`
	SmbShare  string `json:"smbShare,omitempty"`
	// WebDAV-specific fields
	WebdavURL    string `json:"webdavUrl,omitempty"`
	WebdavUseSSL bool   `json:"webdavUseSSL"` // default true
	// S3-specific fields
	S3Region string `json:"s3Region,omitempty"`
	S3Bucket string `json:"s3Bucket,omitempty"`
	// Terminal character encoding for ssh/telnet:
	// "" / "utf-8"(default) | "gbk" | "gb2312" | "gb18030" | "big5" | "shift-jis" | "euc-jp" | "euc-kr"
	Encoding string `json:"encoding,omitempty"`
}

type ConnectionGroup

type ConnectionGroup struct {
	ID       string  `json:"id"`
	Name     string  `json:"name"`
	ParentId *string `json:"parentId,omitempty"`
}

type ConnectionStoreData

type ConnectionStoreData struct {
	Groups      []ConnectionGroup  `json:"groups"`
	Connections []ConnectionConfig `json:"connections"`
}

ConnectionStoreData is the top-level structure persisted to connections.json.

type DatabaseSession

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

func NewDatabaseSession

func NewDatabaseSession(id string) *DatabaseSession

func (*DatabaseSession) Connect

func (s *DatabaseSession) Connect(config ConnectionConfig) error

func (*DatabaseSession) DB

func (s *DatabaseSession) DB() *sql.DB

DB returns the underlying database/sql connection (used by Wails bindings).

func (*DatabaseSession) DBType

func (s *DatabaseSession) DBType() string

DBType returns the database type string.

func (*DatabaseSession) Disconnect

func (s *DatabaseSession) Disconnect() error

func (*DatabaseSession) GetPendingSize

func (s *DatabaseSession) GetPendingSize() (cols, rows int)

func (*DatabaseSession) ID

func (s *DatabaseSession) ID() string

func (*DatabaseSession) IsConnected

func (s *DatabaseSession) IsConnected() bool

func (*DatabaseSession) IsZmodemMode

func (s *DatabaseSession) IsZmodemMode() bool

func (*DatabaseSession) RecordReadActivity added in v1.2.1

func (s *DatabaseSession) RecordReadActivity()

RecordReadActivity updates the last-read timestamp for idle detection. Each session's readLoop should call this whenever data is received.

func (*DatabaseSession) Resize

func (s *DatabaseSession) Resize(cols, rows int) error

func (*DatabaseSession) RunPostLoginScript added in v1.2.1

func (s *DatabaseSession) RunPostLoginScript(ctx context.Context, script string, send func([]byte), isConnected func() bool)

RunPostLoginScript sends each non-empty line of script after the terminal output goes idle, and waits for idle between commands. Stops early if ctx is cancelled or isConnected returns false.

func (*DatabaseSession) SetOnBinaryCallback

func (s *DatabaseSession) SetOnBinaryCallback(cb func([]byte))

func (*DatabaseSession) SetOnDataCallback

func (s *DatabaseSession) SetOnDataCallback(cb func([]byte))

func (*DatabaseSession) SetOnStatusChangeCallback

func (s *DatabaseSession) SetOnStatusChangeCallback(cb func(SessionStatus))

func (*DatabaseSession) SetPendingSize

func (s *DatabaseSession) SetPendingSize(cols, rows int)

func (*DatabaseSession) SetZmodemMode

func (s *DatabaseSession) SetZmodemMode(v bool)

func (*DatabaseSession) Status

func (s *DatabaseSession) Status() SessionStatus

func (*DatabaseSession) Title

func (s *DatabaseSession) Title() string

func (*DatabaseSession) Type

func (s *DatabaseSession) Type() string

func (*DatabaseSession) Write

func (s *DatabaseSession) Write(data []byte) error

type DiskInfo

type DiskInfo struct {
	Name       string `json:"name"`
	Type       string `json:"type"`
	Size       string `json:"size"`
	MountPoint string `json:"mountPoint"`
	Used       string `json:"used"`
	Total      string `json:"total"`
	Usage      int    `json:"usage"`
	Media      string `json:"media"`
	FSType     string `json:"fsType"`
	UUID       string `json:"uuid"`
	Vendor     string `json:"vendor"`
	Model      string `json:"model"`
}

type FTPSession

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

func NewFTPSession

func NewFTPSession(id string) *FTPSession

func (*FTPSession) CancelTransfer

func (s *FTPSession) CancelTransfer(taskID string) error

CancelTransfer cancels an ongoing transfer task.

func (*FTPSession) ChangeLocalDir

func (o *FTPSession) ChangeLocalDir(dir string) (FileListResult, error)

func (*FTPSession) ChangeRemoteDir

func (s *FTPSession) ChangeRemoteDir(dir string) (FileListResult, error)

func (*FTPSession) Chmod

func (s *FTPSession) Chmod(p string, mode os.FileMode) error

func (*FTPSession) Connect

func (s *FTPSession) Connect(config ConnectionConfig) error

func (*FTPSession) Copy added in v1.1.2

func (s *FTPSession) Copy(oldPath, newPath string) error

Copy copies a remote file via FTP (download + re-upload — FTP has no server-side copy).

func (*FTPSession) Disconnect

func (s *FTPSession) Disconnect() error

func (*FTPSession) Get

func (s *FTPSession) Get(remotePath, localPath string, recursive bool) (string, error)

func (*FTPSession) GetContent added in v1.1.2

func (s *FTPSession) GetContent(remotePath string) ([]byte, error)

GetContent reads the full content of a remote file via FTP.

func (*FTPSession) GetPendingSize

func (s *FTPSession) GetPendingSize() (cols, rows int)

func (*FTPSession) ID

func (s *FTPSession) ID() string

func (*FTPSession) IsConnected

func (s *FTPSession) IsConnected() bool

func (*FTPSession) IsZmodemMode

func (s *FTPSession) IsZmodemMode() bool

func (*FTPSession) ListLocal

func (o *FTPSession) ListLocal(dir string) (FileListResult, error)

func (*FTPSession) ListLocalDrives

func (o *FTPSession) ListLocalDrives() ([]FileItem, error)

func (*FTPSession) ListRemote

func (s *FTPSession) ListRemote(dir string) (FileListResult, error)

func (*FTPSession) LocalCopy added in v1.1.2

func (o *FTPSession) LocalCopy(oldPath, newPath string) error

func (*FTPSession) LocalGetContent added in v1.1.2

func (o *FTPSession) LocalGetContent(localPath string) ([]byte, error)

func (*FTPSession) LocalMkdir

func (o *FTPSession) LocalMkdir(dir string) error

func (*FTPSession) LocalMove added in v1.1.2

func (o *FTPSession) LocalMove(oldPath, newPath string) error

func (*FTPSession) LocalPutContent added in v1.1.2

func (o *FTPSession) LocalPutContent(localPath string, content []byte) error

func (*FTPSession) LocalRemove

func (o *FTPSession) LocalRemove(p string, recursive bool) error

func (*FTPSession) LocalRename

func (o *FTPSession) LocalRename(oldName, newName string) error

func (*FTPSession) MakeDir

func (s *FTPSession) MakeDir(dir string) error

func (*FTPSession) Move added in v1.1.2

func (s *FTPSession) Move(oldPath, newPath string) error

Move moves a remote file via FTP Rename (server-side, no data transfer).

func (*FTPSession) PauseTransfer

func (s *FTPSession) PauseTransfer(taskID string) error

PauseTransfer pauses an ongoing transfer task.

func (*FTPSession) Put

func (s *FTPSession) Put(localPath, remotePath string, recursive bool) (string, error)

func (*FTPSession) PutContent

func (s *FTPSession) PutContent(remotePath string, content []byte) error

PutContent writes raw content directly to a remote file via FTP.

func (*FTPSession) RecordReadActivity added in v1.2.1

func (s *FTPSession) RecordReadActivity()

RecordReadActivity updates the last-read timestamp for idle detection. Each session's readLoop should call this whenever data is received.

func (*FTPSession) Remove

func (s *FTPSession) Remove(p string, recursive bool) error

func (*FTPSession) Rename

func (s *FTPSession) Rename(oldName, newName string) error

func (*FTPSession) Resize

func (s *FTPSession) Resize(cols, rows int) error

func (*FTPSession) ResumeTransfer

func (s *FTPSession) ResumeTransfer(taskID string) error

ResumeTransfer resumes a paused transfer task.

func (*FTPSession) RunPostLoginScript added in v1.2.1

func (s *FTPSession) RunPostLoginScript(ctx context.Context, script string, send func([]byte), isConnected func() bool)

RunPostLoginScript sends each non-empty line of script after the terminal output goes idle, and waits for idle between commands. Stops early if ctx is cancelled or isConnected returns false.

func (*FTPSession) SetOnBinaryCallback

func (s *FTPSession) SetOnBinaryCallback(cb func([]byte))

func (*FTPSession) SetOnDataCallback

func (s *FTPSession) SetOnDataCallback(cb func([]byte))

func (*FTPSession) SetOnStatusChangeCallback

func (s *FTPSession) SetOnStatusChangeCallback(cb func(SessionStatus))

func (*FTPSession) SetPendingSize

func (s *FTPSession) SetPendingSize(cols, rows int)

func (*FTPSession) SetZmodemMode

func (s *FTPSession) SetZmodemMode(v bool)

func (*FTPSession) Status

func (s *FTPSession) Status() SessionStatus

func (*FTPSession) Title

func (s *FTPSession) Title() string

func (*FTPSession) Type

func (s *FTPSession) Type() string

func (*FTPSession) Write

func (s *FTPSession) Write(data []byte) error

type FieldEntry added in v1.2.1

type FieldEntry struct {
	Field string `json:"field"`
	Value string `json:"value"`
}

FieldEntry represents a hash field-value pair.

type FileItem

type FileItem struct {
	Name     string `json:"name"`
	Size     int64  `json:"size"`
	ModTime  string `json:"modTime"`
	Mode     string `json:"mode"`
	IsDir    bool   `json:"isDir"`
	IsHidden bool   `json:"isHidden"`
	Owner    string `json:"owner"`
	Group    string `json:"group"`
}

FileItem represents a file entry returned to the frontend.

type FileListResult

type FileListResult struct {
	Files []FileItem `json:"files"`
	Dir   string     `json:"dir"`
}

FileListResult wraps files + current directory for a list response.

type LocalSession

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

func NewLocalSession

func NewLocalSession(id string) *LocalSession

func (*LocalSession) Connect

func (s *LocalSession) Connect(config ConnectionConfig) error

func (*LocalSession) Disconnect

func (s *LocalSession) Disconnect() error

func (*LocalSession) GetPendingSize

func (s *LocalSession) GetPendingSize() (cols, rows int)

func (*LocalSession) ID

func (s *LocalSession) ID() string

func (*LocalSession) IsConnected

func (s *LocalSession) IsConnected() bool

func (*LocalSession) IsZmodemMode

func (s *LocalSession) IsZmodemMode() bool

func (*LocalSession) RecordReadActivity added in v1.2.1

func (s *LocalSession) RecordReadActivity()

RecordReadActivity updates the last-read timestamp for idle detection. Each session's readLoop should call this whenever data is received.

func (*LocalSession) Resize

func (s *LocalSession) Resize(cols, rows int) error

func (*LocalSession) RunPostLoginScript added in v1.2.1

func (s *LocalSession) RunPostLoginScript(ctx context.Context, script string, send func([]byte), isConnected func() bool)

RunPostLoginScript sends each non-empty line of script after the terminal output goes idle, and waits for idle between commands. Stops early if ctx is cancelled or isConnected returns false.

func (*LocalSession) SetOnBinaryCallback

func (s *LocalSession) SetOnBinaryCallback(cb func([]byte))

func (*LocalSession) SetOnDataCallback

func (s *LocalSession) SetOnDataCallback(cb func([]byte))

func (*LocalSession) SetOnStatusChangeCallback

func (s *LocalSession) SetOnStatusChangeCallback(cb func(SessionStatus))

func (*LocalSession) SetPendingSize

func (s *LocalSession) SetPendingSize(cols, rows int)

func (*LocalSession) SetZmodemMode

func (s *LocalSession) SetZmodemMode(v bool)

func (*LocalSession) Status

func (s *LocalSession) Status() SessionStatus

func (*LocalSession) Title

func (s *LocalSession) Title() string

func (*LocalSession) Type

func (s *LocalSession) Type() string

func (*LocalSession) Write

func (s *LocalSession) Write(data []byte) error

type MongoIndexInfo added in v1.4.0

type MongoIndexInfo struct {
	Name   string   `json:"name"`
	Keys   []string `json:"keys"`
	Type   string   `json:"type"`
	Unique bool     `json:"unique"`
}

MongoIndexInfo holds metadata for a MongoDB index.

type MongoQueryResult added in v1.4.0

type MongoQueryResult struct {
	Documents []string `json:"documents"`
	Total     int64    `json:"total"`
	Skip      int64    `json:"skip"`
	Limit     int64    `json:"limit"`
}

MongoQueryResult holds paginated find results as raw JSON documents.

type MongoSession added in v1.4.0

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

MongoSession implements the Session interface for MongoDB connections.

func NewMongoSession added in v1.4.0

func NewMongoSession(id string) *MongoSession

NewMongoSession creates a new MongoSession with the given ID.

func (*MongoSession) Client added in v1.4.0

func (s *MongoSession) Client() *mongo.Client

Client returns the underlying mongo-go-driver client.

func (*MongoSession) Connect added in v1.4.0

func (s *MongoSession) Connect(config ConnectionConfig) error

Connect establishes a connection to the MongoDB server.

func (*MongoSession) CreateCollection added in v1.4.0

func (s *MongoSession) CreateCollection(dbName, collection string) error

CreateCollection creates a new collection in the specified database.

func (*MongoSession) CreateIndex added in v1.4.0

func (s *MongoSession) CreateIndex(dbName, collection, name string, keys []string, unique bool) error

CreateIndex creates an index on a collection.

func (*MongoSession) DeleteOne added in v1.4.0

func (s *MongoSession) DeleteOne(dbName, collection, filterJSON string) error

DeleteOne deletes a single document matching the filter.

func (*MongoSession) Disconnect added in v1.4.0

func (s *MongoSession) Disconnect() error

Disconnect closes the MongoDB connection.

func (*MongoSession) DropCollection added in v1.4.0

func (s *MongoSession) DropCollection(dbName, collection string) error

DropCollection drops a collection from the specified database.

func (*MongoSession) DropDatabase added in v1.4.0

func (s *MongoSession) DropDatabase(dbName string) error

DropDatabase drops the specified database.

func (*MongoSession) DropIndex added in v1.4.0

func (s *MongoSession) DropIndex(dbName, collection, name string) error

DropIndex drops an index from a collection.

func (*MongoSession) Find added in v1.4.0

func (s *MongoSession) Find(dbName, collection, filterJSON string, skip, limit int64) (*MongoQueryResult, error)

Find executes a find query with filter, projection, skip, and limit. Returns documents as JSON strings.

func (*MongoSession) GetDocument added in v1.4.0

func (s *MongoSession) GetDocument(dbName, collection, docID string) (string, error)

GetDocument retrieves a single document by its _id.

func (*MongoSession) GetPendingSize added in v1.4.0

func (s *MongoSession) GetPendingSize() (cols, rows int)

func (*MongoSession) ID added in v1.4.0

func (s *MongoSession) ID() string

func (*MongoSession) InsertOne added in v1.4.0

func (s *MongoSession) InsertOne(dbName, collection, docJSON string) (string, error)

InsertOne inserts a document and returns the inserted ID as a string.

func (*MongoSession) IsConnected added in v1.4.0

func (s *MongoSession) IsConnected() bool

IsConnected returns true if the session is connected and the client is valid.

func (*MongoSession) IsZmodemMode added in v1.4.0

func (s *MongoSession) IsZmodemMode() bool

func (*MongoSession) ListCollections added in v1.4.0

func (s *MongoSession) ListCollections(dbName string) ([]string, error)

ListCollections returns the names of all collections in a database.

func (*MongoSession) ListDatabases added in v1.4.0

func (s *MongoSession) ListDatabases() ([]string, error)

ListDatabases returns the names of all non-system databases.

func (*MongoSession) ListIndexes added in v1.4.0

func (s *MongoSession) ListIndexes(dbName, collection string) ([]MongoIndexInfo, error)

ListIndexes returns all indexes for a collection.

func (*MongoSession) Ping added in v1.4.0

func (s *MongoSession) Ping() error

Ping checks connectivity to the MongoDB server.

func (*MongoSession) RecordReadActivity added in v1.4.0

func (s *MongoSession) RecordReadActivity()

RecordReadActivity updates the last-read timestamp for idle detection. Each session's readLoop should call this whenever data is received.

func (*MongoSession) Resize added in v1.4.0

func (s *MongoSession) Resize(cols, rows int) error

Resize is a no-op for MongoDB sessions (no terminal dimensions).

func (*MongoSession) RunPostLoginScript added in v1.4.0

func (s *MongoSession) RunPostLoginScript(ctx context.Context, script string, send func([]byte), isConnected func() bool)

RunPostLoginScript sends each non-empty line of script after the terminal output goes idle, and waits for idle between commands. Stops early if ctx is cancelled or isConnected returns false.

func (*MongoSession) SetOnBinaryCallback added in v1.4.0

func (s *MongoSession) SetOnBinaryCallback(cb func([]byte))

func (*MongoSession) SetOnDataCallback added in v1.4.0

func (s *MongoSession) SetOnDataCallback(cb func([]byte))

func (*MongoSession) SetOnStatusChangeCallback added in v1.4.0

func (s *MongoSession) SetOnStatusChangeCallback(cb func(SessionStatus))

func (*MongoSession) SetPendingSize added in v1.4.0

func (s *MongoSession) SetPendingSize(cols, rows int)

func (*MongoSession) SetZmodemMode added in v1.4.0

func (s *MongoSession) SetZmodemMode(v bool)

func (*MongoSession) Status added in v1.4.0

func (s *MongoSession) Status() SessionStatus

func (*MongoSession) Title added in v1.4.0

func (s *MongoSession) Title() string

func (*MongoSession) Type added in v1.4.0

func (s *MongoSession) Type() string

func (*MongoSession) UpdateOne added in v1.4.0

func (s *MongoSession) UpdateOne(dbName, collection, filterJSON, updateJSON string) error

UpdateOne updates a single document matching the filter.

func (*MongoSession) Write added in v1.4.0

func (s *MongoSession) Write(data []byte) error

Write is a no-op for MongoDB sessions (no interactive terminal I/O).

type MonitorSession

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

func NewMonitorSession

func NewMonitorSession(id string) *MonitorSession

func (*MonitorSession) ActiveTab

func (s *MonitorSession) ActiveTab() string

func (*MonitorSession) Connect

func (s *MonitorSession) Connect(config ConnectionConfig) error

func (*MonitorSession) Disconnect

func (s *MonitorSession) Disconnect() error

func (*MonitorSession) GetDisks

func (s *MonitorSession) GetDisks() ([]DiskInfo, error)

func (*MonitorSession) GetNetworkCards

func (s *MonitorSession) GetNetworkCards() ([]NetCardInfo, error)

func (*MonitorSession) GetPendingSize

func (s *MonitorSession) GetPendingSize() (cols, rows int)

func (*MonitorSession) GetPorts

func (s *MonitorSession) GetPorts() ([]PortInfo, error)

func (*MonitorSession) GetProcessDetail

func (s *MonitorSession) GetProcessDetail(pid int) (map[string]interface{}, error)

func (*MonitorSession) ID

func (s *MonitorSession) ID() string

func (*MonitorSession) IsConnected

func (s *MonitorSession) IsConnected() bool

func (*MonitorSession) IsPaused

func (s *MonitorSession) IsPaused() bool

func (*MonitorSession) IsZmodemMode

func (s *MonitorSession) IsZmodemMode() bool

func (*MonitorSession) KillProcess

func (s *MonitorSession) KillProcess(pid int, signal string) error

func (*MonitorSession) RecordReadActivity added in v1.2.1

func (s *MonitorSession) RecordReadActivity()

RecordReadActivity updates the last-read timestamp for idle detection. Each session's readLoop should call this whenever data is received.

func (*MonitorSession) Resize

func (s *MonitorSession) Resize(cols, rows int) error

func (*MonitorSession) RunPostLoginScript added in v1.2.1

func (s *MonitorSession) RunPostLoginScript(ctx context.Context, script string, send func([]byte), isConnected func() bool)

RunPostLoginScript sends each non-empty line of script after the terminal output goes idle, and waits for idle between commands. Stops early if ctx is cancelled or isConnected returns false.

func (*MonitorSession) SetActiveTab

func (s *MonitorSession) SetActiveTab(tab string)

func (*MonitorSession) SetOnBinaryCallback

func (s *MonitorSession) SetOnBinaryCallback(cb func([]byte))

func (*MonitorSession) SetOnDataCallback

func (s *MonitorSession) SetOnDataCallback(cb func([]byte))

func (*MonitorSession) SetOnStatusChangeCallback

func (s *MonitorSession) SetOnStatusChangeCallback(cb func(SessionStatus))

func (*MonitorSession) SetPaused

func (s *MonitorSession) SetPaused(paused bool)

func (*MonitorSession) SetPendingSize

func (s *MonitorSession) SetPendingSize(cols, rows int)

func (*MonitorSession) SetZmodemMode

func (s *MonitorSession) SetZmodemMode(v bool)

func (*MonitorSession) Status

func (s *MonitorSession) Status() SessionStatus

func (*MonitorSession) Title

func (s *MonitorSession) Title() string

func (*MonitorSession) Type

func (s *MonitorSession) Type() string

func (*MonitorSession) Write

func (s *MonitorSession) Write(data []byte) error

type MoshSession

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

func NewMoshSession

func NewMoshSession(id string) *MoshSession

func (*MoshSession) Connect

func (s *MoshSession) Connect(config ConnectionConfig) error

func (*MoshSession) Disconnect

func (s *MoshSession) Disconnect() error

func (*MoshSession) GetPendingSize

func (s *MoshSession) GetPendingSize() (cols, rows int)

func (*MoshSession) ID

func (s *MoshSession) ID() string

func (*MoshSession) IsConnected

func (s *MoshSession) IsConnected() bool

func (*MoshSession) IsZmodemMode

func (s *MoshSession) IsZmodemMode() bool

func (*MoshSession) RecordReadActivity added in v1.2.1

func (s *MoshSession) RecordReadActivity()

RecordReadActivity updates the last-read timestamp for idle detection. Each session's readLoop should call this whenever data is received.

func (*MoshSession) Resize

func (s *MoshSession) Resize(cols, rows int) error

func (*MoshSession) RunPostLoginScript added in v1.2.1

func (s *MoshSession) RunPostLoginScript(ctx context.Context, script string, send func([]byte), isConnected func() bool)

RunPostLoginScript sends each non-empty line of script after the terminal output goes idle, and waits for idle between commands. Stops early if ctx is cancelled or isConnected returns false.

func (*MoshSession) SetOnBinaryCallback

func (s *MoshSession) SetOnBinaryCallback(cb func([]byte))

func (*MoshSession) SetOnDataCallback

func (s *MoshSession) SetOnDataCallback(cb func([]byte))

func (*MoshSession) SetOnStatusChangeCallback

func (s *MoshSession) SetOnStatusChangeCallback(cb func(SessionStatus))

func (*MoshSession) SetPendingSize

func (s *MoshSession) SetPendingSize(cols, rows int)

func (*MoshSession) SetZmodemMode

func (s *MoshSession) SetZmodemMode(v bool)

func (*MoshSession) Status

func (s *MoshSession) Status() SessionStatus

func (*MoshSession) Title

func (s *MoshSession) Title() string

func (*MoshSession) Type

func (s *MoshSession) Type() string

func (*MoshSession) Write

func (s *MoshSession) Write(data []byte) error

type NetCardInfo

type NetCardInfo struct {
	Name       string   `json:"name"`
	State      string   `json:"state"`
	MAC        string   `json:"mac"`
	Speed      string   `json:"speed"`
	Type       string   `json:"type"`
	BondMaster string   `json:"bondMaster"`
	BondSlaves []string `json:"bondSlaves"`
	IPAddrs    []string `json:"ipAddrs"`
}

type PortInfo

type PortInfo struct {
	Protocol  string `json:"protocol"`
	LocalAddr string `json:"localAddr"`
	State     string `json:"state"`
	Process   string `json:"process"`
}

type PostLoginExpectStep added in v1.2.0

type PostLoginExpectStep struct {
	Expect        string `json:"expect"`
	Send          string `json:"send"`
	Enter         bool   `json:"enter"`
	TimeoutSecond int    `json:"timeoutSecond,omitempty"`
}

type RDPSession

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

RDPSession is a stub for non-Windows platforms. It satisfies the Session interface but Connect always returns an error.

func NewRDPSession

func NewRDPSession(id string) *RDPSession

func (*RDPSession) ClientAreaScreenRect

func (s *RDPSession) ClientAreaScreenRect() (x, y, w, h int)

func (*RDPSession) Connect

func (s *RDPSession) Connect(_ ConnectionConfig) error

func (*RDPSession) Disconnect

func (s *RDPSession) Disconnect() error

func (*RDPSession) GetPendingSize

func (s *RDPSession) GetPendingSize() (cols, rows int)

func (*RDPSession) Hide

func (s *RDPSession) Hide()

func (*RDPSession) ID

func (s *RDPSession) ID() string

func (*RDPSession) IsConnected

func (s *RDPSession) IsConnected() bool

func (*RDPSession) IsZmodemMode

func (s *RDPSession) IsZmodemMode() bool

func (*RDPSession) RecordReadActivity added in v1.2.1

func (s *RDPSession) RecordReadActivity()

RecordReadActivity updates the last-read timestamp for idle detection. Each session's readLoop should call this whenever data is received.

func (*RDPSession) Resize

func (s *RDPSession) Resize(_, _ int) error

func (*RDPSession) RunPostLoginScript added in v1.2.1

func (s *RDPSession) RunPostLoginScript(ctx context.Context, script string, send func([]byte), isConnected func() bool)

RunPostLoginScript sends each non-empty line of script after the terminal output goes idle, and waits for idle between commands. Stops early if ctx is cancelled or isConnected returns false.

func (*RDPSession) SetFocus

func (s *RDPSession) SetFocus(_ bool)

func (*RDPSession) SetOnBinaryCallback

func (s *RDPSession) SetOnBinaryCallback(cb func([]byte))

func (*RDPSession) SetOnDataCallback

func (s *RDPSession) SetOnDataCallback(cb func([]byte))

func (*RDPSession) SetOnStatusChangeCallback

func (s *RDPSession) SetOnStatusChangeCallback(cb func(SessionStatus))

func (*RDPSession) SetParentHwnd

func (s *RDPSession) SetParentHwnd(_ uintptr)

func (*RDPSession) SetPendingSize

func (s *RDPSession) SetPendingSize(cols, rows int)

func (*RDPSession) SetPosition

func (s *RDPSession) SetPosition(_, _, _, _ int)

func (*RDPSession) SetZmodemMode

func (s *RDPSession) SetZmodemMode(v bool)

func (*RDPSession) Show

func (s *RDPSession) Show()

func (*RDPSession) Status

func (s *RDPSession) Status() SessionStatus

func (*RDPSession) Title

func (s *RDPSession) Title() string

func (*RDPSession) Type

func (s *RDPSession) Type() string

func (*RDPSession) Write

func (s *RDPSession) Write(_ []byte) error

type RedisKeyInfo added in v1.2.1

type RedisKeyInfo struct {
	Name string `json:"name"`
	Type string `json:"type"`
	TTL  int64  `json:"ttl"`
}

RedisKeyInfo holds metadata for a single Redis key.

type RedisSession added in v1.2.1

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

RedisSession implements the Session interface for Redis connections using go-redis.

func NewRedisSession added in v1.2.1

func NewRedisSession(id string) *RedisSession

NewRedisSession creates a new RedisSession with the given ID.

func (*RedisSession) Client added in v1.2.1

func (s *RedisSession) Client() *redis.Client

Client returns the underlying go-redis client.

func (*RedisSession) Connect added in v1.2.1

func (s *RedisSession) Connect(config ConnectionConfig) error

Connect establishes a connection to the Redis server.

func (*RedisSession) DBIndex added in v1.2.1

func (s *RedisSession) DBIndex() int

DBIndex returns the current database index (0-15).

func (*RedisSession) DBSize added in v1.2.1

func (s *RedisSession) DBSize() (int64, error)

DBSize returns the number of keys in the current database.

func (*RedisSession) DeleteKey added in v1.2.1

func (s *RedisSession) DeleteKey(key string) error

DeleteKey deletes a key from Redis.

func (*RedisSession) Disconnect added in v1.2.1

func (s *RedisSession) Disconnect() error

Disconnect closes the Redis connection.

func (*RedisSession) GetHashAll added in v1.2.1

func (s *RedisSession) GetHashAll(key string) ([]FieldEntry, error)

GetHashAll returns all field-value pairs of a hash.

func (*RedisSession) GetKeyInfo added in v1.2.1

func (s *RedisSession) GetKeyInfo(key string) (*RedisKeyInfo, error)

GetKeyInfo returns metadata (type, TTL) for a single key.

func (*RedisSession) GetKeyTTL added in v1.2.1

func (s *RedisSession) GetKeyTTL(key string) (int64, error)

GetKeyTTL returns the TTL for a key in seconds.

func (*RedisSession) GetListRange added in v1.2.1

func (s *RedisSession) GetListRange(key string, start int64, stop int64) ([]string, error)

GetListRange returns elements from a list within the specified range.

func (*RedisSession) GetPendingSize added in v1.2.1

func (s *RedisSession) GetPendingSize() (cols, rows int)

func (*RedisSession) GetSetAll added in v1.2.1

func (s *RedisSession) GetSetAll(key string) ([]string, error)

GetSetAll returns all members of a set.

func (*RedisSession) GetSortedSetRange added in v1.2.1

func (s *RedisSession) GetSortedSetRange(key string, min string, max string) ([]ScoredMember, error)

GetSortedSetRange returns members within a score range, with scores.

func (*RedisSession) GetString added in v1.2.1

func (s *RedisSession) GetString(key string) (string, error)

GetString returns the string value of a key.

func (*RedisSession) HashDel added in v1.2.1

func (s *RedisSession) HashDel(key string, fields []string) (int64, error)

HashDel deletes one or more fields from a hash.

func (*RedisSession) HashSet added in v1.2.1

func (s *RedisSession) HashSet(key string, field string, value string) error

HashSet sets a field in a hash.

func (*RedisSession) ID added in v1.2.1

func (s *RedisSession) ID() string

func (*RedisSession) IsConnected added in v1.2.1

func (s *RedisSession) IsConnected() bool

IsConnected returns true if the session is connected and the client is valid.

func (*RedisSession) IsZmodemMode added in v1.2.1

func (s *RedisSession) IsZmodemMode() bool

func (*RedisSession) KeyExists added in v1.2.1

func (s *RedisSession) KeyExists(key string) (bool, error)

KeyExists returns true if the key exists in Redis.

func (*RedisSession) KeyspaceInfo added in v1.2.1

func (s *RedisSession) KeyspaceInfo() (map[int]int64, error)

KeyspaceInfo returns key counts for all databases via INFO keyspace. Returns a map of db index -> key count. Empty dbs are omitted by Redis.

func (*RedisSession) ListPop added in v1.2.1

func (s *RedisSession) ListPop(key string, direction string) (string, error)

ListPop pops a value from a list from the specified direction ("left" or "right").

func (*RedisSession) ListPush added in v1.2.1

func (s *RedisSession) ListPush(key string, direction string, values []string) (int64, error)

ListPush pushes values onto a list from the specified direction ("left" or "right").

func (*RedisSession) ListRemove added in v1.2.1

func (s *RedisSession) ListRemove(key string, value string, count int64) (int64, error)

ListRemove removes elements from a list matching the value.

func (*RedisSession) ListSet added in v1.2.1

func (s *RedisSession) ListSet(key string, index int64, value string) error

ListSet sets the value at an index in a list.

func (*RedisSession) Ping added in v1.2.1

func (s *RedisSession) Ping() error

Ping checks connectivity to the Redis server.

func (*RedisSession) RecordReadActivity added in v1.2.1

func (s *RedisSession) RecordReadActivity()

RecordReadActivity updates the last-read timestamp for idle detection. Each session's readLoop should call this whenever data is received.

func (*RedisSession) Resize added in v1.2.1

func (s *RedisSession) Resize(cols, rows int) error

Resize is a no-op for Redis sessions (no terminal dimensions).

func (*RedisSession) RunPostLoginScript added in v1.2.1

func (s *RedisSession) RunPostLoginScript(ctx context.Context, script string, send func([]byte), isConnected func() bool)

RunPostLoginScript sends each non-empty line of script after the terminal output goes idle, and waits for idle between commands. Stops early if ctx is cancelled or isConnected returns false.

func (*RedisSession) ScanKeys added in v1.2.1

func (s *RedisSession) ScanKeys(pattern string, cursor uint64, count int64) (*ScanResult, error)

ScanKeys scans keys matching pattern with cursor-based pagination. Returns key metadata (name, type, TTL) via pipeline batching.

func (*RedisSession) SetAdd added in v1.2.1

func (s *RedisSession) SetAdd(key string, members []string) (int64, error)

SetAdd adds members to a set.

func (*RedisSession) SetKeyTTL added in v1.2.1

func (s *RedisSession) SetKeyTTL(key string, seconds int64) error

SetKeyTTL sets the TTL for a key in seconds.

func (*RedisSession) SetOnBinaryCallback added in v1.2.1

func (s *RedisSession) SetOnBinaryCallback(cb func([]byte))

func (*RedisSession) SetOnDataCallback added in v1.2.1

func (s *RedisSession) SetOnDataCallback(cb func([]byte))

func (*RedisSession) SetOnStatusChangeCallback added in v1.2.1

func (s *RedisSession) SetOnStatusChangeCallback(cb func(SessionStatus))

func (*RedisSession) SetPendingSize added in v1.2.1

func (s *RedisSession) SetPendingSize(cols, rows int)

func (*RedisSession) SetRemove added in v1.2.1

func (s *RedisSession) SetRemove(key string, members []string) (int64, error)

SetRemove removes members from a set.

func (*RedisSession) SetString added in v1.2.1

func (s *RedisSession) SetString(key string, value string) error

SetString sets a string value for a key.

func (*RedisSession) SetZmodemMode added in v1.2.1

func (s *RedisSession) SetZmodemMode(v bool)

func (*RedisSession) Status added in v1.2.1

func (s *RedisSession) Status() SessionStatus

func (*RedisSession) SwitchDB added in v1.2.1

func (s *RedisSession) SwitchDB(idx int) error

SwitchDB switches to the specified Redis database index (0-15).

func (*RedisSession) Title added in v1.2.1

func (s *RedisSession) Title() string

func (*RedisSession) Type added in v1.2.1

func (s *RedisSession) Type() string

func (*RedisSession) Write added in v1.2.1

func (s *RedisSession) Write(data []byte) error

Write is a no-op for Redis sessions (no interactive terminal I/O).

func (*RedisSession) ZSetAdd added in v1.2.1

func (s *RedisSession) ZSetAdd(key string, members []ScoredMember) (int64, error)

ZSetAdd adds members with scores to a sorted set.

func (*RedisSession) ZSetRemove added in v1.2.1

func (s *RedisSession) ZSetRemove(key string, members []string) (int64, error)

ZSetRemove removes members from a sorted set.

type S3Session added in v1.2.2

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

func NewS3Session added in v1.2.2

func NewS3Session(id string) *S3Session

func (*S3Session) CancelTransfer added in v1.2.2

func (s *S3Session) CancelTransfer(taskID string) error

func (*S3Session) ChangeLocalDir added in v1.2.2

func (o *S3Session) ChangeLocalDir(dir string) (FileListResult, error)

func (*S3Session) ChangeRemoteDir added in v1.2.2

func (s *S3Session) ChangeRemoteDir(dir string) (FileListResult, error)

func (*S3Session) Chmod added in v1.2.2

func (s *S3Session) Chmod(p string, mode os.FileMode) error

func (*S3Session) Connect added in v1.2.2

func (s *S3Session) Connect(config ConnectionConfig) error

func (*S3Session) Copy added in v1.2.2

func (s *S3Session) Copy(oldPath, newPath string) error

func (*S3Session) Disconnect added in v1.2.2

func (s *S3Session) Disconnect() error

func (*S3Session) Get added in v1.2.2

func (s *S3Session) Get(remotePath, localPath string, recursive bool) (string, error)

func (*S3Session) GetContent added in v1.2.2

func (s *S3Session) GetContent(remotePath string) ([]byte, error)

func (*S3Session) GetPendingSize added in v1.2.2

func (s *S3Session) GetPendingSize() (cols, rows int)

func (*S3Session) ID added in v1.2.2

func (s *S3Session) ID() string

func (*S3Session) IsConnected added in v1.2.2

func (s *S3Session) IsConnected() bool

func (*S3Session) IsZmodemMode added in v1.2.2

func (s *S3Session) IsZmodemMode() bool

func (*S3Session) ListLocal added in v1.2.2

func (o *S3Session) ListLocal(dir string) (FileListResult, error)

func (*S3Session) ListLocalDrives added in v1.2.2

func (o *S3Session) ListLocalDrives() ([]FileItem, error)

func (*S3Session) ListRemote added in v1.2.2

func (s *S3Session) ListRemote(dir string) (FileListResult, error)

func (*S3Session) LocalCopy added in v1.2.2

func (o *S3Session) LocalCopy(oldPath, newPath string) error

func (*S3Session) LocalGetContent added in v1.2.2

func (o *S3Session) LocalGetContent(localPath string) ([]byte, error)

func (*S3Session) LocalMkdir added in v1.2.2

func (o *S3Session) LocalMkdir(dir string) error

func (*S3Session) LocalMove added in v1.2.2

func (o *S3Session) LocalMove(oldPath, newPath string) error

func (*S3Session) LocalPutContent added in v1.2.2

func (o *S3Session) LocalPutContent(localPath string, content []byte) error

func (*S3Session) LocalRemove added in v1.2.2

func (o *S3Session) LocalRemove(p string, recursive bool) error

func (*S3Session) LocalRename added in v1.2.2

func (o *S3Session) LocalRename(oldName, newName string) error

func (*S3Session) MakeDir added in v1.2.2

func (s *S3Session) MakeDir(dir string) error

func (*S3Session) Move added in v1.2.2

func (s *S3Session) Move(oldPath, newPath string) error

func (*S3Session) PauseTransfer added in v1.2.2

func (s *S3Session) PauseTransfer(taskID string) error

func (*S3Session) Put added in v1.2.2

func (s *S3Session) Put(localPath, remotePath string, recursive bool) (string, error)

func (*S3Session) PutContent added in v1.2.2

func (s *S3Session) PutContent(remotePath string, content []byte) error

func (*S3Session) RecordReadActivity added in v1.2.2

func (s *S3Session) RecordReadActivity()

RecordReadActivity updates the last-read timestamp for idle detection. Each session's readLoop should call this whenever data is received.

func (*S3Session) Remove added in v1.2.2

func (s *S3Session) Remove(p string, recursive bool) error

func (*S3Session) Rename added in v1.2.2

func (s *S3Session) Rename(oldName, newName string) error

func (*S3Session) Resize added in v1.2.2

func (s *S3Session) Resize(cols, rows int) error

func (*S3Session) ResumeTransfer added in v1.2.2

func (s *S3Session) ResumeTransfer(taskID string) error

func (*S3Session) RunPostLoginScript added in v1.2.2

func (s *S3Session) RunPostLoginScript(ctx context.Context, script string, send func([]byte), isConnected func() bool)

RunPostLoginScript sends each non-empty line of script after the terminal output goes idle, and waits for idle between commands. Stops early if ctx is cancelled or isConnected returns false.

func (*S3Session) SetOnBinaryCallback added in v1.2.2

func (s *S3Session) SetOnBinaryCallback(cb func([]byte))

func (*S3Session) SetOnDataCallback added in v1.2.2

func (s *S3Session) SetOnDataCallback(cb func([]byte))

func (*S3Session) SetOnStatusChangeCallback added in v1.2.2

func (s *S3Session) SetOnStatusChangeCallback(cb func(SessionStatus))

func (*S3Session) SetPendingSize added in v1.2.2

func (s *S3Session) SetPendingSize(cols, rows int)

func (*S3Session) SetZmodemMode added in v1.2.2

func (s *S3Session) SetZmodemMode(v bool)

func (*S3Session) Status added in v1.2.2

func (s *S3Session) Status() SessionStatus

func (*S3Session) Title added in v1.2.2

func (s *S3Session) Title() string

func (*S3Session) Type added in v1.2.2

func (s *S3Session) Type() string

func (*S3Session) Write added in v1.2.2

func (s *S3Session) Write(data []byte) error

type SFTPSession

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

func NewSFTPSession

func NewSFTPSession(id string) *SFTPSession

func (*SFTPSession) CancelTransfer

func (s *SFTPSession) CancelTransfer(taskID string) error

CancelTransfer cancels an ongoing transfer task.

func (*SFTPSession) ChangeLocalDir

func (s *SFTPSession) ChangeLocalDir(dir string) (FileListResult, error)

func (*SFTPSession) ChangeRemoteDir

func (s *SFTPSession) ChangeRemoteDir(dir string) (FileListResult, error)

func (*SFTPSession) Chmod

func (s *SFTPSession) Chmod(p string, mode os.FileMode) error

func (*SFTPSession) Connect

func (s *SFTPSession) Connect(config ConnectionConfig) error

func (*SFTPSession) Copy added in v1.1.2

func (s *SFTPSession) Copy(oldPath, newPath string) error

Copy copies a file or directory on the remote server. Tries shell cp -r first (zero data transfer on Linux), falls back to SFTP-level copy for servers without cp (Windows, etc.).

func (*SFTPSession) Disconnect

func (s *SFTPSession) Disconnect() error

func (*SFTPSession) Get

func (s *SFTPSession) Get(remotePath, localPath string, recursive bool) (string, error)

func (*SFTPSession) GetContent added in v1.1.2

func (s *SFTPSession) GetContent(remotePath string) ([]byte, error)

GetContent reads the full content of a remote file.

func (*SFTPSession) GetPendingSize

func (s *SFTPSession) GetPendingSize() (cols, rows int)

func (*SFTPSession) ID

func (s *SFTPSession) ID() string

func (*SFTPSession) IsConnected

func (s *SFTPSession) IsConnected() bool

func (*SFTPSession) IsZmodemMode

func (s *SFTPSession) IsZmodemMode() bool

func (*SFTPSession) ListLocal

func (s *SFTPSession) ListLocal(dir string) (FileListResult, error)

func (*SFTPSession) ListLocalDrives

func (s *SFTPSession) ListLocalDrives() ([]FileItem, error)

func (*SFTPSession) ListRemote

func (s *SFTPSession) ListRemote(dir string) (FileListResult, error)

func (*SFTPSession) LocalCopy added in v1.1.2

func (s *SFTPSession) LocalCopy(oldPath, newPath string) error

LocalCopy copies a local file or directory.

func (*SFTPSession) LocalGetContent added in v1.1.2

func (s *SFTPSession) LocalGetContent(localPath string) ([]byte, error)

LocalGetContent reads a local file's full content.

func (*SFTPSession) LocalMkdir

func (s *SFTPSession) LocalMkdir(dir string) error

func (*SFTPSession) LocalMove added in v1.1.2

func (s *SFTPSession) LocalMove(oldPath, newPath string) error

LocalMove moves a local file or directory (rename, same filesystem only).

func (*SFTPSession) LocalPutContent added in v1.1.2

func (s *SFTPSession) LocalPutContent(localPath string, content []byte) error

LocalPutContent writes content to a local file, creating parent directories as needed.

func (*SFTPSession) LocalRemove

func (s *SFTPSession) LocalRemove(p string, recursive bool) error

func (*SFTPSession) LocalRename

func (s *SFTPSession) LocalRename(oldName, newName string) error

func (*SFTPSession) MakeDir

func (s *SFTPSession) MakeDir(dir string) error

func (*SFTPSession) Move added in v1.1.2

func (s *SFTPSession) Move(oldPath, newPath string) error

Move moves a file or directory on the remote server. Tries SFTP Rename first (atomic, server-side), falls back to shell mv.

func (*SFTPSession) PauseTransfer

func (s *SFTPSession) PauseTransfer(taskID string) error

PauseTransfer pauses an ongoing transfer task.

func (*SFTPSession) Put

func (s *SFTPSession) Put(localPath, remotePath string, recursive bool) (string, error)

func (*SFTPSession) PutContent

func (s *SFTPSession) PutContent(remotePath string, content []byte) error

PutContent writes raw content directly to a remote file via SFTP.

func (*SFTPSession) RecordReadActivity added in v1.2.1

func (s *SFTPSession) RecordReadActivity()

RecordReadActivity updates the last-read timestamp for idle detection. Each session's readLoop should call this whenever data is received.

func (*SFTPSession) Remove

func (s *SFTPSession) Remove(p string, recursive bool) error

func (*SFTPSession) Rename

func (s *SFTPSession) Rename(oldName, newName string) error

func (*SFTPSession) Resize

func (s *SFTPSession) Resize(cols, rows int) error

func (*SFTPSession) ResumeTransfer

func (s *SFTPSession) ResumeTransfer(taskID string) error

ResumeTransfer resumes a paused transfer task.

func (*SFTPSession) RunPostLoginScript added in v1.2.1

func (s *SFTPSession) RunPostLoginScript(ctx context.Context, script string, send func([]byte), isConnected func() bool)

RunPostLoginScript sends each non-empty line of script after the terminal output goes idle, and waits for idle between commands. Stops early if ctx is cancelled or isConnected returns false.

func (*SFTPSession) SetMaxConcurrency

func (s *SFTPSession) SetMaxConcurrency(n int)

SetMaxConcurrency limits concurrent file transfers. n <= 0 means unlimited.

func (*SFTPSession) SetOnBinaryCallback

func (s *SFTPSession) SetOnBinaryCallback(cb func([]byte))

func (*SFTPSession) SetOnDataCallback

func (s *SFTPSession) SetOnDataCallback(cb func([]byte))

func (*SFTPSession) SetOnStatusChangeCallback

func (s *SFTPSession) SetOnStatusChangeCallback(cb func(SessionStatus))

func (*SFTPSession) SetPendingSize

func (s *SFTPSession) SetPendingSize(cols, rows int)

func (*SFTPSession) SetZmodemMode

func (s *SFTPSession) SetZmodemMode(v bool)

func (*SFTPSession) Status

func (s *SFTPSession) Status() SessionStatus

func (*SFTPSession) Title

func (s *SFTPSession) Title() string

func (*SFTPSession) Type

func (s *SFTPSession) Type() string

func (*SFTPSession) Write

func (s *SFTPSession) Write(data []byte) error

type SMBSession added in v1.2.2

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

func NewSMBSession added in v1.2.2

func NewSMBSession(id string) *SMBSession

func (*SMBSession) CancelTransfer added in v1.2.2

func (s *SMBSession) CancelTransfer(taskID string) error

func (*SMBSession) ChangeLocalDir added in v1.2.2

func (o *SMBSession) ChangeLocalDir(dir string) (FileListResult, error)

func (*SMBSession) ChangeRemoteDir added in v1.2.2

func (s *SMBSession) ChangeRemoteDir(dir string) (FileListResult, error)

func (*SMBSession) Chmod added in v1.2.2

func (s *SMBSession) Chmod(p string, mode os.FileMode) error

func (*SMBSession) Connect added in v1.2.2

func (s *SMBSession) Connect(config ConnectionConfig) error

func (*SMBSession) Copy added in v1.2.2

func (s *SMBSession) Copy(oldPath, newPath string) error

func (*SMBSession) Disconnect added in v1.2.2

func (s *SMBSession) Disconnect() error

func (*SMBSession) Get added in v1.2.2

func (s *SMBSession) Get(remotePath, localPath string, recursive bool) (string, error)

func (*SMBSession) GetContent added in v1.2.2

func (s *SMBSession) GetContent(remotePath string) ([]byte, error)

func (*SMBSession) GetPendingSize added in v1.2.2

func (s *SMBSession) GetPendingSize() (cols, rows int)

func (*SMBSession) ID added in v1.2.2

func (s *SMBSession) ID() string

func (*SMBSession) IsConnected added in v1.2.2

func (s *SMBSession) IsConnected() bool

func (*SMBSession) IsZmodemMode added in v1.2.2

func (s *SMBSession) IsZmodemMode() bool

func (*SMBSession) ListLocal added in v1.2.2

func (o *SMBSession) ListLocal(dir string) (FileListResult, error)

func (*SMBSession) ListLocalDrives added in v1.2.2

func (o *SMBSession) ListLocalDrives() ([]FileItem, error)

func (*SMBSession) ListRemote added in v1.2.2

func (s *SMBSession) ListRemote(dir string) (FileListResult, error)

func (*SMBSession) LocalCopy added in v1.2.2

func (o *SMBSession) LocalCopy(oldPath, newPath string) error

func (*SMBSession) LocalGetContent added in v1.2.2

func (o *SMBSession) LocalGetContent(localPath string) ([]byte, error)

func (*SMBSession) LocalMkdir added in v1.2.2

func (o *SMBSession) LocalMkdir(dir string) error

func (*SMBSession) LocalMove added in v1.2.2

func (o *SMBSession) LocalMove(oldPath, newPath string) error

func (*SMBSession) LocalPutContent added in v1.2.2

func (o *SMBSession) LocalPutContent(localPath string, content []byte) error

func (*SMBSession) LocalRemove added in v1.2.2

func (o *SMBSession) LocalRemove(p string, recursive bool) error

func (*SMBSession) LocalRename added in v1.2.2

func (o *SMBSession) LocalRename(oldName, newName string) error

func (*SMBSession) MakeDir added in v1.2.2

func (s *SMBSession) MakeDir(dir string) error

func (*SMBSession) Move added in v1.2.2

func (s *SMBSession) Move(oldPath, newPath string) error

func (*SMBSession) PauseTransfer added in v1.2.2

func (s *SMBSession) PauseTransfer(taskID string) error

func (*SMBSession) Put added in v1.2.2

func (s *SMBSession) Put(localPath, remotePath string, recursive bool) (string, error)

func (*SMBSession) PutContent added in v1.2.2

func (s *SMBSession) PutContent(remotePath string, content []byte) error

func (*SMBSession) RecordReadActivity added in v1.2.2

func (s *SMBSession) RecordReadActivity()

RecordReadActivity updates the last-read timestamp for idle detection. Each session's readLoop should call this whenever data is received.

func (*SMBSession) Remove added in v1.2.2

func (s *SMBSession) Remove(p string, recursive bool) error

func (*SMBSession) Rename added in v1.2.2

func (s *SMBSession) Rename(oldName, newName string) error

func (*SMBSession) Resize added in v1.2.2

func (s *SMBSession) Resize(cols, rows int) error

func (*SMBSession) ResumeTransfer added in v1.2.2

func (s *SMBSession) ResumeTransfer(taskID string) error

func (*SMBSession) RunPostLoginScript added in v1.2.2

func (s *SMBSession) RunPostLoginScript(ctx context.Context, script string, send func([]byte), isConnected func() bool)

RunPostLoginScript sends each non-empty line of script after the terminal output goes idle, and waits for idle between commands. Stops early if ctx is cancelled or isConnected returns false.

func (*SMBSession) SetOnBinaryCallback added in v1.2.2

func (s *SMBSession) SetOnBinaryCallback(cb func([]byte))

func (*SMBSession) SetOnDataCallback added in v1.2.2

func (s *SMBSession) SetOnDataCallback(cb func([]byte))

func (*SMBSession) SetOnStatusChangeCallback added in v1.2.2

func (s *SMBSession) SetOnStatusChangeCallback(cb func(SessionStatus))

func (*SMBSession) SetPendingSize added in v1.2.2

func (s *SMBSession) SetPendingSize(cols, rows int)

func (*SMBSession) SetZmodemMode added in v1.2.2

func (s *SMBSession) SetZmodemMode(v bool)

func (*SMBSession) Status added in v1.2.2

func (s *SMBSession) Status() SessionStatus

func (*SMBSession) Title added in v1.2.2

func (s *SMBSession) Title() string

func (*SMBSession) Type added in v1.2.2

func (s *SMBSession) Type() string

func (*SMBSession) Write added in v1.2.2

func (s *SMBSession) Write(data []byte) error

type SPICEProxy

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

SPICEProxy bridges WebSocket (frontend spice-html5) to TCP (SPICE server). One instance per SPICE session, bound to a random local port.

func NewSPICEProxy

func NewSPICEProxy(target string) *SPICEProxy

func (*SPICEProxy) Start

func (p *SPICEProxy) Start() (string, error)

Start begins listening on a random local port and returns the WebSocket URL.

func (*SPICEProxy) Stop

func (p *SPICEProxy) Stop()

Stop closes all connections and waits for goroutines to exit.

type SPICESession

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

func NewSPICESession

func NewSPICESession(id string) *SPICESession

func (*SPICESession) Connect

func (s *SPICESession) Connect(config ConnectionConfig) error

func (*SPICESession) Disconnect

func (s *SPICESession) Disconnect() error

func (*SPICESession) GetPendingSize

func (s *SPICESession) GetPendingSize() (cols, rows int)

func (*SPICESession) ID

func (s *SPICESession) ID() string

func (*SPICESession) IsConnected

func (s *SPICESession) IsConnected() bool

func (*SPICESession) IsZmodemMode

func (s *SPICESession) IsZmodemMode() bool

func (*SPICESession) ProxyAddr

func (s *SPICESession) ProxyAddr() string

func (*SPICESession) RecordReadActivity added in v1.2.1

func (s *SPICESession) RecordReadActivity()

RecordReadActivity updates the last-read timestamp for idle detection. Each session's readLoop should call this whenever data is received.

func (*SPICESession) Resize

func (s *SPICESession) Resize(cols, rows int) error

func (*SPICESession) RunPostLoginScript added in v1.2.1

func (s *SPICESession) RunPostLoginScript(ctx context.Context, script string, send func([]byte), isConnected func() bool)

RunPostLoginScript sends each non-empty line of script after the terminal output goes idle, and waits for idle between commands. Stops early if ctx is cancelled or isConnected returns false.

func (*SPICESession) SetOnBinaryCallback

func (s *SPICESession) SetOnBinaryCallback(cb func([]byte))

func (*SPICESession) SetOnDataCallback

func (s *SPICESession) SetOnDataCallback(cb func([]byte))

func (*SPICESession) SetOnStatusChangeCallback

func (s *SPICESession) SetOnStatusChangeCallback(cb func(SessionStatus))

func (*SPICESession) SetPendingSize

func (s *SPICESession) SetPendingSize(cols, rows int)

func (*SPICESession) SetZmodemMode

func (s *SPICESession) SetZmodemMode(v bool)

func (*SPICESession) Status

func (s *SPICESession) Status() SessionStatus

func (*SPICESession) Title

func (s *SPICESession) Title() string

func (*SPICESession) Type

func (s *SPICESession) Type() string

func (*SPICESession) Write

func (s *SPICESession) Write(data []byte) error

type SSHSession

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

func NewSSHSession

func NewSSHSession(id string) *SSHSession

func (*SSHSession) Connect

func (s *SSHSession) Connect(config ConnectionConfig) error

func (*SSHSession) Disconnect

func (s *SSHSession) Disconnect() error

Disconnect tears down the SSH session. It uses sync.Once so the entire teardown sequence executes exactly once, regardless of how many goroutines call Disconnect concurrently (session.Wait, readLoop error, keepalive failure, or explicit user close).

func (*SSHSession) GetPendingSize

func (s *SSHSession) GetPendingSize() (cols, rows int)

func (*SSHSession) ID

func (s *SSHSession) ID() string

func (*SSHSession) IsConnected

func (s *SSHSession) IsConnected() bool

func (*SSHSession) IsZmodemMode

func (s *SSHSession) IsZmodemMode() bool

func (*SSHSession) RecordReadActivity added in v1.2.1

func (s *SSHSession) RecordReadActivity()

RecordReadActivity updates the last-read timestamp for idle detection. Each session's readLoop should call this whenever data is received.

func (*SSHSession) Resize

func (s *SSHSession) Resize(cols, rows int) error

func (*SSHSession) RunPostLoginScript added in v1.2.1

func (s *SSHSession) RunPostLoginScript(ctx context.Context, script string, send func([]byte), isConnected func() bool)

RunPostLoginScript sends each non-empty line of script after the terminal output goes idle, and waits for idle between commands. Stops early if ctx is cancelled or isConnected returns false.

func (*SSHSession) SetEncoding added in v1.2.0

func (s *SSHSession) SetEncoding(name string)

SetEncoding configures the character encoding for this session. name: "" / "utf-8" (passthrough) | "gbk" | "gb2312" | "gb18030" | "big5" | "shift-jis" | "euc-jp" | "euc-kr".

func (*SSHSession) SetOnBinaryCallback

func (s *SSHSession) SetOnBinaryCallback(cb func([]byte))

func (*SSHSession) SetOnDataCallback

func (s *SSHSession) SetOnDataCallback(cb func([]byte))

func (*SSHSession) SetOnStatusChangeCallback

func (s *SSHSession) SetOnStatusChangeCallback(cb func(SessionStatus))

func (*SSHSession) SetPendingSize

func (s *SSHSession) SetPendingSize(cols, rows int)

func (*SSHSession) SetZmodemMode

func (s *SSHSession) SetZmodemMode(v bool)

func (*SSHSession) Status

func (s *SSHSession) Status() SessionStatus

func (*SSHSession) Title

func (s *SSHSession) Title() string

func (*SSHSession) Type

func (s *SSHSession) Type() string

func (*SSHSession) Write

func (s *SSHSession) Write(data []byte) error

type ScanResult added in v1.2.1

type ScanResult struct {
	Keys      []RedisKeyInfo `json:"keys"`
	Cursor    uint64         `json:"cursor"`
	ScanCount int            `json:"scanCount"`
}

ScanResult holds a page of SCAN results with cursor for pagination.

type ScoredMember added in v1.2.1

type ScoredMember struct {
	Score  float64 `json:"score"`
	Member string  `json:"member"`
}

ScoredMember represents a sorted-set member with its score.

type SerialConfig added in v1.1.0

type SerialConfig struct {
	PortName string
	BaudRate int
	DataBits int
	StopBits serial.StopBits
	Parity   serial.Parity
}

SerialConfig holds serial port connection parameters.

type SerialSession added in v1.1.0

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

func NewSerialSession added in v1.1.0

func NewSerialSession(id string) *SerialSession

func (*SerialSession) Connect added in v1.1.0

func (s *SerialSession) Connect(config ConnectionConfig) error

func (*SerialSession) Disconnect added in v1.1.0

func (s *SerialSession) Disconnect() error

func (*SerialSession) GetPendingSize added in v1.1.0

func (s *SerialSession) GetPendingSize() (cols, rows int)

func (*SerialSession) ID added in v1.1.0

func (s *SerialSession) ID() string

func (*SerialSession) IsConnected added in v1.1.0

func (s *SerialSession) IsConnected() bool

func (*SerialSession) IsLogEnabled added in v1.4.0

func (s *SerialSession) IsLogEnabled() bool

func (*SerialSession) IsZmodemMode added in v1.1.0

func (s *SerialSession) IsZmodemMode() bool

func (*SerialSession) RecordReadActivity added in v1.2.1

func (s *SerialSession) RecordReadActivity()

RecordReadActivity updates the last-read timestamp for idle detection. Each session's readLoop should call this whenever data is received.

func (*SerialSession) Resize added in v1.1.0

func (s *SerialSession) Resize(cols, rows int) error

func (*SerialSession) RunPostLoginScript added in v1.2.1

func (s *SerialSession) RunPostLoginScript(ctx context.Context, script string, send func([]byte), isConnected func() bool)

RunPostLoginScript sends each non-empty line of script after the terminal output goes idle, and waits for idle between commands. Stops early if ctx is cancelled or isConnected returns false.

func (*SerialSession) SetOnBinaryCallback added in v1.1.0

func (s *SerialSession) SetOnBinaryCallback(cb func([]byte))

func (*SerialSession) SetOnDataCallback added in v1.1.0

func (s *SerialSession) SetOnDataCallback(cb func([]byte))

func (*SerialSession) SetOnStatusChangeCallback added in v1.1.0

func (s *SerialSession) SetOnStatusChangeCallback(cb func(SessionStatus))

func (*SerialSession) SetPendingSize added in v1.1.0

func (s *SerialSession) SetPendingSize(cols, rows int)

func (*SerialSession) SetSerialConfig added in v1.1.0

func (s *SerialSession) SetSerialConfig(cfg SerialConfig)

func (*SerialSession) SetZmodemMode added in v1.1.0

func (s *SerialSession) SetZmodemMode(v bool)

func (*SerialSession) StartLogAtPath added in v1.4.0

func (s *SerialSession) StartLogAtPath(path string) string

func (*SerialSession) Status added in v1.1.0

func (s *SerialSession) Status() SessionStatus

func (*SerialSession) StopLog added in v1.4.0

func (s *SerialSession) StopLog()

func (*SerialSession) Title added in v1.1.0

func (s *SerialSession) Title() string

func (*SerialSession) Type added in v1.1.0

func (s *SerialSession) Type() string

func (*SerialSession) Write added in v1.1.0

func (s *SerialSession) Write(data []byte) error

type Session

type Session interface {
	ID() string
	Type() string
	Title() string
	Status() SessionStatus

	Connect(config ConnectionConfig) error
	Disconnect() error
	IsConnected() bool
	Resize(cols, rows int) error

	Write(data []byte) error
	SetOnDataCallback(cb func([]byte))
	SetOnBinaryCallback(cb func([]byte))
	SetOnStatusChangeCallback(cb func(SessionStatus))
	SetZmodemMode(bool)
	IsZmodemMode() bool
}

type SessionInfo

type SessionInfo struct {
	ID     string        `json:"id"`
	Type   string        `json:"type"`
	Title  string        `json:"title"`
	Status SessionStatus `json:"status"`
}

type SessionManager

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

func NewSessionManager

func NewSessionManager() *SessionManager

func (*SessionManager) Close

func (sm *SessionManager) Close(sessionID string) error

func (*SessionManager) CloseAll

func (sm *SessionManager) CloseAll()

func (*SessionManager) Create

func (sm *SessionManager) Create(sessionType string, config ConnectionConfig) (Session, error)

func (*SessionManager) Get

func (sm *SessionManager) Get(sessionID string) (Session, bool)

func (*SessionManager) List

func (sm *SessionManager) List() []SessionInfo

type SessionStatus

type SessionStatus string
const (
	StatusConnecting   SessionStatus = "connecting"
	StatusConnected    SessionStatus = "connected"
	StatusDisconnected SessionStatus = "disconnected"
	StatusError        SessionStatus = "error"
)

type SocksProxy added in v1.4.0

type SocksProxy struct {
	Kind string `json:"kind"` // "socks5" | "http"
	Host string `json:"host"`
	Port int    `json:"port"`
	User string `json:"user,omitempty"`
	Pass string `json:"pass,omitempty"`
}

SocksProxy is an optional upstream proxy used as the entry point of a tunnel's chain: the first SSH hop is dialed through this proxy instead of directly.

type TelnetSession

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

func NewTelnetSession

func NewTelnetSession(id string) *TelnetSession

func (*TelnetSession) Connect

func (s *TelnetSession) Connect(config ConnectionConfig) error

func (*TelnetSession) Disconnect

func (s *TelnetSession) Disconnect() error

func (TelnetSession) GetPendingSize

func (s TelnetSession) GetPendingSize() (cols, rows int)

func (TelnetSession) ID

func (s TelnetSession) ID() string

func (*TelnetSession) IsConnected

func (s *TelnetSession) IsConnected() bool

func (TelnetSession) IsZmodemMode

func (s TelnetSession) IsZmodemMode() bool

func (TelnetSession) RecordReadActivity added in v1.2.1

func (s TelnetSession) RecordReadActivity()

RecordReadActivity updates the last-read timestamp for idle detection. Each session's readLoop should call this whenever data is received.

func (*TelnetSession) Resize

func (s *TelnetSession) Resize(cols, rows int) error

func (TelnetSession) RunPostLoginScript added in v1.2.1

func (s TelnetSession) RunPostLoginScript(ctx context.Context, script string, send func([]byte), isConnected func() bool)

RunPostLoginScript sends each non-empty line of script after the terminal output goes idle, and waits for idle between commands. Stops early if ctx is cancelled or isConnected returns false.

func (TelnetSession) SetOnBinaryCallback

func (s TelnetSession) SetOnBinaryCallback(cb func([]byte))

func (TelnetSession) SetOnDataCallback

func (s TelnetSession) SetOnDataCallback(cb func([]byte))

func (TelnetSession) SetOnStatusChangeCallback

func (s TelnetSession) SetOnStatusChangeCallback(cb func(SessionStatus))

func (TelnetSession) SetPendingSize

func (s TelnetSession) SetPendingSize(cols, rows int)

func (TelnetSession) SetZmodemMode

func (s TelnetSession) SetZmodemMode(v bool)

func (TelnetSession) Status

func (s TelnetSession) Status() SessionStatus

func (TelnetSession) Title

func (s TelnetSession) Title() string

func (TelnetSession) Type

func (s TelnetSession) Type() string

func (*TelnetSession) Write

func (s *TelnetSession) Write(data []byte) error

type TransferTask

type TransferTask struct {
	ID         string
	Type       string // "upload" | "download"
	LocalPath  string
	RemotePath string
	Progress   int64
	Total      int64
	Status     string // "pending" | "running" | "paused" | "done" | "error" | "cancelled"
	// contains filtered or unexported fields
}

TransferTask tracks an ongoing file transfer.

type Tunnel added in v1.4.0

type Tunnel struct {
	ID        string     `json:"id"`
	Name      string     `json:"name"`
	Mode      TunnelMode `json:"mode"`
	SSHConnID string     `json:"sshConnId"` // exit SSH connection (ConnectionConfig.ID)

	// ListenHost/ListenPort: local bind for local/dynamic; remote bind for remote.
	ListenHost string `json:"listenHost,omitempty"` // default 127.0.0.1
	ListenPort int    `json:"listenPort"`

	// Target: destination for local; local service to forward back to for remote.
	// Unused for dynamic (SOCKS5 picks the destination per request).
	TargetHost string `json:"targetHost,omitempty"`
	TargetPort int    `json:"targetPort,omitempty"`

	Upstream  *SocksProxy `json:"upstream,omitempty"`
	AutoStart bool        `json:"autoStart,omitempty"`
	GroupID   string      `json:"groupId,omitempty"`
	SortOrder int         `json:"sortOrder,omitempty"`
}

Tunnel is one user-configured SSH tunnel. The proxy chain is implicit: it recurses the exit connection's own jump host (ConnectionConfig.TunnelSSHConnID) — no jump host means a single hop straight to the exit.

type TunnelGroup added in v1.4.0

type TunnelGroup struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	SortOrder int    `json:"sortOrder,omitempty"`
}

TunnelGroup is a display grouping in the tunnels panel (like connection groups).

type TunnelMode added in v1.4.0

type TunnelMode string

TunnelMode is the kind of SSH port forwarding a tunnel performs.

It is a stable, non-localized enum persisted to disk and shown (as-is) in the picker. The UI never translates these values; only their descriptions go through i18n.

const (
	// TunnelLocal forwards a local listening port to a destination host:port
	// reached from the exit SSH connection (ssh -L).
	TunnelLocal TunnelMode = "local"
	// TunnelRemote listens on the exit host and forwards back to a local
	// destination host:port (ssh -R).
	TunnelRemote TunnelMode = "remote"
	// TunnelDynamic runs a local SOCKS5 proxy whose connections egress through
	// the exit SSH connection (ssh -D). The SOCKS5 server runs on this machine;
	// nothing is installed on the server.
	TunnelDynamic TunnelMode = "dynamic"
)

type TunnelService

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

TunnelService manages SSH tunnel lifecycles.

Two independent kinds of tunnel share it: session tunnels (keyed by the parent session ID — the implicit jump-host forwarding used by CreateSession), and user tunnels (keyed by Tunnel.ID — the standalone port forwards managed from the tunnels panel; see tunnel_forward.go).

func NewTunnelService

func NewTunnelService() *TunnelService

func (*TunnelService) SetStateCallback added in v1.4.0

func (ts *TunnelService) SetStateCallback(cb func(TunnelState))

SetStateCallback registers a callback invoked whenever a tunnel's state changes.

func (*TunnelService) Shutdown

func (ts *TunnelService) Shutdown()

Shutdown closes all tunnels. Call on app shutdown.

func (*TunnelService) Start

func (ts *TunnelService) Start(sessionID string, sshConfig ConnectionConfig, targetHost string, targetPort int) (int, error)

Start establishes an SSH connection using the given config, opens a local TCP listener on an auto-assigned port, and forwards every accepted connection to targetHost:targetPort through the SSH tunnel. Returns the local port number that was assigned.

func (*TunnelService) StartTunnel added in v1.4.0

func (ts *TunnelService) StartTunnel(t Tunnel, resolve ConnResolver) TunnelState

StartTunnel brings a user-configured tunnel up: it dials the proxy chain (recursing the exit connection's own jump hosts, optionally entering through an upstream SOCKS5/HTTP proxy) and starts the listener for the tunnel's mode. It returns the running state; on failure the returned state carries the error and nothing is left running.

func (*TunnelService) Stop

func (ts *TunnelService) Stop(sessionID string)

Stop closes the tunnel and SSH connection for the given session.

func (*TunnelService) StopTunnel added in v1.4.0

func (ts *TunnelService) StopTunnel(id string)

StopTunnel tears down a running user tunnel (listener + whole ssh.Client chain). No-op if the tunnel isn't running.

func (*TunnelService) TunnelStates added in v1.4.0

func (ts *TunnelService) TunnelStates() []TunnelState

TunnelStates returns a snapshot of all known tunnel runtime states.

type TunnelState added in v1.4.0

type TunnelState struct {
	ID        string       `json:"id"`
	Status    TunnelStatus `json:"status"`
	LocalPort int          `json:"localPort,omitempty"` // effective listen port once running
	Error     string       `json:"error,omitempty"`
}

TunnelState is the runtime state of a tunnel, pushed to the frontend via the "tunnel:state" event.

type TunnelStatus added in v1.4.0

type TunnelStatus string

TunnelStatus is a tunnel's runtime lifecycle state (not persisted).

const (
	TunnelStopped TunnelStatus = "stopped"
	TunnelRunning TunnelStatus = "running"
	TunnelError   TunnelStatus = "error"
)

type TunnelStoreData added in v1.4.0

type TunnelStoreData struct {
	Version int           `json:"version"`
	Groups  []TunnelGroup `json:"groups"`
	Tunnels []Tunnel      `json:"tunnels"`
}

TunnelStoreData is the persisted shape of tunnels.json.

type VNCProxy

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

VNCProxy bridges WebSocket (frontend noVNC) to TCP (VNC server). One instance per VNC session, bound to a random local port.

func NewVNCProxy

func NewVNCProxy(target string) *VNCProxy

func (*VNCProxy) Start

func (p *VNCProxy) Start() (string, error)

Start begins listening on a random local port and returns the WebSocket URL.

func (*VNCProxy) Stop

func (p *VNCProxy) Stop()

Stop closes all connections and waits for goroutines to exit.

type VNCSession

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

func NewVNCSession

func NewVNCSession(id string) *VNCSession

func (*VNCSession) Connect

func (s *VNCSession) Connect(config ConnectionConfig) error

func (*VNCSession) Disconnect

func (s *VNCSession) Disconnect() error

func (*VNCSession) GetPendingSize

func (s *VNCSession) GetPendingSize() (cols, rows int)

func (*VNCSession) ID

func (s *VNCSession) ID() string

func (*VNCSession) IsConnected

func (s *VNCSession) IsConnected() bool

func (*VNCSession) IsZmodemMode

func (s *VNCSession) IsZmodemMode() bool

func (*VNCSession) ProxyAddr

func (s *VNCSession) ProxyAddr() string

func (*VNCSession) RecordReadActivity added in v1.2.1

func (s *VNCSession) RecordReadActivity()

RecordReadActivity updates the last-read timestamp for idle detection. Each session's readLoop should call this whenever data is received.

func (*VNCSession) Resize

func (s *VNCSession) Resize(cols, rows int) error

func (*VNCSession) RunPostLoginScript added in v1.2.1

func (s *VNCSession) RunPostLoginScript(ctx context.Context, script string, send func([]byte), isConnected func() bool)

RunPostLoginScript sends each non-empty line of script after the terminal output goes idle, and waits for idle between commands. Stops early if ctx is cancelled or isConnected returns false.

func (*VNCSession) SetOnBinaryCallback

func (s *VNCSession) SetOnBinaryCallback(cb func([]byte))

func (*VNCSession) SetOnDataCallback

func (s *VNCSession) SetOnDataCallback(cb func([]byte))

func (*VNCSession) SetOnStatusChangeCallback

func (s *VNCSession) SetOnStatusChangeCallback(cb func(SessionStatus))

func (*VNCSession) SetPendingSize

func (s *VNCSession) SetPendingSize(cols, rows int)

func (*VNCSession) SetZmodemMode

func (s *VNCSession) SetZmodemMode(v bool)

func (*VNCSession) Status

func (s *VNCSession) Status() SessionStatus

func (*VNCSession) Title

func (s *VNCSession) Title() string

func (*VNCSession) Type

func (s *VNCSession) Type() string

func (*VNCSession) Write

func (s *VNCSession) Write(data []byte) error

type WebDAVSession added in v1.2.2

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

func NewWebDAVSession added in v1.2.2

func NewWebDAVSession(id string) *WebDAVSession

func (*WebDAVSession) CancelTransfer added in v1.2.2

func (s *WebDAVSession) CancelTransfer(taskID string) error

func (*WebDAVSession) ChangeLocalDir added in v1.2.2

func (o *WebDAVSession) ChangeLocalDir(dir string) (FileListResult, error)

func (*WebDAVSession) ChangeRemoteDir added in v1.2.2

func (s *WebDAVSession) ChangeRemoteDir(dir string) (FileListResult, error)

func (*WebDAVSession) Chmod added in v1.2.2

func (s *WebDAVSession) Chmod(p string, mode os.FileMode) error

func (*WebDAVSession) Connect added in v1.2.2

func (s *WebDAVSession) Connect(config ConnectionConfig) error

func (*WebDAVSession) Copy added in v1.2.2

func (s *WebDAVSession) Copy(oldPath, newPath string) error

func (*WebDAVSession) Disconnect added in v1.2.2

func (s *WebDAVSession) Disconnect() error

func (*WebDAVSession) Get added in v1.2.2

func (s *WebDAVSession) Get(remotePath, localPath string, recursive bool) (string, error)

func (*WebDAVSession) GetContent added in v1.2.2

func (s *WebDAVSession) GetContent(remotePath string) ([]byte, error)

func (*WebDAVSession) GetPendingSize added in v1.2.2

func (s *WebDAVSession) GetPendingSize() (cols, rows int)

func (*WebDAVSession) ID added in v1.2.2

func (s *WebDAVSession) ID() string

func (*WebDAVSession) IsConnected added in v1.2.2

func (s *WebDAVSession) IsConnected() bool

func (*WebDAVSession) IsZmodemMode added in v1.2.2

func (s *WebDAVSession) IsZmodemMode() bool

func (*WebDAVSession) ListLocal added in v1.2.2

func (o *WebDAVSession) ListLocal(dir string) (FileListResult, error)

func (*WebDAVSession) ListLocalDrives added in v1.2.2

func (o *WebDAVSession) ListLocalDrives() ([]FileItem, error)

func (*WebDAVSession) ListRemote added in v1.2.2

func (s *WebDAVSession) ListRemote(dir string) (FileListResult, error)

func (*WebDAVSession) LocalCopy added in v1.2.2

func (o *WebDAVSession) LocalCopy(oldPath, newPath string) error

func (*WebDAVSession) LocalGetContent added in v1.2.2

func (o *WebDAVSession) LocalGetContent(localPath string) ([]byte, error)

func (*WebDAVSession) LocalMkdir added in v1.2.2

func (o *WebDAVSession) LocalMkdir(dir string) error

func (*WebDAVSession) LocalMove added in v1.2.2

func (o *WebDAVSession) LocalMove(oldPath, newPath string) error

func (*WebDAVSession) LocalPutContent added in v1.2.2

func (o *WebDAVSession) LocalPutContent(localPath string, content []byte) error

func (*WebDAVSession) LocalRemove added in v1.2.2

func (o *WebDAVSession) LocalRemove(p string, recursive bool) error

func (*WebDAVSession) LocalRename added in v1.2.2

func (o *WebDAVSession) LocalRename(oldName, newName string) error

func (*WebDAVSession) MakeDir added in v1.2.2

func (s *WebDAVSession) MakeDir(dir string) error

func (*WebDAVSession) Move added in v1.2.2

func (s *WebDAVSession) Move(oldPath, newPath string) error

func (*WebDAVSession) PauseTransfer added in v1.2.2

func (s *WebDAVSession) PauseTransfer(taskID string) error

func (*WebDAVSession) Put added in v1.2.2

func (s *WebDAVSession) Put(localPath, remotePath string, recursive bool) (string, error)

func (*WebDAVSession) PutContent added in v1.2.2

func (s *WebDAVSession) PutContent(remotePath string, content []byte) error

func (*WebDAVSession) RecordReadActivity added in v1.2.2

func (s *WebDAVSession) RecordReadActivity()

RecordReadActivity updates the last-read timestamp for idle detection. Each session's readLoop should call this whenever data is received.

func (*WebDAVSession) Remove added in v1.2.2

func (s *WebDAVSession) Remove(p string, recursive bool) error

func (*WebDAVSession) Rename added in v1.2.2

func (s *WebDAVSession) Rename(oldName, newName string) error

func (*WebDAVSession) Resize added in v1.2.2

func (s *WebDAVSession) Resize(cols, rows int) error

func (*WebDAVSession) ResumeTransfer added in v1.2.2

func (s *WebDAVSession) ResumeTransfer(taskID string) error

func (*WebDAVSession) RunPostLoginScript added in v1.2.2

func (s *WebDAVSession) RunPostLoginScript(ctx context.Context, script string, send func([]byte), isConnected func() bool)

RunPostLoginScript sends each non-empty line of script after the terminal output goes idle, and waits for idle between commands. Stops early if ctx is cancelled or isConnected returns false.

func (*WebDAVSession) SetOnBinaryCallback added in v1.2.2

func (s *WebDAVSession) SetOnBinaryCallback(cb func([]byte))

func (*WebDAVSession) SetOnDataCallback added in v1.2.2

func (s *WebDAVSession) SetOnDataCallback(cb func([]byte))

func (*WebDAVSession) SetOnStatusChangeCallback added in v1.2.2

func (s *WebDAVSession) SetOnStatusChangeCallback(cb func(SessionStatus))

func (*WebDAVSession) SetPendingSize added in v1.2.2

func (s *WebDAVSession) SetPendingSize(cols, rows int)

func (*WebDAVSession) SetZmodemMode added in v1.2.2

func (s *WebDAVSession) SetZmodemMode(v bool)

func (*WebDAVSession) Status added in v1.2.2

func (s *WebDAVSession) Status() SessionStatus

func (*WebDAVSession) Title added in v1.2.2

func (s *WebDAVSession) Title() string

func (*WebDAVSession) Type added in v1.2.2

func (s *WebDAVSession) Type() string

func (*WebDAVSession) Write added in v1.2.2

func (s *WebDAVSession) Write(data []byte) error

Jump to

Keyboard shortcuts

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