The tool could be more robust to servers which are down
If one of the name servers is down, the tool crashes completely. May be add an option to have just a warning?
% ./ns-tree.py cyberstructure.fr
Traceback (most recent call last):
File "/home/stephane/tmp/ns-tree/./ns-tree.py", line 163, in <module>
tree.build()
File "/home/stephane/tmp/ns-tree/./ns-tree.py", line 27, in build
node.create_edges( self.nodes )
File "/home/stephane/tmp/ns-tree/./ns-tree.py", line 99, in create_edges
ns_zone = get_zone_name( ns )
^^^^^^^^^^^^^^^^^^^
File "/home/stephane/tmp/ns-tree/./ns-tree.py", line 129, in get_zone_name
ans = dns.resolver.resolve( qname, dns.rdatatype.SOA, raise_on_no_answer=False )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/dns/resolver.py", line 1565, in resolve
return get_default_resolver().resolve(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/dns/resolver.py", line 1321, in resolve
timeout = self._compute_timeout(start, lifetime, resolution.errors)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/dns/resolver.py", line 1075, in _compute_timeout
raise LifetimeTimeout(timeout=duration, errors=errors)
dns.resolver.LifetimeTimeout: The resolution lifetime expired after 5.401 seconds: Server Do53:192.168.2.254@53 answered The DNS operation timed out.; Server Do53:192.168.2.254@53 answered The DNS operation timed out.; Server Do53:192.168.2.254@53 answered The DNS operation timed out.