修改默认配置
This commit is contained in:
parent
cfeb5b2404
commit
9dfbaea1c5
@ -14,13 +14,13 @@ namespace FastGithub.Dns
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// dns后台服务
|
/// dns后台服务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
sealed class DnsHostedService : BackgroundService
|
sealed class DnsServerHostedService : BackgroundService
|
||||||
{
|
{
|
||||||
private const int SIO_UDP_CONNRESET = unchecked((int)0x9800000C);
|
private const int SIO_UDP_CONNRESET = unchecked((int)0x9800000C);
|
||||||
|
|
||||||
private readonly IRequestResolver requestResolver;
|
private readonly IRequestResolver requestResolver;
|
||||||
private readonly IOptions<DnsOptions> options;
|
private readonly IOptions<DnsOptions> options;
|
||||||
private readonly ILogger<DnsHostedService> logger;
|
private readonly ILogger<DnsServerHostedService> logger;
|
||||||
|
|
||||||
private readonly Socket socket = new(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
private readonly Socket socket = new(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||||
private readonly byte[] buffer = new byte[ushort.MaxValue];
|
private readonly byte[] buffer = new byte[ushort.MaxValue];
|
||||||
@ -33,10 +33,10 @@ namespace FastGithub.Dns
|
|||||||
/// <param name="githubRequestResolver"></param>
|
/// <param name="githubRequestResolver"></param>
|
||||||
/// <param name="options"></param>
|
/// <param name="options"></param>
|
||||||
/// <param name="logger"></param>
|
/// <param name="logger"></param>
|
||||||
public DnsHostedService(
|
public DnsServerHostedService(
|
||||||
GithubRequestResolver githubRequestResolver,
|
GithubRequestResolver githubRequestResolver,
|
||||||
IOptions<DnsOptions> options,
|
IOptions<DnsOptions> options,
|
||||||
ILogger<DnsHostedService> logger)
|
ILogger<DnsServerHostedService> logger)
|
||||||
{
|
{
|
||||||
this.options = options;
|
this.options = options;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
@ -20,7 +20,7 @@ namespace FastGithub
|
|||||||
var assembly = typeof(DnsServiceCollectionExtensions).Assembly;
|
var assembly = typeof(DnsServiceCollectionExtensions).Assembly;
|
||||||
return services
|
return services
|
||||||
.AddServiceAndOptions(assembly, configuration)
|
.AddServiceAndOptions(assembly, configuration)
|
||||||
.AddHostedService<DnsHostedService>();
|
.AddHostedService<DnsServerHostedService>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"Dns": {
|
"Dns": {
|
||||||
"UpStream": "114.114.114.114", // 上游dns
|
"UpStream": "114.114.114.114", // 上游dns
|
||||||
"GithubTTL": "00:10:00", // github相关域名解析结果的存活时长
|
"GithubTTL": "00:05:00", // github相关域名解析结果的存活时长
|
||||||
"SetToLocalMachine": true, // 是否设置本机使用此dns(仅支持windows)
|
"SetToLocalMachine": true, // 是否设置本机使用此dns(仅支持windows)
|
||||||
"UseGithubReverseProxy": true // 是否使用反向代理访问github以解决连接被重复的问题
|
"UseGithubReverseProxy": true // 是否使用反向代理访问github以解决连接被重复的问题
|
||||||
},
|
},
|
||||||
@ -15,7 +15,7 @@
|
|||||||
},
|
},
|
||||||
"PublicDnsProvider": {
|
"PublicDnsProvider": {
|
||||||
"Enable": true, // 是否需要从dns服务器查找ip
|
"Enable": true, // 是否需要从dns服务器查找ip
|
||||||
"Timeout": "00:00:00.100", // dns查询超时时长
|
"Timeout": "00:00:00.200", // dns查询超时时长
|
||||||
"Dnss": [ // dns服务器列表
|
"Dnss": [ // dns服务器列表
|
||||||
"1.2.4.8",
|
"1.2.4.8",
|
||||||
"8.8.8.8",
|
"8.8.8.8",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user