Fix route range

This commit is contained in:
世界
2023-12-09 22:38:00 +08:00
parent c0d2f57ec0
commit 4892c54313
2 changed files with 56 additions and 25 deletions

View File

@@ -1,6 +1,11 @@
package io.nekohasekai.sfa.ktx
import android.net.IpPrefix
import android.os.Build
import androidx.annotation.RequiresApi
import io.nekohasekai.libbox.RoutePrefix
import io.nekohasekai.libbox.StringIterator
import java.net.InetAddress
fun Iterable<String>.toStringIterator(): StringIterator {
return object : StringIterator {
@@ -22,4 +27,7 @@ fun StringIterator.toList(): List<String> {
add(next())
}
}
}
}
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
fun RoutePrefix.toIpPrefix() = IpPrefix(InetAddress.getByName(address()), prefix())