mirror of
https://github.com/shanghai-edu/multissh.git
synced 2025-12-16 21:37:50 +00:00
VERSION 0.4.0
支持在 sshHost 中配置 ciphers 和 keyExchanges 参数,以更好的适配不同的服务器环境
This commit is contained in:
parent
f369e796bf
commit
770df7122e
4 changed files with 39 additions and 25 deletions
17
g/cfg.go
17
g/cfg.go
|
|
@ -27,6 +27,12 @@ type SSHHost struct {
|
|||
|
||||
type HostJson struct {
|
||||
SshHosts []SSHHost
|
||||
Global GlobalConfig
|
||||
}
|
||||
|
||||
type GlobalConfig struct {
|
||||
Ciphers string
|
||||
KeyExchanges string
|
||||
}
|
||||
|
||||
type SSHResult struct {
|
||||
|
|
@ -36,6 +42,9 @@ type SSHResult struct {
|
|||
}
|
||||
|
||||
func SplitString(str string) (strList []string) {
|
||||
if str == "" {
|
||||
return
|
||||
}
|
||||
if strings.Contains(str, ",") {
|
||||
strList = strings.Split(str, ",")
|
||||
} else {
|
||||
|
|
@ -72,20 +81,18 @@ func Getfile(filePath string) ([]string, error) {
|
|||
}
|
||||
|
||||
//gu
|
||||
func GetJsonFile(filePath string) ([]SSHHost, error) {
|
||||
result := []SSHHost{}
|
||||
func GetJsonFile(filePath string) (HostJson, error) {
|
||||
var result HostJson
|
||||
b, err := ioutil.ReadFile(filePath)
|
||||
if err != nil {
|
||||
log.Println("read file ", filePath, err)
|
||||
return result, err
|
||||
}
|
||||
var m HostJson
|
||||
err = json.Unmarshal(b, &m)
|
||||
err = json.Unmarshal(b, &result)
|
||||
if err != nil {
|
||||
log.Println("read file ", filePath, err)
|
||||
return result, err
|
||||
}
|
||||
result = m.SshHosts
|
||||
return result, nil
|
||||
}
|
||||
func WriteIntoTxt(sshResult SSHResult, locate string) error {
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@ package g
|
|||
// json Unmarshal with error
|
||||
// 0.2.3
|
||||
const (
|
||||
VERSION = "0.3.0"
|
||||
VERSION = "0.4.0"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue