|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2025 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing network related utility functions. |
|
8 """ |
|
9 |
|
10 |
|
11 def ipv6AddressScope(address): |
|
12 """ |
|
13 Function to determine the scope of an IPv6 address. |
|
14 |
|
15 @param address IPv6 address |
|
16 @type str |
|
17 @return address scope |
|
18 @rtype str |
|
19 """ |
|
20 address = address.lower() |
|
21 if address.startswith("fe80"): |
|
22 return "Link-Local Scope" |
|
23 elif address.startswith("fec"): |
|
24 return "Site-Local Scope" |
|
25 elif address.startswith("ff"): |
|
26 return "Multicast Scope" |
|
27 elif address.startswith(("fc", "fd")): |
|
28 return "Unique-Local Scope" |
|
29 else: |
|
30 return "Global Scope" |