Documentation
¶
Overview ¶
Package conf is a package used to read configuration file (~/.bssh.toml).
Index ¶
- func AppendFile(file, line string) error
- func CheckFormatServerConf(c Config) (isFormat bool)
- func CheckFormatServerConfAuth(c ServerConfig) (isFormat bool)
- func IsDirectServer(server string) bool
- type Config
- func (cf *Config) EnsureSearchHost(host string) (string, []string)
- func (cf *Config) ExpandHosts(c *cli.Context) ([]string, []string)
- func (cf *Config) FilterNamesByGroup(group string, names []string) []string
- func (cf *Config) GetGrouping() map[string]map[string]ServerConfig
- func (cf *Config) GetNameList() (nameList []string)
- func (cf *Config) GetNameSortedList() (nameList []string)
- func (cf *Config) GroupsNames() []string
- func (cf *Config) IsDisableAutoEncryptPwd() bool
- func (cf *Config) PrintServerList(names []string, printTitle bool)
- func (cf *Config) WriteTempHosts(tempHost string)
- type ExtraConfig
- type IncludeConfig
- type IncludesConfig
- type LogConfig
- type OpenSSHConfig
- type ProxyConfig
- type ServerConfig
- type ShellConfig
- type Tmpl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendFile ¶ added in v1.0.1
func CheckFormatServerConf ¶ added in v1.0.1
CheckFormatServerConf checkes format of server config.
Note: Checking Addr, User and authentications having a value. No checking a validity of each fields.
See also: checkFormatServerConfAuth function.
func CheckFormatServerConfAuth ¶ added in v1.0.1
func CheckFormatServerConfAuth(c ServerConfig) (isFormat bool)
CheckFormatServerConfAuth checkes format of server config authentication.
Note: Checking Pass, Key, Cert, AgentAuth, PKCS11Use, PKCS11Provider, Keys or Passes having a value. No checking a validity of each fields.
func IsDirectServer ¶ added in v1.0.1
IsDirectServer tells that the server is a direct server address like user:pass@host:port.
Types ¶
type Config ¶
type Config struct {
Extra ExtraConfig
Log LogConfig
Shell ShellConfig
Include map[string]IncludeConfig
Includes IncludesConfig
Common ServerConfig
Server map[string]ServerConfig
Proxy map[string]ProxyConfig
SSHConfig map[string]OpenSSHConfig
// DisableAutoEncryptPwd disable auto PBE passwords in config file.
DisableAutoEncryptPwd bool
Passphrase string
Hosts []string
// contains filtered or unexported fields
}
Config is Struct that stores the entire configuration file.
func (*Config) EnsureSearchHost ¶ added in v1.0.1
EnsureSearchHost searches the host name by glob pattern.
func (*Config) ExpandHosts ¶ added in v0.6.13
ExpandHosts expand hosts to comma-separated or wild match (file name pattern).
func (*Config) FilterNamesByGroup ¶ added in v0.6.13
FilterNamesByGroup filter server names by group.
func (*Config) GetGrouping ¶ added in v0.6.13
func (cf *Config) GetGrouping() map[string]map[string]ServerConfig
GetGrouping get grouping map.
func (*Config) GetNameList ¶ added in v0.6.13
GetNameList return a list of server names from the Config structure.
func (*Config) GetNameSortedList ¶ added in v0.6.13
GetNameSortedList return a list of server names from the Config structure.
func (*Config) GroupsNames ¶ added in v0.6.13
GroupsNames get groups' names.
func (*Config) IsDisableAutoEncryptPwd ¶ added in v1.0.1
func (*Config) PrintServerList ¶ added in v1.0.1
PrintServerList prints server list which has names.
func (*Config) WriteTempHosts ¶ added in v1.0.1
WriteTempHosts writes a new host to temporary file.
type ExtraConfig ¶ added in v0.6.13
type ExtraConfig struct {
// Passphrase used to decrypt {PBE}xxx
Passphrase string
// DisableGrouping disable server names grouping
DisableGrouping bool
// DisableAutoEncryptPwd disable auto PBE passwords in config file.
DisableAutoEncryptPwd bool
}
ExtraConfig store extra configs.
type IncludeConfig ¶
type IncludeConfig struct {
Path string
}
IncludeConfig specify the configuration file to include (ServerConfig only).
type IncludesConfig ¶ added in v0.5.2
type IncludesConfig struct {
// example:
// path = [
// "~/.bssh.d/home.toml"
// ,"~/.bssh.d/cloud.toml"
// ]
Path []string
}
IncludesConfig specify the configuration file to include (ServerConfig only). Struct that can specify multiple files in array.
type LogConfig ¶
type LogConfig struct {
// Enable terminal logging.
Enable bool
// Add a timestamp at the beginning of the terminal log line.
Timestamp bool
// Specifies the directory for creating terminal logs.
Dir string `toml:"dirpath"`
}
LogConfig store the contents about the terminal log. The log file name is created in "YYYYmmdd_HHMMSS_servername.log" of the specified directory.
type OpenSSHConfig ¶ added in v0.6.13
type OpenSSHConfig struct {
Path string // This is preferred
Command string
ServerConfig
}
OpenSSHConfig to read OpenSSH configuration file.
WARN: This struct is not use...
type ProxyConfig ¶ added in v0.4.4
type ProxyConfig struct {
Addr string
Port string
User string
Pass string
Proxy string
ProxyType string `toml:"proxy_type"`
Note string
}
ProxyConfig struct that stores Proxy server settings connected via http and socks5.
type ServerConfig ¶
type ServerConfig struct {
// templates, host:port user/pass
Tmpl string
Group []string
// Connect basic Setting
Addr string
Port string
User string
// Connect auth Setting
Pass string
Passes []string
Key string
KeyCommand string `toml:"keycmd"`
KeyCommandPass string `toml:"keycmdpass"`
KeyPass string `toml:"keypass"`
Keys []string `toml:"keys"` // "keypath::passphrase"
Cert string
CertKey string `toml:"certkey"`
CertKeyPass string `toml:"certkeypass"`
CertPKCS11 bool `toml:"certpkcs11"`
AgentAuth bool `toml:"agentauth"`
SSHAgentUse bool `toml:"ssh_agent"`
PKCS11Use bool `toml:"pkcs11"`
// x11 forwarding setting
X11 bool
SSHAgentKeyPath []string `toml:"ssh_agent_key"` // "keypath::passphrase"
PKCS11Provider string `toml:"pkcs11provider"` // PKCS11 Provider PATH
PKCS11PIN string `toml:"pkcs11pin"` // PKCS11 PIN code
// pre | post command setting
PreCmd string `toml:"pre_cmd"`
PostCmd string `toml:"post_cmd"`
// proxy setting
ProxyType string `toml:"proxy_type"`
Proxy string
ProxyCommand string `toml:"proxy_cmd"` // OpenSSH type proxy setting
// local rcfile setting
LocalRcUse string `toml:"local_rc"` // yes|no (default: yes)
LocalRcPath []string `toml:"local_rc_file"`
LocalRcDecodeCmd string `toml:"local_rc_decode_cmd"`
// local/remote port forwarding setting
PortForwardMode string `toml:"port_forward"` // [`L`,`l`,`LOCAL`,`local`]|[`R`,`r`,`REMOTE`,`remote`]
PortForwardLocal string `toml:"port_forward_local"` // port forward (local). "host:port"
PortForwardRemote string `toml:"port_forward_remote"` // port forward (remote). "host:port"
// Dynamic Port Forwarding setting
DynamicPortForward string `toml:"dynamic_port_forward"` // ex.) "11080"
Note string
// Connection Timeout second
ConnectTimeout int `toml:"connect_timeout"`
// Server Alive
ServerAliveCountMax int `toml:"alive_max"`
ServerAliveCountInterval int `toml:"alive_interval"`
}
ServerConfig structure for holding SSH connection information.
func ParseDirectServer ¶ added in v1.0.1
func ParseDirectServer(server string) (ServerConfig, bool)
ParseDirectServer parses a direct server address.
func ServerConfigDeduct ¶ added in v1.0.1
func ServerConfigDeduct(perConfig, childConfig ServerConfig) ServerConfig
ServerConfigDeduct returns a new server config that set perConfig field to childConfig empty filed.
func (ServerConfig) BelongsToGroup ¶ added in v0.6.13
func (c ServerConfig) BelongsToGroup(cf *Config, name string) bool
BelongsToGroup belongs to group or not.
type ShellConfig ¶ added in v0.6.13
type ShellConfig struct {
// prompt
Prompt string `toml:"PROMPT"` // bssh shell prompt
OPrompt string `toml:"OPROMPT"` // bssh shell output prompt
// message,title etc...
Title string
// history file
HistoryFile string `toml:"histfile"`
// pre | post command setting
PreCmd string `toml:"pre_cmd"`
PostCmd string `toml:"post_cmd"`
}
ShellConfig structure for storing bssh-shell settings.