NAME
Net::DNS::AutoDNS::Zone - Class to represent one zone in AutoDNS
VERSION
version 0.1
SYNOPSIS
use Net::DNS::AutoDNS;
use File::Slurp;
my $autodns = Net::DNS::AutoDNS->new(...);
my $zone = $autodns->get_zone("example.org");
my $contents = read_file "example.org.new";
$zone->read_rr_from_zonefile($contents);
$autodns->update($zone);
DESCRIPTION
By internally keeping records as Net::DNS::RR objects as an in-between format, this module intends to bridge between AutoDNS and regular zonefiles.
However, directly converting between the two is possibly lossy. This module does not attempt to translate records of types that AutoDNS does not support.
The functionality is very limited; only what was needed to implement Cpanel support was implemented.
ATTRIBUTES
rr
reference to the array of record objects.
name
string; required. Read-only.
ns_action ($new_value)
Attribute; string; optional. Note: semantics ignored.
Should be complete
or primary
.
allow_transfer_from ($new_value)
string; optional.
allow_transfer ($new_value);
0 or 1; optional.
internal_ns ($new_value);
string; optional.
www_include ($new_value);
0 or 1; optional.
METHODS
new ($name)
Create a new, empty, zone object for the origin $name
.
clone ($name)
Given the name of the new zone, returns a new zone object, copying the attributes of the source.
new_from_zonefile ($name, $zonefile)
Combines new
with read_rr_from_zonefile
in one call.
new_from_xml ($xml, $xmlparser)
Parses an existing AutoDNS XML document, where $xml
is the document itself.
$xmlparser
is an optional XML::LibXML instance. If none is given, a new one will be created and discarded after use.
read_rr_from_zonefile ($zonefile)
Parses a zonefile where $zonefile
is the zonefile data itself, not a filename.
zonefile
Returns the zone in zonefile format.
xml
Returns the zone in the AutoDNS XML format.
CAVEATS
This module does not validate data.
Behaviour for non-ASCII data is undefined.
AutoDNS supports extra meta-information for DNS zones. When updating an existing zone with regular zonefile data, it is recommended that you retrieve the zone from AutoDNS, then update the records, and then submit the zone back. If you create a new object, information like the ns_action
and allow_transfer_from
may be lost.
Internally, the origin is always called XXORIGINXX
. This renders using this as part of a hostname impossible.
Email addresses are only interpreted correctly if they do not contain any .
before the @
. Because DNS doesn't support the @
, the @
is converted to a .
. However, because AutoDNS needs the @
, the first .
is converted back to an @
. This results in j.doe@example.org
being transformed to j@doe.example.org
, while john@example.org
remains unchanged.
Relative hostnames on the right hand side may not round-trip correctly. This is currently considered unimportant because AutoDNS will make them absolute.
Caveats for new_from_zonefile
and read_rr_from_zonefile
The behaviour for zonefiles including $-statements like $ORIGIN
and $INCLUDE
and $GENERATE
is undefined. The current implementation does handle them (and $INCLUDE does read arbitrary files!) but a future implementation may use a different parser.
Unsupported records are silently discarded.
The ignore
attribute of SOA
records is silently discarded, as is the serial
.
Caveats for new_from_xml
While unknown records are silently discarded from zonefiles, records of the <free>
type from AutoDNS are passed as is when converting to zonefiles. This means that after a round trip, records of unsupported types are gone, and records of supported types are converted to their respective non-freeform syntaxes.
Caveats for zonefile
output
The serial
of the SOA
is always 0.
The nameserver
field of the SOA
is always intentionally.invalid
.
Caveats for xml
output
AutoDNS supports only one A record for the origin itself. Additional such records are silently discarded.
AutoDNS supports up to 7 NS records for the origin itself. Additional such records are silently discarded.
SEE ALSO
AUTHOR
Juerd Waalboer <juerd@tnx.nl>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Juerd Waalboer.
This is free software, licensed under:
The (three-clause) BSD License