Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend stats reporting to support custom load-balanced configs with several outbounds #5225

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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