From 2145f1e2728c20b31cb3587e2ae810f86ab389bc Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Wed, 26 Jan 2022 22:26:25 -0800 Subject: [PATCH] Check for local IPv6 addresses --- plexpy/helpers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plexpy/helpers.py b/plexpy/helpers.py index 6cd28a36..fb4afb80 100644 --- a/plexpy/helpers.py +++ b/plexpy/helpers.py @@ -705,7 +705,11 @@ def sanitize(obj): def is_public_ip(host): ip = is_valid_ip(get_ip(host)) - if ip and (ip.iptype() == 'PUBLIC' or ip.version() == 6): + ip_version = ip.version() + ip_type = ip.iptype() + if ip and ip_type != 'LOOPBACK' and ( + ip_version == 4 and ip_type == 'PUBLIC' or + ip_version == 6 and 'LOCAL' not in ip_type): return True return False