Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
SpfExpression.cs
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace Waher.Security.SPF
6{
10 public class SpfExpression
11 {
12 private readonly string domain;
13 private readonly string domainSuffix;
14 private readonly string spf;
15 private readonly bool includeSubdomains;
16
23 public SpfExpression(string Domain, bool IncludeSubdomains, string Spf)
24 {
25 this.domain = Domain;
26 this.domainSuffix = "+" + Domain;
27 this.includeSubdomains = IncludeSubdomains;
28 this.spf = Spf;
29 }
30
34 public string Domain => this.domain;
35
39 public string Spf => this.spf;
40
44 public bool IncludeSubdomains => this.includeSubdomains;
45
51 public bool IsApplicable(string Domain)
52 {
53 if (string.Compare(Domain, this.domain, true) == 0)
54 return true;
55
56 if (this.includeSubdomains && Domain.EndsWith(this.domainSuffix, StringComparison.CurrentCultureIgnoreCase))
57 return true;
58
59 return false;
60 }
61 }
62}
Contains information about a SPF string.
bool IncludeSubdomains
If expression is valid for subdomains to Domain also.
SpfExpression(string Domain, bool IncludeSubdomains, string Spf)
Contains information about a SPF string.
bool IsApplicable(string Domain)
Checks if the expression is applicable to a given domain.
string Spf
SPF expression.