Skip to content

Commit

Permalink
IPv6: Lint warnings cleanup
Browse files Browse the repository at this point in the history
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 b7302ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
13 changes: 3 additions & 10 deletions pilot/pkg/model/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions pkg/bootstrap/bootstrap_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit b7302ab

Please sign in to comment.