We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 85dd5c8 commit d5e0c06Copy full SHA for d5e0c06
ip.go
@@ -16,6 +16,9 @@ func newIPValue(val net.IP, p *net.IP) *ipValue {
16
17
func (i *ipValue) String() string { return net.IP(*i).String() }
18
func (i *ipValue) Set(s string) error {
19
+ if s == "" {
20
+ return nil
21
+ }
22
ip := net.ParseIP(strings.TrimSpace(s))
23
if ip == nil {
24
return fmt.Errorf("failed to parse IP: %q", s)
ip_test.go
@@ -24,7 +24,7 @@ func TestIP(t *testing.T) {
{"1.2.3.4", true, "1.2.3.4"},
25
{"127.0.0.1", true, "127.0.0.1"},
26
{"255.255.255.255", true, "255.255.255.255"},
27
- {"", false, ""},
+ {"", true, "0.0.0.0"},
28
{"0", false, ""},
29
{"localhost", false, ""},
30
{"0.0.0", false, ""},
0 commit comments