fix: fix IsValidSubnet

This commit is contained in:
JustSong 2024-04-05 12:40:03 +08:00
parent 5b41f57423
commit 77f9e75654

View File

@ -9,7 +9,10 @@ import (
func IsValidSubnet(subnet string) error {
_, _, err := net.ParseCIDR(subnet)
return fmt.Errorf("failed to parse subnet: %w", err)
if err != nil {
return fmt.Errorf("failed to parse subnet: %w", err)
}
return nil
}
func IsIpInSubnet(ctx context.Context, ip string, subnet string) bool {