feat(config): support CIDR (#1415)

This commit is contained in:
MaineK00n
2022-06-10 09:24:25 +00:00
committed by GitHub
parent 42fdc08933
commit 86b60e1478
8 changed files with 210 additions and 28 deletions

View File

@@ -91,11 +91,10 @@ func (p *ConfigtestCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interfa
targets := make(map[string]config.ServerInfo)
for _, arg := range servernames {
found := false
for servername, info := range config.Conf.Servers {
if servername == arg {
targets[servername] = info
for _, info := range config.Conf.Servers {
if info.BaseName == arg {
targets[info.ServerName] = info
found = true
break
}
}
if !found {

View File

@@ -201,6 +201,7 @@ func printConfigToml(ips []string) (err error) {
{{range $i, $ip := .IPs}}
[servers.{{index $names $i}}]
host = "{{$ip}}"
#ignoreIPAddresses = ["{{$ip}}"]
#port = "22"
#user = "root"
#sshConfigPath = "/home/username/.ssh/config"

View File

@@ -141,11 +141,10 @@ func (p *ScanCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{})
targets := make(map[string]config.ServerInfo)
for _, arg := range servernames {
found := false
for servername, info := range config.Conf.Servers {
if servername == arg {
targets[servername] = info
for _, info := range config.Conf.Servers {
if info.BaseName == arg {
targets[info.ServerName] = info
found = true
break
}
}
if !found {