ipv4utils

Simple library to work with IPv4 addresses. Made for fun for everyone.

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version 0.1.0
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:26

Tags

Authors

  • EnteryName

Installation

nimble install ipv4utils
choosenim install ipv4utils
git clone https://github.com/TelegramXPlus/ipv4utils

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
ipv4utils - - - - - - -

Dependencies

Package Version Optional
nim >= 1.0.0 No

Source

Repository https://github.com/TelegramXPlus/ipv4utils
Homepage https://github.com/TelegramXPlus/ipv4utils
Registry Source nimble_official

README

ipv4utils

Build And Test

Simple library for ipv4 parsing

Installation

nimble install ipv4utils

or

nimle install https://github.com/TelegramXPlus/ipv4utils

Usage

All the things covered here can be seen in tests/test.nim

Create an instance

import ipv4utils

let ip = newIPv4Address("192.168.0.1", "255.255.255.0")

From now on you can access multiple attributes of the IPv4Address object

ip.address   # get the address
ip.subnet    # get the subnet mask
ip.network   # get the network address (192.168.0.0)
ip.broadcast # get the broadcast address (192.168.0.255)

ip.firstHostAddress # 192.168.0.1
ip.lastHostAddress  # 192.168.0.254

ip.wildCardMask # complement of subnet mask
ip.cidrMask     # CIDR value as an int
ip.cidrMaskStr  # CIDR value with appending /

ip.ping(otherIP) # check whether two addresses are on the same network

And some other utilities

"192.168.1.1".toBinAddress                         # decimal to binary
"11111111.11111111.11111111.11111101".toDecAddress # binary to decimal
"255.255.255.0".toBinSubnet                        # decimal subnet to binary subnet
"11111111.11111111.11111111.11111111".toDecSubnet  # binary subnet to decimal subnet