feat: Support proxy command. (#55)

This commit is contained in:
Bo-Yi Wu
2017-03-04 18:31:49 +08:00
committed by GitHub
parent 7e4e0224ee
commit 530df8d98b
5 changed files with 165 additions and 25 deletions
+20
View File
@@ -19,6 +19,16 @@ const (
)
type (
defaultConfig struct {
User string
Server string
Key string
KeyPath string
Port string
Password string
Timeout time.Duration
}
// Config for the plugin.
Config struct {
Key string
@@ -30,6 +40,7 @@ type (
Timeout time.Duration
CommandTimeout int
Script []string
Proxy defaultConfig
}
// Plugin structure
@@ -66,6 +77,15 @@ func (p Plugin) Exec() error {
Key: p.Config.Key,
KeyPath: p.Config.KeyPath,
Timeout: p.Config.Timeout,
Proxy: defaultConfig{
Server: p.Config.Proxy.Server,
User: p.Config.Proxy.User,
Password: p.Config.Proxy.Password,
Port: p.Config.Proxy.Port,
Key: p.Config.Proxy.Key,
KeyPath: p.Config.Proxy.KeyPath,
Timeout: p.Config.Proxy.Timeout,
},
}
p.log(host, "commands: ", strings.Join(p.Config.Script, "\n"))