611 lines
21 KiB
C#
611 lines
21 KiB
C#
using System.Net;
|
||
using Microsoft.AspNetCore.Authorization;
|
||
using Microsoft.AspNetCore.Cors;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
using Peripherals.NetConfigClient;
|
||
|
||
namespace server.Controllers;
|
||
|
||
/// <summary>
|
||
/// 网络配置控制器(仅管理员权限)
|
||
/// </summary>
|
||
[ApiController]
|
||
[Route("api/[controller]")]
|
||
[Authorize("Admin")]
|
||
public class NetConfigController : ControllerBase
|
||
{
|
||
private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||
|
||
// 固定的实验板IP和端口
|
||
private const string BOARD_IP = "169.254.109.0";
|
||
private const int BOARD_PORT = 1234;
|
||
|
||
/// <summary>
|
||
/// 获取主机IP地址
|
||
/// </summary>
|
||
/// <returns>主机IP地址</returns>
|
||
[HttpGet("GetHostIP")]
|
||
[EnableCors("Users")]
|
||
[ProducesResponseType(typeof(string), StatusCodes.Status200OK)]
|
||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||
public async Task<IActionResult> GetHostIP()
|
||
{
|
||
try
|
||
{
|
||
var netConfig = new NetConfig(BOARD_IP, BOARD_PORT, 0);
|
||
var result = await netConfig.GetHostIP();
|
||
|
||
if (!result.IsSuccessful)
|
||
{
|
||
logger.Error($"获取主机IP失败: {result.Error}");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, $"获取失败: {result.Error}");
|
||
}
|
||
|
||
return Ok(result.Value);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
logger.Error(ex, "获取主机IP时发生异常");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, "获取失败,请稍后重试");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取板卡IP地址
|
||
/// </summary>
|
||
/// <returns>板卡IP地址</returns>
|
||
[HttpGet("GetBoardIP")]
|
||
[EnableCors("Users")]
|
||
[ProducesResponseType(typeof(string), StatusCodes.Status200OK)]
|
||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||
public async Task<IActionResult> GetBoardIP()
|
||
{
|
||
try
|
||
{
|
||
var netConfig = new NetConfig(BOARD_IP, BOARD_PORT, 0);
|
||
var result = await netConfig.GetBoardIP();
|
||
|
||
if (!result.IsSuccessful)
|
||
{
|
||
logger.Error($"获取板卡IP失败: {result.Error}");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, $"获取失败: {result.Error}");
|
||
}
|
||
|
||
return Ok(result.Value);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
logger.Error(ex, "获取板卡IP时发生异常");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, "获取失败,请稍后重试");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取主机MAC地址
|
||
/// </summary>
|
||
/// <returns>主机MAC地址</returns>
|
||
[HttpGet("GetHostMAC")]
|
||
[EnableCors("Users")]
|
||
[ProducesResponseType(typeof(string), StatusCodes.Status200OK)]
|
||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||
public async Task<IActionResult> GetHostMAC()
|
||
{
|
||
try
|
||
{
|
||
var netConfig = new NetConfig(BOARD_IP, BOARD_PORT, 0);
|
||
var result = await netConfig.GetHostMAC();
|
||
|
||
if (!result.IsSuccessful)
|
||
{
|
||
logger.Error($"获取主机MAC地址失败: {result.Error}");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, $"获取失败: {result.Error}");
|
||
}
|
||
|
||
return Ok(result.Value);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
logger.Error(ex, "获取主机MAC地址时发生异常");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, "获取失败,请稍后重试");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取板卡MAC地址
|
||
/// </summary>
|
||
/// <returns>板卡MAC地址</returns>
|
||
[HttpGet("GetBoardMAC")]
|
||
[EnableCors("Users")]
|
||
[ProducesResponseType(typeof(string), StatusCodes.Status200OK)]
|
||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||
public async Task<IActionResult> GetBoardMAC()
|
||
{
|
||
try
|
||
{
|
||
var netConfig = new NetConfig(BOARD_IP, BOARD_PORT, 0);
|
||
var result = await netConfig.GetBoardMAC();
|
||
|
||
if (!result.IsSuccessful)
|
||
{
|
||
logger.Error($"获取板卡MAC地址失败: {result.Error}");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, $"获取失败: {result.Error}");
|
||
}
|
||
|
||
return Ok(result.Value);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
logger.Error(ex, "获取板卡MAC地址时发生异常");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, "获取失败,请稍后重试");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取所有网络配置信息
|
||
/// </summary>
|
||
/// <returns>网络配置信息</returns>
|
||
[HttpGet("GetNetworkConfig")]
|
||
[EnableCors("Users")]
|
||
[ProducesResponseType(typeof(NetworkConfigDto), StatusCodes.Status200OK)]
|
||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||
public async Task<IActionResult> GetNetworkConfig()
|
||
{
|
||
try
|
||
{
|
||
var netConfig = new NetConfig(BOARD_IP, BOARD_PORT, 0);
|
||
|
||
var hostIPResult = await netConfig.GetHostIP();
|
||
var boardIPResult = await netConfig.GetBoardIP();
|
||
var hostMACResult = await netConfig.GetHostMAC();
|
||
var boardMACResult = await netConfig.GetBoardMAC();
|
||
|
||
var config = new NetworkConfigDto
|
||
{
|
||
HostIP = hostIPResult.IsSuccessful ? hostIPResult.Value : "获取失败",
|
||
BoardIP = boardIPResult.IsSuccessful ? boardIPResult.Value : "获取失败",
|
||
HostMAC = hostMACResult.IsSuccessful ? hostMACResult.Value : "获取失败",
|
||
BoardMAC = boardMACResult.IsSuccessful ? boardMACResult.Value : "获取失败"
|
||
};
|
||
|
||
return Ok(config);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
logger.Error(ex, "获取网络配置信息时发生异常");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, "获取失败,请稍后重试");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取本机所有网络接口信息
|
||
/// </summary>
|
||
/// <returns>网络接口信息列表</returns>
|
||
[HttpGet("GetLocalNetworkInterfaces")]
|
||
[EnableCors("Users")]
|
||
[ProducesResponseType(typeof(List<NetworkInterfaceDto>), StatusCodes.Status200OK)]
|
||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||
public IActionResult GetLocalNetworkInterfaces()
|
||
{
|
||
try
|
||
{
|
||
var interfaces = System.Net.NetworkInformation.NetworkInterface
|
||
.GetAllNetworkInterfaces()
|
||
.Where(nic => nic.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up
|
||
&& nic.NetworkInterfaceType != System.Net.NetworkInformation.NetworkInterfaceType.Loopback)
|
||
.Select(nic => new NetworkInterfaceDto
|
||
{
|
||
Name = nic.Name,
|
||
Description = nic.Description,
|
||
Type = nic.NetworkInterfaceType.ToString(),
|
||
Status = nic.OperationalStatus.ToString(),
|
||
IPAddresses = nic.GetIPProperties().UnicastAddresses
|
||
.Where(addr => addr.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||
.Select(addr => addr.Address.ToString())
|
||
.ToList(),
|
||
MACAddress = nic.GetPhysicalAddress().ToString()
|
||
})
|
||
.ToList();
|
||
|
||
return Ok(interfaces);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
logger.Error(ex, "获取本机网络接口信息时发生异常");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, "获取失败,请稍后重试");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 设置主机IP地址
|
||
/// </summary>
|
||
/// <param name="hostIp">主机IP地址</param>
|
||
/// <returns>操作结果</returns>
|
||
[HttpPost("SetHostIP")]
|
||
[EnableCors("Users")]
|
||
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
|
||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||
public async Task<IActionResult> SetHostIP(string hostIp)
|
||
{
|
||
if (string.IsNullOrWhiteSpace(hostIp))
|
||
return BadRequest("主机IP地址不能为空");
|
||
|
||
if (!IPAddress.TryParse(hostIp, out var hostIpAddress))
|
||
return BadRequest("主机IP地址格式不正确");
|
||
|
||
try
|
||
{
|
||
// 创建网络配置客户端
|
||
var netConfig = new NetConfig(BOARD_IP, BOARD_PORT, 0);
|
||
var result = await netConfig.SetHostIP(hostIpAddress);
|
||
|
||
if (!result.IsSuccessful)
|
||
{
|
||
logger.Error($"设置主机IP失败: {result.Error}");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, $"设置失败: {result.Error}");
|
||
}
|
||
|
||
return Ok(result.Value);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
logger.Error(ex, "设置主机IP时发生异常");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, "设置失败,请稍后重试");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 设置板卡IP地址
|
||
/// </summary>
|
||
/// <param name="newBoardIp">新的板卡IP地址</param>
|
||
/// <returns>操作结果</returns>
|
||
[HttpPost("SetBoardIP")]
|
||
[EnableCors("Users")]
|
||
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
|
||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||
public async Task<IActionResult> SetBoardIP(string newBoardIp)
|
||
{
|
||
if (string.IsNullOrWhiteSpace(newBoardIp))
|
||
return BadRequest("新的板卡IP地址不能为空");
|
||
|
||
if (!IPAddress.TryParse(newBoardIp, out var newIpAddress))
|
||
return BadRequest("新的板卡IP地址格式不正确");
|
||
|
||
try
|
||
{
|
||
// 创建网络配置客户端
|
||
var netConfig = new NetConfig(BOARD_IP, BOARD_PORT, 0);
|
||
var result = await netConfig.SetBoardIP(newIpAddress);
|
||
|
||
if (!result.IsSuccessful)
|
||
{
|
||
logger.Error($"设置板卡IP失败: {result.Error}");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, $"设置失败: {result.Error}");
|
||
}
|
||
|
||
return Ok(result.Value);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
logger.Error(ex, "设置板卡IP时发生异常");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, "设置失败,请稍后重试");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 设置主机MAC地址
|
||
/// </summary>
|
||
/// <param name="hostMac">主机MAC地址(格式:AA:BB:CC:DD:EE:FF)</param>
|
||
/// <returns>操作结果</returns>
|
||
[HttpPost("SetHostMAC")]
|
||
[EnableCors("Users")]
|
||
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
|
||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||
public async Task<IActionResult> SetHostMAC(string hostMac)
|
||
{
|
||
if (string.IsNullOrWhiteSpace(hostMac))
|
||
return BadRequest("主机MAC地址不能为空");
|
||
|
||
// 解析MAC地址
|
||
if (!TryParseMacAddress(hostMac, out var macBytes))
|
||
return BadRequest("MAC地址格式不正确,请使用格式:AA:BB:CC:DD:EE:FF");
|
||
|
||
try
|
||
{
|
||
// 创建网络配置客户端
|
||
var netConfig = new NetConfig(BOARD_IP, BOARD_PORT, 0);
|
||
var result = await netConfig.SetHostMAC(macBytes);
|
||
|
||
if (!result.IsSuccessful)
|
||
{
|
||
logger.Error($"设置主机MAC地址失败: {result.Error}");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, $"设置失败: {result.Error}");
|
||
}
|
||
|
||
return Ok(result.Value);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
logger.Error(ex, "设置主机MAC地址时发生异常");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, "设置失败,请稍后重试");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 自动获取本机IP地址并设置为实验板主机IP
|
||
/// </summary>
|
||
/// <returns>操作结果</returns>
|
||
[HttpPost("UpdateHostIP")]
|
||
[EnableCors("Users")]
|
||
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
|
||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||
public async Task<IActionResult> UpdateHostIP()
|
||
{
|
||
try
|
||
{
|
||
// 获取本机第一个有效的IPv4地址
|
||
var ip = System.Net.NetworkInformation.NetworkInterface
|
||
.GetAllNetworkInterfaces()
|
||
.Where(nic => nic.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up
|
||
&& nic.NetworkInterfaceType != System.Net.NetworkInformation.NetworkInterfaceType.Loopback)
|
||
.SelectMany(nic => nic.GetIPProperties().UnicastAddresses)
|
||
.Where(addr => addr.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||
.Select(addr => addr.Address)
|
||
.FirstOrDefault();
|
||
|
||
if (ip == null)
|
||
return StatusCode(StatusCodes.Status500InternalServerError, "无法获取本机IP地址");
|
||
|
||
var netConfig = new NetConfig(BOARD_IP, BOARD_PORT, 0);
|
||
var result = await netConfig.SetHostIP(ip);
|
||
|
||
if (!result.IsSuccessful)
|
||
{
|
||
logger.Error($"自动设置主机IP失败: {result.Error}");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, $"设置失败: {result.Error}");
|
||
}
|
||
|
||
return Ok(result.Value);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
logger.Error(ex, "自动设置主机IP时发生异常");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, "设置失败,请稍后重试");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新主机MAC地址
|
||
/// </summary>
|
||
/// <returns>操作结果</returns>
|
||
[HttpPost("UpdateHostMAC")]
|
||
[EnableCors("Users")]
|
||
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
|
||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||
public async Task<IActionResult> UpdateHostMAC()
|
||
{
|
||
byte[]? macBytes = null;
|
||
try
|
||
{
|
||
// 获取本机第一个可用的MAC地址
|
||
macBytes = System.Net.NetworkInformation.NetworkInterface
|
||
.GetAllNetworkInterfaces()
|
||
.Where(nic => nic.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up
|
||
&& nic.NetworkInterfaceType != System.Net.NetworkInformation.NetworkInterfaceType.Loopback)
|
||
.Select(nic => nic.GetPhysicalAddress()?.GetAddressBytes())
|
||
.FirstOrDefault(bytes => bytes != null && bytes.Length == 6);
|
||
|
||
if (macBytes == null)
|
||
return StatusCode(StatusCodes.Status500InternalServerError, "无法获取本机MAC地址");
|
||
|
||
// 创建网络配置客户端
|
||
var netConfig = new NetConfig(BOARD_IP, BOARD_PORT, 0);
|
||
var result = await netConfig.SetHostMAC(macBytes);
|
||
|
||
if (!result.IsSuccessful)
|
||
{
|
||
logger.Error($"设置主机MAC地址失败: {result.Error}");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, $"设置失败: {result.Error}");
|
||
}
|
||
|
||
return Ok(result.Value);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
logger.Error(ex, "设置主机MAC地址时发生异常");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, "设置失败,请稍后重试");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 设置板卡MAC地址
|
||
/// </summary>
|
||
/// <param name="boardMac">板卡MAC地址(格式:AA:BB:CC:DD:EE:FF)</param>
|
||
/// <returns>操作结果</returns>
|
||
[HttpPost("SetBoardMAC")]
|
||
[EnableCors("Users")]
|
||
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
|
||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||
public async Task<IActionResult> SetBoardMAC(string boardMac)
|
||
{
|
||
if (string.IsNullOrWhiteSpace(boardMac))
|
||
return BadRequest("板卡MAC地址不能为空");
|
||
|
||
// 解析MAC地址
|
||
if (!TryParseMacAddress(boardMac, out var macBytes))
|
||
return BadRequest("MAC地址格式不正确,请使用格式:AA:BB:CC:DD:EE:FF");
|
||
|
||
try
|
||
{
|
||
// 创建网络配置客户端
|
||
var netConfig = new NetConfig(BOARD_IP, BOARD_PORT, 0);
|
||
var result = await netConfig.SetBoardMAC(macBytes);
|
||
|
||
if (!result.IsSuccessful)
|
||
{
|
||
logger.Error($"设置板卡MAC地址失败: {result.Error}");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, $"设置失败: {result.Error}");
|
||
}
|
||
|
||
return Ok(result.Value);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
logger.Error(ex, "设置板卡MAC地址时发生异常");
|
||
return StatusCode(StatusCodes.Status500InternalServerError, "设置失败,请稍后重试");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 解析MAC地址字符串为字节数组
|
||
/// </summary>
|
||
/// <param name="macAddress">MAC地址字符串</param>
|
||
/// <param name="macBytes">解析后的字节数组</param>
|
||
/// <returns>是否解析成功</returns>
|
||
private static bool TryParseMacAddress(string macAddress, out byte[] macBytes)
|
||
{
|
||
macBytes = Array.Empty<byte>();
|
||
|
||
if (string.IsNullOrWhiteSpace(macAddress))
|
||
return false;
|
||
|
||
// 移除可能的分隔符并统一为冒号
|
||
var cleanMac = macAddress.Replace("-", ":").Replace(" ", "").ToUpper();
|
||
|
||
// 验证格式
|
||
if (cleanMac.Length != 17 || cleanMac.Count(c => c == ':') != 5)
|
||
return false;
|
||
|
||
var parts = cleanMac.Split(':');
|
||
if (parts.Length != 6)
|
||
return false;
|
||
|
||
try
|
||
{
|
||
macBytes = new byte[6];
|
||
for (int i = 0; i < 6; i++)
|
||
{
|
||
macBytes[i] = Convert.ToByte(parts[i], 16);
|
||
}
|
||
return true;
|
||
}
|
||
catch
|
||
{
|
||
macBytes = Array.Empty<byte>();
|
||
return false;
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 网络配置数据传输对象
|
||
/// </summary>
|
||
public class NetworkConfigDto
|
||
{
|
||
/// <summary>
|
||
/// 主机IP地址
|
||
/// </summary>
|
||
public string? HostIP { get; set; }
|
||
|
||
/// <summary>
|
||
/// 板卡IP地址
|
||
/// </summary>
|
||
public string? BoardIP { get; set; }
|
||
|
||
/// <summary>
|
||
/// 主机MAC地址
|
||
/// </summary>
|
||
public string? HostMAC { get; set; }
|
||
|
||
/// <summary>
|
||
/// 板卡MAC地址
|
||
/// </summary>
|
||
public string? BoardMAC { get; set; }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 网络配置操作结果
|
||
/// </summary>
|
||
public class NetworkConfigResult
|
||
{
|
||
/// <summary>
|
||
/// 主机IP设置结果
|
||
/// </summary>
|
||
public bool? HostIPResult { get; set; }
|
||
|
||
/// <summary>
|
||
/// 主机IP设置错误信息
|
||
/// </summary>
|
||
public string? HostIPError { get; set; }
|
||
|
||
/// <summary>
|
||
/// 板卡IP设置结果
|
||
/// </summary>
|
||
public bool? BoardIPResult { get; set; }
|
||
|
||
/// <summary>
|
||
/// 板卡IP设置错误信息
|
||
/// </summary>
|
||
public string? BoardIPError { get; set; }
|
||
|
||
/// <summary>
|
||
/// 主机MAC设置结果
|
||
/// </summary>
|
||
public bool? HostMACResult { get; set; }
|
||
|
||
/// <summary>
|
||
/// 主机MAC设置错误信息
|
||
/// </summary>
|
||
public string? HostMACError { get; set; }
|
||
|
||
/// <summary>
|
||
/// 板卡MAC设置结果
|
||
/// </summary>
|
||
public bool? BoardMACResult { get; set; }
|
||
|
||
/// <summary>
|
||
/// 板卡MAC设置错误信息
|
||
/// </summary>
|
||
public string? BoardMACError { get; set; }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 网络接口信息数据传输对象
|
||
/// </summary>
|
||
public class NetworkInterfaceDto
|
||
{
|
||
/// <summary>
|
||
/// 网络接口名称
|
||
/// </summary>
|
||
public string Name { get; set; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 网络接口描述
|
||
/// </summary>
|
||
public string Description { get; set; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 网络接口类型
|
||
/// </summary>
|
||
public string Type { get; set; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 网络接口状态
|
||
/// </summary>
|
||
public string Status { get; set; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// IP地址列表
|
||
/// </summary>
|
||
public List<string> IPAddresses { get; set; } = new();
|
||
|
||
/// <summary>
|
||
/// MAC地址
|
||
/// </summary>
|
||
public string MACAddress { get; set; } = string.Empty;
|
||
}
|