属性名重命名
This commit is contained in:
parent
92ce30af09
commit
9e798f0c94
@ -8,16 +8,16 @@ namespace FastGithub
|
||||
sealed class DomainMatch
|
||||
{
|
||||
private readonly Regex regex;
|
||||
private readonly string pattern;
|
||||
private readonly string domainPattern;
|
||||
|
||||
/// <summary>
|
||||
/// 域名匹配
|
||||
/// </summary>
|
||||
/// <param name="pattern">域名表达式</param>
|
||||
public DomainMatch(string pattern)
|
||||
/// <param name="domainPattern">域名表达式</param>
|
||||
public DomainMatch(string domainPattern)
|
||||
{
|
||||
this.pattern = pattern;
|
||||
var regexPattern = Regex.Escape(pattern).Replace(@"\*", ".*");
|
||||
this.domainPattern = domainPattern;
|
||||
var regexPattern = Regex.Escape(domainPattern).Replace(@"\*", ".*");
|
||||
this.regex = new Regex($"^{regexPattern}$", RegexOptions.IgnoreCase);
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ namespace FastGithub
|
||||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return this.pattern;
|
||||
return this.domainPattern;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,9 +28,9 @@ namespace FastGithub
|
||||
public IPEndPointOptions UntrustedDns { get; set; } = new IPEndPointOptions { IPAddress = "114.114.114.114", Port = 53 };
|
||||
|
||||
/// <summary>
|
||||
/// 代理的域名匹配
|
||||
/// 代理的域名表达式
|
||||
/// </summary>
|
||||
public HashSet<string> DomainMatches { get; set; } = new();
|
||||
public HashSet<string> DomainPatterns { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 验证选项值
|
||||
@ -40,7 +40,7 @@ namespace FastGithub
|
||||
{
|
||||
this.trustedDnsEndPoint = this.TrustedDns.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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
"IPAddress": "114.114.114.114",
|
||||
"Port": 53
|
||||
},
|
||||
"DomainMatches": [ // *表示0到多个任意字符
|
||||
"DomainPatterns": [ // *表示0到多个任意字符
|
||||
"github.com",
|
||||
"githubstatus.com",
|
||||
"*.github.com",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user