API
This commit is contained in:
19
PARR.API/Services/Implementations/ClientService.cs
Normal file
19
PARR.API/Services/Implementations/ClientService.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using PARR.API.Services.Interfaces;
|
||||
using System.Net;
|
||||
|
||||
namespace PARR.API.Services.Implementations
|
||||
{
|
||||
public class ClientService : IClientService
|
||||
{
|
||||
private readonly IHttpContextAccessor httpContextAccessor;
|
||||
|
||||
public ClientService(IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
this.httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
public IPAddress? GetClientIp()
|
||||
{
|
||||
return httpContextAccessor.HttpContext?.Connection.RemoteIpAddress;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user