get ip v4
This commit is contained in:
@@ -24,6 +24,9 @@ namespace PARR.API.Controllers.V1
|
|||||||
public IActionResult GetMyIp()
|
public IActionResult GetMyIp()
|
||||||
{
|
{
|
||||||
var ipAddress = clientService.GetClientIp();
|
var ipAddress = clientService.GetClientIp();
|
||||||
|
|
||||||
|
//var ipV4 = ipAddress?.MapToIPv4();
|
||||||
|
|
||||||
var ip = ipAddress?.ToString();
|
var ip = ipAddress?.ToString();
|
||||||
|
|
||||||
return Ok(new Response<object>(new { ip }, true));
|
return Ok(new Response<object>(new { ip }, true));
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace PARR.API.Services.Implementations
|
|||||||
}
|
}
|
||||||
public IPAddress? GetClientIp()
|
public IPAddress? GetClientIp()
|
||||||
{
|
{
|
||||||
return httpContextAccessor.HttpContext?.Connection.RemoteIpAddress;
|
return httpContextAccessor.HttpContext?.Connection.RemoteIpAddress?.MapToIPv4();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user