⚠ Deprecated: Other
Package IpLocate is deprecated and longer maintained. Use IPLocateIO.Client instead.
Suggested alternative: IPLocateIO.Client
Simple client for the IPLocate API
$ dotnet add package IpLocateA C# client for the IPLocate.io geolocation API. Look up detailed geolocation and threat intelligence data for any IP address:
See what information we can provide for your IP address.
You can make 1,000 free requests per day with a free account. For higher plans, check out API pricing.
dotnet add package IpLocate
Get your free API key from IPLocate.io, and pass it to the IPLocateClient constructor:
IPLocateClient client = IpLocateClientFactory.Client("YOUR_API_KEY");
using IpLocate;
var client = IpLocateClientFactory.Client("YOUR_API_KEY");
var result = await client.LookupCurrentIpAsync();
Console.WriteLine($"IP: {result.Ip}, Country: {result.Country}");
services.AddHttpClient<IPLocateClient>((sp, http) =>
{
var opts = sp.GetRequiredService<IOptions<MyApiOptions>>();
http.BaseAddress = new Uri(opts.Value.BaseUrl);
http.DefaultRequestHeaders.Add("X-Api-Key", opts.Value.ApiKey);
http.DefaultRequestHeaders.Add("Accept", "application/json");
http.DefaultRequestHeaders.Add("User-Agent", "IPLocateClient-OkHttp/1.0.0");
});
For complete API documentation, visit iplocate.io/docs.
This project is licensed under the MIT License - see the LICENSE file for details
To run tests for this C# library:
dotnet test