Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ale
autoradio
Commits
34b1341a
Commit
34b1341a
authored
Nov 21, 2015
by
ale
Browse files
resolve hostnames passed in IPList flags
parent
6c595930
Changes
1
Hide whitespace changes
Inline
Side-by-side
util/flag.go
View file @
34b1341a
...
...
@@ -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
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment