add a way to detect network interface on macOS
- typically returns en0, or if a VPN is on it will most likely show one of the `utun` interfaces
This commit is contained in:
parent
ac097bbe5c
commit
5f47b1644d
1 changed files with 5 additions and 0 deletions
|
@ -26,6 +26,11 @@ interface_get() {
|
|||
name="$(ip -o route get 192.168.0.0 | awk '{print $5}')"
|
||||
fi
|
||||
;;
|
||||
Darwin)
|
||||
if type route >/dev/null; then
|
||||
name="$(route -n get 192.168.0.0 2>/dev/null | awk '/interface: / {print $2}')"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue