Open andyfangaf opened 4 years ago
You are just trying to figure out the best value for the device
option, right? Not trying to detect if the computer is connected to a Wi-Fi access point?
A machine can have multiple devices enabled at once (e.g. Wi-Fi
and en0
Ethernet), so it's probably best to treat them separately. The closest thing I am aware of to what you're looking for would seem to be networksetup -listnetworkserviceorder
. I believe this acta like a priority list. It probably makes sense for os-proxy
to have a method that iterates through that list and returns the first device that is enabled.
Checking whether Wi-Fi
is connected to an access point is probably out of scope for this project, but I could be convinced to add it.
This feature would be really useful to ensure a proxy is enabled, but when you don't know whether the device is connected to Wi-Fi or Ethernet. Would it make sense to add it in os-proxy? Or is there another way to do it that you know of?
Thanks for open sourcing this. Super useful.