Permalink
Browse files

IPv6: Lint warnings cleanup

Even those these are temp commits, I decided to do a commit to fix
lint warnings (in case any were of importance).
  • Loading branch information...
pmichali committed Mar 5, 2018
1 parent 814036f commit b7302ab9f7410443f9528bedbb5bcfa94c90ed5e
Showing with 8 additions and 15 deletions.
  1. +3 −10 pilot/pkg/model/validation.go
  2. +5 −5 pkg/bootstrap/bootstrap_config.go
@@ -548,14 +548,7 @@ func ValidateIPv4Address(addr string) error {
if ip == nil {
return fmt.Errorf("%v is not a valid IP", addr)
}
return nil // Temp HACK
// The current implementation only supports IP v4 addresses
if ip.To4() == nil {
return fmt.Errorf("%v is not a valid IPv4 address", addr)
}
return nil
return nil // Accet IPv4 or IPv6 address
}
// ValidateDelay checks that fault injection delay is well-formed
@@ -1224,11 +1217,11 @@ func ValidateDestinationPolicy(msg proto.Message) error {
func ValidateProxyAddress(hostAddr string) error {
host, p, err := net.SplitHostPort(hostAddr)
if err != nil {
return fmt.Errorf("Unable to split %q: %s", hostAddr, err.Error())
return fmt.Errorf("unable to split %q: %s", hostAddr, err.Error())
}
port, err := strconv.Atoi(p)
if err != nil {
return fmt.Errorf("Atoi parsing of %s: %s", p, err.Error())
return fmt.Errorf("unable to parse string %q as int: %s", p, err.Error())
}
if err = ValidatePort(port); err != nil {
return err
@@ -74,21 +74,21 @@ func WriteBootstrap(config *meshconfig.ProxyConfig, epoch int, pilotSAN []string
h, p, err := net.SplitHostPort(config.DiscoveryAddress)
if err != nil {
return "", fmt.Errorf("PCM: Unable to parse Discovery address %q: %s", config.DiscoveryAddress, err.Error())
return "", fmt.Errorf("unable to parse discovery address %q: %s", config.DiscoveryAddress, err.Error())
}
opts["pilot_address"] = fmt.Sprintf("{\"address\": \"%s\", \"port_value\": %s}", h, p)
if config.ZipkinAddress != "" {
h, p, err := net.SplitHostPort(config.ZipkinAddress)
h, p, err = net.SplitHostPort(config.ZipkinAddress)
if err != nil {
return "", fmt.Errorf("PCM: Unable to parse Zipkin address %q: %s", config.ZipkinAddress, err.Error())
return "", fmt.Errorf("unable to parse zipkin address %q: %s", config.ZipkinAddress, err.Error())
}
opts["zipkin"] = fmt.Sprintf("{\"address\": \"%s\", \"port_value\": %s}", h, p)
}
if config.StatsdUdpAddress != "" {
h, p, err := net.SplitHostPort(config.StatsdUdpAddress)
h, p, err = net.SplitHostPort(config.StatsdUdpAddress)
if err != nil {
return "", fmt.Errorf("PCM: Unable to parse StatsdUdp address %q: %s", config.StatsdUdpAddress, err.Error())
return "", fmt.Errorf("unable to parse statsd address %q: %s", config.StatsdUdpAddress, err.Error())
}
opts["statsd"] = fmt.Sprintf("{\"address\": \"%s\", \"port_value\": %s}", h, p)
}

0 comments on commit b7302ab

Please sign in to comment.