From 493dd98e26d4d8e6dff128487b348bf1025e7c25 Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sat, 18 Jan 2025 13:08:03 +0530 Subject: [PATCH] DnsApplication: implemented support for IDnsQueryLogs. --- DnsServerCore/Dns/Applications/DnsApplication.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/DnsServerCore/Dns/Applications/DnsApplication.cs b/DnsServerCore/Dns/Applications/DnsApplication.cs index dbd27f08..ef1cb076 100644 --- a/DnsServerCore/Dns/Applications/DnsApplication.cs +++ b/DnsServerCore/Dns/Applications/DnsApplication.cs @@ -1,6 +1,6 @@ /* Technitium DNS Server -Copyright (C) 2024 Shreyas Zare (shreyas@technitium.com) +Copyright (C) 2025 Shreyas Zare (shreyas@technitium.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,6 +45,7 @@ namespace DnsServerCore.Dns.Applications readonly IReadOnlyDictionary _dnsAuthoritativeRequestHandlers; readonly IReadOnlyDictionary _dnsRequestBlockingHandlers; readonly IReadOnlyDictionary _dnsQueryLoggers; + readonly IReadOnlyDictionary _dnsQueryLogs; readonly IReadOnlyDictionary _dnsPostProcessors; #endregion @@ -65,6 +66,7 @@ namespace DnsServerCore.Dns.Applications Dictionary dnsAuthoritativeRequestHandlers = new Dictionary(1); Dictionary dnsRequestBlockingHandlers = new Dictionary(1); Dictionary dnsQueryLoggers = new Dictionary(1); + Dictionary dnsQueryLogs = new Dictionary(1); Dictionary dnsPostProcessors = new Dictionary(1); foreach (Assembly appAssembly in _appContext.AppAssemblies) @@ -107,6 +109,9 @@ namespace DnsServerCore.Dns.Applications if (app is IDnsQueryLogger logger) dnsQueryLoggers.Add(classType.FullName, logger); + if (app is IDnsQueryLogs queryLogs) + dnsQueryLogs.Add(classType.FullName, queryLogs); + if (app is IDnsPostProcessor postProcessor) dnsPostProcessors.Add(classType.FullName, postProcessor); @@ -147,6 +152,7 @@ namespace DnsServerCore.Dns.Applications _dnsAuthoritativeRequestHandlers = dnsAuthoritativeRequestHandlers; _dnsRequestBlockingHandlers = dnsRequestBlockingHandlers; _dnsQueryLoggers = dnsQueryLoggers; + _dnsQueryLogs = dnsQueryLogs; _dnsPostProcessors = dnsPostProcessors; } @@ -263,6 +269,9 @@ namespace DnsServerCore.Dns.Applications public IReadOnlyDictionary DnsQueryLoggers { get { return _dnsQueryLoggers; } } + public IReadOnlyDictionary DnsQueryLogs + { get { return _dnsQueryLogs; } } + public IReadOnlyDictionary DnsPostProcessors { get { return _dnsPostProcessors; } }