- autohosts: support tab character
This commit is contained in:
parent
2fca419c7f
commit
2f454117ce
|
@ -154,14 +154,21 @@ func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string]string,
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
line = strings.TrimSpace(line)
|
line = strings.TrimSpace(line)
|
||||||
|
if len(line) == 0 || line[0] == '#' {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
ip := SplitNext(&line, ' ')
|
fields := strings.Fields(line)
|
||||||
ipAddr := net.ParseIP(ip)
|
if len(fields) < 2 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
ipAddr := net.ParseIP(fields[0])
|
||||||
if ipAddr == nil {
|
if ipAddr == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for {
|
for i := 1; i != len(fields); i++ {
|
||||||
host := SplitNext(&line, ' ')
|
host := fields[i]
|
||||||
if len(host) == 0 {
|
if len(host) == 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue