Extend stats reporting to support custom configs with several load-balanced outbounds in them, with tags starting with "proxy" e.g. proxy1, proxy2 (fully compatible with existing configs) (#5225)

pull/5264/head
OnceUponATimeInAmerica 2024-06-20 11:02:10 +03:30 committed by GitHub
parent 63d5a2a1be
commit 1ff88d29be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 3 deletions

View File

@ -87,6 +87,8 @@ namespace v2rayN.Handler
private void ParseOutput(Google.Protobuf.Collections.RepeatedField<Stat> source, out ServerSpeedItem server)
{
server = new();
long aggregateProxyUp = 0;
long aggregateProxyDown = 0;
try
{
foreach (Stat stat in source)
@ -101,15 +103,15 @@ namespace v2rayN.Handler
name = nStr[1];
type = nStr[3];
if (name == Global.ProxyTag)
if (name.StartsWith(Global.ProxyTag))
{
if (type == "uplink")
{
server.proxyUp = value;
aggregateProxyUp += value;
}
else if (type == "downlink")
{
server.proxyDown = value;
aggregateProxyDown += value;
}
}
else if (name == Global.DirectTag)
@ -124,6 +126,8 @@ namespace v2rayN.Handler
}
}
}
server.proxyUp = aggregateProxyUp;
server.proxyDown = aggregateProxyDown;
}
catch
{