Skip to content

Commit 1ff88d2

Browse files
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)
1 parent 63d5a2a commit 1ff88d2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

v2rayN/v2rayN/Handler/StatisticsV2ray.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ private async void Run()
8787
private void ParseOutput(Google.Protobuf.Collections.RepeatedField<Stat> source, out ServerSpeedItem server)
8888
{
8989
server = new();
90+
long aggregateProxyUp = 0;
91+
long aggregateProxyDown = 0;
9092
try
9193
{
9294
foreach (Stat stat in source)
@@ -101,15 +103,15 @@ private void ParseOutput(Google.Protobuf.Collections.RepeatedField<Stat> source,
101103
name = nStr[1];
102104
type = nStr[3];
103105

104-
if (name == Global.ProxyTag)
106+
if (name.StartsWith(Global.ProxyTag))
105107
{
106108
if (type == "uplink")
107109
{
108-
server.proxyUp = value;
110+
aggregateProxyUp += value;
109111
}
110112
else if (type == "downlink")
111113
{
112-
server.proxyDown = value;
114+
aggregateProxyDown += value;
113115
}
114116
}
115117
else if (name == Global.DirectTag)
@@ -124,6 +126,8 @@ private void ParseOutput(Google.Protobuf.Collections.RepeatedField<Stat> source,
124126
}
125127
}
126128
}
129+
server.proxyUp = aggregateProxyUp;
130+
server.proxyDown = aggregateProxyDown;
127131
}
128132
catch
129133
{

0 commit comments

Comments
 (0)