2
0
老九 3 жил өмнө
parent
commit
6af2e01c09

+ 2 - 1
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)

+ 14 - 2
FastGithub.DomainResolve/TomlUtil.cs

@@ -36,11 +36,23 @@ namespace FastGithub.DomainResolve
         /// <param name="logLevel"></param>
         /// <param name="cancellationToken"></param>
         /// <returns></returns>
-        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);
         }
 
+        /// <summary>
+        /// 设置负载均衡模式
+        /// </summary>
+        /// <param name="tomlPath"></param>
+        /// <param name="value"></param>
+        /// <param name="cancellationToken"></param>
+        /// <returns></returns>
+        public static Task SetLBStrategyAsync(string tomlPath, string value, CancellationToken cancellationToken)
+        {
+            return SetAsync(tomlPath, "lb_strategy", new TomlString { Value = value }, cancellationToken);
+        }
+
         /// <summary>
         /// 设置TTL
         /// </summary>
@@ -59,7 +71,7 @@ namespace FastGithub.DomainResolve
             await SetAsync(tomlPath, "cache_max_ttl", maxValue, cancellationToken);
             await SetAsync(tomlPath, "cache_neg_max_ttl", maxValue, cancellationToken);
         }
-         
+
         /// <summary>
         /// 设置指定键的值
         /// </summary>