INET

NAME

Config::BINDish::INET - implement IP addresses as values

DESCRIPTION

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 Is A Value!

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 {
    ...
}

SEE ALSO

COPYRIGHT

(c) 2023, Vadim Belman [email protected]

LICENSE

Artistic License 2.0

See the LICENSE file in this distribution.

Config::BINDish v0.0.18

Extensible BIND9-like Configuration Files Support

Authors

  • Vadim Belman

License

Artistic-2.0

Dependencies

AttrX::Mooish:auth<zef:vrurg>:ver<1.0.0+>:api<1.0.*>IP::AddrTest::Async:auth<zef:vrurg>:ver<0.1.2+>

Test Dependencies

Provides

  • Config::BINDish
  • Config::BINDish::AST
  • Config::BINDish::Actions
  • Config::BINDish::Expandable
  • Config::BINDish::Grammar
  • Config::BINDish::INET
  • Config::BINDish::Ops
  • Config::BINDish::Test
  • Config::BINDish::X

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.