ph负载均衡模式

This commit is contained in:
老九 2021-11-19 20:04:43 +08:00
parent dd36207241
commit 6af2e01c09
2 changed files with 16 additions and 3 deletions

View File

@ -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)

View File

@ -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>