Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use IPv6 DNS Servers #24

Merged
merged 1 commit into from
Jul 11, 2018
Merged

use IPv6 DNS Servers #24

merged 1 commit into from
Jul 11, 2018

Conversation

Farom
Copy link
Contributor

@Farom Farom commented Jun 21, 2018

If a domain has 2 public nameservers, lets say ns1.domain.example
and ns2.domain.example, the hook now requests A and AAAA records for NS entries.
These are saved to a list

  [
   [ 'IPv4#1 of ns1',  'IPv4#2 of ns1', 'IPv6#1 of ns1'],
   [ 'IPv4#1 of ns2',  'IPv4#2 of ns2', 'IPv6#1 of ns2'],
  ]

When checking the TXT-record dnspython can check any IP of this server.

if a domain has 2 public nameservers, lets say ns1.domain.example
and ns2.domain.example, the hook now requests A and AAAA records for NS entries.
These are saved to a list
  [
   [ 'IPv4#1 of ns1',  'IPv4#2 of ns1', 'IPv6#1 of ns1'],
   [ 'IPv4#1 of ns2',  'IPv4#2 of ns2', 'IPv6#1 of ns2'],
  ]
When checking the TXT-record dnspython can check any IP of this server.
nsL = []
nsL.extend([_.to_text() for _ in dns.resolver.query(ns)]) # default type: A
nsL.extend([_.to_text() for _ in dns.resolver.query(ns, rdtype=dns.rdatatype.AAAA)])
nameservers.append(nsL)
Copy link

@ukleinek ukleinek Jun 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be written more easily and probably with shorter execution time as:

ns = rdata.target.to_unicode()
nsL = [_.to_text() for _ in chain(dns.resolver.query(ns), 
                                  dns.resolver.query(ns, rdtype=dns.rdatatype.AAAA))]
nameservers.append(nsL)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you could do that, but in case you run in a 30s timeout, you have no clue, where this comes from. I personally do not like lines that does multiple things and leave you in the dark if something goes wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants