diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/Utils.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/Utils.kt index ae85000c..33aa5933 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/Utils.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/Utils.kt @@ -178,7 +178,7 @@ object Utils { //CIDR if (addr.indexOf("/") > 0) { val arr = addr.split("/") - if (arr.count() == 2 && Integer.parseInt(arr[1]) > 0) { + if (arr.count() == 2 && Integer.parseInt(arr[1]) > -1) { addr = arr[0] } } diff --git a/V2rayNG/app/src/test/kotlin/com/v2ray/ang/ExampleUnitTest.kt b/V2rayNG/app/src/test/kotlin/com/v2ray/ang/ExampleUnitTest.kt index dd21d55a..8e7961ff 100644 --- a/V2rayNG/app/src/test/kotlin/com/v2ray/ang/ExampleUnitTest.kt +++ b/V2rayNG/app/src/test/kotlin/com/v2ray/ang/ExampleUnitTest.kt @@ -20,6 +20,7 @@ class UtilTest { assertTrue(Utils.isIpAddress("127.0.0.1" )) assertTrue(Utils.isIpAddress("127.0.0.1:80" )) + assertTrue(Utils.isIpAddress("0.0.0.0/0" )) assertTrue(Utils.isIpAddress("::1" )) assertTrue(Utils.isIpAddress("[::1]:80" )) assertTrue(Utils.isIpAddress("2605:2700:0:3::4713:93e3" )) @@ -28,6 +29,7 @@ class UtilTest { assertTrue(Utils.isIpAddress("[::ffff:192.168.173.22]:80" )) assertTrue(Utils.isIpAddress("1::" )) assertTrue(Utils.isIpAddress("::" )) + assertTrue(Utils.isIpAddress("::/0" )) assertTrue(Utils.isIpAddress("10.24.56.0/24" )) assertTrue(Utils.isIpAddress("2001:4321::1" )) assertTrue(Utils.isIpAddress("240e:1234:abcd:12::6666" ))