connection

package
v0.0.0-...-4374b59 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StorageFileName  = "connections.toml"
	StorageDirPrefix = "ssh-manager"
	StorageDirPerm   = 0755
	StorageFilePerm  = 0600
)
View Source
const (
	DefaultPort = 22
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Username   string
	Host       string
	Port       int
	IsPassword bool
}

func (*Connection) Password

func (c *Connection) Password() (string, error)

func (*Connection) RemovePassword

func (c *Connection) RemovePassword() error

func (Connection) SSHCommand

func (c Connection) SSHCommand() (string, []string, error)

func (Connection) StartSession

func (c Connection) StartSession() error

StartSession starts a new SSH session with the given connection. It will prompt for a password if one was provided, otherwise, it will try to find all available keys in the default paths. TODO: allow custom key paths

func (*Connection) StorePassword

func (c *Connection) StorePassword(password string) error

Store the password in pass

type ConnectionManager

type ConnectionManager struct {
	Connections []Connection
}

func (*ConnectionManager) AddConnection

func (cm *ConnectionManager) AddConnection(host string, user string, port int, password *string) error

func (*ConnectionManager) DeleteConnection

func (cm *ConnectionManager) DeleteConnection(index int) error

func (ConnectionManager) FetchConnections

func (cm ConnectionManager) FetchConnections() tea.Msg

FetchConnections is a helper function for bubbletea. It fetches the connections from disk, and returns a message. This is useful for loading the model from the Init function.

It returns a ConnectionsFetchedMsg message.

func (ConnectionManager) Items

func (cm ConnectionManager) Items() []list.Item

func (ConnectionManager) SaveToDisk

func (cm ConnectionManager) SaveToDisk() error

Saves the connections as a TOML file in the user config directory

type ConnectionsFetchedMsg

type ConnectionsFetchedMsg struct {
	FetchedManager ConnectionManager
}

ConnectionsFetchedMsg is a bubbletea message that is sent when the connections have been fetched from disk.

type Item

type Item struct {
	Conn Connection
}

func (Item) Description

func (i Item) Description() string

func (Item) FilterValue

func (i Item) FilterValue() string

func (Item) Title

func (i Item) Title() string

Jump to

Keyboard shortcuts

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