feat: 增加 IPAddress 扩展
This commit is contained in:
parent
22f5907bc4
commit
d0860e57a5
|
@ -2,6 +2,9 @@
|
|||
|
||||
namespace BootstrapAdmin.Web.Components;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public partial class LoginLogSearch
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
// Website: https://www.blazor.zone or https://argozhang.github.io/
|
||||
|
||||
using System.Net;
|
||||
|
||||
namespace Microsoft.AspNetCore.Builder;
|
||||
|
||||
/// <summary>
|
||||
/// IPAddress 内部操作扩展类
|
||||
/// </summary>
|
||||
internal static class InternalIPAddressExtensions
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="address"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToIPv4String(this IPAddress? address)
|
||||
{
|
||||
var ipv4Address = (address ?? IPAddress.IPv6Loopback).ToString();
|
||||
return ipv4Address.StartsWith("::ffff:") ? (address ?? IPAddress.IPv6Loopback).MapToIPv4().ToString() : ipv4Address;
|
||||
}
|
||||
}
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
namespace BootstrapAdmin.Web.Pages.Admin;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public partial class Logins
|
||||
{
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue