cmd/cli: only set DNS for physical interfaces on Windows

By filtering the interfaces by MAC address instead of name.
This commit is contained in:
Cuong Manh Le
2024-03-01 15:16:40 +07:00
committed by Cuong Manh Le
parent 73a697b2fa
commit e89021ec3a
4 changed files with 61 additions and 6 deletions
+21
View File
@@ -0,0 +1,21 @@
package cli
import (
"net"
)
func patchNetIfaceName(iface *net.Interface) error {
return nil
}
// validInterface reports whether the *net.Interface is a valid one.
// On Windows, only physical interfaces are considered valid.
func validInterface(iface *net.Interface) bool {
if iface == nil {
return false
}
if isPhysicalInterface(iface.HardwareAddr.String()) {
return true
}
return false
}