pssh

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSSHMenuActions

func CreateSSHMenuActions(selectedDevices []string, parent fyne.Window, app fyne.App) []*fyne.MenuItem

CreateSSHMenuActions creates menu actions for the devices table

func OpenMultipleTabbedTerminals

func OpenMultipleTabbedTerminals(connections []*SSHConnection) error

OpenMultipleTabbedTerminals opens multiple terminals in a tabbed interface

func OpenMultipleTerminals

func OpenMultipleTerminals(connections []*SSHConnection, parentWindow fyne.Window) error

OpenMultipleTerminals opens a single multi-device terminal for SSH connections

func ProbeSSHAuthMethods

func ProbeSSHAuthMethods(host string, port int) ([]string, error)

ProbeSSHAuthMethods tests what authentication methods are supported by an SSH server

func ShowCredentialsDialog

func ShowCredentialsDialog(parent fyne.Window, callback func(SSHCredentials, bool))

ShowCredentialsDialog displays a dialog to collect SSH credentials

func TestConnection

func TestConnection(host string, port int, timeout time.Duration) error

TestConnection tests if a host is reachable on the specified port

Types

type ConnectionConfig

type ConnectionConfig struct {
	Host       string
	Port       int
	Username   string
	Password   string
	Timeout    time.Duration
	PrivateKey []byte // Optional: SSH private key for key-based auth
}

ConnectionConfig holds SSH connection configuration

func NewConnectionConfig

func NewConnectionConfig(host string, port int, username, password string) ConnectionConfig

NewConnectionConfig creates a new connection configuration

func NewConnectionConfigForMikroTik

func NewConnectionConfigForMikroTik(host, username, password string) ConnectionConfig

NewConnectionConfigForMikroTik creates a connection config optimized for MikroTik devices

func NewConnectionConfigWithKey

func NewConnectionConfigWithKey(host, username string, privateKey []byte) ConnectionConfig

NewConnectionConfigWithKey creates a connection config with SSH key authentication

type ConnectionProgress

type ConnectionProgress struct {
	Total     int
	Connected int
	Failed    int
	Progress  *widget.ProgressBar
	Status    *widget.Label
}

ConnectionProgress represents the progress of connecting to multiple devices

func ShowConnectionProgress

func ShowConnectionProgress(parent fyne.Window, deviceCount int) *ConnectionProgress

ShowConnectionProgress displays a progress dialog for connecting to multiple devices

func (*ConnectionProgress) UpdateProgress

func (cp *ConnectionProgress) UpdateProgress(connected, failed int, currentHost string)

UpdateProgress updates the connection progress

type ConnectionResult

type ConnectionResult struct {
	Host       string
	Connection *SSHConnection
	Error      error
}

ConnectionResult holds the result of a connection attempt

type SSHConnection

type SSHConnection struct {
	Config    ConnectionConfig
	Client    *ssh.Client
	Session   *ssh.Session
	Connected bool
	Error     error
	// contains filtered or unexported fields
}

SSHConnection represents an active SSH connection

func ConnectToMultipleDevices

func ConnectToMultipleDevices(devices []string, credentials SSHCredentials, parent fyne.Window) ([]*SSHConnection, error)

ConnectToMultipleDevices connects to multiple devices and shows progress

func NewSSHConnection

func NewSSHConnection(config ConnectionConfig) *SSHConnection

NewSSHConnection creates a new SSH connection with the given configuration

func (*SSHConnection) Close

func (conn *SSHConnection) Close() error

Close closes the SSH connection

func (*SSHConnection) Connect

func (conn *SSHConnection) Connect() error

Connect establishes an SSH connection using enhanced authentication

func (*SSHConnection) ConnectWithAllMethods

func (conn *SSHConnection) ConnectWithAllMethods() error

ConnectWithAllMethods attempts connection with multiple authentication methods

func (*SSHConnection) CreateSession

func (conn *SSHConnection) CreateSession() (*ssh.Session, error)

CreateSession creates a new SSH session

func (*SSHConnection) IsConnected

func (conn *SSHConnection) IsConnected() bool

IsConnected returns whether the connection is active

func (*SSHConnection) RunCommand

func (conn *SSHConnection) RunCommand(command string) (string, error)

RunCommand runs a command on the remote server and returns its output

type SSHCredentials

type SSHCredentials struct {
	Username   string
	Password   string
	PrivateKey []byte
	UseKey     bool
}

SSHCredentials holds the SSH login credentials

type SSHManager

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

SSHManager manages multiple SSH connections

func NewSSHManager

func NewSSHManager() *SSHManager

NewSSHManager creates a new SSH manager

func (*SSHManager) CloseAll

func (manager *SSHManager) CloseAll() error

