NAME

Vulcan::NetMap - network mappings of data centers

SYNOPSIS

use Vulcan::NetMap;

my $map = Vulcan::NetMap->load( '/conf/file' );
my $info = $map->search( $ip );

CONFIG

A YAML file, containing a HASH of subnet definitions indexed by data centers. Each subnet definition should be a HASH of masks indexed by subnets. e.g.

---
dc1:
  10.141.0.0: 255.255.0.0
  111.13.65.1: 255.255.255.0
dc2:
  10.138.0.0: 16
  10.139.0.0: 16
  106.120.160.0: 24

METHODS

dc( %param )

Returns a list of data centers in the config. List is sorted by size or segment if $param{sort} is defined.

search( $ip, %param )

Returns dc, net, mask of $ip if within the net map. net and mask are returned in integer if $param{int} is defined.

mask( $mask )

Returns the integer value of a (dotted or decimal) netmask.

ip2n( $ip )

Returns the integer value of a dotted ip.

n2ip( $int )

Returns dotted ip form of an integer.