Last active
August 12, 2023 07:10
-
-
Save SibeeshVenu/9a016d75d5c43173e1df9bf5f55a3b9b to your computer and use it in GitHub Desktop.
IpFilterService that implements IIpFilterService
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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