dns记录保存
This commit is contained in:
		
							parent
							
								
									34653a754f
								
							
						
					
					
						commit
						8df865b6e7
					
				@ -18,21 +18,21 @@ namespace FastGithub.DomainResolve
 | 
				
			|||||||
    /// </summary> 
 | 
					    /// </summary> 
 | 
				
			||||||
    sealed class DomainResolver : IDomainResolver
 | 
					    sealed class DomainResolver : IDomainResolver
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        private readonly DnsClient dnsClient;
 | 
				
			||||||
 | 
					        private readonly FastGithubConfig fastGithubConfig;
 | 
				
			||||||
 | 
					        private readonly ILogger<DomainResolver> logger;
 | 
				
			||||||
        private record EndPointItem(string Host, int Port);
 | 
					        private record EndPointItem(string Host, int Port);
 | 
				
			||||||
 | 
					        private readonly ConcurrentDictionary<DnsEndPoint, IPAddressElapsedCollection> dnsEndPointAddressElapseds = new();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private static readonly string dnsEndpointFile = "dnsendpoints.json";
 | 
					        private static readonly string dnsEndpointFile = "dnsendpoints.json";
 | 
				
			||||||
        private static readonly SemaphoreSlim dnsEndpointLocker = new(1, 1);
 | 
					        private static readonly SemaphoreSlim dnsEndpointLocker = new(1, 1);
 | 
				
			||||||
        private static readonly JsonSerializerOptions jsonOptions = new JsonSerializerOptions
 | 
					        private static readonly JsonSerializerOptions jsonOptions = new()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            WriteIndented = true,
 | 
					            WriteIndented = true,
 | 
				
			||||||
            PropertyNameCaseInsensitive = true,
 | 
					            PropertyNameCaseInsensitive = true,
 | 
				
			||||||
            PropertyNamingPolicy = JsonNamingPolicy.CamelCase
 | 
					            PropertyNamingPolicy = JsonNamingPolicy.CamelCase
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private readonly DnsClient dnsClient;
 | 
					 | 
				
			||||||
        private readonly FastGithubConfig fastGithubConfig;
 | 
					 | 
				
			||||||
        private readonly ILogger<DomainResolver> logger;
 | 
					 | 
				
			||||||
        private readonly ConcurrentDictionary<DnsEndPoint, IPAddressElapsedCollection> dnsEndPointAddressElapseds = new();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// 域名解析器
 | 
					        /// 域名解析器
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
@ -80,7 +80,7 @@ namespace FastGithub.DomainResolve
 | 
				
			|||||||
                var dnsEndPoints = new List<DnsEndPoint>();
 | 
					                var dnsEndPoints = new List<DnsEndPoint>();
 | 
				
			||||||
                foreach (var item in endPointItems)
 | 
					                foreach (var item in endPointItems)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    if (this.fastGithubConfig.IsMatch(item.Host))
 | 
					                    if (this.fastGithubConfig.IsMatch(item.Host) == true)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        dnsEndPoints.Add(new DnsEndPoint(item.Host, item.Port));
 | 
					                        dnsEndPoints.Add(new DnsEndPoint(item.Host, item.Port));
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user