config

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfigPath

func DefaultConfigPath() string

func DefaultHistoryPath

func DefaultHistoryPath() string

DefaultHistoryPath returns the default path for the history file

Types

type Config

type Config struct {
	Version     int                 `yaml:"version"`
	ThemePreset string              `yaml:"theme_preset,omitempty"`
	Theme       map[string]string   `yaml:"theme,omitempty"`
	ThemeDark   map[string]string   `yaml:"theme_dark,omitempty"`
	ThemeLight  map[string]string   `yaml:"theme_light,omitempty"`
	Defaults    Defaults            `yaml:"defaults,omitempty"`
	Connections []Connection        `yaml:"connections"`
	Groups      map[string][]string `yaml:"groups,omitempty"`
}

func Load

func Load(path string) (*Config, error)

func (*Config) AddConnection

func (c *Config) AddConnection(conn Connection)

func (*Config) DeleteConnection

func (c *Config) DeleteConnection(id string) bool

func (*Config) FindConnection

func (c *Config) FindConnection(id string) *Connection

func (*Config) Save

func (c *Config) Save(path string) error

func (*Config) UpdateConnection

func (c *Config) UpdateConnection(id string, conn Connection) bool

func (*Config) Validate

func (c *Config) Validate() error

type Connection

type Connection struct {
	ID           string            `yaml:"id"`
	Host         string            `yaml:"host"`
	User         string            `yaml:"user,omitempty"`
	Port         int               `yaml:"port,omitempty"`
	Project      string            `yaml:"project,omitempty"`
	Env          string            `yaml:"env,omitempty"`
	IdentityFile string            `yaml:"identity_file,omitempty"`
	ProxyJump    string            `yaml:"proxy_jump,omitempty"`
	ForwardAgent bool              `yaml:"forward_agent,omitempty"`
	UseMosh      *bool             `yaml:"use_mosh,omitempty"`
	Tags         []string          `yaml:"tags,omitempty"`
	Options      map[string]string `yaml:"options,omitempty"`
}

func (*Connection) EffectiveUser

func (c *Connection) EffectiveUser() string

func (*Connection) Mosh added in v1.2.0

func (c *Connection) Mosh() bool

Mosh returns whether mosh is enabled for this connection.

func (*Connection) SetMosh added in v1.2.0

func (c *Connection) SetMosh(v bool)

SetMosh sets the mosh flag on a connection.

type Defaults

type Defaults struct {
	User        string `yaml:"user,omitempty"`
	Port        int    `yaml:"port,omitempty"`
	UseMosh     bool   `yaml:"use_mosh,omitempty"`
	HealthCheck *bool  `yaml:"health_check,omitempty"`
}

func (*Defaults) HealthCheckEnabled added in v1.3.0

func (d *Defaults) HealthCheckEnabled() bool

HealthCheckEnabled returns whether health checks are enabled (default: true).

type History

type History struct {
	Entries []HistoryEntry `yaml:"entries"`
}

History tracks connection usage for recent connections feature

func LoadHistory

func LoadHistory() (*History, error)

LoadHistory loads the history from the default path

func LoadHistoryFromPath

func LoadHistoryFromPath(path string) (*History, error)

LoadHistoryFromPath loads history from a specific path

func (*History) GetLastUsed

func (h *History) GetLastUsed(id string) (time.Time, bool)

GetLastUsed returns the last used time for a connection

func (*History) GetMostUsed

func (h *History) GetMostUsed(limit int) []string

GetMostUsed returns the most frequently used connection IDs

func (*History) GetRecent

func (h *History) GetRecent(limit int) []string

GetRecent returns the most recently used connection IDs

func (*History) GetUseCount

func (h *History) GetUseCount(id string) int

GetUseCount returns the use count for a connection

func (*History) RecordUsage

func (h *History) RecordUsage(id string)

RecordUsage records a connection usage

func (*History) RemoveEntry

func (h *History) RemoveEntry(id string)

RemoveEntry removes an entry from history (for when connection is deleted)

func (*History) Save

func (h *History) Save() error

Save saves the history to the default path

func (*History) SaveToPath

func (h *History) SaveToPath(path string) error

SaveToPath saves history to a specific path

type HistoryEntry

type HistoryEntry struct {
	ID       string    `yaml:"id"`
	LastUsed time.Time `yaml:"last_used"`
	UseCount int       `yaml:"use_count"`
}

HistoryEntry represents a single connection usage record

type ValidationError

type ValidationError struct {
	Field   string
	Message string
}

func (ValidationError) Error

func (e ValidationError) Error() string

type ValidationErrors

type ValidationErrors []ValidationError

func (ValidationErrors) Error

func (e ValidationErrors) Error() string

Jump to

Keyboard shortcuts

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