package opts

import (
	"fmt"
	"net"
)

type IpOpt struct {
	*net.IP
}

func NewIpOpt(ref *net.IP, defaultVal string) *IpOpt {
	o := &IpOpt{
		IP: ref,
	}
	o.Set(defaultVal)
	return o
}

func (o *IpOpt) Set(val string) error {
	ip := net.ParseIP(val)
	if ip == nil {
		return fmt.Errorf("incorrect IP format")
	}
	(*o.IP) = net.ParseIP(val)
	return nil
}

func (o *IpOpt) String() string {
	return (*o.IP).String()
}

package opts

import (
	"fmt"
	"net"
)

type IpOpt struct {
	*net.IP
}

func NewIpOpt(ref *net.IP, defaultVal string) *IpOpt {
	o := &IpOpt{
		IP: ref,
	}
	o.Set(defaultVal)
	return o
}

func (o *IpOpt) Set(val string) error {
	ip := net.ParseIP(val)
	if ip == nil {
		return fmt.Errorf("%s is not an ip address", val)
	}
	(*o.IP) = net.ParseIP(val)
	return nil
}

func (o *IpOpt) String() string {
	return (*o.IP).String()
}

Fix inconsistency in IP address parsing errors
Fix inconsistency in IP address parsing errors

Signed-off-by: Solomon Hykes <510d74b69d9d43b60b6f6aa9d95e9f9c9497f815@docker.com>
