Skip to content

Instantly share code, notes, and snippets.

@SibeeshVenu
Last active August 12, 2023 07:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SibeeshVenu/9a016d75d5c43173e1df9bf5f55a3b9b to your computer and use it in GitHub Desktop.
Save SibeeshVenu/9a016d75d5c43173e1df9bf5f55a3b9b to your computer and use it in GitHub Desktop.
IpFilterService that implements IIpFilterService
namespace DotNetIpFilter.Services
{
/// <summary>
/// IpFilterService
/// </summary>
public class IpFilterService : IIpFilterService
{
/// <summary>
/// Logger
/// </summary>
private readonly ILogger<IpFilterService> logger;
/// <summary>
/// Initializes a new instance of the <see cref="IpFilterService"/> class.
/// </summary>
public IpFilterService(ILogger<IpFilterService> logger)
{
this.logger = logger;
}
/// <summary>
/// GetAdminSafeIpList
/// </summary>
/// <returns></returns>
public async Task<string> GetAdminSafeIpList()
{
this.logger.LogInformation($"{nameof(IpFilterService)}.{nameof(GetAdminSafeIpList)} start");
// To mimic an async call, this can be your API to get the IP addresses
await Task.Delay(1000);
var ipListArray = "127.0.0.1;192.168.1.5"; // Sample IP addresses
this.logger.LogInformation($"{nameof(IpFilterService)}.{nameof(GetAdminSafeIpList)} end");
return ipListArray;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment