config

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VIKING_CONFIG_DIR = "VIKING_CONFIG_DIR"
)

Variables

View Source
var (
	ErrKeyNameRequired = errors.New("key name is required")
	ErrKeyNotFound     = errors.New("key not found")
	ErrKeyExist        = errors.New("key already exists")
)
View Source
var (
	ErrMachineNotFound           = errors.New("machine not found")
	ErrMachineAlreadyExists      = errors.New("machine already exists")
	ErrMachineNameOrHostRequired = errors.New("machine name or host is required")
)

Functions

func ConfigDir

func ConfigDir() (string, error)

Types

type Config

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

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) GetDefaultProfile added in v0.1.4

func (c Config) GetDefaultProfile() Profile

func (*Config) GetKeyByName

func (c *Config) GetKeyByName(name string) (Key, 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

func (*Config) SetDefaultProfile added in v0.1.4

func (c *Config) SetDefaultProfile(profile Profile) error

type IPList added in v0.1.1

type IPList []net.IP

func (*IPList) UnmarshalTOML added in v0.1.1

func (m *IPList) UnmarshalTOML(data interface{}) 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      IPList
	Port      int
	User      string
	Key       string
	CreatedAt time.Time
}

func (*Machine) ConnPort added in v0.1.4

func (m *Machine) ConnPort() int

type Profile added in v0.1.4

type Profile struct {
	Email string
}

Jump to

Keyboard shortcuts

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