From: Marcel van der Veldt Date: Fri, 25 Apr 2025 17:49:48 +0000 (+0200) Subject: Fix: change preferred order of private network ranges X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=3d96bc034a8d512f8961f0e5288ea7a3984e049c;p=music-assistant-server.git Fix: change preferred order of private network ranges --- diff --git a/music_assistant/helpers/util.py b/music_assistant/helpers/util.py index a50e4611..7dca3724 100644 --- a/music_assistant/helpers/util.py +++ b/music_assistant/helpers/util.py @@ -237,9 +237,11 @@ async def get_ip_addresses(include_ipv6: bool = False) -> tuple[str]: if ip.ip.startswith(("::1", "::ffff:", "fe80")): # filter out IPv6 loopback/link-local address continue - if ip.ip.startswith(("192.", "10.")): + if ip.ip.startswith(("192.168.",)): + # we rank the 192.168 range a bit higher as its most + # often used as the private network subnet score = 2 - elif ip.ip.startswith("172."): + elif ip.ip.startswith(("172.", "10.", "192.")): # we rank the 172 range a bit lower as its most # often used as the private docker network score = 1