Filter AAAA: add config option for TTL

Add a `defaultTtl` configuration option to set the TTL for use in SOA
records returned by the Filter AAAA app. The default remains at the
previous value of `30`.
This commit is contained in:
Ingmar Stein
2024-10-27 10:31:02 +01:00
parent d3dea06ef3
commit b224cb0369
2 changed files with 4 additions and 1 deletions

View File

@@ -37,6 +37,7 @@ namespace FilterAaaa
IDnsServer _dnsServer;
bool _enableFilterAaaa;
uint _defaultTtl;
bool _bypassLocalZones;
NetworkAddress[] _bypassNetworks;
string[] _bypassDomains;
@@ -62,6 +63,7 @@ namespace FilterAaaa
JsonElement jsonConfig = jsonDocument.RootElement;
_enableFilterAaaa = jsonConfig.GetPropertyValue("enableFilterAaaa", false);
_defaultTtl = jsonConfig.GetPropertyValue("defaultTtl", 30u);
_bypassLocalZones = jsonConfig.GetPropertyValue("bypassLocalZones", false);
if (jsonConfig.TryReadArray("bypassNetworks", NetworkAddress.Parse, out NetworkAddress[] bypassNetworks))
@@ -146,7 +148,7 @@ namespace FilterAaaa
}
}
DnsResourceRecord[] authority = [new DnsResourceRecord(qname, DnsResourceRecordType.SOA, DnsClass.IN, 30, new DnsSOARecordData(_dnsServer.ServerDomain, _dnsServer.ResponsiblePerson.Address, 1, 3600, 900, 86400, 30))];
DnsResourceRecord[] authority = [new DnsResourceRecord(qname, DnsResourceRecordType.SOA, DnsClass.IN, _defaultTtl, new DnsSOARecordData(_dnsServer.ServerDomain, _dnsServer.ResponsiblePerson.Address, 1, 3600, 900, 86400, _defaultTtl))];
return new DnsDatagram(response.Identifier, true, response.OPCODE, false, false, response.RecursionDesired, response.RecursionAvailable, false, false, DnsResponseCode.NoError, response.Question, answer, authority);
}

View File

@@ -1,5 +1,6 @@
{
"enableFilterAaaa": true,
"defaultTtl": 30,
"bypassLocalZones": false,
"bypassNetworks": [
],