mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-06 16:53:42 +08:00
fix: fix IsValidSubnet
This commit is contained in:
@@ -9,7 +9,10 @@ import (
|
|||||||
|
|
||||||
func IsValidSubnet(subnet string) error {
|
func IsValidSubnet(subnet string) error {
|
||||||
_, _, err := net.ParseCIDR(subnet)
|
_, _, 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 {
|
func IsIpInSubnet(ctx context.Context, ip string, subnet string) bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user