Python dns.rdatatype() Examples
The following are 30
code examples of dns.rdatatype().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
dns
, or try the search function
.
Example #1
Source File: zone.py From script.elementum.burst with Do What The F*ck You Want To Public License | 7 votes |
def iterate_rdatas(self, rdtype=dns.rdatatype.ANY, covers=dns.rdatatype.NONE): """Return a generator which yields (name, ttl, rdata) tuples for all rdatas in the zone which have the specified I{rdtype} and I{covers}. If I{rdtype} is dns.rdatatype.ANY, the default, then all rdatas will be matched. @param rdtype: int or string @type rdtype: int or string @param covers: the covered type (defaults to None) @type covers: int or string """ if isinstance(rdtype, string_types): rdtype = dns.rdatatype.from_text(rdtype) if isinstance(covers, string_types): covers = dns.rdatatype.from_text(covers) for (name, node) in self.iteritems(): for rds in node: if rdtype == dns.rdatatype.ANY or \ (rds.rdtype == rdtype and rds.covers == covers): for rdata in rds: yield (name, rds.ttl, rdata)
Example #2
Source File: notify.py From designate with Apache License 2.0 | 7 votes |
def _make_dns_message(self, zone_name, notify=False): """ This constructs a SOA query or a dns NOTIFY message. :param zone_name: The zone name for which a SOA/NOTIFY needs to be sent. :param notify: If true, a notify message is constructed else a SOA message is constructed. :return: The constructed message. """ dns_message = dns.message.make_query(zone_name, dns.rdatatype.SOA) dns_message.flags = 0 if notify: dns_message.set_opcode(dns.opcode.NOTIFY) dns_message.flags |= dns.flags.AA else: # Setting the flags to RD causes BIND9 to respond with a NXDOMAIN. dns_message.set_opcode(dns.opcode.QUERY) dns_message.flags |= dns.flags.RD return dns_message
Example #3
Source File: zone.py From Tautulli with GNU General Public License v3.0 | 6 votes |
def iterate_rdatas(self, rdtype=dns.rdatatype.ANY, covers=dns.rdatatype.NONE): """Return a generator which yields (name, ttl, rdata) tuples for all rdatas in the zone which have the specified I{rdtype} and I{covers}. If I{rdtype} is dns.rdatatype.ANY, the default, then all rdatas will be matched. @param rdtype: int or string @type rdtype: int or string @param covers: the covered type (defaults to None) @type covers: int or string """ if isinstance(rdtype, string_types): rdtype = dns.rdatatype.from_text(rdtype) if isinstance(covers, string_types): covers = dns.rdatatype.from_text(covers) for (name, node) in self.iteritems(): for rds in node: if rdtype == dns.rdatatype.ANY or \ (rds.rdtype == rdtype and rds.covers == covers): for rdata in rds: yield (name, rds.ttl, rdata)
Example #4
Source File: test_dnsutils.py From designate with Apache License 2.0 | 6 votes |
def test_limit_notify_middleware(self): self.CONF.set_override('notify_delay', 0.1, 'service:agent') # Initialize the middlware placeholder_app = None middleware = dnsutils.LimitNotifyMiddleware(placeholder_app) # Prepare a NOTIFY zone_name = 'example.com.' notify = dns.message.make_query(zone_name, dns.rdatatype.SOA) notify.flags = 0 notify.set_opcode(dns.opcode.NOTIFY) notify.flags |= dns.flags.AA # Send the NOTIFY through the middleware # No problem, middleware should return None to pass it on self.assertIsNone(middleware.process_request(notify))
Example #5
Source File: test_dnsutils.py From designate with Apache License 2.0 | 6 votes |
def test_limit_notify_middleware_no_acquire(self, mock_acquire): self.CONF.set_override('notify_delay', 0.1, 'service:agent') # Initialize the middlware placeholder_app = None middleware = dnsutils.LimitNotifyMiddleware(placeholder_app) # Prepare a NOTIFY zone_name = 'example.com.' notify = dns.message.make_query(zone_name, dns.rdatatype.SOA) notify.flags = 0 notify.set_opcode(dns.opcode.NOTIFY) notify.flags |= dns.flags.AA # Make a response object to match the middleware's return response = dns.message.make_response(notify) # Provide an authoritative answer response.flags |= dns.flags.AA # Send the NOTIFY through the middleware # Lock can't be acquired, a NOTIFY is already being worked on # so just return what would have come back for a successful NOTIFY # This needs to be a one item tuple for the serialization middleware self.assertEqual(middleware.process_request(notify), (response,))
Example #6
Source File: test_notify.py From designate with Apache License 2.0 | 6 votes |
def test_get_serial_number_nxdomain_deleted_zone(self, mock_sleep): # The zone is not found and it's not was supposed be there response = RoObject( answer=[RoObject( rdclass=dns.rdataclass.IN, rdtype=dns.rdatatype.SOA )], rcode=mock.Mock(return_value=dns.rcode.NXDOMAIN) ) zone = RoObject(name='zn', serial=0, action='DELETE') self.notify._make_and_send_dns_message = mock.Mock( return_value=(response, 1) ) out = self.notify.get_serial_number( 'c', zone, 'h', 1234, 1, 2, 3, 4 ) self.assertEqual(('NO_ZONE', 0, 3), out)
Example #7
Source File: test_notify.py From designate with Apache License 2.0 | 6 votes |
def test_get_serial_number_ok(self, mock_sleep): zone = RoObject(name='zn', serial=314) ds = RoObject(items=[zone]) response = RoObject( answer=[RoObject( name='zn', rdclass=dns.rdataclass.IN, rdtype=dns.rdatatype.SOA, to_rdataset=mock.Mock(return_value=ds) )], rcode=mock.Mock(return_value=dns.rcode.NOERROR) ) self.notify._make_and_send_dns_message = mock.Mock( return_value=(response, 1) ) out = self.notify.get_serial_number( 'c', zone, 'h', 1234, 1, 2, 3, 4 ) self.assertEqual(('SUCCESS', 314, 3), out)
Example #8
Source File: test_notify.py From designate with Apache License 2.0 | 6 votes |
def test_get_serial_number_too_many_retries(self, mock_sleep): zone = RoObject(name='zn', serial=314) ds = RoObject(items=[RoObject(serial=310)]) response = RoObject( answer=[RoObject( name='zn', rdclass=dns.rdataclass.IN, rdtype=dns.rdatatype.SOA, to_rdataset=mock.Mock(return_value=ds) )], rcode=mock.Mock(return_value=dns.rcode.NOERROR) ) self.notify._make_and_send_dns_message = mock.Mock( return_value=(response, 1) ) out = self.notify.get_serial_number( 'c', zone, 'h', 1234, 1, 2, 3, 4 ) self.assertEqual(('ERROR', 310, 0), out)
Example #9
Source File: impl_denominator.py From designate with Apache License 2.0 | 6 votes |
def find_zone_serial(self, zone_name): LOG.debug("Finding %s", zone_name) zone_name = zone_name.rstrip('.') output = self.denominator.get_record( zone=zone_name, type='SOA', name=zone_name) try: text = ' '.join(output.split()[3:]) rdata = dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.SOA, text) except Exception: return None return rdata.serial
Example #10
Source File: dnsutils.py From treadmill with Apache License 2.0 | 6 votes |
def _build_resource_to_address_map(answer): """Return a dictionary that maps resource name to address. The response from any DNS query is a list of answer records and a list of additional records that may be useful. In the case of SRV queries, the answer section contains SRV records which contain the service weighting information and a DNS resource name which requires further resolution. The additional records segment may contain A records for the resources. This function collects them into a dictionary that maps resource name to an array of addresses. :rtype: dict """ mapping = collections.defaultdict(list) for resource in answer.response.additional: target = resource.name.to_text() mapping[target].extend(record.address for record in resource.items if record.rdtype == dns.rdatatype.A) return mapping
Example #11
Source File: zone.py From luscan-devel with GNU General Public License v2.0 | 6 votes |
def iterate_rdatas(self, rdtype=dns.rdatatype.ANY, covers=dns.rdatatype.NONE): """Return a generator which yields (name, ttl, rdata) tuples for all rdatas in the zone which have the specified I{rdtype} and I{covers}. If I{rdtype} is dns.rdatatype.ANY, the default, then all rdatas will be matched. @param rdtype: int or string @type rdtype: int or string @param covers: the covered type (defaults to None) @type covers: int or string """ if isinstance(rdtype, (str, unicode)): rdtype = dns.rdatatype.from_text(rdtype) if isinstance(covers, (str, unicode)): covers = dns.rdatatype.from_text(covers) for (name, node) in self.iteritems(): for rds in node: if rdtype == dns.rdatatype.ANY or \ (rds.rdtype == rdtype and rds.covers == covers): for rdata in rds: yield (name, rds.ttl, rdata)
Example #12
Source File: zone.py From elasticintel with GNU General Public License v3.0 | 6 votes |
def iterate_rdatas(self, rdtype=dns.rdatatype.ANY, covers=dns.rdatatype.NONE): """Return a generator which yields (name, ttl, rdata) tuples for all rdatas in the zone which have the specified I{rdtype} and I{covers}. If I{rdtype} is dns.rdatatype.ANY, the default, then all rdatas will be matched. @param rdtype: int or string @type rdtype: int or string @param covers: the covered type (defaults to None) @type covers: int or string """ if isinstance(rdtype, string_types): rdtype = dns.rdatatype.from_text(rdtype) if isinstance(covers, string_types): covers = dns.rdatatype.from_text(covers) for (name, node) in self.iteritems(): for rds in node: if rdtype == dns.rdatatype.ANY or \ (rds.rdtype == rdtype and rds.covers == covers): for rdata in rds: yield (name, rds.ttl, rdata)
Example #13
Source File: zone.py From bazarr with GNU General Public License v3.0 | 6 votes |
def iterate_rdatas(self, rdtype=dns.rdatatype.ANY, covers=dns.rdatatype.NONE): """Return a generator which yields (name, ttl, rdata) tuples for all rdatas in the zone which have the specified I{rdtype} and I{covers}. If I{rdtype} is dns.rdatatype.ANY, the default, then all rdatas will be matched. @param rdtype: int or string @type rdtype: int or string @param covers: the covered type (defaults to None) @type covers: int or string """ if isinstance(rdtype, string_types): rdtype = dns.rdatatype.from_text(rdtype) if isinstance(covers, string_types): covers = dns.rdatatype.from_text(covers) for (name, node) in self.iteritems(): for rds in node: if rdtype == dns.rdatatype.ANY or \ (rds.rdtype == rdtype and rds.covers == covers): for rdata in rds: yield (name, rds.ttl, rdata)
Example #14
Source File: zone.py From arissploit with GNU General Public License v3.0 | 6 votes |
def iterate_rdatas(self, rdtype=dns.rdatatype.ANY, covers=dns.rdatatype.NONE): """Return a generator which yields (name, ttl, rdata) tuples for all rdatas in the zone which have the specified I{rdtype} and I{covers}. If I{rdtype} is dns.rdatatype.ANY, the default, then all rdatas will be matched. @param rdtype: int or string @type rdtype: int or string @param covers: the covered type (defaults to None) @type covers: int or string """ if isinstance(rdtype, string_types): rdtype = dns.rdatatype.from_text(rdtype) if isinstance(covers, string_types): covers = dns.rdatatype.from_text(covers) for (name, node) in self.iteritems(): for rds in node: if rdtype == dns.rdatatype.ANY or \ (rds.rdtype == rdtype and rds.covers == covers): for rdata in rds: yield (name, rds.ttl, rdata)
Example #15
Source File: zone.py From Tautulli with GNU General Public License v3.0 | 5 votes |
def find_rrset(self, name, rdtype, covers=dns.rdatatype.NONE): """Look for rdata with the specified name and type in the zone, and return an RRset encapsulating it. The I{name}, I{rdtype}, and I{covers} parameters may be strings, in which case they will be converted to their proper type. This method is less efficient than the similar L{find_rdataset} because it creates an RRset instead of returning the matching rdataset. It may be more convenient for some uses since it returns an object which binds the owner name to the rdata. This method may not be used to create new nodes or rdatasets; use L{find_rdataset} instead. KeyError is raised if the name or type are not found. Use L{get_rrset} if you want to have None returned instead. @param name: the owner name to look for @type name: DNS.name.Name object or string @param rdtype: the rdata type desired @type rdtype: int or string @param covers: the covered type (defaults to None) @type covers: int or string @raises KeyError: the node or rdata could not be found @rtype: dns.rrset.RRset object """ name = self._validate_name(name) if isinstance(rdtype, string_types): rdtype = dns.rdatatype.from_text(rdtype) if isinstance(covers, string_types): covers = dns.rdatatype.from_text(covers) rdataset = self.nodes[name].find_rdataset(self.rdclass, rdtype, covers) rrset = dns.rrset.RRset(name, self.rdclass, rdtype, covers) rrset.update(rdataset) return rrset
Example #16
Source File: zone.py From bazarr with GNU General Public License v3.0 | 5 votes |
def get_rrset(self, name, rdtype, covers=dns.rdatatype.NONE): """Look for rdata with the specified name and type in the zone, and return an RRset encapsulating it. The I{name}, I{rdtype}, and I{covers} parameters may be strings, in which case they will be converted to their proper type. This method is less efficient than the similar L{get_rdataset} because it creates an RRset instead of returning the matching rdataset. It may be more convenient for some uses since it returns an object which binds the owner name to the rdata. This method may not be used to create new nodes or rdatasets; use L{find_rdataset} instead. None is returned if the name or type are not found. Use L{find_rrset} if you want to have KeyError raised instead. @param name: the owner name to look for @type name: DNS.name.Name object or string @param rdtype: the rdata type desired @type rdtype: int or string @param covers: the covered type (defaults to None) @type covers: int or string @rtype: dns.rrset.RRset object """ try: rrset = self.find_rrset(name, rdtype, covers) except KeyError: rrset = None return rrset
Example #17
Source File: zone.py From Tautulli with GNU General Public License v3.0 | 5 votes |
def get_rrset(self, name, rdtype, covers=dns.rdatatype.NONE): """Look for rdata with the specified name and type in the zone, and return an RRset encapsulating it. The I{name}, I{rdtype}, and I{covers} parameters may be strings, in which case they will be converted to their proper type. This method is less efficient than the similar L{get_rdataset} because it creates an RRset instead of returning the matching rdataset. It may be more convenient for some uses since it returns an object which binds the owner name to the rdata. This method may not be used to create new nodes or rdatasets; use L{find_rdataset} instead. None is returned if the name or type are not found. Use L{find_rrset} if you want to have KeyError raised instead. @param name: the owner name to look for @type name: DNS.name.Name object or string @param rdtype: the rdata type desired @type rdtype: int or string @param covers: the covered type (defaults to None) @type covers: int or string @rtype: dns.rrset.RRset object """ try: rrset = self.find_rrset(name, rdtype, covers) except KeyError: rrset = None return rrset
Example #18
Source File: zone.py From Tautulli with GNU General Public License v3.0 | 5 votes |
def find_rdataset(self, name, rdtype, covers=dns.rdatatype.NONE, create=False): """Look for rdata with the specified name and type in the zone, and return an rdataset encapsulating it. The I{name}, I{rdtype}, and I{covers} parameters may be strings, in which case they will be converted to their proper type. The rdataset returned is not a copy; changes to it will change the zone. KeyError is raised if the name or type are not found. Use L{get_rdataset} if you want to have None returned instead. @param name: the owner name to look for @type name: DNS.name.Name object or string @param rdtype: the rdata type desired @type rdtype: int or string @param covers: the covered type (defaults to None) @type covers: int or string @param create: should the node and rdataset be created if they do not exist? @type create: bool @raises KeyError: the node or rdata could not be found @rtype: dns.rrset.RRset object """ name = self._validate_name(name) if isinstance(rdtype, string_types): rdtype = dns.rdatatype.from_text(rdtype) if isinstance(covers, string_types): covers = dns.rdatatype.from_text(covers) node = self.find_node(name, create) return node.find_rdataset(self.rdclass, rdtype, covers, create)
Example #19
Source File: zone.py From Tautulli with GNU General Public License v3.0 | 5 votes |
def get_rdataset(self, name, rdtype, covers=dns.rdatatype.NONE, create=False): """Look for rdata with the specified name and type in the zone, and return an rdataset encapsulating it. The I{name}, I{rdtype}, and I{covers} parameters may be strings, in which case they will be converted to their proper type. The rdataset returned is not a copy; changes to it will change the zone. None is returned if the name or type are not found. Use L{find_rdataset} if you want to have KeyError raised instead. @param name: the owner name to look for @type name: DNS.name.Name object or string @param rdtype: the rdata type desired @type rdtype: int or string @param covers: the covered type (defaults to None) @type covers: int or string @param create: should the node and rdataset be created if they do not exist? @type create: bool @rtype: dns.rrset.RRset object """ try: rdataset = self.find_rdataset(name, rdtype, covers, create) except KeyError: rdataset = None return rdataset
Example #20
Source File: zone.py From Tautulli with GNU General Public License v3.0 | 5 votes |
def delete_rdataset(self, name, rdtype, covers=dns.rdatatype.NONE): """Delete the rdataset matching I{rdtype} and I{covers}, if it exists at the node specified by I{name}. The I{name}, I{rdtype}, and I{covers} parameters may be strings, in which case they will be converted to their proper type. It is not an error if the node does not exist, or if there is no matching rdataset at the node. If the node has no rdatasets after the deletion, it will itself be deleted. @param name: the owner name to look for @type name: DNS.name.Name object or string @param rdtype: the rdata type desired @type rdtype: int or string @param covers: the covered type (defaults to None) @type covers: int or string """ name = self._validate_name(name) if isinstance(rdtype, string_types): rdtype = dns.rdatatype.from_text(rdtype) if isinstance(covers, string_types): covers = dns.rdatatype.from_text(covers) node = self.get_node(name) if node is not None: node.delete_rdataset(self.rdclass, rdtype, covers) if len(node) == 0: self.delete_node(name)
Example #21
Source File: zone.py From arissploit with GNU General Public License v3.0 | 5 votes |
def check_origin(self): """Do some simple checking of the zone's origin. @raises dns.zone.NoSOA: there is no SOA RR @raises dns.zone.NoNS: there is no NS RRset @raises KeyError: there is no origin node """ if self.relativize: name = dns.name.empty else: name = self.origin if self.get_rdataset(name, dns.rdatatype.SOA) is None: raise NoSOA if self.get_rdataset(name, dns.rdatatype.NS) is None: raise NoNS
Example #22
Source File: zone.py From arissploit with GNU General Public License v3.0 | 5 votes |
def delete_rdataset(self, name, rdtype, covers=dns.rdatatype.NONE): """Delete the rdataset matching I{rdtype} and I{covers}, if it exists at the node specified by I{name}. The I{name}, I{rdtype}, and I{covers} parameters may be strings, in which case they will be converted to their proper type. It is not an error if the node does not exist, or if there is no matching rdataset at the node. If the node has no rdatasets after the deletion, it will itself be deleted. @param name: the owner name to look for @type name: DNS.name.Name object or string @param rdtype: the rdata type desired @type rdtype: int or string @param covers: the covered type (defaults to None) @type covers: int or string """ name = self._validate_name(name) if isinstance(rdtype, string_types): rdtype = dns.rdatatype.from_text(rdtype) if isinstance(covers, string_types): covers = dns.rdatatype.from_text(covers) node = self.get_node(name) if node is not None: node.delete_rdataset(self.rdclass, rdtype, covers) if len(node) == 0: self.delete_node(name)
Example #23
Source File: zone.py From bazarr with GNU General Public License v3.0 | 5 votes |
def find_rrset(self, name, rdtype, covers=dns.rdatatype.NONE): """Look for rdata with the specified name and type in the zone, and return an RRset encapsulating it. The I{name}, I{rdtype}, and I{covers} parameters may be strings, in which case they will be converted to their proper type. This method is less efficient than the similar L{find_rdataset} because it creates an RRset instead of returning the matching rdataset. It may be more convenient for some uses since it returns an object which binds the owner name to the rdata. This method may not be used to create new nodes or rdatasets; use L{find_rdataset} instead. KeyError is raised if the name or type are not found. Use L{get_rrset} if you want to have None returned instead. @param name: the owner name to look for @type name: DNS.name.Name object or string @param rdtype: the rdata type desired @type rdtype: int or string @param covers: the covered type (defaults to None) @type covers: int or string @raises KeyError: the node or rdata could not be found @rtype: dns.rrset.RRset object """ name = self._validate_name(name) if isinstance(rdtype, string_types): rdtype = dns.rdatatype.from_text(rdtype) if isinstance(covers, string_types): covers = dns.rdatatype.from_text(covers) rdataset = self.nodes[name].find_rdataset(self.rdclass, rdtype, covers) rrset = dns.rrset.RRset(name, self.rdclass, rdtype, covers) rrset.update(rdataset) return rrset
Example #24
Source File: zone.py From bazarr with GNU General Public License v3.0 | 5 votes |
def delete_rdataset(self, name, rdtype, covers=dns.rdatatype.NONE): """Delete the rdataset matching I{rdtype} and I{covers}, if it exists at the node specified by I{name}. The I{name}, I{rdtype}, and I{covers} parameters may be strings, in which case they will be converted to their proper type. It is not an error if the node does not exist, or if there is no matching rdataset at the node. If the node has no rdatasets after the deletion, it will itself be deleted. @param name: the owner name to look for @type name: DNS.name.Name object or string @param rdtype: the rdata type desired @type rdtype: int or string @param covers: the covered type (defaults to None) @type covers: int or string """ name = self._validate_name(name) if isinstance(rdtype, string_types): rdtype = dns.rdatatype.from_text(rdtype) if isinstance(covers, string_types): covers = dns.rdatatype.from_text(covers) node = self.get_node(name) if node is not None: node.delete_rdataset(self.rdclass, rdtype, covers) if len(node) == 0: self.delete_node(name)
Example #25
Source File: zone.py From bazarr with GNU General Public License v3.0 | 5 votes |
def get_rdataset(self, name, rdtype, covers=dns.rdatatype.NONE, create=False): """Look for rdata with the specified name and type in the zone, and return an rdataset encapsulating it. The I{name}, I{rdtype}, and I{covers} parameters may be strings, in which case they will be converted to their proper type. The rdataset returned is not a copy; changes to it will change the zone. None is returned if the name or type are not found. Use L{find_rdataset} if you want to have KeyError raised instead. @param name: the owner name to look for @type name: DNS.name.Name object or string @param rdtype: the rdata type desired @type rdtype: int or string @param covers: the covered type (defaults to None) @type covers: int or string @param create: should the node and rdataset be created if they do not exist? @type create: bool @rtype: dns.rrset.RRset object """ try: rdataset = self.find_rdataset(name, rdtype, covers, create) except KeyError: rdataset = None return rdataset
Example #26
Source File: zone.py From bazarr with GNU General Public License v3.0 | 5 votes |
def find_rdataset(self, name, rdtype, covers=dns.rdatatype.NONE, create=False): """Look for rdata with the specified name and type in the zone, and return an rdataset encapsulating it. The I{name}, I{rdtype}, and I{covers} parameters may be strings, in which case they will be converted to their proper type. The rdataset returned is not a copy; changes to it will change the zone. KeyError is raised if the name or type are not found. Use L{get_rdataset} if you want to have None returned instead. @param name: the owner name to look for @type name: DNS.name.Name object or string @param rdtype: the rdata type desired @type rdtype: int or string @param covers: the covered type (defaults to None) @type covers: int or string @param create: should the node and rdataset be created if they do not exist? @type create: bool @raises KeyError: the node or rdata could not be found @rtype: dns.rrset.RRset object """ name = self._validate_name(name) if isinstance(rdtype, string_types): rdtype = dns.rdatatype.from_text(rdtype) if isinstance(covers, string_types): covers = dns.rdatatype.from_text(covers) node = self.find_node(name, create) return node.find_rdataset(self.rdclass, rdtype, covers, create)
Example #27
Source File: dnsutils.py From treadmill with Apache License 2.0 | 5 votes |
def ns(fqdn, dns_server=None): """Resolve DNS zone. """ return [str(rec) for rec in query(fqdn, dns.rdatatype.NS, dns_server)]
Example #28
Source File: dnsutils.py From treadmill with Apache License 2.0 | 5 votes |
def soa(label, dns_server=None): """Resolve a SOA resource record :param label: label to lookup :type zone: str :param dns_server: dns host and port information :type dns_server: (list, int) :return: a list of soa records """ return query(label, dns.rdatatype.SOA, dns_server)
Example #29
Source File: dnsutils.py From treadmill with Apache License 2.0 | 5 votes |
def srv(label, dns_server=None, ignore_additional=True): """Resolve a CNAME resource record :param label: label to lookup :type zone: str :param dns_server: dns host and port information :type dns_server: (list, int) :return: a list of tuples (ip, port, prio, weight) """ return _build_result_set(query(label, dns.rdatatype.SRV, dns_server), ignore_additional)
Example #30
Source File: dnsutils.py From treadmill with Apache License 2.0 | 5 votes |
def cname(label, dns_server=None): """Resolve a CNAME resource record :param label: label to lookup :type zone: str :param dns_server: dns host and port information :type dns_server: (list, int) :return: a list of cnames """ return [str(rec) for rec in query(label, dns.rdatatype.CNAME, dns_server)]