config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HOST_LIST_HEADERS = "NAME\tHOST\tUSER\tPORT\tJUMP\tTAGS\tTIMEOUT\t"
)

Variables

View Source
var Config = &ConfigType{Parallel: 1, OverlayTimeout: -1}

Functions

func AddHost

func AddHost(name string, user string, ip string, port uint16, jump string, tags string, timeout int) error

func CheckTags

func CheckTags(tags string) error

func DeleteHost

func DeleteHost(name string) error

func GetHostNames

func GetHostNames() (names []string)

func ListConfigHosts

func ListConfigHosts(name string, user string, tags string) error

func LoadConfig added in v1.0.1

func LoadConfig() error

func UpdateHost

func UpdateHost(name string, user string, ip string, port uint16, jump string, tags string, timeout int) error

Types

type ConfigType

type ConfigType struct {
	ModulesDir     string           `yaml:"modulesDir,omitempty"`
	SSHAuthSock    string           `yaml:"sshAuthSock,omitempty"`
	DefaultTimeout int              `yaml:"defaultTimeout,omitempty"`
	DefaultUser    string           `yaml:"defaultUser,omitempty"`
	DefaultPort    uint16           `yaml:"defaultPort,omitempty"`
	DefaultJump    string           `yaml:"defaultJump,omitempty"`
	Hosts          map[string]*Host `yaml:"hosts"`
	Parallel       int              `yaml:"-"`
	OverlayTimeout int              `yaml:"-"`
	OverlayUser    string           `yaml:"-"`
	OverlayPort    uint16           `yaml:"-"`
	OverlayJump    string           `yaml:"-"`
	OverlayHost    string           `yaml:"-"`
	JumpHosts      []*Host          `yaml:"-"`
}

type Host

type Host struct {
	Addr     string   `yaml:"addr"`
	Jump     string   `yaml:"jump,omitempty"`
	Tags     string   `yaml:"tags,omitempty"`
	Timeout  int      `yaml:"timeout,omitempty"`
	Name     string   `yaml:"-"`
	User     string   `yaml:"-"`
	Host     string   `yaml:"-"`
	Port     uint16   `yaml:"-"`
	TagList  []string `yaml:"-"`
	JumpList []*Host  `yaml:"-"`
}

func ConfigHostsFilter

func ConfigHostsFilter(name string, user string, tags string) (hosts []*Host, err error)

func (*Host) EndPoint

func (host *Host) EndPoint() string

func (*Host) JumpString

func (host *Host) JumpString() string

func (*Host) Parse

func (host *Host) Parse() (err error)

func (*Host) Row

func (host *Host) Row() string

func (*Host) SetDefaultValue added in v1.0.1

func (host *Host) SetDefaultValue()

func (*Host) SetOverlayValue added in v1.0.1

func (host *Host) SetOverlayValue()

func (*Host) String

func (host *Host) String() string

func (*Host) TagsFormat added in v1.0.1

func (host *Host) TagsFormat()

Jump to

Keyboard shortcuts

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