config

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSSHUser = "root"
	DefaultSSHPort = 22
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	CurrentContext string              `yaml:"current_context"`
	Contexts       map[string]*Context `yaml:"contexts"`
	// contains filtered or unexported fields
}

func NewFromFile

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

func (*Config) Path added in v0.6.0

func (c *Config) Path() string

func (*Config) Read

func (c *Config) Read() error

func (*Config) Save

func (c *Config) Save() error

type Context added in v0.6.0

type Context struct {
	Name        string              `yaml:"-"`
	Connections []MachineConnection `yaml:"connections"`
}

func (*Context) SetDefaultConnection added in v0.15.0

func (c *Context) SetDefaultConnection(index int)

type MachineConnection

type MachineConnection struct {
	SSH        SSHDestination `yaml:"ssh,omitempty"`
	SSHCLI     SSHDestination `yaml:"ssh_cli,omitempty"`
	SSHKeyFile string         `yaml:"ssh_key_file,omitempty"`
	// TCP is the address and port of the machine's API server.
	// The pointer is used to omit the field when not set. Otherwise, yaml marshalling includes an empty object.
	TCP *netip.AddrPort `yaml:"tcp,omitempty"`
	// Unix is the path to the machine's API unix socket.
	Unix      string        `yaml:"unix,omitempty"`
	Host      string        `yaml:"host,omitempty"`
	PublicKey secret.Secret `yaml:"public_key,omitempty"`
	MachineID string        `yaml:"machine_id,omitempty"`
}

func (MachineConnection) String added in v0.12.2

func (c MachineConnection) String() string

func (*MachineConnection) Validate added in v0.14.0

func (c *MachineConnection) Validate() error

type SSHDestination

type SSHDestination string

SSHDestination represents an SSH destination string in the canonical form of "user@host:port". The default user "root" and port 22 can be omitted.

func NewSSHDestination

func NewSSHDestination(user, host string, port int) SSHDestination

func (SSHDestination) Parse

func (d SSHDestination) Parse() (user string, host string, port int, err error)

Jump to

Keyboard shortcuts

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