回调增加网络路由

This commit is contained in:
lubeilin
2024-04-19 18:35:37 +08:00
parent cc6cd6dc37
commit 0352982c14
3 changed files with 27 additions and 2 deletions
@@ -6,6 +6,12 @@ package top.wherewego.vnt.jni;
* @author https://github.com/lbl8603/vnt
*/
public class IpUtils {
/**
* 将整数的ip地址转成字符串,例如 0 转成 "0.0.0.0"
*
* @param ipAddress
* @return
*/
public static String intToIpAddress(int ipAddress) {
return ((ipAddress & 0xFF000000) >>> 24) + "." +
@@ -13,6 +19,13 @@ public class IpUtils {
((ipAddress & 0x0000FF00) >>> 8) + "." +
(ipAddress & 0x000000FF);
}
/**
* 返回掩码的长度
*
* @param subnetMask
* @return
*/
public static int subnetMaskToPrefixLength(int subnetMask) {
int prefixLength = 0;
int bit = 1 << 31;