NAME
IP::Tools - internet protocol address tools
SYNOPSIS
use IP::Tools;
DESCRIPTION
Do not use this module.
FUNCTIONS
$ip_re
if ($ip =~ /$ip_re/) {
}
This regular expression matches an ip address.
$cidr_re
if ($ip =~ /$ip_re/) {
}
This regular expression matches a CIDR.
ip_to_int
my $int = ip_to_int ($ip);
Convert an IP address to an integer.
int_to_ip
my $ip = int_to_ip ($int);
Given an integer $int
, turn it into an IP address.
cidr_to_ip_range
my ($ip1, $ip2) = cidr_to_ip_range ($ip, $bits);
get_ip_range
my ($ip_range, $error) = get_ip_range ('12.23.34.56/13');
Given a CIDR range, turn it into two ip addresses.
ip_range_to_cidr
ip_range_to_cidr ($ip1, $ip2);
Given two IP addresses, return the difference as a CIDR.
This is not able to split into multiple CIDRs.
read_whitelist
my @list = read_whitelist ('file.txt');
my @list = read_whitelist ('file.txt', 1);
Read a whitelist from disc.
search_whitelist
Search a whitelist for an IP. This is a Perl version of the C code in IP::Whitelist.