github.com/hexonet/dnscontrol@v0.2.8/docs/_functions/domain/PTR.md (about)

     1  ---
     2  name: PTR
     3  parameters:
     4    - name
     5    - target
     6    - modifiers...
     7  ---
     8  
     9  PTR adds a PTR record to the domain.
    10  
    11  The name is normally a the relative label for the domain, or a FQDN that ends with `.`.  If magic mode is enabled (see below) it can also be an IP address, which will be replaced by the proper string automatically, thus
    12  saving the user from having to reverse the IP address manually.
    13  
    14  Target should be a string representing the FQDN of a host.  Like all FQDNs in DNSControl, it must end with a `.`.
    15  
    16  **Magic Mode:**
    17  
    18  PTR records are complex and typos are common. Therefore DNSControl
    19  enables features to save labor and
    20  prevent typos.  This magic is only
    21  enabled when the domain ends with `in-addr.arpa.` or `ipv6.arpa.`.
    22  
    23  *Automatic IP-to-reverse:* If the name is a valid IP address, DNSControl will replace it with
    24  a string that is appropriate for the domain. That is, if the domain
    25  ends with `in-addr.arpa` (no `.`) and name is a valid IPv4 address, the name
    26  will be replaced with the correct string to make a reverse lookup for that address.
    27  IPv6 is properly handled too.
    28  
    29  *Extra Validation:* DNSControl considers it an error to include a name that
    30  is inappropriate for the domain.  For example
    31  `PTR('1.2.3.4', 'f.co.')` is valid for the domain `D("3.2.1.in-addr.arpa',`
    32   but DNSControl will generate an error if the domain is `D("9.9.9.in-addr.arpa',`.
    33  This is because `1.2.3.4` is contained in `1.2.3.0/24` but not `9.9.9.0/24`.
    34  This validation works for IPv6, IPv4, and
    35  RFC2317 "Classless in-addr.arpa delegation" domains.
    36  
    37  *Automatic truncation:* DNSControl will automatically truncate FQDNs
    38  as needed.
    39  If the name is a FQDN ending with `.`, DNSControl will verify that the
    40  name is contained within the CIDR block implied by domain.  For example
    41  if name is `4.3.2.1.in-addr.arpa.` (note the trailing `.`)
    42  and the domain is `2.1.in-addr.arpa` (no trailing `.`)
    43  then the name will be replaced with `4.3`.  Note that the output
    44  of `REV('1.2.3.4')` is `4.3.2.1.in-addr.arpa.`, which means the following
    45  are all equivalent:
    46  
    47  * `PTR(REV('1.2.3.4'), `
    48  * `PTR('4.3.2.1.in-addr.arpa.'), `
    49  * `PTR('4.3',`    // Assuming the domain is `2.1.in-addr.arpa`
    50  
    51  All magic is RFC2317-aware. We use the first format listed in the
    52  RFC for both `REV()` and `PTR()`. The format is
    53  `FIRST/MASK.C.B.A.in-addr.arpa` where `FIRST` is the first IP address
    54  of the zone, `MASK` is the netmask of the zone (25-31 inclusive),
    55  and A, B, C are the first 3 octets of the IP address. For example
    56  `172.20.18.130/27` is located in a zone named
    57  `128/27.18.20.172.in-addr.arpa`
    58  
    59  {% include startExample.html %}
    60  {% highlight js %}
    61  D(REV('1.2.3.0/24'), REGISTRAR, DnsProvider(BIND),
    62    PTR('1', 'foo.example.com.'),
    63    PTR('2', 'bar.example.com.'),
    64    PTR('3', 'baz.example.com.'),
    65    // If the first parameter is a valid IP address, DNSControl will generate the correct name:
    66    PTR('1.2.3.10', 'ten.example.com.'),    // '10'
    67  );
    68  
    69  D(REV('9.9.9.128/25'), REGISTRAR, DnsProvider(BIND),
    70    PTR('9.9.9.129', 'first.example.com.'),
    71  );
    72  
    73  D(REV('2001:db8:302::/48'), REGISTRAR, DnsProvider(BIND),
    74    PTR('1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0', 'foo.example.com.'),  // 2001:db8:302::1
    75    // If the first parameter is a valid IP address, DNSControl will generate the correct name:
    76    PTR('2001:db8:302::2', 'two.example.com.'),                          // '2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0'
    77    PTR('2001:db8:302::3', 'three.example.com.'),                        // '3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0'
    78  );
    79  
    80  {%endhighlight%}
    81  {% include endExample.html %}
    82  
    83  In the future we plan on adding a flag to `A()` which will insert
    84  the correct PTR() record if the approprate `.arpa` domain has been
    85  defined.