src/iputils/ipv6

  Source   Edit

Types

Ipv6 = array[16, uint8]
  Source   Edit
Ipv6Mode = enum
  Ipv6Compressed = 0,       ## Compressed mode. Removes the largest possible chain of zeros. According to https://tools.ietf.org/html/rfc5952#section-4
  Ipv6LeadingZeros = 1,     ## Leading zeros removed mode. There is no omission of groups, but there is the removal of leading zeros.
  Ipv6Expanded = 2           ## Expanded mode. All 8 groups have 4 hexadecimal digits.
IPv6 textual representation modes.   Source   Edit

Procs

proc `$`(ip: Ipv6): string {....raises: [], tags: [].}
  Source   Edit
proc cmp(a, b: Ipv6): int {....raises: [], tags: [].}
Compares IPv6 a with b and returns:
  • 0, if a is equal to b;
  • 1, if a is greater than b; or
  • -1, if a is less than b.
  Source   Edit
proc ipv6ToString(ip: Ipv6; mode: Ipv6Mode = Ipv6Compressed): string {.
    ...raises: [], tags: [].}
Returns an expanded IPv6 textual representation of ip.   Source   Edit
proc isIpv6(ip: string): bool {....raises: [], tags: [].}
Returns true if the value of ip is a valid IPv6.   Source   Edit
proc isIpv6AndStore(ip: string; stored: var Ipv6): bool {....raises: [], tags: [].}
Returns true if the value of ip is a valid IPv6 and store the value into stored.   Source   Edit
proc parseIpv6(ip: string): Ipv6 {....raises: [ValueError], tags: [].}
Parses a IPv6 value contained in ip. According to https://tools.ietf.org/html/rfc4291   Source   Edit