# A pattern to match the timestamp format that the tai64nlocal program
# produces. It appears in both dnscache and tinydns lines, after
# they've been piped through tai64nlocal, of course.
-timestamp_pat = r'[\d-]+ [\d:\.]+'
+TIMESTAMP_PAT = r'[\d-]+ [\d:\.]+'
# A dictionary mapping query type identifiers, in decimal, to their
# friendly names for tinydns. Reference:
#
# Note that mapping here is non-exhaustive, and that tinydns will
# log responses for record types that it does not know about.
-query_type = {
+QUERY_TYPE_NAME = {
1: "a",
2: "ns",
5: "cname",
if len(ip) == 8:
# IPv4, eg. "7f000001" -> "7f 00 00 01" -> "127.0.0.1"
return ".".join(map(str, pack(">L", int(ip, 16))))
- elif len(ip) == 32:
- # IPv6 is actually simpler -- it's just a string-slicing operation.
- return ":".join([ip[(4*i) : (4*i+4)] for i in range(8)])
+
+ # IPv6 is actually simpler -- it's just a string-slicing operation.
+ return ":".join([ip[(4*i) : (4*i+4)] for i in range(8)])