Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

IPGeo

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

IPGeo

This library that provides simple means of obtaining geolocation and other IP-related data from the IP Geolocation API.

Source
nugetNuGet
Version
1.0.0
Version published
Maintainers
1
Created
Source

IPGeo

Summary

This is a C# (.NET 6) library that provides simple means of obtaining geolocation and other IP-related data from the IP Geolocation API.

Status

NuGet Badge

Methods

There is one asynchronous method which return an Object containing all the relevant information for a given IP addres:

GetGeoData(string ip)

Example usage

using IPGeo;

var geoController = new GeoController();
var ipData = await geoController.GetGeoData("24.48.0.1");

if (ipData.Status == "success")
{
    Console.WriteLine($"The user with IP: {ipData.IP} is located in {ipData.City}, {ipData.Country}"); 
}
else
{
    Console.WriteLine($"The provided IP ({ipData.IP}) is invalid");
}

This will produce the following result:

The user with IP: 24.48.0.1 is located in Montreal, Canada

The IP address used in the above example comes from IP Geolocation API's Documentation.

Installation

NuGet package to come

License

Copyright © 2022 Ivan Gechev.

This package has MIT license. Refer to the LICENSE for detailed information.

Questions, comments or additions

If you have a feature request or bug report, open a new Issue or send a Pull request.

Support

If you like this project, give it a ⭐ and share it with friends!

Keywords

ip

FAQs

Package last updated on 19 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts