Interface IDomainFilter
- Namespace
- VpnHood.Core.Filtering.Abstractions
- Assembly
- VpnHood.Core.Filtering.Abstractions.dll
Defines a stage of a pipe of domain filters, which decides what happens to a flow by the domain name it is for.
public interface IDomainFilter : IDisposable
- Inherited Members
Remarks
A stage may wrap the next one and combine its verdict with its own. The client asks the domain pipe first, with the name a flow's TLS handshake gives, and its IP pipe only when the answer is Default.
Properties
IsEmpty
Gets a value indicating whether the pipe holds no rule, so it can only answer Default. Read it again when Changed occurs.
bool IsEmpty { get; }
Property Value
Remarks
The client reads a flow's domain name from its TLS handshake only while the pipe is not empty, or while its options force the names to be logged.
Methods
Process(string?)
Decides what happens to a flow for a domain name.
FilterAction Process(string? domainName)
Parameters
Returns
- FilterAction
The verdict; Default when the pipe has no objection.
Reconfigure(CancellationToken)
Tells the pipe that its configuration outside the program, such as a database's path, may have changed.
Task Reconfigure(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Task
A task that represents the asynchronous operation.
Remarks
Each stage passes it to its next one; a stage that owns such configuration reads it again and swaps its own parts, raising Changed if its verdicts may differ.
Events
Changed
Occurs when the pipe's verdicts may have changed, as when a stage swaps its rules. A stage raises its next stage's event as its own, so the event reaches the outermost stage; a stage whose verdicts never change never raises it.
event EventHandler? Changed