Changed from `isPrivate` to `isSiteLocal` to reflect the actual name
This commit is contained in:
parent
9a0b2d9c6e
commit
1cc7ac128b
|
@ -19,12 +19,7 @@ package dorkbox.netUtil
|
||||||
|
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.io.Writer
|
import java.io.Writer
|
||||||
import java.net.Inet4Address
|
import java.net.*
|
||||||
import java.net.InetAddress
|
|
||||||
import java.net.InetSocketAddress
|
|
||||||
import java.net.NetworkInterface
|
|
||||||
import java.net.Socket
|
|
||||||
import java.net.SocketException
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.floor
|
import kotlin.math.floor
|
||||||
import kotlin.math.ln
|
import kotlin.math.ln
|
||||||
|
@ -148,8 +143,8 @@ object IPv4 {
|
||||||
* 172.16.0.0/12
|
* 172.16.0.0/12
|
||||||
* 192.168.0.0/16
|
* 192.168.0.0/16
|
||||||
*/
|
*/
|
||||||
fun isPrivate(ipAsString: String): Boolean {
|
fun isSiteLocal(ipAsString: String): Boolean {
|
||||||
return isPrivate(toInt(ipAsString))
|
return isSiteLocal(toInt(ipAsString))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,7 +155,7 @@ object IPv4 {
|
||||||
* 172.16.0.0/12
|
* 172.16.0.0/12
|
||||||
* 192.168.0.0/16
|
* 192.168.0.0/16
|
||||||
*/
|
*/
|
||||||
fun isPrivate(ipAsInt: Int): Boolean {
|
fun isSiteLocal(ipAsInt: Int): Boolean {
|
||||||
// check from smaller to larger
|
// check from smaller to larger
|
||||||
return isInRange(ipAsInt, private192, 16) || isInRange(ipAsInt, private172, 12) || isInRange(ipAsInt, private10, 8)
|
return isInRange(ipAsInt, private192, 16) || isInRange(ipAsInt, private172, 12) || isInRange(ipAsInt, private10, 8)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue