Documents for @litert/utils-network
    Preparing search index...

    Function normalizeIPv6Address

    • Transform an IPv6 address to a normalized format, with exact 8 segments.

      Parameters

      • ip: string

        The IPv6 address to be normalized.

      • padLeadingZeros: boolean

        Whether to pad leading zeros in each segment, upto 4 digits.

      Returns string

      The normalized IPv6 address.

      If the input is an invalid IPv6 address.

      `::     -> 0:0:0:0:0:0:0:0`
      
      `::1    -> 0:0:0:0:0:0:0:1`
      
      `a::1   -> a:0:0:0:0:0:0:1`
      
      `a:b::1 -> a:b:0:0:0:0:0:1`