Skip to content

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

#150 Added Log Filter Added Log Auto Remove

AnoF-Cyber672a877e298c
diff --git a/Windows/gui/Resources/Resources.Designer.cs b/Windows/gui/Resources/Resources.Designer.cs
index 9756baa..388e10f 100644
--- a/Windows/gui/Resources/Resources.Designer.cs
+++ b/Windows/gui/Resources/Resources.Designer.cs
@@ -104,9 +104,21 @@ namespace ProxyBridge.GUI.Resources {
}
}
- internal static string MenuHideDirectConnections {
+ internal static string MenuLogFilters {
get {
- return ResourceManager.GetString("MenuHideDirectConnections", resourceCulture);
+ return ResourceManager.GetString("MenuLogFilters", resourceCulture);
+ }
+ }
+
+ internal static string LogFiltersDesc1 =>
+ ResourceManager.GetString("LogFiltersDesc1", resourceCulture);
+
+ internal static string LogFiltersDesc2 =>
+ ResourceManager.GetString("LogFiltersDesc2", resourceCulture);
+
+ internal static string MenuAutoClearLogs {
+ get {
+ return ResourceManager.GetString("MenuAutoClearLogs", resourceCulture);
}
}
diff --git a/Windows/gui/Resources/Resources.resx b/Windows/gui/Resources/Resources.resx
index db064d7..a1f3362 100644
--- a/Windows/gui/Resources/Resources.resx
+++ b/Windows/gui/Resources/Resources.resx
@@ -32,8 +32,17 @@
<data name="MenuEnableTrafficLogging" xml:space="preserve">
<value>Enable Traffic Logging</value>
</data>
- <data name="MenuHideDirectConnections" xml:space="preserve">
- <value>Hide Direct Connections</value>
+ <data name="MenuLogFilters" xml:space="preserve">
+ <value>Log Filters...</value>
+ </data>
+ <data name="LogFiltersDesc1" xml:space="preserve">
+ <value>Only connections matching all your filters will appear in the log. Connections that don't match are silently ignored and never stored.</value>
+ </data>
+ <data name="LogFiltersDesc2" xml:space="preserve">
+ <value>Use * as a wildcard anywhere in text fields: chrome* = starts with, *.exe = ends with, *ch* = contains anywhere. Action and Protocol use a dropdown choose "All" to ignore that field.</value>
+ </data>
+ <data name="MenuAutoClearLogs" xml:space="preserve">
+ <value>Auto Clear Logs</value>
</data>
<data name="MenuSettings" xml:space="preserve">
<value>Settings</value>
diff --git a/Windows/gui/Resources/Resources.zh.resx b/Windows/gui/Resources/Resources.zh.resx
index 674e892..7912514 100644
--- a/Windows/gui/Resources/Resources.zh.resx
+++ b/Windows/gui/Resources/Resources.zh.resx
@@ -32,8 +32,17 @@
<data name="MenuEnableTrafficLogging" xml:space="preserve">
<value>启用流量日志</value>
</data>
- <data name="MenuHideDirectConnections" xml:space="preserve">
- <value>隐藏直连连接</value>
+ <data name="MenuLogFilters" xml:space="preserve">
+ <value>日志过滤...</value>
+ </data>
+ <data name="LogFiltersDesc1" xml:space="preserve">
+ <value>只有符合所有过滤条件的连接才会显示在日志中。不符合的连接将被忽略,不会被记录。</value>
+ </data>
+ <data name="LogFiltersDesc2" xml:space="preserve">
+ <value>文本字段支持 * 通配符:chrome* = 以此开头,*.exe = 以此结尾,*ch* = 包含此内容。操作和协议使用下拉菜单 选择"全部"可忽略该字段。</value>
+ </data>
+ <data name="MenuAutoClearLogs" xml:space="preserve">
+ <value>自动清除日志</value>
</data>
<data name="MenuSettings" xml:space="preserve">
<value>设置</value>
diff --git a/Windows/gui/Services/Loc.cs b/Windows/gui/Services/Loc.cs
index 1d7a099..994010d 100644
--- a/Windows/gui/Services/Loc.cs
+++ b/Windows/gui/Services/Loc.cs
@@ -43,7 +43,10 @@ public class Loc : INotifyPropertyChanged
public string MenuDnsViaProxy => Resources.Resources.MenuDnsViaProxy;
public string MenuLocalhostViaProxy => Resources.Resources.MenuLocalhostViaProxy;
public string MenuEnableTrafficLogging => Resources.Resources.MenuEnableTrafficLogging;
- public string MenuHideDirectConnections => Resources.Resources.MenuHideDirectConnections;
+ public string MenuLogFilters => Resources.Resources.MenuLogFilters;
+ public string LogFiltersDesc1 => Resources.Resources.LogFiltersDesc1;
+ public string LogFiltersDesc2 => Resources.Resources.LogFiltersDesc2;
+ public string MenuAutoClearLogs => Resources.Resources.MenuAutoClearLogs;
public string MenuSettings => Resources.Resources.MenuSettings;
public string MenuCloseToTray => Resources.Resources.MenuCloseToTray;
public string MenuRunAtStartup => Resources.Resources.MenuRunAtStartup;
diff --git a/Windows/gui/Services/ProfileManager.cs b/Windows/gui/Services/ProfileManager.cs
index e5aacb1..97ccdf7 100644
--- a/Windows/gui/Services/ProfileManager.cs
+++ b/Windows/gui/Services/ProfileManager.cs
@@ -7,6 +7,13 @@ using System.Text.Json.Serialization;
namespace ProxyBridge.GUI.Services;
+public class LogFilterEntry
+{
+ public string Field { get; set; } = "Process Name"; // Process Name, IP, Port, Protocol, Action
+ public string Operator { get; set; } = "Contains"; // Contains, Not Contains, Equals, Not Equals, Starts With
+ public string Value { get; set; } = "";
+}
+
public class ProxyConfigEntry
{
public uint Id { get; set; }
@@ -35,11 +42,12 @@ public class ProxyProfile
public bool DnsViaProxy { get; set; } = true;
public bool LocalhostViaProxy { get; set; } = false;
public bool IsTrafficLoggingEnabled { get; set; } = true;
- public bool HideDirectConnections { get; set; } = false;
+ public bool AutoClearConnectionLogs { get; set; } = true;
public string Language { get; set; } = "en";
public bool CloseToTray { get; set; } = true;
public List<ProxyConfigEntry> ProxyConfigs { get; set; } = new();
public List<ProxyRuleConfig> ProxyRules { get; set; } = new();
+ public List<LogFilterEntry> LogFilters { get; set; } = new();
}
[JsonSourceGenerationOptions(WriteIndented = true)]
@@ -48,6 +56,8 @@ public class ProxyProfile
[JsonSerializable(typeof(List<ProxyConfigEntry>))]
[JsonSerializable(typeof(ProxyRuleConfig))]
[JsonSerializable(typeof(List<ProxyRuleConfig>))]
+[JsonSerializable(typeof(LogFilterEntry))]
+[JsonSerializable(typeof(List<LogFilterEntry>))]
internal partial class ProxyProfileJsonContext : JsonSerializerContext { }
internal static class AtomicFileHelper
diff --git a/Windows/gui/ViewModels/LogFiltersViewModel.cs b/Windows/gui/ViewModels/LogFiltersViewModel.cs
new file mode 100644
index 0000000..7243303
--- /dev/null
+++ b/Windows/gui/ViewModels/LogFiltersViewModel.cs
@@ -0,0 +1,141 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Windows.Input;
+using Avalonia.Controls;
+using ProxyBridge.GUI.Common;
+using ProxyBridge.GUI.Services;
+
+namespace ProxyBridge.GUI.ViewModels;
+
+public class LogFilterRowViewModel : ViewModelBase
+{
+ private static readonly string[] _textOperators =
+ { "Contains", "Not Contains", "Equals", "Not Equals", "Starts With" };
+ private static readonly string[] _enumOperators =
+ { "Equals", "Not Equals" };
+ private static readonly string[] _actionValues =
+ { "All", "Proxy", "Direct", "Blocked" };
+ private static readonly string[] _protocolValues =
+ { "All", "TCP", "UDP" };
+ private static readonly string[] _noOptions = Array.Empty<string>();
+
+ public static readonly string[] AvailableFields =
+ { "Process Name", "IP", "Port", "Protocol", "Action" };
+
+ private string _field = "Process Name";
+ private string _operator = "Contains";
+ private string _value = "";
+
+ public string[] Fields => AvailableFields;
+
+ // Dynamic — depends on selected field
+ public string[] AvailableOperators =>
+ IsValueDropdown ? _enumOperators : _textOperators;
+
+ // Non-empty only for enum fields (Protocol, Action)
+ public string[] ValueOptions => _field switch
+ {
+ "Action" => _actionValues,
+ "Protocol" => _protocolValues,
+ _ => _noOptions
+ };
+
+ public bool IsValueDropdown => _field is "Action" or "Protocol";
+
+ public string ValuePlaceholder => _field switch
+ {
+ "Process Name" => "e.g. chrome*, *.exe, *ch*",
+ "IP" => "e.g. 192.168.*, *.1, 10.*",
+ "Port" => "e.g. 443, 8080",
+ _ => ""
+ };
+
+ public string Field
+ {
+ get => _field;
+ set
+ {
+ if (!SetProperty(ref _field, value)) return;
+ OnPropertyChanged(nameof(AvailableOperators));
+ OnPropertyChanged(nameof(ValueOptions));
+ OnPropertyChanged(nameof(IsValueDropdown));
+ OnPropertyChanged(nameof(ValuePlaceholder));
+ // reset operator and value to sensible defaults for the new field
+ Operator = IsValueDropdown ? _enumOperators[0] : _textOperators[0];
+ Value = ValueOptions.Length > 0 ? ValueOptions[0] : "";
+ }
+ }
+
+ public string Operator
+ {
+ get => _operator;
+ set => SetProperty(ref _operator, value);
+ }
+
+ public string Value
+ {
+ get => _value;
+ set => SetProperty(ref _value, value);
+ }
+}
+
+public class LogFiltersViewModel : ViewModelBase
+{
+ private readonly Action<List<LogFilterEntry>> _onSave;
+ private readonly Action _onClose;
+
+ public Loc Loc => Loc.Instance;
+
+ public ObservableCollection<LogFilterRowViewModel> FilterRows { get; } = new();
+
+ public ICommand AddFilterCommand { get; }
+ public ICommand RemoveFilterRowCommand { get; }
+ public ICommand ClearAllCommand { get; }
+ public ICommand SaveCommand { get; }
+ public ICommand CloseCommand { get; }
+
+ public LogFiltersViewModel(
+ List<LogFilterEntry> existingFilters,
+ Action<List<LogFilterEntry>> onSave,
+ Action onClose)
+ {
+ _onSave = onSave;
+ _onClose = onClose;
+
+ foreach (var f in existingFilters)
+ {
+ FilterRows.Add(new LogFilterRowViewModel
+ {
+ Field = f.Field,
+ Operator = f.Operator,
+ Value = f.Value
+ });
+ }
+
+ AddFilterCommand = new RelayCommand(() =>
+ FilterRows.Add(new LogFilterRowViewModel()));
+
+ RemoveFilterRowCommand =
+ new RelayCommandWithParameter<LogFilterRowViewModel>(row => FilterRows.Remove(row));
+
+ ClearAllCommand = new RelayCommand(() => FilterRows.Clear());
+
+ SaveCommand = new RelayCommand(() =>
+ {
+ var filters = FilterRows
+ .Select(r => new LogFilterEntry
+ {
+ Field = r.Field,
+ Operator = r.Operator,
+ Value = r.Value
+ })
+ .ToList();
+ _onSave(filters);
+ _onClose();
+ });
+
+ CloseCommand = new RelayCommand(() => _onClose());
+ }
+}
diff --git a/Windows/gui/ViewModels/MainWindowViewModel.cs b/Windows/gui/ViewModels/MainWindowViewModel.cs
index 5eac8a2..908d60e 100644
--- a/Windows/gui/ViewModels/MainWindowViewModel.cs
+++ b/Windows/gui/ViewModels/MainWindowViewModel.cs
@@ -53,6 +53,8 @@ public class MainWindowViewModel : ViewModelBase
private int _connectionLogLineCount = 0;
private int _activityLogLineCount = 0;
private CancellationTokenSource? _saveCts;
+ private volatile LogFilterEntry[] _activeFilters = Array.Empty<LogFilterEntry>();
+ private List<LogFilterEntry> _currentLogFilters = new();
public void SetMainWindow(Window window)
{
@@ -78,7 +80,7 @@ public class MainWindowViewModel : ViewModelBase
if (!_isTrafficLoggingEnabled)
return;
- if (_hideDirectConnections && proxyInfo.StartsWith("Direct"))
+ if (!PassesLogFilters(processName, destIp, destPort, proxyInfo))
return;
lock (_connectionLogLock)
@@ -101,7 +103,7 @@ public class MainWindowViewModel : ViewModelBase
var newConnLog = _connectionsLog + string.Concat(logsToAdd);
_connectionLogLineCount += logsToAdd.Count;
- if (_connectionLogLineCount > MAX_CONNECTION_LOG_LINES)
+ if (_autoClearConnectionLogs && _connectionLogLineCount > MAX_CONNECTION_LOG_LINES)
newConnLog = TrimToLastNLines(newConnLog, MAX_CONNECTION_LOG_LINES, out _connectionLogLineCount);
ConnectionsLog = newConnLog;
};
@@ -306,25 +308,14 @@ public class MainWindowViewModel : ViewModelBase
}
}
- private bool _hideDirectConnections = false;
- public bool HideDirectConnections
+ private bool _autoClearConnectionLogs = true;
+ public bool AutoClearConnectionLogs
{
- get => _hideDirectConnections;
+ get => _autoClearConnectionLogs;
set
{
- if (SetProperty(ref _hideDirectConnections, value))
- {
- // refilter the existing log immediately
- if (value)
- {
- _connectionsLog = StripDirectLines(_connectionsLog);
- _connectionLogLineCount = CountNewlines(_connectionsLog);
- FilteredConnectionsLog = string.IsNullOrWhiteSpace(_connectionsSearchText)
- ? _connectionsLog
- : FilterLog(_connectionsLog, _connectionsSearchText);
- }
+ if (SetProperty(ref _autoClearConnectionLogs, value))
SaveCurrentProfileAsync();
- }
}
}
@@ -394,12 +385,13 @@ public class MainWindowViewModel : ViewModelBase
public ICommand ShowProxySettingsCommand { get; }
public ICommand ShowProxyRulesCommand { get; }
+ public ICommand ShowLogFiltersCommand { get; }
public ICommand ShowAboutCommand { get; }
public ICommand CheckForUpdatesCommand { get; }
public ICommand ToggleDnsViaProxyCommand { get; }
public ICommand ToggleLocalhostViaProxyCommand { get; }
public ICommand ToggleTrafficLoggingCommand { get; }
- public ICommand ToggleHideDirectConnectionsCommand { get; }
+ public ICommand ToggleAutoClearConnectionLogsCommand { get; }
public ICommand ToggleCloseToTrayCommand { get; }
public ICommand ToggleStartWithWindowsCommand { get; }
public ICommand CloseDialogCommand { get; }
@@ -516,7 +508,20 @@ public class MainWindowViewModel : ViewModelBase
ToggleDnsViaProxyCommand = new RelayCommand(() => { DnsViaProxy = !DnsViaProxy; });
ToggleLocalhostViaProxyCommand = new RelayCommand(() => { LocalhostViaProxy = !LocalhostViaProxy; });
ToggleTrafficLoggingCommand = new RelayCommand(() => { IsTrafficLoggingEnabled = !IsTrafficLoggingEnabled; });
- ToggleHideDirectConnectionsCommand = new RelayCommand(() => { HideDirectConnections = !HideDirectConnections; });
+ ToggleAutoClearConnectionLogsCommand = new RelayCommand(() => { AutoClearConnectionLogs = !AutoClearConnectionLogs; });
+
+ ShowLogFiltersCommand = new RelayCommand(async () =>
+ {
+ var window = new LogFiltersWindow();
+ var viewModel = new LogFiltersViewModel(
+ existingFilters: new List<LogFilterEntry>(_currentLogFilters),
+ onSave: filters => UpdateLogFilters(filters),
+ onClose: () => window.Close()
+ );
+ window.DataContext = viewModel;
+ if (_mainWindow != null)
+ await window.ShowDialog(_mainWindow);
+ });
ToggleCloseToTrayCommand = new RelayCommand(() =>
{
@@ -849,6 +854,91 @@ public class MainWindowViewModel : ViewModelBase
try { _proxyService?.Dispose(); _proxyService = null; } catch { }
}
+ private void UpdateLogFilters(List<LogFilterEntry> filters)
+ {
+ _currentLogFilters = filters;
+ _activeFilters = filters.ToArray();
+
+ // Clear the connection log so the display starts fresh with the new filters
+ lock (_connectionLogLock)
+ _pendingConnectionLogs.Clear();
+
+ _connectionLogLineCount = 0;
+ ConnectionsLog = "";
+ FilteredConnectionsLog = "";
+
+ SaveCurrentProfileAsync();
+ }
+
+ private bool PassesLogFilters(string processName, string destIp, ushort destPort, string proxyInfo)
+ {
+ var filters = _activeFilters; // single volatile read → local snapshot
+ if (filters.Length == 0) return true;
+
+ foreach (var f in filters)
+ {
+ // skip no-op rows: empty value, wildcard-all, or "All" dropdown selection
+ if (string.IsNullOrEmpty(f.Value) || f.Value is "*" or "All") continue;
+
+ string fieldValue = f.Field switch
+ {
+ "Process Name" => processName,
+ "IP" => destIp,
+ "Port" => destPort.ToString(),
+ "Protocol" => proxyInfo.Contains("(UDP)", StringComparison.OrdinalIgnoreCase) ? "UDP" : "TCP",
+ "Action" => proxyInfo.StartsWith("Direct", StringComparison.OrdinalIgnoreCase) ? "Direct"
+ : proxyInfo.StartsWith("Proxy", StringComparison.OrdinalIgnoreCase) ? "Proxy"
+ : proxyInfo.StartsWith("Block", StringComparison.OrdinalIgnoreCase) ? "Blocked"
+ : proxyInfo,
+ _ => ""
+ };
+
+ if (!ApplyFilterOperator(fieldValue, f.Operator, f.Value))
+ return false; // AND logic — one failure = entry rejected
+ }
+
+ return true;
+ }
+
+ private static bool ApplyFilterOperator(string fieldValue, string op, string filterValue)
+ {
+ return op switch
+ {
+ "Contains" => fieldValue.Contains(filterValue, StringComparison.OrdinalIgnoreCase),
+ "Not Contains" => !fieldValue.Contains(filterValue, StringComparison.OrdinalIgnoreCase),
+ "Equals" => WildcardMatch(fieldValue, filterValue),
+ "Not Equals" => !WildcardMatch(fieldValue, filterValue),
+ "Starts With" => fieldValue.StartsWith(filterValue, StringComparison.OrdinalIgnoreCase),
+ _ => true
+ };
+ }
+
+ private static bool WildcardMatch(string text, string pattern)
+ {
+ if (pattern == "*") return true;
+
+ if (!pattern.Contains('*'))
+ return text.Equals(pattern, StringComparison.OrdinalIgnoreCase);
+
+ // simple glob: split on * and require ordered subsequence
+ var parts = pattern.Split('*');
+ int pos = 0;
+ for (int i = 0; i < parts.Length; i++)
+ {
+ if (parts[i].Length == 0) continue;
+ int idx = text.IndexOf(parts[i], pos, StringComparison.OrdinalIgnoreCase);
+ if (idx < 0) return false;
+ if (i == 0 && idx != 0) return false; // no leading * → must start with first part
+ pos = idx + parts[i].Length;
+ }
+ // no trailing * → text must end with last non-empty part
+ var lastPart = parts[^1];
+ if (lastPart.Length > 0 && !text.EndsWith(lastPart, StringComparison.OrdinalIgnoreCase))
+ return false;
+
+ return true;
+ }
+
private string FilterLog(string log, string searchText)
{
if (string.IsNullOrWhiteSpace(searchText))
@@ -869,20 +959,6 @@ public class MainWindowViewModel : ViewModelBase
return sb.ToString();
}
- private string StripDirectLines(string log)
- {
- if (string.IsNullOrEmpty(log))
- return log;
-
- var sb = new StringBuilder(log.Length);
- foreach (var line in log.Split('\n').Where(l => !l.Contains(" via Direct", StringComparison.OrdinalIgnoreCase)))
- {
- sb.Append(line);
- sb.Append('\n');
- }
- return sb.ToString();
- }
-
private static string TrimToLastNLines(string log, int maxLines, out int actualLines)
{
int newlines = 0;
@@ -936,8 +1012,11 @@ public class MainWindowViewModel : ViewModelBase
_isTrafficLoggingEnabled = profile.IsTrafficLoggingEnabled;
OnPropertyChanged(nameof(IsTrafficLoggingEnabled));
- _hideDirectConnections = profile.HideDirectConnections;
- OnPropertyChanged(nameof(HideDirectConnections));
+ _autoClearConnectionLogs = profile.AutoClearConnectionLogs;
+ OnPropertyChanged(nameof(AutoClearConnectionLogs));
+
+ _currentLogFilters = profile.LogFilters ?? new List<LogFilterEntry>();
+ _activeFilters = _currentLogFilters.ToArray();
if (!string.IsNullOrWhiteSpace(profile.Language))
{
@@ -1027,8 +1106,11 @@ public class MainWindowViewModel : ViewModelBase
ProxyBridgeService.SetTrafficLoggingEnabled(profile.IsTrafficLoggingEnabled);
}
- _hideDirectConnections = profile.HideDirectConnections;
- OnPropertyChanged(nameof(HideDirectConnections));
+ _autoClearConnectionLogs = profile.AutoClearConnectionLogs;
+ OnPropertyChanged(nameof(AutoClearConnectionLogs));
+
+ _currentLogFilters = profile.LogFilters ?? new List<LogFilterEntry>();
+ _activeFilters = _currentLogFilters.ToArray();
if (!string.IsNullOrWhiteSpace(profile.Language))
{
@@ -1133,9 +1215,10 @@ public class MainWindowViewModel : ViewModelBase
DnsViaProxy = _dnsViaProxy,
LocalhostViaProxy = _localhostViaProxy,
IsTrafficLoggingEnabled = _isTrafficLoggingEnabled,
- HideDirectConnections = _hideDirectConnections,
+ AutoClearConnectionLogs = _autoClearConnectionLogs,
Language = _currentLanguage,
CloseToTray = _closeToTray,
+ LogFilters = new List<LogFilterEntry>(_currentLogFilters),
ProxyConfigs = ProxyConfigs.Select(pc => new ProxyConfigEntry
{
Id = pc.Id,
diff --git a/Windows/gui/Views/LogFiltersWindow.axaml b/Windows/gui/Views/LogFiltersWindow.axaml
new file mode 100644
index 0000000..843fe1f
--- /dev/null
+++ b/Windows/gui/Views/LogFiltersWindow.axaml
@@ -0,0 +1,138 @@
+<Window xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:vm="using:ProxyBridge.GUI.ViewModels"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ mc:Ignorable="d" d:DesignWidth="700" d:DesignHeight="480"
+ x:Class="ProxyBridge.GUI.Views.LogFiltersWindow"
+ x:DataType="vm:LogFiltersViewModel"
+ x:CompileBindings="True"
+ Title="Log Filters"
+ Icon="/Assets/logo.ico"
+ Width="700" Height="460"
+ MinWidth="560" MinHeight="300"
+ Background="#FF2D2D30"
+ WindowStartupLocation="CenterOwner">
+
+ <DockPanel>
+ <!-- Header -->
+ <Border DockPanel.Dock="Top" Background="#FF1E1E1E" Padding="20,16"
+ BorderBrush="#FF3F3F46" BorderThickness="0,0,0,1">
+ <StackPanel Spacing="6">
+ <StackPanel Orientation="Horizontal" Spacing="10">
+ <TextBlock Text="🔽" FontSize="20" VerticalAlignment="Center"/>
+ <TextBlock Text="Log Filters"
+ FontSize="18"
+ FontWeight="SemiBold"
+ Foreground="#FFE0E0E0"
+ VerticalAlignment="Center"/>
+ </StackPanel>
+ <TextBlock Text="{Binding Loc.LogFiltersDesc1}"
+ FontSize="12"
+ Foreground="#FF9E9E9E"
+ TextWrapping="Wrap"/>
+ <TextBlock Text="{Binding Loc.LogFiltersDesc2}"
+ FontSize="12"
+ Foreground="#FF9E9E9E"
+ TextWrapping="Wrap"/>
+ </StackPanel>
+ </Border>
+
+ <!-- Footer -->
+ <Border DockPanel.Dock="Bottom" Background="#FF1E1E1E" Padding="16,12"
+ BorderBrush="#FF3F3F46" BorderThickness="0,1,0,0">
+ <Grid ColumnDefinitions="*,Auto,8,Auto,8,Auto">
+ <Button Grid.Column="1"
+ Content="Clear All"
+ Command="{Binding ClearAllCommand}"
+ Classes="secondary"
+ Padding="12,8"/>
+ <Button Grid.Column="3"
+ Content="Cancel"
+ Command="{Binding CloseCommand}"
+ Classes="secondary"
+ Padding="12,8"/>
+ <Button Grid.Column="5"
+ Content="Save"
+ Command="{Binding SaveCommand}"
+ Padding="24,8"/>
+ </Grid>
+ </Border>
+
+ <!-- Body -->
+ <DockPanel>
+ <!-- Add Filter + column headers -->
+ <Border DockPanel.Dock="Top" Background="#FF252526" Padding="16,10"
+ BorderBrush="#FF3F3F46" BorderThickness="0,0,0,1">
+ <Button Content="+ Add Filter"
+ Command="{Binding AddFilterCommand}"
+ Classes="secondary"
+ Padding="12,6"
+ HorizontalAlignment="Left"/>
+ </Border>
+
+ <Border DockPanel.Dock="Top" Background="#FF1E1E1E" Padding="16,8"
+ BorderBrush="#FF3F3F46" BorderThickness="0,0,0,1">
+ <Grid ColumnDefinitions="180,160,*,40">
+ <TextBlock Grid.Column="0" Text="Field"
+ FontSize="12" FontWeight="SemiBold" Foreground="#FFB0B0B0"/>
+ <TextBlock Grid.Column="1" Text="Operator"
+ FontSize="12" FontWeight="SemiBold" Foreground="#FFB0B0B0"/>
+ <TextBlock Grid.Column="2" Text="Value"
+ FontSize="12" FontWeight="SemiBold" Foreground="#FFB0B0B0"
+ Margin="8,0,0,0"/>
+ </Grid>
+ </Border>
+
+ <!-- Filter rows -->
+ <ScrollViewer VerticalScrollBarVisibility="Auto">
+ <ItemsControl ItemsSource="{Binding FilterRows}">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate x:DataType="vm:LogFilterRowViewModel">
+ <Border Background="#FF252526"
+ BorderBrush="#FF3F3F46"
+ BorderThickness="0,0,0,1"
+ Padding="16,10">
+ <Grid ColumnDefinitions="180,160,*,40">
+ <ComboBox Grid.Column="0"
+ ItemsSource="{Binding Fields}"
+ SelectedItem="{Binding Field}"
+ Margin="0,0,8,0"
+ HorizontalAlignment="Stretch"
+ Padding="8,6"/>
+ <ComboBox Grid.Column="1"
+ ItemsSource="{Binding AvailableOperators}"
+ SelectedItem="{Binding Operator}"
+ Margin="0,0,8,0"
+ HorizontalAlignment="Stretch"
+ Padding="8,6"/>
+ <!-- Value: free-text for Process Name/IP/Port, dropdown for Action/Protocol -->
+ <Panel Grid.Column="2" Margin="0,0,8,0">
+ <TextBox Text="{Binding Value}"
+ Watermark="{Binding ValuePlaceholder}"
+ IsVisible="{Binding !IsValueDropdown}"
+ Padding="8,6"/>
+ <ComboBox ItemsSource="{Binding ValueOptions}"
+ SelectedItem="{Binding Value}"
+ IsVisible="{Binding IsValueDropdown}"
+ HorizontalAlignment="Stretch"
+ Padding="8,6"/>
+ </Panel>
+ <Button Grid.Column="3"
+ Content="🗑"
+ Command="{Binding $parent[ItemsControl].((vm:LogFiltersViewModel)DataContext).RemoveFilterRowCommand}"
+ CommandParameter="{Binding}"
+ Classes="secondary"
+ Padding="4"
+ Width="32"
+ Height="32"
+ VerticalAlignment="Center"/>
+ </Grid>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </ScrollViewer>
+ </DockPanel>
+ </DockPanel>
+</Window>
diff --git a/Windows/gui/Views/LogFiltersWindow.axaml.cs b/Windows/gui/Views/LogFiltersWindow.axaml.cs
new file mode 100644
index 0000000..6c567de
--- /dev/null
+++ b/Windows/gui/Views/LogFiltersWindow.axaml.cs
@@ -0,0 +1,11 @@
+using Avalonia.Controls;
+
+namespace ProxyBridge.GUI.Views;
+
+public partial class LogFiltersWindow : Window
+{
+ public LogFiltersWindow()
+ {
+ InitializeComponent();
+ }
+}
diff --git a/Windows/gui/Views/MainWindow.axaml b/Windows/gui/Views/MainWindow.axaml
index 002bd26..647ac02 100644
--- a/Windows/gui/Views/MainWindow.axaml
+++ b/Windows/gui/Views/MainWindow.axaml
@@ -213,14 +213,6 @@
Margin="0"/>
</MenuItem.Icon>
</MenuItem>
- <MenuItem Header="{Binding Loc.MenuHideDirectConnections}"
- Command="{Binding ToggleHideDirectConnectionsCommand}">
- <MenuItem.Icon>
- <CheckBox IsChecked="{Binding HideDirectConnections}"
- IsHitTestVisible="False"
- Margin="0"/>
- </MenuItem.Icon>
- </MenuItem>
<MenuItem Header="{Binding Loc.MenuDnsViaProxy}"
Command="{Binding ToggleDnsViaProxyCommand}">
<MenuItem.Icon>
@@ -256,6 +248,17 @@
</MenuItem.Icon>
</MenuItem>
<Separator/>
+ <MenuItem Header="{Binding Loc.MenuLogFilters}"
+ Command="{Binding ShowLogFiltersCommand}"/>
+ <MenuItem Header="{Binding Loc.MenuAutoClearLogs}"
+ Command="{Binding ToggleAutoClearConnectionLogsCommand}">
+ <MenuItem.Icon>
+ <CheckBox IsChecked="{Binding AutoClearConnectionLogs}"
+ IsHitTestVisible="False"
+ Margin="0"/>
+ </MenuItem.Icon>
+ </MenuItem>
+ <Separator/>
<MenuItem Header="{Binding Loc.MenuLanguage}">
<MenuItem Header="English" Click="OnChangeLanguageEnglish">
<MenuItem.Icon>