Config::BINDish::INET
- implement IP addresses as values
This module extends Config::BINDish
with ability to parse IPv4/IPv6 IP addresses and networks; and with very generic form of URIs.
For supported IP formats see IP::Addr
module.
URIs are basically anything starting with a word followed with ://
and then with non-whitespace symbols. For example:
foo://buppa-duppa_dop?oki,this_thing_works!
is a valid URI.
This extension creates a normal Config::BINDish::AST::Value
. And as such it can be used anywhere where a value is allowed. Say, we can decalre a network block:
network 192.168.1.0/24 {
ns { 192.168.1.1; 192.168.1.5 }
default-gw 192.168.1.1;
admin-url https://router.local/login;
}
Type names used for values produced by this extension are:
-
IPv4
-
IPv6
-
URL
For IP data payload is of IP::Addr
type. This makes it possible for the above example to do something like this in your code:
my $network = $cfg.top.block("network");
for $network.name.payload.netowrk.each -> $ip {
say $ip;
}
Apparently, if you declare more than one network
block in your config you'd have to be more specific in call to method block
and use something like:
my $network = $cfg.top.block("network", name => IP::Addr.new('192.168.1.0/24'));
Or you may want to iterate over all known networks. Then it would be:
for $cfg.top.blocks("network") -> $network {
...
}
(c) 2023, Vadim Belman [email protected]
Artistic License 2.0
See the LICENSE file in this distribution.