Documentation
¶
Index ¶
- Constants
- func Copy(args []string, multiServer bool)
- func Exec(cmd, tagOrName string, execGroup, ping bool)
- func LoadConfig()
- func Ping(name string)
- func PrintServerDetail(serverName string)
- func PrintServers(serverSort bool)
- func SetConfig(name string)
- func SingleLogin(name string)
- func Tunnel(name, leftAddr, rightAddr string, reverse bool)
- type BasicServerConfig
- type Config
- type ConfigInfo
- type ConfigList
- type KeyBoardRequest
- type Server
- type Servers
- type Tags
Constants ¶
const ( // EnvConfigDirName The MMH_CONFIG_DIR env specifies the dir where the mmh config file is stored EnvConfigDirName = "MMH_CONFIG_DIR" ConfigNameFile = ".current" BasicConfigName = "basic.yaml" )
Variables ¶
This section is empty.
Functions ¶
func Exec ¶
Exec batch execution of commands If execGroup is true, execute the command on a group of servers If ping is true and a proxy is set on the server, execute the command on the second-to-last server
func LoadConfig ¶
func LoadConfig()
LoadConfig is responsible for loading config files and serializing them to memory objects
func Ping ¶
func Ping(name string)
Ping execute the ping target server if the target server requires a proxy, ping on the last proxy server
func PrintServerDetail ¶
func PrintServerDetail(serverName string)
PrintServerDetail print single server detail
func PrintServers ¶ added in v1.6.0
func PrintServers(serverSort bool)
PrintServers print server list
func SetConfig ¶
func SetConfig(name string)
SetConfig set which config file to use, and writes the config file name into the file storage; the config file must exist or the operation fails
func SingleLogin ¶
func SingleLogin(name string)
SingleLogin open a single server interactive terminal If running in the tmux environment, mmh will automatically update the tmux window name
Types ¶
type BasicServerConfig ¶
type BasicServerConfig struct { User string `yaml:"user,omitempty"` Password string `yaml:"password,omitempty"` PrivateKey string `yaml:"private_key,omitempty"` PrivateKeyPassword string `yaml:"private_key_password,omitempty"` KeyboardAuthCmd string `yaml:"keyboard_auth_cmd,omitempty"` Environment map[string]string `yaml:"environment,omitempty"` EnableAPI string `yaml:"enable_api,omitempty"` ExtAuth string `yaml:"ext_auth,omitempty"` Port int `yaml:"port,omitempty"` ServerAliveInterval time.Duration `yaml:"server_alive_interval,omitempty"` }
BasicServerConfig server basic config
type Config ¶
type Config struct { Basic BasicServerConfig `yaml:"basic,omitempty"` MaxProxy int `yaml:"max_proxy,omitempty"` Servers Servers `yaml:"servers"` Tags Tags `yaml:"tags,omitempty"` // contains filtered or unexported fields }
Config context config(eg: default.yaml)
func (*Config) SetConfigPath ¶
SetConfigPath set config file path
type ConfigInfo ¶
type ConfigList ¶ added in v1.6.0
type ConfigList []ConfigInfo
var (
Configs ConfigList
)
func (ConfigList) Len ¶ added in v1.6.0
func (info ConfigList) Len() int
func (ConfigList) Less ¶ added in v1.6.0
func (info ConfigList) Less(i, j int) bool
func (ConfigList) Swap ¶ added in v1.6.0
func (info ConfigList) Swap(i, j int)
type KeyBoardRequest ¶ added in v1.6.0
type Server ¶ added in v1.6.0
type Server struct { Name string `yaml:"name"` Address string `yaml:"address"` Port int `yaml:"port,omitempty"` User string `yaml:"user,omitempty"` Proxy string `yaml:"proxy,omitempty"` Password string `yaml:"password,omitempty"` PrivateKey string `yaml:"private_key,omitempty"` PrivateKeyPassword string `yaml:"private_key_password,omitempty"` HookCmd string `yaml:"hook_cmd,omitempty"` HookStdout bool `yaml:"hook_stdout,omitempty"` KeyboardAuthCmd string `yaml:"keyboard_auth_cmd,omitempty"` Environment map[string]string `yaml:"environment,omitempty"` EnableAPI string `yaml:"enable_api,omitempty"` ServerAliveInterval time.Duration `yaml:"server_alive_interval,omitempty"` Tags []string `yaml:"tags,omitempty"` ConfigPath string `yaml:"config_path,omitempty"` }
Server server config
type Servers ¶
type Servers []*Server
Servers mmh servers
func ListServers ¶
ListServers merge basic context servers and current context servers