Clarify tunnel-only traffic accounting

This commit is contained in:
MaxFan
2026-05-11 21:22:59 +03:30
parent 52d970f49e
commit a51bcbdadd
5 changed files with 20 additions and 20 deletions
+3 -3
View File
@@ -473,7 +473,7 @@
</StackPanel>
<StackPanel Grid.Column="3" HorizontalAlignment="Center">
<TextBlock Text="📡 مستقیم" FontSize="11"
<TextBlock Text="📡 خارج تونل" FontSize="11"
Foreground="{StaticResource TextSecondaryBrush}"
HorizontalAlignment="Center"/>
<TextBlock Text="{Binding DirectTraffic}" FontSize="14"
@@ -535,7 +535,7 @@
<Border Style="{StaticResource CardPanel}">
<StackPanel>
<TextBlock Style="{StaticResource SectionHeader}"
Text="ترافیک به تفکیک برنامه"/>
Text="مصرف تونل به تفکیک برنامه"/>
<Grid Margin="0,6,0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
@@ -544,7 +544,7 @@
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Background="#11FFFFFF" CornerRadius="8" Padding="10,7">
<StackPanel Orientation="Horizontal" FlowDirection="LeftToRight">
<TextBlock Text="برنامه‌ها: " FontSize="11"
<TextBlock Text="اپ‌های تونل: " FontSize="11"
Foreground="{StaticResource TextSecondaryBrush}"/>
<TextBlock Text="{Binding AppTrafficTotal}" FontSize="11" FontWeight="SemiBold"
Foreground="{StaticResource AccentBrush}"/>
@@ -240,19 +240,19 @@ public partial class TrafficRouterService : IDisposable
Interlocked.Read(ref _totalVpnBytesReceived));
/// <summary>
/// Returns the sum of tunnel traffic attributed to currently-tracked apps.
/// Returns the sum of tunnel traffic attributed to app counters during the
/// current connection. This intentionally includes apps that were disabled
/// later in the same session, so per-app totals remain consistent with the
/// history and total tunnel counters.
/// </summary>
public (long sent, long received) GetTrackedAppsTraffic()
{
long sent = 0;
long received = 0;
foreach (var appName in _targetExecutables.Keys)
foreach (var counter in _trafficCounters.Values)
{
if (_trafficCounters.TryGetValue(appName, out var counter))
{
sent += Interlocked.Read(ref counter.BytesSent);
received += Interlocked.Read(ref counter.BytesReceived);
}
sent += Interlocked.Read(ref counter.BytesSent);
received += Interlocked.Read(ref counter.BytesReceived);
}
return (sent, received);
}
@@ -279,9 +279,9 @@ public partial class MainViewModel
app.BytesReceived = received;
}
// Total tunnel usage: use the authoritative VPN-interface counter,
// and also expose the attributed per-app sum so UI can show both
// values without ambiguity.
// Total tunnel usage: use the authoritative VPN-interface counter.
// Every visible "usage" counter in the app is based on tunneled bytes;
// direct/outside-tunnel bytes are kept only as a diagnostic signal.
var (totalSent, totalReceived) = _trafficRouter.GetTotalVpnTraffic();
long vpnTotal = totalSent + totalReceived;
TotalTraffic = FormatBytes(vpnTotal);
+4 -4
View File
@@ -297,7 +297,7 @@
</StackPanel>
</Border>
<!-- Traffic -->
<!-- Tunnel Traffic -->
<Border Grid.Column="4" Background="#11FFFFFF" CornerRadius="10" Padding="10,10"
ToolTip="مجموع ترافیک ارسال و دریافت عبوری از تونل VPN (کل تونل)">
<StackPanel HorizontalAlignment="Center">
@@ -312,16 +312,16 @@
</StackPanel>
</Border>
<!-- Server -->
<!-- Direct diagnostic -->
<Border Grid.Column="6" Background="#11FFFFFF" CornerRadius="10" Padding="10,10"
ToolTip="ترافیک مستقیم خارج از تونل: شامل برنامه‌های غیرفعال، IPها و دامنه‌های وایت‌لیست‌شده و ترافیک سیستم">
ToolTip="نمایش تشخیصی ترافیک خارج از تونل. این عدد در مصرف تونل و تاریخچه ثبت نمی‌شود.">
<StackPanel HorizontalAlignment="Center">
<TextBlock Text="📡" FontSize="14" HorizontalAlignment="Center"/>
<TextBlock Text="{Binding DirectTraffic}" FontSize="13"
FontWeight="SemiBold" Foreground="{StaticResource TextPrimaryBrush}"
HorizontalAlignment="Center" Margin="0,4,0,0"
FlowDirection="LeftToRight"/>
<TextBlock Text="مستقیم" FontSize="9"
<TextBlock Text="خارج تونل" FontSize="9"
Foreground="{StaticResource TextSecondaryBrush}"
HorizontalAlignment="Center"/>
</StackPanel>
+3 -3
View File
@@ -20,7 +20,7 @@
<StackPanel Grid.Row="0" Grid.Column="0">
<TextBlock Text="📜 تاریخچه اتصالات" FontSize="16" FontWeight="SemiBold"
Foreground="{StaticResource TextPrimaryBrush}"/>
<TextBlock Text="سوابق اتصالات قبلی شما در این بخش نمایش داده می‌شود"
<TextBlock Text="سوابق مصرف تونل در اتصال‌های قبلی نمایش داده می‌شود"
Foreground="{StaticResource TextSecondaryBrush}"
FontSize="11" Margin="0,4,0,0"/>
</StackPanel>
@@ -36,7 +36,7 @@
Padding="14,10" Margin="0,12,0,0">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"
FlowDirection="LeftToRight">
<TextBlock Text="📊 مجموع مصرف داده: " FontSize="13"
<TextBlock Text="📊 مجموع مصرف تونل: " FontSize="13"
Foreground="{StaticResource TextSecondaryBrush}"
FlowDirection="RightToLeft"/>
<TextBlock Text="{Binding TotalHistoryData}" FontSize="15"
@@ -92,7 +92,7 @@
<TextBlock Text="{Binding DurationText}"
Foreground="{StaticResource SuccessBrush}"
FontSize="11"/>
<TextBlock Text=" • 📊 " FontSize="11"
<TextBlock Text=" • 📊 تونل " FontSize="11"
Foreground="{StaticResource TextSecondaryBrush}"/>
<TextBlock Text="{Binding TotalDataText}"
Foreground="{StaticResource WarningBrush}"