Skip to content

Commit

Permalink
Rename util module to dnsdiag (#123)
Browse files Browse the repository at this point in the history
util is too generic to be used as shared module.

Fixes #122
  • Loading branch information
pemensik authored Nov 8, 2024
1 parent d887284 commit 39a1b1e
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions dnseval.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
import dns.rdatatype
import dns.resolver

import util.dns
import dnsdiag.dns

__author__ = 'Babak Farrokhi (babak@farrokhi.net)'
__license__ = 'BSD'
__progname__ = os.path.basename(sys.argv[0])

from util.dns import PROTO_UDP, PROTO_TCP, PROTO_TLS, PROTO_HTTPS, setup_signal_handler, flags_to_text
from util.shared import __version__, Colors
from dnsdiag.dns import PROTO_UDP, PROTO_TCP, PROTO_TLS, PROTO_HTTPS, setup_signal_handler, flags_to_text
from dnsdiag.shared import __version__, Colors


def usage():
Expand Down Expand Up @@ -156,7 +156,7 @@ def main():
usage()

# validate RR type
if not util.dns.valid_rdatatype(rdatatype):
if not dnsdiag.dns.valid_rdatatype(rdatatype):
print('Error: Invalid record type "%s" ' % rdatatype)
sys.exit(1)

Expand Down Expand Up @@ -214,7 +214,7 @@ def main():
continue

try:
retval = util.dns.ping(qname, resolver, dst_port, rdatatype, waittime, count, proto, src_ip,
retval = dnsdiag.dns.ping(qname, resolver, dst_port, rdatatype, waittime, count, proto, src_ip,
use_edns=use_edns, force_miss=force_miss, want_dnssec=want_dnssec)

except SystemExit:
Expand Down
4 changes: 2 additions & 2 deletions dnsping.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
import dns.resolver
import httpx

from util.dns import PROTO_UDP, PROTO_TCP, PROTO_TLS, PROTO_HTTPS, PROTO_QUIC, PROTO_HTTP3, proto_to_text, \
from dnsdiag.dns import PROTO_UDP, PROTO_TCP, PROTO_TLS, PROTO_HTTPS, PROTO_QUIC, PROTO_HTTP3, proto_to_text, \
unsupported_feature, random_string, getDefaultPort, valid_rdatatype
from util.shared import __version__
from dnsdiag.shared import __version__

__author__ = 'Babak Farrokhi (babak@farrokhi.net)'
__license__ = 'BSD'
Expand Down
16 changes: 8 additions & 8 deletions dnstraceroute.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
import dns.rdatatype
import dns.resolver

import util.whois
from util.dns import PROTO_UDP, PROTO_TCP, setup_signal_handler
from util.shared import __version__, Colors
import dnsdiag.whois
from dnsdiag.dns import PROTO_UDP, PROTO_TCP, setup_signal_handler
from dnsdiag.shared import __version__, Colors

# Global Variables
quiet = False
Expand Down Expand Up @@ -116,7 +116,7 @@ def ping(qname, server, rdtype, proto, port, ttl, timeout, src_ip, use_edns):
resp_time = None

try:
resp = util.dns.ping(qname, server, port, rdtype, timeout, 1, proto, src_ip, use_edns, force_miss=False,
resp = dnsdiag.dns.ping(qname, server, port, rdtype, timeout, 1, proto, src_ip, use_edns, force_miss=False,
want_dnssec=False, socket_ttl=ttl)

except SystemExit:
Expand Down Expand Up @@ -205,7 +205,7 @@ def main():
color = Colors(color_mode)

# validate RR type
if not util.dns.valid_rdatatype(rdatatype):
if not dnsdiag.dns.valid_rdatatype(rdatatype):
print('Error: Invalid record type "%s" ' % rdatatype)
sys.exit(1)

Expand Down Expand Up @@ -299,7 +299,7 @@ def main():
if curr_addr:
as_name = ""
if as_lookup:
asn, whois_cache = util.whois.asn_lookup(curr_addr, whois_cache)
asn, whois_cache = dnsdiag.whois.asn_lookup(curr_addr, whois_cache)
as_name = ''
try:
if asn and asn.asn != "NA":
Expand Down Expand Up @@ -338,7 +338,7 @@ def main():

if __name__ == '__main__':
try:
whois_cache = util.whois.restore()
whois_cache = dnsdiag.whois.restore()
main()
finally:
util.whois.save(whois_cache)
dnsdiag.whois.save(whois_cache)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from setuptools import setup, find_packages
from util.shared import __version__
from dnsdiag.shared import __version__

setup(
name="dnsdiag",
Expand Down

0 comments on commit 39a1b1e

Please sign in to comment.