Use short name for modules + reformat

This commit is contained in:
otthorn 2021-04-05 18:01:35 +02:00
parent 7c87f9514a
commit 5b498310b0

47
main.py
View file

@ -53,7 +53,7 @@ def soa_handler(zone, records):
soa = zone["soa"] soa = zone["soa"]
records["@"].append( records["@"].append(
dns.rdtypes.ANY.SOA.SOA( SOA.SOA(
dns.rdataclass.IN, dns.rdataclass.IN,
dns.rdatatype.SOA, dns.rdatatype.SOA,
format_mname(soa["name"]), format_mname(soa["name"]),
@ -73,7 +73,11 @@ def originv4_handler(zone, records):
ipv4_addr = zone["originv4"]["ipv4"] ipv4_addr = zone["originv4"]["ipv4"]
records["@"].append( records["@"].append(
dns.rdtypes.IN.A.A(dns.rdataclass.IN, dns.rdatatype.A, ipv4_addr) A.A(
dns.rdataclass.IN,
dns.rdatatype.A,
ipv4_addr
)
) )
@ -83,8 +87,10 @@ def originv6_handler(zone, records):
ipv6_addr = zone["originv6"] # Yes, re2o is this weird and inconsistent ipv6_addr = zone["originv6"] # Yes, re2o is this weird and inconsistent
records["@"].append( records["@"].append(
dns.rdtypes.IN.AAAA.AAAA( AAAA.AAAA(
dns.rdataclass.IN, dns.rdatatype.AAAA, ipv6_addr dns.rdataclass.IN,
dns.rdatatype.AAAA,
ipv6_addr
) )
) )
@ -97,7 +103,11 @@ def ns_records_handler(zone, records):
target = record["target"] target = record["target"]
records["@"].append( records["@"].append(
dns.rdtypes.ANY.NS.NS(dns.rdataclass.IN, dns.rdatatype.NS, target) NS.NS(
dns.rdataclass.IN,
dns.rdatatype.NS,
target
)
) )
@ -114,7 +124,7 @@ def sshfp_record_handler(zone, records):
fingerprint = fp["hash"][fp_type] fingerprint = fp["hash"][fp_type]
records[record["hostname"]].append( records[record["hostname"]].append(
dns.rdtype.ANY.SSHFP.SSHFP( SSHFP.SSHFP(
dns.rdataclass.IN, dns.rdataclass.IN,
dns.rdatatype.SSHFP, dns.rdatatype.SSHFP,
algorithm, algorithm,
@ -132,8 +142,11 @@ def mx_records_handler(zone, records):
exchange = record["target"] exchange = record["target"]
records["@"].append( records["@"].append(
dns.rdtype.ANY.MX.MX( MX.MX(
dns.rdataclass.IN, dns.rdatatype.MX, preference, priority dns.rdataclass.IN,
dns.rdatatype.MX,
preference,
priority
) )
) )
@ -146,8 +159,10 @@ def txt_records_handler(zone, records):
name = record["field1"] name = record["field1"]
records[name].append( records[name].append(
dns.rdtypes.ANY.TXT.TXT( TXT.TXT(
dns.rdataclass.IN, dns.rdatatype.TXT, record["field2"] dns.rdataclass.IN
dns.rdatatype.TXT
record["field2"]
) )
) )
@ -161,13 +176,13 @@ def srv_records_handler(zone, records):
name_key = name.to_text() name_key = name.to_text()
records[name_key].append( records[name_key].append(
dns.rdtypes.IN.SRV.SRV( SRV.SRV(
dns.rdataclass.IN, dns.rdataclass.IN,
dns.rdatatype.SRV, dns.rdatatype.SRV,
record["priority"], record["priority"],
record["weight"], record["weight"],
record["port"], record["port"],
record["target"], record["target"]
) )
) )
@ -180,10 +195,10 @@ def a_records_handler(zone, records):
ipv4_addr = record["ipv4"] ipv4_addr = record["ipv4"]
records[record["hostname"]].append( records[record["hostname"]].append(
dns.rdtypes.IN.A.A( A.A(
dns.rdataclass.IN, dns.rdataclass.IN,
dns.rdatatype.A, dns.rdatatype.A,
ipv4_addr, ipv4_addr
) )
) )
@ -196,10 +211,10 @@ def aaaa_records_handler(zone, records):
ipv6_addr = record["ipv6"] ipv6_addr = record["ipv6"]
records[record["hostname"]].append( records[record["hostname"]].append(
dns.rdtypes.IN.AAAA.AAAA( AAAA.AAAA(
dns.rdataclass.IN, dns.rdataclass.IN,
dns.rdatatype.AAAA, dns.rdatatype.AAAA,
ipv6_addr, ipv6_addr
) )
) )