gbkannan89 commented on code in PR #7596:
URL: https://github.com/apache/trafficcontrol/pull/7596#discussion_r1255447729
##########
lib/go-tc/tovalidate/rules.go:
##########
@@ -217,3 +217,14 @@ func StringIsValidFloat() *validation.StringRule {
return err == nil && !math.IsNaN(validated)
}, "must be a valid float")
}
+
+// IsValidIPorCIDR returns whether the input is a valid IP address or CIDR
notation subnet
+func IsValidIPorCIDR(input string) bool {
+ ip := net.ParseIP(input)
+ if ip != nil {
+ return true // Valid IP address
+ }
+
+ _, _, err := net.ParseCIDR(input)
+ return err == nil // Valid CIDR notation subnet
Review Comment:
now removed as i removed post method itself.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]