属性名重命名

This commit is contained in:
xljiulang 2021-07-17 21:42:33 +08:00
parent 92ce30af09
commit 9e798f0c94
3 changed files with 10 additions and 10 deletions

View File

@ -8,16 +8,16 @@ namespace FastGithub
sealed class DomainMatch sealed class DomainMatch
{ {
private readonly Regex regex; private readonly Regex regex;
private readonly string pattern; private readonly string domainPattern;
/// <summary> /// <summary>
/// 域名匹配 /// 域名匹配
/// </summary> /// </summary>
/// <param name="pattern">域名表达式</param> /// <param name="domainPattern">域名表达式</param>
public DomainMatch(string pattern) public DomainMatch(string domainPattern)
{ {
this.pattern = pattern; this.domainPattern = domainPattern;
var regexPattern = Regex.Escape(pattern).Replace(@"\*", ".*"); var regexPattern = Regex.Escape(domainPattern).Replace(@"\*", ".*");
this.regex = new Regex($"^{regexPattern}$", RegexOptions.IgnoreCase); this.regex = new Regex($"^{regexPattern}$", RegexOptions.IgnoreCase);
} }
@ -37,7 +37,7 @@ namespace FastGithub
/// <returns></returns> /// <returns></returns>
public override string ToString() public override string ToString()
{ {
return this.pattern; return this.domainPattern;
} }
} }
} }

View File

@ -28,9 +28,9 @@ namespace FastGithub
public IPEndPointOptions UntrustedDns { get; set; } = new IPEndPointOptions { IPAddress = "114.114.114.114", Port = 53 }; public IPEndPointOptions UntrustedDns { get; set; } = new IPEndPointOptions { IPAddress = "114.114.114.114", Port = 53 };
/// <summary> /// <summary>
/// 代理的域名匹配 /// 代理的域名表达式
/// </summary> /// </summary>
public HashSet<string> DomainMatches { get; set; } = new(); public HashSet<string> DomainPatterns { get; set; } = new();
/// <summary> /// <summary>
/// 验证选项值 /// 验证选项值
@ -40,7 +40,7 @@ namespace FastGithub
{ {
this.trustedDnsEndPoint = this.TrustedDns.ToIPEndPoint(); this.trustedDnsEndPoint = this.TrustedDns.ToIPEndPoint();
this.unTrustedDnsEndPoint = this.UntrustedDns.ToIPEndPoint(); this.unTrustedDnsEndPoint = this.UntrustedDns.ToIPEndPoint();
this.domainMatches = this.DomainMatches.Select(item => new DomainMatch(item)).ToArray(); this.domainMatches = this.DomainPatterns.Select(item => new DomainMatch(item)).ToArray();
} }

View File

@ -8,7 +8,7 @@
"IPAddress": "114.114.114.114", "IPAddress": "114.114.114.114",
"Port": 53 "Port": 53
}, },
"DomainMatches": [ // *0 "DomainPatterns": [ // *0
"github.com", "github.com",
"githubstatus.com", "githubstatus.com",
"*.github.com", "*.github.com",