| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.Json.Serialization;
- namespace NetworkTool.Client.Models;
- public sealed class RemoteInterfaceAddress
- {
- [JsonPropertyName("address")]
- public string Address { get; init; } = string.Empty;
- [JsonPropertyName("prefix")]
- public int Prefix { get; init; }
- [JsonPropertyName("source")]
- public string Source { get; init; } = string.Empty;
- }
- public sealed class RemoteInterfaceInfo
- {
- [JsonPropertyName("name")]
- public string Name { get; init; } = string.Empty;
- [JsonPropertyName("system_name")]
- public string SystemName { get; init; } = string.Empty;
- [JsonPropertyName("role")]
- public string Role { get; init; } = string.Empty;
- [JsonPropertyName("link_up")]
- public bool LinkUp { get; init; }
- [JsonPropertyName("is_management_interface")]
- public bool IsManagementInterface { get; init; }
- [JsonPropertyName("is_suggested_target")]
- public bool IsSuggestedTarget { get; init; }
- [JsonPropertyName("mac")]
- public string Mac { get; init; } = string.Empty;
- [JsonPropertyName("gateway")]
- public string Gateway { get; init; } = string.Empty;
- [JsonPropertyName("dns")]
- public IReadOnlyList<string> Dns { get; init; } = [];
- [JsonPropertyName("ipv4")]
- public IReadOnlyList<RemoteInterfaceAddress> IPv4 { get; init; } = [];
- public string IPv4Summary => IPv4.Count == 0
- ? "无"
- : string.Join("; ", IPv4.Select(item => $"{item.Address}/{item.Prefix}"));
- public string DisplayName => $"{Name} / {SystemName} / {(LinkUp ? "已连接" : "未连接")}";
- }
- public sealed class RemoteInterfacesInfo
- {
- [JsonPropertyName("management_interface")]
- public string ManagementInterface { get; init; } = string.Empty;
- [JsonPropertyName("suggested_target_interface")]
- public string SuggestedTargetInterface { get; init; } = string.Empty;
- [JsonPropertyName("requires_target_selection")]
- public bool RequiresTargetSelection { get; init; }
- [JsonPropertyName("interfaces")]
- public IReadOnlyList<RemoteInterfaceInfo> Interfaces { get; init; } = [];
- }
|