src/nodejs/jsnetutils

    Dark Mode
Search:
Group by:

Example:

import src/nodejs/jsnetutils
template example() =
  doAssert 0.uint64.toIpAddress.toUint == 0.uint64                         # 0.0.0.0
  doAssert 1.uint64.toIpAddress.toUint == 1.uint64                         # 0.0.0.1
  doAssert 4_294_967_295.uint64.toIpAddress.toUint == 4_294_967_295.uint64 # 255.255.255.255
  doAssert 2_130_706_433.uint64.toIpAddress.toUint == 2_130_706_433.uint64 # 127.0.0.1
  doAssert 3_232_235_521.uint64.toIpAddress.toUint == 3_232_235_521.uint64 # 192.168.0.1
example()
static: example()

Procs

func toIpAddress(ip: uint64): array[4, uint8] {....raises: [], tags: [].}
Converts an uint64 to an IP Address (IPv4).
func toUint(ip: array[4, uint8]): uint64 {....raises: [], tags: [].}
Converts an IP Address (IPv4) to an uint64.