diff --git a/util/flag.go b/util/flag.go index d3c4c9e5fb57889422f34c15736d71575bcf549e..d736d0e479cb567312e27a66ce8abe2882903c28 100644 --- a/util/flag.go +++ b/util/flag.go @@ -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 }