validateip
Checks if a provided string is actually a correct IP address. Supports detection of Class A to D of IPv4 addresses.
Summary
| Latest Version | Unknown |
|---|---|
| License | GPL-3.0-or-later |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:24 |
Tags
Installation
nimble install validateip
choosenim install validateip
git clone https://github.com/theAkito/nim-validateip
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| validateip | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://github.com/theAkito/nim-validateip |
|---|---|
| Homepage | https://github.com/theAkito/nim-validateip |
| Documentation | View Documentation |
| Registry Source | nimble_official |
README
What is this?
This is a Nim module that evaluates if a given string is an IPv4 address. Evaluation of specific IPv4 address ranges is also possible. See examples below.
Tests
nimble test
Runs tests.
Documentation
nim doc --project validateip.nim
Creates documentation for the entire project.
Examples
Check if given string is an IP address:
let myIp = "11.0.5.2".isIp4
assert myIp == true
let myIp = "11.0.5.2".isValidIp4
assert myIp == true
Check if given string is a local IP address:
Just pick whatever keyword you personally prefer.
let myIp = isValidIp4("192.168.1.10", "local")
assert myIp == true
let myIp = isValidIp4("192.168.1.10", "lan")
assert myIp == true
let myIp = isValidIp4("192.168.1.10", "private")
assert myIp == true
Check if given string is a public IP address:
Just pick whatever keyword you personally prefer.
let myIp = isValidIp4("111.12.1.10", "public")
assert myIp == true
let myIp = isValidIp4("111.12.1.10", "wan")
assert myIp == true
let myIp = isValidIp4("111.12.1.10", "internet")
assert myIp == true
Same applies to classes B and D.
License
Copyright (C) 2020 Akito the@akito.ooo
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
