From 9ddf0b42e7cc62990f0a65441f596dc5267601ac Mon Sep 17 00:00:00 2001 From: DHR60 Date: Sun, 15 Jun 2025 14:41:47 +0800 Subject: [PATCH] Fix Observatory (#7437) * Enables concurrency for observatory * Adds burst observatory for least load balancer --- .../CoreConfig/CoreConfigV2rayService.cs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs index b1dc1ffd..42057c09 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs @@ -1366,16 +1366,32 @@ public class CoreConfigV2rayService private async Task GenBalancer(V2rayConfig v2rayConfig, EMultipleLoad multipleLoad) { - if (multipleLoad is EMultipleLoad.LeastLoad or EMultipleLoad.LeastPing) + if (multipleLoad == EMultipleLoad.LeastPing) { var observatory = new Observatory4Ray { subjectSelector = [Global.ProxyTag], probeUrl = AppHandler.Instance.Config.SpeedTestItem.SpeedPingTestUrl, - probeInterval = "3m" + probeInterval = "3m", + enableConcurrency = true, }; v2rayConfig.observatory = observatory; } + else if (multipleLoad == EMultipleLoad.LeastLoad) + { + var burstObservatory = new BurstObservatory4Ray + { + subjectSelector = [Global.ProxyTag], + pingConfig = new() + { + destination = AppHandler.Instance.Config.SpeedTestItem.SpeedPingTestUrl, + interval = "5m", + timeout = "30s", + sampling = 2, + } + }; + v2rayConfig.burstObservatory = burstObservatory; + } var strategyType = multipleLoad switch { EMultipleLoad.Random => "random",