No description
Find a file
2021-07-03 02:06:46 +02:00
tests Overhaul Project Meta 2021-07-03 02:06:09 +02:00
validateip Overhaul Project Meta 2021-07-03 02:06:09 +02:00
.drone.yml Add Drone CI 2021-07-03 02:06:46 +02:00
.gitignore Overhaul Project Meta 2021-07-03 02:06:09 +02:00
LICENSE Overhaul Project Meta 2020-10-07 18:58:19 +02:00
README.md Add Drone CI 2021-07-03 02:06:46 +02:00
validateip.nim Overhaul Project Meta 2021-07-03 02:06:09 +02:00
validateip.nimble Overhaul Project Meta 2021-07-03 02:06:09 +02:00

nimble

Language

Build Status

GitHub Liberapay patrons

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/.