config

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VIKING_CONFIG_DIR = "VIKING_CONFIG_DIR"
)

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() (string, error)

Types

type Config

type Config struct {
	Keys     map[string]Key
	Machines map[string]Machine
}

func ParseDefaultConfig

func ParseDefaultConfig() (Config, error)

func (*Config) AddKey

func (c *Config) AddKey(key Key) error

func (*Config) AddMachine

func (c *Config) AddMachine(machine Machine) error

func (*Config) GetKeyByName

func (c *Config) GetKeyByName(name string) (Key, error)

func (*Config) GetMachine added in v0.0.3

func (c *Config) GetMachine(machine string) (Machine, error)

GetMachine returns a machine by name or host.

func (*Config) GetMachineByHost

func (c *Config) GetMachineByHost(host net.IP) (Machine, error)

func (*Config) GetMachineByName

func (c *Config) GetMachineByName(name string) (Machine, error)

func (*Config) ListKeys

func (c *Config) ListKeys() []Key

func (*Config) ListMachines

func (c *Config) ListMachines() []Machine

func (*Config) RemoveKey

func (c *Config) RemoveKey(name string) error

func (*Config) RemoveMachine

func (c *Config) RemoveMachine(machine string) error

RemoveMachine removes a machine from the config by name or host.

func (Config) Save

func (c Config) Save() error

type Key

type Key struct {
	Name       string `toml:"-"`
	Private    string
	Public     string
	Passphrase string
	CreatedAt  time.Time
}

type Machine

type Machine struct {
	Name      string `toml:"-"`
	Host      net.IP
	User      string
	Key       string
	CreatedAt time.Time
}

func (*Machine) Configure

func (m *Machine) Configure(ctx context.Context, sshClient *ssh.Client) error

Jump to

Keyboard shortcuts

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