CloseAll closes all managed connections

func (*SSHManager) ConnectMultiple

func (manager *SSHManager) ConnectMultiple(configs []ConnectionConfig) <-chan ConnectionResult

ConnectMultiple connects to multiple hosts in parallel

func (*SSHManager) GetConnection

func (manager *SSHManager) GetConnection(host string) (*SSHConnection, bool)

GetConnection returns a connection by host

func (*SSHManager) ListConnections

func (manager *SSHManager) ListConnections() []string

ListConnections returns a list of connected hosts

type SSHMultiTerminal

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

SSHMultiTerminal represents a single terminal widget handling multiple SSH sessions

func (*SSHMultiTerminal) Close

func (smt *SSHMultiTerminal) Close() error

Close closes all SSH sessions and the terminal

func (*SSHMultiTerminal) CreateStandaloneWindow

func (smt *SSHMultiTerminal) CreateStandaloneWindow(title string) (fyne.Window, fyne.App)

CreateStandaloneWindow creates a standalone window containing the multi-terminal widget

func (*SSHMultiTerminal) GetConnectedHosts

func (smt *SSHMultiTerminal) GetConnectedHosts() []string

GetConnectedHosts returns a list of connected host names

func (*SSHMultiTerminal) GetSessionCount

func (smt *SSHMultiTerminal) GetSessionCount() int

GetSessionCount returns the number of active SSH sessions

func (*SSHMultiTerminal) GetWidget

func (smt *SSHMultiTerminal) GetWidget() *terminal.Terminal

GetWidget returns the terminal widget that can be embedded in any container

type SSHMultiTerminalState

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

SSHMultiTerminalState manages shared state for a multi-terminal session.

type TerminalManager

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

TerminalManager manages multiple terminal widgets

func NewTerminalManager

func NewTerminalManager() *TerminalManager

NewTerminalManager creates a new terminal manager

func (*TerminalManager) CloseAllTerminals

func (tm *TerminalManager) CloseAllTerminals() error

CloseAllTerminals closes all managed terminals

func (*TerminalManager) CloseTerminal

func (tm *TerminalManager) CloseTerminal(host string) error

CloseTerminal closes a specific terminal

func (*TerminalManager) CreateMultiTerminalWidget

func (tm *TerminalManager) CreateMultiTerminalWidget(connections []*SSHConnection) (*terminal.Terminal, *SSHMultiTerminal, error)

CreateMultiTerminalWidget creates a multi-terminal widget that can be embedded in any container

func (*TerminalManager) CreateMultiTerminalWindow

func (tm *TerminalManager) CreateMultiTerminalWindow(connections []*SSHConnection, title string) error

CreateMultiTerminalWindow creates a standalone window with multiple SSH terminals (legacy compatibility)

func (*TerminalManager) CreateTerminalWidget

func (tm *TerminalManager) CreateTerminalWidget(conn *SSHConnection, title string) (*TerminalWidget, error)

CreateTerminalWidget creates a new terminal widget for an SSH connection

func (*TerminalManager) GetTerminal

func (tm *TerminalManager) GetTerminal(host string) (*TerminalWidget, bool)

GetTerminal returns a terminal widget by host

func (*TerminalManager) ListTerminals

func (tm *TerminalManager) ListTerminals() []string

ListTerminals returns a list of active terminal hosts

func (*TerminalManager) MultiTerminalWindow

func (tm *TerminalManager) MultiTerminalWindow(connections []*SSHConnection, title string) error

MultiTerminalWindow creates a window with multiple terminals in tabs

func (*TerminalManager) NewSSHMultiTerminal

func (tm *TerminalManager) NewSSHMultiTerminal(connections []*SSHConnection) (*SSHMultiTerminal, error)

NewSSHMultiTerminal creates a single terminal widget that handles multiple SSH sessions

type TerminalWidget

type TerminalWidget struct {
	Connection *SSHConnection
	Session    *ssh.Session
	Terminal   *terminal.Terminal
	Window     fyne.Window
	App        fyne.App
	StdinPipe  io.WriteCloser
	StdoutPipe io.Reader
	// contains filtered or unexported fields
}

TerminalWidget represents a terminal connected to an SSH session

func (*TerminalWidget) Close

func (tw *TerminalWidget) Close() error

Close closes the terminal widget and SSH session

func (*TerminalWidget) ShowTerminal

func (tw *TerminalWidget) ShowTerminal()

ShowTerminal displays the terminal window

func (*TerminalWidget) ShowTerminalWindow

func (tw *TerminalWidget) ShowTerminalWindow()

ShowTerminalWindow displays the terminal window without running (for multiple terminals)

Jump to

Keyboard shortcuts

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