NetworkUtils/src/dorkbox/netUtil/Route.kt

26 lines
551 B
Kotlin

package dorkbox.netUtil
import dorkbox.executor.Executor
/**
*
*/
object Route {
/**
* Gets the version number.
*/
const val version = "2.9.1"
fun flush() {
Executor.run("/sbin/ip", "route", "flush", "cache")
}
fun add(targetIpAndCidr: String, hostIP: String, hostInterface: String) {
if (Common.OS_LINUX) {
Executor.run("/sbin/ip", "route", "add", targetIpAndCidr, "via", hostIP, "dev", hostInterface);
} else {
throw RuntimeException("NOT IMPL.")
}
}
}