2020-08-08 20:23:27 +02:00
|
|
|
package dorkbox.netUtil
|
|
|
|
|
|
|
|
import dorkbox.executor.Executor
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
object Route {
|
2020-08-09 14:44:33 +02:00
|
|
|
fun flush() {
|
|
|
|
Executor.run("/sbin/ip", "route", "flush", "cache")
|
2020-08-08 20:23:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|