From 3d96bc034a8d512f8961f0e5288ea7a3984e049c Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Fri, 25 Apr 2025 19:49:48 +0200 Subject: [PATCH] Fix: change preferred order of private network ranges --- music_assistant/helpers/util.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 -- 2.34.1