homebridge / ciao

RFC 6762 and RFC 6763 compliant mdns service discovery library written in Typescript
MIT License
79 stars 6 forks source link

Fix getting Windows default network interface #3

Closed MystK closed 3 years ago

MystK commented 3 years ago

Before image

This was because the search after running netstat -r only expected 1 space inbetween data. In my case, there were multiple spaces. image

I modified the windows section to check for 1 space or more. After image

Supereg commented 3 years ago

Thanks for the contribution. Ciao currently lacks testing on Windows machines a bit (as I currently don't have access to one and currently didn't yet bother to test stuff in the VM). We should probably consider some multiple platform CI testing for the interface detection stuff.

I'm currently a bit busy, trying to get back working on ciao at the weekend and merging your PR. One thing which is also on my list for Darwin systems is how netstat output looks when the router is not connected to the internet (and all clients invalidated their routing tables). For Darwin netstat doesn't show 0.0.0.0 route as there is no internet. Would be interesting if that's the case for windows netstat too. Goal should be to have proper interface detection even if 0.0.0.0 route is not present.

Could you quickly elaborate what other interfaces are running on your system? what about the 172.0.0.0/8 addresses? I assume your 192.168.68.0/24 is your local LAN network?

Supereg commented 3 years ago

Fix published as ciao v1.0.0-beta.39

MystK commented 3 years ago

We could improve windows testing initially by getting some unit testing for those methods in. I could work on that.

I just tried the scenario you mentioned and Windows also doesn't show 0.0.0.0 image

I have LAN, OpenVPN, and Wifi Adapters, then 3 virtual ones. The 172.0.0.0/8 addresses are virtual adapters from hyper-v/docker. You're correct that 192.168.68.0/24 is local. Pic below for more info.

image