mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Add support for TinyDNS AAAA records
This commit is contained in:
@@ -11,6 +11,7 @@ from os import listdir
|
||||
from os.path import join
|
||||
import logging
|
||||
import re
|
||||
import textwrap
|
||||
|
||||
from ..record import Record
|
||||
from ..zone import DuplicateRecordException, SubzoneRecordException
|
||||
@@ -20,7 +21,7 @@ from .base import BaseSource
|
||||
class TinyDnsBaseSource(BaseSource):
|
||||
SUPPORTS_GEO = False
|
||||
SUPPORTS_DYNAMIC = False
|
||||
SUPPORTS = set(('A', 'CNAME', 'MX', 'NS', 'TXT'))
|
||||
SUPPORTS = set(('A', 'CNAME', 'MX', 'NS', 'TXT', 'AAAA'))
|
||||
|
||||
split_re = re.compile(r':+')
|
||||
|
||||
@@ -45,6 +46,20 @@ class TinyDnsBaseSource(BaseSource):
|
||||
'values': values,
|
||||
}
|
||||
|
||||
def _data_for_AAAA(self, _type, records):
|
||||
values = []
|
||||
for record in records:
|
||||
values.append(u":".join(textwrap.wrap(record[0], 4)))
|
||||
try:
|
||||
ttl = records[0][1]
|
||||
except IndexError:
|
||||
ttl = self.default_ttl
|
||||
return {
|
||||
'ttl': ttl,
|
||||
'type': _type,
|
||||
'values': values,
|
||||
}
|
||||
|
||||
def _data_for_TXT(self, _type, records):
|
||||
values = []
|
||||
|
||||
@@ -121,6 +136,8 @@ class TinyDnsBaseSource(BaseSource):
|
||||
'+': 'A',
|
||||
'@': 'MX',
|
||||
'\'': 'TXT',
|
||||
'3': 'AAAA',
|
||||
'6': 'AAAA',
|
||||
}
|
||||
name_re = re.compile(r'((?P<name>.+)\.)?{}$'.format(zone.name[:-1]))
|
||||
|
||||
|
Reference in New Issue
Block a user