Skip to content

Force Proxy to any Windows/MacOS/Linux Application TCP and UDP traffic

upgraded dotnet and avalonia version improved run time memory usage reduced logging, removed unwanted logs, added more UI optimization

Sourav Kalal23f028e97782
diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml
index 0774cd9..06b9872 100644
--- a/.github/workflows/build-windows.yml
+++ b/.github/workflows/build-windows.yml
@@ -18,7 +18,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
- dotnet-version: '9.0.x'
+ dotnet-version: '10.0.x'
- name: Setup MSYS2 (for GCC)
uses: msys2/setup-msys2@v2
diff --git a/Windows/cli/ProxyBridge.CLI.csproj b/Windows/cli/ProxyBridge.CLI.csproj
index a2cee8a..983d6fe 100644
--- a/Windows/cli/ProxyBridge.CLI.csproj
+++ b/Windows/cli/ProxyBridge.CLI.csproj
@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
- <TargetFramework>net9.0-windows</TargetFramework>
+ <TargetFramework>net10.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>ProxyBridge_CLI</AssemblyName>
diff --git a/Windows/gui/ProxyBridge.GUI.csproj b/Windows/gui/ProxyBridge.GUI.csproj
index e0ce3f7..89c2a84 100644
--- a/Windows/gui/ProxyBridge.GUI.csproj
+++ b/Windows/gui/ProxyBridge.GUI.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
- <TargetFramework>net9.0-windows</TargetFramework>
+ <TargetFramework>net10.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
@@ -18,8 +18,14 @@
<NeutralLanguage>en-US</NeutralLanguage>
<PublishAot>true</PublishAot>
<InvariantGlobalization>false</InvariantGlobalization>
+ <PublishAot>true</PublishAot>
+ <PublishTrimmed>true</PublishTrimmed>
+ <TrimMode>link</TrimMode>
<IlcOptimizationPreference>Speed</IlcOptimizationPreference>
<IlcGenerateDgmlFile>false</IlcGenerateDgmlFile>
+ <IlcFoldIdenticalMethodBodies>true</IlcFoldIdenticalMethodBodies>
+ <EventSourceSupport>false</EventSourceSupport>
+ <UseSystemResourceKeys>true</UseSystemResourceKeys>
</PropertyGroup>
<ItemGroup>
@@ -45,11 +51,10 @@
</ItemGroup>
<ItemGroup>
- <PackageReference Include="Avalonia" Version="11.2.0" />
- <PackageReference Include="Avalonia.Desktop" Version="11.2.0" />
- <PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.0" />
- <PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.0" />
- <PackageReference Include="Avalonia.ReactiveUI" Version="11.2.0" />
- <PackageReference Include="Avalonia.Diagnostics" Version="11.2.0" Condition="'$(Configuration)' == 'Debug'" />
+ <PackageReference Include="Avalonia" Version="11.3.11" />
+ <PackageReference Include="Avalonia.Desktop" Version="11.3.11" />
+ <PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.11" />
+ <PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.11" />
+ <PackageReference Include="Avalonia.Diagnostics" Version="11.3.11" Condition="'$(Configuration)' == 'Debug'" />
</ItemGroup>
</Project>
diff --git a/Windows/gui/Resources/Resources.resx b/Windows/gui/Resources/Resources.resx
index e26a7b4..5fa3e8e 100644
--- a/Windows/gui/Resources/Resources.resx
+++ b/Windows/gui/Resources/Resources.resx
@@ -53,10 +53,10 @@
<!-- Tabs -->
<data name="TabConnections" xml:space="preserve">
- <value>🔌 Connections</value>
+ <value>Connections</value>
</data>
<data name="TabActivity" xml:space="preserve">
- <value>📝 Activity Logs</value>
+ <value>Activity Logs</value>
</data>
<!-- Buttons -->
@@ -91,9 +91,6 @@
</data>
<!-- Log Messages -->
- <data name="LogInitialized" xml:space="preserve">
- <value>ProxyBridge initialized successfully</value>
- </data>
<data name="LogServiceStarted" xml:space="preserve">
<value>ProxyBridge service started successfully</value>
</data>
diff --git a/Windows/gui/Resources/Resources.zh.resx b/Windows/gui/Resources/Resources.zh.resx
index c9dbca9..173fc3c 100644
--- a/Windows/gui/Resources/Resources.zh.resx
+++ b/Windows/gui/Resources/Resources.zh.resx
@@ -51,10 +51,10 @@
<!-- Tabs -->
<data name="TabConnections" xml:space="preserve">
- <value>🔌 网络连接</value>
+ <value>网络连接</value>
</data>
<data name="TabActivity" xml:space="preserve">
- <value>📝 活动日志</value>
+ <value>活动日志</value>
</data>
<!-- Buttons -->
diff --git a/Windows/gui/ViewModels/MainWindowViewModel.cs b/Windows/gui/ViewModels/MainWindowViewModel.cs
index 4d40f43..7f1cc15 100644
--- a/Windows/gui/ViewModels/MainWindowViewModel.cs
+++ b/Windows/gui/ViewModels/MainWindowViewModel.cs
@@ -21,7 +21,7 @@ public class MainWindowViewModel : ViewModelBase
private string _title = "ProxyBridge";
private int _selectedTabIndex;
private string _connectionsLog = "";
- private string _activityLog = "ProxyBridge initialized successfully\n";
+ private string _activityLog = "";
private string _connectionsSearchText = "";
private string _activitySearchText = "";
private string _filteredConnectionsLog = "";
@@ -76,6 +76,9 @@ public class MainWindowViewModel : ViewModelBase
if (!_isTrafficLoggingEnabled)
return;
+ if (_connectionLogTimer?.IsEnabled == false)
+ _connectionLogTimer.Start();
+
string logEntry = $"[{DateTime.Now:HH:mm:ss}] {processName} (PID:{pid}) -> {destIp}:{destPort} via {proxyInfo}\n";
lock (_connectionLogLock)
{
@@ -83,11 +86,7 @@ public class MainWindowViewModel : ViewModelBase
}
};
- // Timer to flush batched logs to UI every 500ms
- _connectionLogTimer = new DispatcherTimer
- {
- Interval = TimeSpan.FromMilliseconds(500)
- };
+ _connectionLogTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(500) };
_connectionLogTimer.Tick += (s, e) =>
{
List<string> logsToAdd;
@@ -107,15 +106,8 @@ public class MainWindowViewModel : ViewModelBase
ConnectionsLog = string.Join("\n", linesToKeep);
}
};
- if (_isTrafficLoggingEnabled)
- {
- _connectionLogTimer.Start();
- }
- _activityLogTimer = new DispatcherTimer
- {
- Interval = TimeSpan.FromMilliseconds(500)
- };
+ _activityLogTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(500) };
_activityLogTimer.Tick += (s, e) =>
{
List<string> logsToAdd;
@@ -143,15 +135,11 @@ public class MainWindowViewModel : ViewModelBase
portNum,
_currentProxyUsername,
_currentProxyPassword);
-
- QueueActivityLog($"Restored proxy settings: {_currentProxyType} {_currentProxyIp}:{_currentProxyPort}");
}
// Start the proxy bridge
if (_proxyService.Start())
{
- QueueActivityLog("ProxyBridge service started successfully");
-
// Apply config proxy rules, Need to see if this cause UI issues/slow/freeze
foreach (var rule in ProxyRules)
{
@@ -168,11 +156,6 @@ public class MainWindowViewModel : ViewModelBase
rule.Index = ProxyRules.IndexOf(rule) + 1;
}
}
-
- if (ProxyRules.Count > 0)
- {
- QueueActivityLog($"Restored {ProxyRules.Count} proxy rule(s)");
- }
}
else
{
@@ -305,7 +288,7 @@ public class MainWindowViewModel : ViewModelBase
{
_proxyService?.SetDnsViaProxy(value);
SaveConfigurationInternal();
- QueueActivityLog($"DNS via Proxy: {(value ? "Enabled" : "Disabled")}");
+
}
}
}
@@ -424,8 +407,6 @@ public class MainWindowViewModel : ViewModelBase
_currentProxyPassword = password;
SaveConfigurationInternal();
- string authInfo = string.IsNullOrEmpty(username) ? "" : " (with auth)";
- QueueActivityLog($"Saved proxy settings: {type} {ip}:{port}{authInfo}");
}
else
{
@@ -471,7 +452,6 @@ public class MainWindowViewModel : ViewModelBase
rule.Index = ProxyRules.Count + 1;
ProxyRules.Add(rule);
SaveConfigurationInternal();
- QueueActivityLog($"Added rule: {rule.ProcessName} ({rule.TargetHosts}:{rule.TargetPorts} {rule.Protocol}) -> {rule.Action} (ID: {ruleId})");
}
else
{
@@ -575,17 +555,14 @@ public class MainWindowViewModel : ViewModelBase
ClearActivityLogCommand = new RelayCommand(() =>
{
- var oldActivity = ActivityLog;
- var oldSearch = ActivitySearchText;
- var oldFiltered = FilteredActivityLog;
+ lock (_activityLogLock)
+ {
+ _pendingActivityLogs.Clear();
+ }
- ActivityLog = "ProxyBridge initialized successfully\n";
+ ActivityLog = "";
ActivitySearchText = "";
- FilteredActivityLog = "ProxyBridge initialized successfully\n";
-
- oldActivity = null!;
- oldSearch = null!;
- oldFiltered = null!;
+ FilteredActivityLog = "";
GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, true, true);
GC.WaitForPendingFinalizers();
@@ -634,7 +611,6 @@ public class MainWindowViewModel : ViewModelBase
rule.RuleId = ruleId;
ProxyRules.Add(rule);
SaveConfigurationInternal();
- QueueActivityLog($"Added rule: {NewProcessName} -> {NewProxyAction}");
IsAddRuleViewOpen = false;
NewProcessName = "";
}
@@ -665,8 +641,6 @@ public class MainWindowViewModel : ViewModelBase
ConfigManager.SaveConfig(config);
_loc.CurrentCulture = new System.Globalization.CultureInfo(languageCode);
-
- QueueActivityLog($"{_loc.LogLanguageChanged}: {languageCode}");
}