diff --git a/v2rayN/ServiceLib/Models/Dto/ClashConnectionModel.cs b/v2rayN/ServiceLib/Models/Dto/ClashConnectionModel.cs index 943f1fd6..850b920d 100644 --- a/v2rayN/ServiceLib/Models/Dto/ClashConnectionModel.cs +++ b/v2rayN/ServiceLib/Models/Dto/ClashConnectionModel.cs @@ -13,4 +13,5 @@ public class ClashConnectionModel public double Time { get; set; } public string? Elapsed { get; set; } public string? Chain { get; set; } + public string? ProcessPath { get; set; } } diff --git a/v2rayN/ServiceLib/Models/Dto/ClashConnections.cs b/v2rayN/ServiceLib/Models/Dto/ClashConnections.cs index 236e2668..87d32608 100644 --- a/v2rayN/ServiceLib/Models/Dto/ClashConnections.cs +++ b/v2rayN/ServiceLib/Models/Dto/ClashConnections.cs @@ -1,36 +1,37 @@ namespace ServiceLib.Models.Dto; -public class ClashConnections +public record ClashConnections { - public ulong downloadTotal { get; set; } - public ulong uploadTotal { get; set; } - public List? connections { get; set; } + public ulong downloadTotal { get; init; } + public ulong uploadTotal { get; init; } + public List? connections { get; init; } } -public class ConnectionItem +public record ConnectionItem { - public string? id { get; set; } - public MetadataItem? metadata { get; set; } - public ulong upload { get; set; } - public ulong download { get; set; } - public DateTime start { get; set; } - public List? chains { get; set; } - public string? rule { get; set; } - public string? rulePayload { get; set; } + public string? id { get; init; } + public MetadataItem? metadata { get; init; } + public ulong upload { get; init; } + public ulong download { get; init; } + public DateTime start { get; init; } + public List? chains { get; init; } + public string? rule { get; init; } + public string? rulePayload { get; init; } } -public class MetadataItem +public record MetadataItem { - public string? network { get; set; } - public string? type { get; set; } - public string? sourceIP { get; set; } - public string? destinationIP { get; set; } - public string? sourcePort { get; set; } - public string? destinationPort { get; set; } - public string? host { get; set; } - public string? nsMode { get; set; } - public object? uid { get; set; } - public string? process { get; set; } - public string? processPath { get; set; } - public string? remoteDestination { get; set; } + public string? network { get; init; } + public string? type { get; init; } + public string? sourceIP { get; init; } + public string? destinationIP { get; init; } + public string? sourcePort { get; init; } + public string? destinationPort { get; init; } + public string? host { get; init; } + public string? nsMode { get; init; } + public object? uid { get; init; } + public string? process { get; init; } + public string? processPath { get; init; } + public string? remoteDestination { get; init; } + public string? sniffHost { get; init; } } diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index 18476257..35f20aa9 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -4238,15 +4238,6 @@ namespace ServiceLib.Resx { return ResourceManager.GetString("TbSettingsEnableCheckPreReleaseUpdate", resourceCulture); } } - - /// - /// 查找类似 Update via proxy 的本地化字符串。 - /// - public static string TbSettingsEnableUpdateViaProxy { - get { - return ResourceManager.GetString("TbSettingsEnableUpdateViaProxy", resourceCulture); - } - } /// /// 查找类似 Enable sorting Configurations by drag-n-drop (requires restart) 的本地化字符串。 @@ -4284,6 +4275,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Update via proxy 的本地化字符串。 + /// + public static string TbSettingsEnableUpdateViaProxy { + get { + return ResourceManager.GetString("TbSettingsEnableUpdateViaProxy", resourceCulture); + } + } + /// /// 查找类似 Exception 的本地化字符串。 /// @@ -4995,6 +4995,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Process 的本地化字符串。 + /// + public static string TbSortingProcess { + get { + return ResourceManager.GetString("TbSortingProcess", resourceCulture); + } + } + /// /// 查找类似 Time 的本地化字符串。 /// diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index cabfec36..4196c53c 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -1887,4 +1887,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if Xray Mux setting + + Process + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index a2e94ea8..c289b260 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -1879,4 +1879,7 @@ Xray Mux 设置 + + 进程 + \ No newline at end of file diff --git a/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs b/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs index c8842bff..c9f47ec2 100644 --- a/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs @@ -63,8 +63,20 @@ public partial class ClashConnectionsViewModel : MyReactiveObject var lstModel = new List(); foreach (var item in connections ?? []) { - var host = - $"{(item.metadata.host.IsNullOrEmpty() ? item.metadata.destinationIP : item.metadata.host)}:{item.metadata.destinationPort}"; + if (item.metadata == null) + { + continue; + } + var dest = item.metadata.host.IsNullOrEmpty() ? item.metadata.destinationIP : item.metadata.host; + var hostSb = new StringBuilder(); + hostSb.Append(dest); + hostSb.Append($":{item.metadata.destinationPort}"); + if (!string.IsNullOrEmpty(item.metadata.sniffHost) && + dest?.Equals(item.metadata.sniffHost, StringComparison.OrdinalIgnoreCase) == false) + { + hostSb.Append($" ({item.metadata.sniffHost})"); + } + var host = hostSb.ToString(); if (HostFilter.IsNotEmpty() && !host.Contains(HostFilter)) { continue; @@ -79,6 +91,7 @@ public partial class ClashConnectionsViewModel : MyReactiveObject Time = (dtNow - item.start).TotalSeconds < 0 ? 1 : (dtNow - item.start).TotalSeconds, Elapsed = (dtNow - item.start).ToString(@"hh\:mm\:ss"), Chain = $"{item.rule} , {string.Join("->", item.chains ?? [])}", + ProcessPath = item.metadata.processPath, }; lstModel.Add(model); diff --git a/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml b/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml index 7c92f1fa..902efa56 100644 --- a/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml @@ -93,6 +93,11 @@ Binding="{Binding Type}" Header="{x:Static resx:ResUI.TbSortingType}" Tag="Type" /> + +