Skip to content

Commit

Permalink
Extend stats reporting to support custom configs with several load-ba…
Browse files Browse the repository at this point in the history
…lanced outbounds in them, with tags starting with "proxy" e.g. proxy1, proxy2 (fully compatible with existing configs) (#5225)
  • Loading branch information
OnceUponATimeInAmerica committed Jun 20, 2024
1 parent 63d5a2a commit 1ff88d2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions v2rayN/v2rayN/Handler/StatisticsV2ray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ private async void Run()
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)
Expand All @@ -101,15 +103,15 @@ private void ParseOutput(Google.Protobuf.Collections.RepeatedField<Stat> source,
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)
Expand All @@ -124,6 +126,8 @@ private void ParseOutput(Google.Protobuf.Collections.RepeatedField<Stat> source,
}
}
}
server.proxyUp = aggregateProxyUp;
server.proxyDown = aggregateProxyDown;
}
catch
{
Expand Down

0 comments on commit 1ff88d2

Please sign in to comment.