code: def _convert_dns_answer(cls, answer: dns.resolver.Answer) \
              -> Iterable[AddressInfo]:
          '''Convert the DNS answer to address info.'''
          assert answer.rdtype in (dns.rdatatype.A, dns.rdatatype.AAAA)
  
          if answer.rdtype == dns.rdatatype.A:
              family = socket.AF_INET
          else:
              family = socket.AF_INET6
  
          for record in answer:
              ip_address = record.to_text()
  
              if family == socket.AF_INET6:
                  flow_info, control_id = cls._get_ipv6_info(ip_address)
              else:
                  flow_info = control_id = None
  
              yield AddressInfo(ip_address, family, flow_info, control_idf _convert_dns_answer(cls, answer: dns.resolver.Answer) \
              -> Iterable[AddressInfo]:
          '''Convert the DNS answer to address info.'''
          assert answer.rdtype in (dns.rdatatype.A, dns.rdatatype.AAAA)
  
          if answer.rdtype == dns.rdatatype.A:
              family = socket.AF_INET
          else:
              family = socket.AF_INET6
  
          for record in answer:
              ip_address = record.to_text()
  
              if family == socket.AF_INET6:
                  flow_info, control_id = cls._get_ipv6_info(ip_address)
              else:
                  flow_info = control_id = None
  
              yield AddressInfo(ip_address, family, flow_info, control_id)
docs: Convert the DNS answer to address info.