mirror of
https://github.com/PowerJob/PowerJob.git
synced 2025-07-17 00:00:04 +08:00
feat: support using network interface name for NetUtils #179
This commit is contained in:
parent
74fc5edb1f
commit
9e349a202a
@ -297,7 +297,11 @@ public class NetUtils {
|
|||||||
*/
|
*/
|
||||||
public static boolean isPreferredNetworkInterface(NetworkInterface networkInterface) {
|
public static boolean isPreferredNetworkInterface(NetworkInterface networkInterface) {
|
||||||
String preferredNetworkInterface = System.getProperty(PowerJobDKey.PREFERRED_NETWORK_INTERFACE);
|
String preferredNetworkInterface = System.getProperty(PowerJobDKey.PREFERRED_NETWORK_INTERFACE);
|
||||||
return Objects.equals(networkInterface.getDisplayName(), preferredNetworkInterface);
|
if (Objects.equals(networkInterface.getDisplayName(), preferredNetworkInterface)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 兼容直接使用网卡名称的情况,比如 Realtek PCIe GBE Family Controller
|
||||||
|
return Objects.equals(networkInterface.getName(), preferredNetworkInterface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean ignoreInterfaceByConfig(String interfaceName) {
|
static boolean ignoreInterfaceByConfig(String interfaceName) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user