diff --git a/DnsServerCore.ApplicationCommon/IDnsRequestBlockingHandler.cs b/DnsServerCore.ApplicationCommon/IDnsRequestBlockingHandler.cs new file mode 100644 index 00000000..f2db2ebf --- /dev/null +++ b/DnsServerCore.ApplicationCommon/IDnsRequestBlockingHandler.cs @@ -0,0 +1,47 @@ +/* +Technitium DNS Server +Copyright (C) 2023 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 +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +*/ + +using System.Net; +using System.Threading.Tasks; +using TechnitiumLibrary.Net.Dns; + +namespace DnsServerCore.ApplicationCommon +{ + /// + /// Lets DNS Apps provide DNS level domain name blocking feature. + /// + public interface IDnsRequestBlockingHandler + { + /// + /// Specifies if the query domain name in the incoming DNS request is allowed to bypass any configured block lists (including for DNS server's built-in blocking feature). + /// + /// The incoming DNS request to be processed. + /// The end point (IP address and port) of the client making the request. + /// Returns true if the query domain name in the incoming DNS request is allowed to bypass blocking. + Task IsAllowedAsync(DnsDatagram request, IPEndPoint remoteEP); + + /// + /// Specifies if the query domain name in the incoming DNS request is blocked based on the app's own configured block lists. + /// + /// The incoming DNS request to be processed. + /// The end point (IP address and port) of the client making the request. + /// The blocked DNS response for the DNS request or null to let the DNS server core process the request as usual. + Task ProcessRequestAsync(DnsDatagram request, IPEndPoint remoteEP); + } +}