diff --git a/FastGithub.Core/IPEndPointOptions.cs b/FastGithub.Core/DnsConfig.cs similarity index 96% rename from FastGithub.Core/IPEndPointOptions.cs rename to FastGithub.Core/DnsConfig.cs index 3a523be..c3ae014 100644 --- a/FastGithub.Core/IPEndPointOptions.cs +++ b/FastGithub.Core/DnsConfig.cs @@ -5,9 +5,9 @@ using System.Net.NetworkInformation; namespace FastGithub { /// - /// dns的终节点 + /// dns配置 /// - public class IPEndPointOptions + public class DnsConfig { /// /// IP地址 diff --git a/FastGithub.Core/DomainConfig.cs b/FastGithub.Core/DomainConfig.cs new file mode 100644 index 0000000..16de37f --- /dev/null +++ b/FastGithub.Core/DomainConfig.cs @@ -0,0 +1,20 @@ +namespace FastGithub +{ + /// + /// 域名配置 + /// + public class DomainConfig + { + /// + /// 是否不发送SNI + /// + public bool NoSni { get; set; } = true; + + /// + /// 目的地 + /// 支持ip或域名 + /// 留空则本域名 + /// + public string? Destination { get; set; } + } +} diff --git a/FastGithub.Core/FastGithubOptions.cs b/FastGithub.Core/FastGithubOptions.cs index 8afe5c1..41c6869 100644 --- a/FastGithub.Core/FastGithubOptions.cs +++ b/FastGithub.Core/FastGithubOptions.cs @@ -14,18 +14,18 @@ namespace FastGithub /// 域名 /// private DomainMatch[]? domainMatches; - private IPEndPoint? trustedDnsEndPoint; - private IPEndPoint? unTrustedDnsEndPoint; + private IPEndPoint? trustedDnsIPEndPoint; + private IPEndPoint? unTrustedDnsIPEndPoint; /// /// 受信任的dns服务 /// - public IPEndPointOptions TrustedDns { get; set; } = new IPEndPointOptions { IPAddress = "127.0.0.1", Port = 5533 }; + public DnsConfig TrustedDns { get; set; } = new DnsConfig { IPAddress = "127.0.0.1", Port = 5533 }; /// /// 不受信任的dns服务 /// - public IPEndPointOptions UntrustedDns { get; set; } = new IPEndPointOptions { IPAddress = "114.114.114.114", Port = 53 }; + public DnsConfig UntrustedDns { get; set; } = new DnsConfig { IPAddress = "114.114.114.114", Port = 53 }; /// /// 代理的域名表达式 @@ -38,8 +38,8 @@ namespace FastGithub /// public void Validate() { - this.trustedDnsEndPoint = this.TrustedDns.ToIPEndPoint(); - this.unTrustedDnsEndPoint = this.UntrustedDns.ToIPEndPoint(); + this.trustedDnsIPEndPoint = this.TrustedDns.ToIPEndPoint(); + this.unTrustedDnsIPEndPoint = this.UntrustedDns.ToIPEndPoint(); this.domainMatches = this.DomainPatterns.Select(item => new DomainMatch(item)).ToArray(); } @@ -49,7 +49,7 @@ namespace FastGithub /// public IPEndPoint GetTrustedDns() { - return this.trustedDnsEndPoint ?? throw new InvalidOperationException(); + return this.trustedDnsIPEndPoint ?? throw new InvalidOperationException(); } /// @@ -57,7 +57,7 @@ namespace FastGithub /// public IPEndPoint GetUnTrustedDns() { - return this.unTrustedDnsEndPoint ?? throw new InvalidOperationException(); + return this.unTrustedDnsIPEndPoint ?? throw new InvalidOperationException(); } /// diff --git a/FastGithub.Dns/RequestResolver.cs b/FastGithub.Dns/RequestResolver.cs index a94261b..0b526c1 100644 --- a/FastGithub.Dns/RequestResolver.cs +++ b/FastGithub.Dns/RequestResolver.cs @@ -32,7 +32,7 @@ namespace FastGithub.Dns { this.options = options; this.logger = logger; - this.untrustedResolver = new UdpRequestResolver(options.CurrentValue.UntrustedDns.ToIPEndPoint()); + this.untrustedResolver = new UdpRequestResolver(options.CurrentValue.GetTrustedDns()); } ///