mirror of
https://github.com/2dust/v2rayN.git
synced 2026-09-22 22:38:10 +03:00
Display more information for Connections (#10116)
* Display sniff host * Display process path
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -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<ConnectionItem>? connections { get; set; }
|
||||
public ulong downloadTotal { get; init; }
|
||||
public ulong uploadTotal { get; init; }
|
||||
public List<ConnectionItem>? 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<string>? 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<string>? 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; }
|
||||
}
|
||||
|
||||
Generated
+18
-9
@@ -4238,15 +4238,6 @@ namespace ServiceLib.Resx {
|
||||
return ResourceManager.GetString("TbSettingsEnableCheckPreReleaseUpdate", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Update via proxy 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsEnableUpdateViaProxy {
|
||||
get {
|
||||
return ResourceManager.GetString("TbSettingsEnableUpdateViaProxy", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Enable sorting Configurations by drag-n-drop (requires restart) 的本地化字符串。
|
||||
@@ -4284,6 +4275,15 @@ namespace ServiceLib.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Update via proxy 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsEnableUpdateViaProxy {
|
||||
get {
|
||||
return ResourceManager.GetString("TbSettingsEnableUpdateViaProxy", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Exception 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -4995,6 +4995,15 @@ namespace ServiceLib.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Process 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSortingProcess {
|
||||
get {
|
||||
return ResourceManager.GetString("TbSortingProcess", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Time 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -1887,4 +1887,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
||||
<data name="TbSettingsMux4Ray" xml:space="preserve">
|
||||
<value>Xray Mux setting</value>
|
||||
</data>
|
||||
<data name="TbSortingProcess" xml:space="preserve">
|
||||
<value>Process</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1879,4 +1879,7 @@
|
||||
<data name="TbSettingsMux4Ray" xml:space="preserve">
|
||||
<value>Xray Mux 设置</value>
|
||||
</data>
|
||||
<data name="TbSortingProcess" xml:space="preserve">
|
||||
<value>进程</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -63,8 +63,20 @@ public partial class ClashConnectionsViewModel : MyReactiveObject
|
||||
var lstModel = new List<ClashConnectionModel>();
|
||||
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);
|
||||
|
||||
@@ -93,6 +93,11 @@
|
||||
Binding="{Binding Type}"
|
||||
Header="{x:Static resx:ResUI.TbSortingType}"
|
||||
Tag="Type" />
|
||||
<DataGridTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding ProcessPath}"
|
||||
Header="{x:Static resx:ResUI.TbSortingProcess}"
|
||||
Tag="ProcessPath" />
|
||||
<DataGridTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding Elapsed}"
|
||||
|
||||
@@ -99,6 +99,11 @@
|
||||
Binding="{Binding Type}"
|
||||
ExName="Type"
|
||||
Header="{x:Static resx:ResUI.TbSortingType}" />
|
||||
<base:MyDGTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding ProcessPath}"
|
||||
ExName="ProcessPath"
|
||||
Header="{x:Static resx:ResUI.TbSortingProcess}" />
|
||||
<base:MyDGTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding Elapsed}"
|
||||
|
||||
Reference in New Issue
Block a user