Skip to content

Commit

Permalink
fix linter issue
Browse files Browse the repository at this point in the history
  • Loading branch information
paulyufan2 committed Dec 4, 2023
1 parent 67abcd4 commit 06cf070
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cns/restserver/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -790,18 +790,20 @@ func (service *HTTPRestService) validateDefaultIPConfigsRequest(_ context.Contex
}

func isPrivateIP(ip net.IP) bool {
var privateIPBlocks []*net.IPNet

for _, cidr := range []string{
privateBlocks := []string{
"127.0.0.0/8", // IPv4 loopback
"10.0.0.0/8", // RFC1918
"172.16.0.0/12", // RFC1918
"192.168.0.0/16", // RFC1918
"169.254.0.0/16", // RFC3927 link-local
} {
}

var privateIPBlocks []*net.IPNet
for _, cidr := range privateBlocks {
_, block, err := net.ParseCIDR(cidr)
if err != nil {
panic(fmt.Errorf("parse error on %q: %v", cidr, err))
logger.Errorf("Failed to parse CIDR")
}
privateIPBlocks = append(privateIPBlocks, block)
}
Expand Down

0 comments on commit 06cf070

Please sign in to comment.