From 6af2e01c090b6d7512cfb3c8f6de5d7dd4c4e3b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=80=81=E4=B9=9D?= <366193849@qq.com>
Date: Fri, 19 Nov 2021 20:04:43 +0800
Subject: [PATCH] =?UTF-8?q?ph=E8=B4=9F=E8=BD=BD=E5=9D=87=E8=A1=A1=E6=A8=A1?=
=?UTF-8?q?=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
FastGithub.DomainResolve/DnscryptProxy.cs | 3 ++-
FastGithub.DomainResolve/TomlUtil.cs | 16 ++++++++++++++--
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/FastGithub.DomainResolve/DnscryptProxy.cs b/FastGithub.DomainResolve/DnscryptProxy.cs
index 6cf2cd3..98afa7f 100644
--- a/FastGithub.DomainResolve/DnscryptProxy.cs
+++ b/FastGithub.DomainResolve/DnscryptProxy.cs
@@ -79,7 +79,8 @@ namespace FastGithub.DomainResolve
var localEndPoint = new IPEndPoint(IPAddress.Loopback, port);
await TomlUtil.SetListensAsync(this.tomlFilePath, localEndPoint, cancellationToken);
- await TomlUtil.SetlogLevelAsync(this.tomlFilePath, 6, cancellationToken);
+ await TomlUtil.SetLogLevelAsync(this.tomlFilePath, 6, cancellationToken);
+ await TomlUtil.SetLBStrategyAsync(this.tomlFilePath, "ph", cancellationToken);
await TomlUtil.SetMinMaxTTLAsync(this.tomlFilePath, TimeSpan.FromMinutes(1d), TimeSpan.FromMinutes(2d), cancellationToken);
if (OperatingSystem.IsWindows() && Environment.UserInteractive == false)
diff --git a/FastGithub.DomainResolve/TomlUtil.cs b/FastGithub.DomainResolve/TomlUtil.cs
index 4ec35f6..5228f7a 100644
--- a/FastGithub.DomainResolve/TomlUtil.cs
+++ b/FastGithub.DomainResolve/TomlUtil.cs
@@ -36,11 +36,23 @@ namespace FastGithub.DomainResolve
///
///
///
- public static Task SetlogLevelAsync(string tomlPath, int logLevel, CancellationToken cancellationToken)
+ public static Task SetLogLevelAsync(string tomlPath, int logLevel, CancellationToken cancellationToken)
{
return SetAsync(tomlPath, "log_level", new TomlInteger { Value = logLevel }, cancellationToken);
}
+ ///
+ /// 设置负载均衡模式
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static Task SetLBStrategyAsync(string tomlPath, string value, CancellationToken cancellationToken)
+ {
+ return SetAsync(tomlPath, "lb_strategy", new TomlString { Value = value }, cancellationToken);
+ }
+
///
/// 设置TTL
///
@@ -59,7 +71,7 @@ namespace FastGithub.DomainResolve
await SetAsync(tomlPath, "cache_max_ttl", maxValue, cancellationToken);
await SetAsync(tomlPath, "cache_neg_max_ttl", maxValue, cancellationToken);
}
-
+
///
/// 设置指定键的值
///