Commit 34b1341a authored by ale's avatar ale

resolve hostnames passed in IPList flags

parent 6c595930
......@@ -18,11 +18,17 @@ func (l *ipList) String() string {
}
func (l *ipList) Set(value string) error {
ip := net.ParseIP(value)
if ip == nil {
return fmt.Errorf("Unable to parse IP address \"%s\"", value)
if ip := net.ParseIP(value); ip != nil {
*l = append(*l, ip)
return nil
}
*l = append(*l, ip)
// Value is not an IP address, try to resolve it.
ips, err := net.LookupIP(value)
if err != nil {
return fmt.Errorf("Unable to parse IP address \"%s\": %v", value, err)
}
*l = append(*l, ips...)
return nil
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment