VERSION 0.4.0

支持在 sshHost 中配置 ciphers 和 keyExchanges 参数,以更好的适配不同的服务器环境
This commit is contained in:
Feng_Qi 2022-02-11 15:26:40 +08:00
parent f369e796bf
commit 770df7122e
4 changed files with 39 additions and 25 deletions

View file

@ -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 {

View file

@ -9,5 +9,5 @@ package g
// json Unmarshal with error
// 0.2.3
const (
VERSION = "0.3.0"
VERSION = "0.4.0"
)