GithubHelp home page GithubHelp logo

drozhkov / ipdata Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ipdata/dotnet

0.0 1.0 0.0 108 KB

C#(CSharp) library to gather information for an ip using ipdata.co

Home Page: https://ipdata.co

License: MIT License

C# 86.67% PowerShell 9.52% Shell 3.81%
ipdata csharp dotnet dotnet-standard api

ipdata's Introduction

Ip Data Logo

IpData License: MIT IpData

ipdata.co is a fast, reliable and clean service that allows you to look up the location of an IP Address and other data.

Branch Platform Status Coverage
Master Linux\Windows\macOS Build Status Coverage Status
Develop Linux\Windows\macOS Build Status Coverage Status

Table of Content

Installing

NuGet package install using package manager:

Install-Package IpData -Version 1.1.0

NuGet package install using .NET CLI:

dotnet add package IpData --version 1.1.0

Usage

All usage examples you can find on samples folder.

Basic Lookup

var client = new IpDataClient("API_KEY");

// Get ip data from my ip
var myIpInfo = await client.Lookup();
Console.WriteLine($"Country name for {myIpInfo.Ip} is {myIpInfo.CountryName}");

// Get localized ip data from my ip
var myIpInfoLocalized = await client.Lookup(CultureInfo.GetCultureInfo("zh-CN"));
Console.WriteLine($"Localized country name for {myIpInfoLocalized.Ip} is {myIpInfoLocalized.CountryName}");

// Get ip data from ip
var ipInfo = await client.Lookup("8.8.8.8");
Console.WriteLine($"Country name for {ipInfo.Ip} is {ipInfo.CountryName}");

// Get localized ip data from ip
var ipInfoLocalized = await client.Lookup("8.8.8.8", CultureInfo.GetCultureInfo("zh-CN"));
Console.WriteLine($"Localized country name for {myIpInfoLocalized.Ip} is {ipInfoLocalized.CountryName}");

// Get single field from ip
var countryName = await client.Lookup("8.8.8.8", x => x.CountryName);
Console.WriteLine($"Country name for 8.8.8.8 is {countryName}");

Bulk Lookup

From ipdata.co docs:

Note that bulk lookups are only available to paid users and are currently limited to a 100 at a time. Reach out to support if you need to lookup larger batches.

var client = new IpDataClient("API_KEY");

var ipInfoList = await client.Lookup(new string[] { "1.1.1.1", "2.2.2.2", "3.3.3.3" });
foreach (var ipInfo in ipInfoList)
{
    Console.WriteLine($"Country name for {ipInfo.Ip} is {ipInfo.CountryName}");
}

Carrier Lookup

var client = new IpDataClient("API_KEY");

var carrierInfo = await client.Carrier("69.78.70.144");
Console.WriteLine($"Carrier name: {carrierInfo.Name}");

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

ipdata's People

Contributors

alexkhil avatar gloomman avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.