Module ipaddress

Types

Ip6Address* = distinct array[16, uint8]
  Source Edit
Ip6Interface* = Interface[Ip6Interface]
  Source Edit
Ip4Address* = distinct array[4, uint8]
  Source Edit
Ip4Interface* = Interface[Ip4Interface]
  Source Edit
IpKind* = enum
  ip4, ip6
  Source Edit
IpAddress* = object
  case kind*: IpKind
  of ip4:
      ip4*: Ip4Address

  of ip6:
      ip6*: Ip6Address

  
Represents IPv4 or IPv6 address.   Source Edit
IpInterface* = Interface[IpAddress]
Represents IP address with a mask.   Source Edit

Procs

proc toBinaryString*(s: Ip4Address | Ip6Address): string
Converts IP address to its binary representation.   Source Edit
proc toBinaryString*(s: IpAddress): string
Converts IP address to its binary representation.   Source Edit
proc ipAddress*(a: int32): Ip4Address
Creates IPv4 address from 32-bit integer.   Source Edit
proc ipAddress*(a: uint32): Ip4Address
Creates IPv4 address from 32-bit integer.   Source Edit
proc ipAddress*(a: array[16, char]): Ip6Address
Creates IPv6 address from its binary representation.   Source Edit
proc ipAddress*(a: array[16, byte]): Ip6Address
Creates IPv6 address from its binary representation.   Source Edit
proc ipAddress*(a: array[4, char]): Ip4Address
Creates IPv4 address from its binary representation.   Source Edit
proc ipAddress*(a: array[4, byte]): Ip4Address
Creates IPv4 address from its binary representation.   Source Edit
proc ipFromBinaryString*(s: string): IpAddress
  Source Edit
proc `[]`*(a: Ip4Address; index: int): uint8
  Source Edit
proc `[]`*(a: Ip6Address; index: int): uint8
  Source Edit
proc `[]`*(a: IpAddress; k: int): uint8
Returns k-th byte of the IP address.   Source Edit
proc `$`*(a: Ip4Address): string
  Source Edit
proc `$`*(a: Ip6Address): string
  Source Edit
proc `$`*(a: IpAddress): string
  Source Edit
proc `$`*[T](a: Interface[T]): string
  Source Edit
proc addressBitLength*(kind: IpKind): int
  Source Edit
proc addressBitLength*(a: IpAddress): int
  Source Edit
proc addressBitLength*(a: Ip4Address): int
  Source Edit
proc addressBitLength*(a: Ip6Address): int
  Source Edit
proc parseAddress4*(a: string): Ip4Address
  Source Edit
proc parseAddress6*(s: string): Ip6Address
  Source Edit
proc parseAddress*(a: string): IpAddress
  Source Edit
proc getBit*(a: Ip4Address | Ip6Address | IpAddress; i: int): bool
  Source Edit
proc asMask*(s: Ip4Address | Ip6Address | IpAddress): int
  Source Edit
proc parseInterface*(a: string): IpInterface
  Source Edit
proc makeMaskAddress4*(mask: int): Ip4Address
  Source Edit
proc `==`*(a: Ip4Address; b: Ip4Address): bool
  Source Edit
proc `==`*(a: Ip6Address; b: Ip6Address): bool
  Source Edit
proc `==`*(a: IpAddress; b: IpAddress): bool
  Source Edit
proc contains*[T: Ip4Address | Ip6Address](s: Interface[T]; ip: T): bool
  Source Edit
proc contains*(s: IpInterface; i: IpAddress): bool
  Source Edit
proc networkAddress*(i: IpInterface): IpAddress
  Source Edit
proc `+`*(i: IpAddress; k: int64): IpAddress
  Source Edit
proc nthAddress*(i: IpInterface; n: int64): IpAddress
  Source Edit
proc hash*(x: IpAddress): int
  Source Edit

Converters

converter from4*(a: Ip4Address): IpAddress
  Source Edit
converter from6*(a: Ip6Address): IpAddress
  Source Edit