history

package
v1.0.32 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionHistory

type ConnectionHistory struct {
	Connections map[string]ConnectionInfo `json:"connections"`
}

ConnectionHistory represents the history of SSH connections

type ConnectionInfo

type ConnectionInfo struct {
	HostName        string                 `json:"host_name"`
	LastConnect     time.Time              `json:"last_connect"`
	ConnectCount    int                    `json:"connect_count"`
	PortForwarding  *PortForwardConfig     `json:"port_forwarding,omitempty"`
	TransferHistory []TransferHistoryEntry `json:"transfer_history,omitempty"`
}

ConnectionInfo stores information about a specific connection

type HistoryManager

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

HistoryManager manages the connection history

func NewHistoryManager

func NewHistoryManager() (*HistoryManager, error)

NewHistoryManager creates a new history manager

func (*HistoryManager) CleanupOldEntries

func (hm *HistoryManager) CleanupOldEntries(currentHosts []config.SSHHost) error

CleanupOldEntries removes connection history for hosts that no longer exist

func (*HistoryManager) GetAllConnectionsInfo

func (hm *HistoryManager) GetAllConnectionsInfo() []ConnectionInfo

GetAllConnectionsInfo returns all connection information sorted by last connection time

func (*HistoryManager) GetConnectionCount

func (hm *HistoryManager) GetConnectionCount(hostName string) int

GetConnectionCount returns the total number of connections for a host

func (*HistoryManager) GetLastConnectionTime

func (hm *HistoryManager) GetLastConnectionTime(hostName string) (time.Time, bool)

GetLastConnectionTime returns the last connection time for a host

func (*HistoryManager) GetLastTransfer

func (hm *HistoryManager) GetLastTransfer(hostName string) *TransferHistoryEntry

GetLastTransfer retrieves the most recent transfer for a host

func (*HistoryManager) GetPortForwardingConfig

func (hm *HistoryManager) GetPortForwardingConfig(hostName string) *PortForwardConfig

GetPortForwardingConfig retrieves the last used port forwarding configuration for a host

func (*HistoryManager) GetTransferHistory

func (hm *HistoryManager) GetTransferHistory(hostName string) []TransferHistoryEntry

GetTransferHistory retrieves the transfer history for a host

func (*HistoryManager) RecordConnection

func (hm *HistoryManager) RecordConnection(hostName string) error

RecordConnection records a new connection for the specified host

func (*HistoryManager) RecordPortForwarding

func (hm *HistoryManager) RecordPortForwarding(hostName, forwardType, localPort, remoteHost, remotePort, bindAddress string) error

RecordPortForwarding saves port forwarding configuration for a host

func (*HistoryManager) RecordTransfer

func (hm *HistoryManager) RecordTransfer(hostName, direction, localPath, remotePath string) error

RecordTransfer saves a file transfer record for a host

func (*HistoryManager) SortHostsByLastUsed

func (hm *HistoryManager) SortHostsByLastUsed(hosts []config.SSHHost) []config.SSHHost

SortHostsByLastUsed sorts hosts by their last connection time (most recent first)

func (*HistoryManager) SortHostsByMostUsed

func (hm *HistoryManager) SortHostsByMostUsed(hosts []config.SSHHost) []config.SSHHost

SortHostsByMostUsed sorts hosts by their connection count (most used first)

type PortForwardConfig

type PortForwardConfig struct {
	Type        string `json:"type"` // "local", "remote", "dynamic"
	LocalPort   string `json:"local_port"`
	RemoteHost  string `json:"remote_host"`
	RemotePort  string `json:"remote_port"`
	BindAddress string `json:"bind_address"`
}

PortForwardConfig stores port forwarding configuration

type TransferHistoryEntry

type TransferHistoryEntry struct {
	Direction  string    `json:"direction"` // "upload" or "download"
	LocalPath  string    `json:"local_path"`
	RemotePath string    `json:"remote_path"`
	Timestamp  time.Time `json:"timestamp"`
}

TransferHistoryEntry stores a file transfer record

Jump to

Keyboard shortcuts

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