src/eric7/SystemUtilities/NetworkUtilities.py

Mon, 05 May 2025 17:40:08 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 05 May 2025 17:40:08 +0200
branch
eric7
changeset 11263
28f0ead11a82
permissions
-rw-r--r--

MicroPython
- Added support for IPv6 for WiFi and Ethernet enabled devices (MPy ≥ 1.24.0).

# -*- coding: utf-8 -*-

# Copyright (c) 2025 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing network related utility functions.
"""


def ipv6AddressScope(address):
    """
    Function to determine the scope of an IPv6 address.

    @param address IPv6 address
    @type str
    @return address scope
    @rtype str
    """
    address = address.lower()
    if address.startswith("fe80"):
        return "Link-Local Scope"
    elif address.startswith("fec"):
        return "Site-Local Scope"
    elif address.startswith("ff"):
        return "Multicast Scope"
    elif address.startswith(("fc", "fd")):
        return "Unique-Local Scope"
    else:
        return "Global Scope"

eric ide

mercurial