Skip to content
Snippets Groups Projects
Commit 34b1341a authored by ale's avatar ale
Browse files

resolve hostnames passed in IPList flags

parent 6c595930
Branches
No related tags found
No related merge requests found
......@@ -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
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment