Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Describe the big picture of your changes here to communicate to the maintainers

## Types of changes

What types of changes does your code introduce to IpData?
What types of changes does your code introduce to IPData?
_Put an `x` in the boxes that apply_

- [ ] Bugfix (non-breaking change which fixes an issue)
Expand All @@ -15,7 +15,7 @@ _Put an `x` in the boxes that apply_

_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._

- [ ] I have read the [CONTRIBUTING](https://github.com/alexkhil/IpData/blob/master/.github/CONTRIBUTING.md) doc
- [ ] I have read the [CONTRIBUTING](https://github.com/alexkhil/IPData/blob/master/.github/CONTRIBUTING.md) doc
- [ ] Lint and unit tests pass locally with my changes
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)
Expand Down
82 changes: 63 additions & 19 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

# ipdata
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/alexkhil/IpData/blob/master/LICENSE) [![IpData](https://img.shields.io/nuget/v/IpData.svg)](https://www.nuget.org/packages/IpData/) [![Build Status](https://dev.azure.com/alexkhildev/IpData/_apis/build/status/outer-loop?branchName=master)](https://dev.azure.com/alexkhildev/IpData/_build/latest?definitionId=4?branchName=master) [![Coverage Status](https://img.shields.io/azure-devops/coverage/alexkhildev/ipdata/4/master)](https://img.shields.io/azure-devops/coverage/alexkhildev/ipdata/4/master)
# ipdata
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/alexkhil/IPData/blob/master/LICENSE) [![IPData](https://img.shields.io/nuget/v/IPData.svg)](https://www.nuget.org/packages/IPData/)

> **v3.0.0 Breaking Changes** — All public types have been renamed to follow .NET naming conventions for two-letter acronyms. See the [Migration Guide](#migrating-from-v2-to-v3) for details.

[ipdata.co](https://ipdata.co/) is a fast, reliable and clean service that allows you to look up the location of an IP Address and other data.

Expand All @@ -17,6 +19,7 @@
- [Currency](#currency)
- [Threat](#threat)
- [EU Endpoint](#eu-endpoint)
- [Migrating from v2 to v3](#migrating-from-v2-to-v3)
- [Contributing](#contributing)
- [Versioning](#versioning)
- [License](#license)
Expand All @@ -26,13 +29,13 @@
NuGet package install using package manager:

```bash
Install-Package IpData -Version 2.0.1
Install-Package IPData -Version 3.0.0
```

NuGet package install using .NET CLI:

```bash
dotnet add package IpData --version 2.0.1
dotnet add package IPData --version 3.0.0
```

## Lookup
Expand All @@ -42,11 +45,11 @@ All usage examples you can find on `samples` folder.
### Basic

```csharp
var client = new IpDataClient("API_KEY");
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}");
var myIp = await client.Lookup();
Console.WriteLine($"Country name for {myIp.Ip} is {myIp.CountryName}");

// Get IP data from IP
var ipInfo = await client.Lookup("8.8.8.8");
Expand All @@ -67,7 +70,7 @@ 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.

```csharp
var client = new IpDataClient("API_KEY");
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)
Expand All @@ -79,7 +82,7 @@ foreach (var ipInfo in ipInfoList)
### Carrier

```csharp
var client = new IpDataClient("API_KEY");
var client = new IPDataClient("API_KEY");

var carrierInfo = await client.Carrier("69.78.70.144");
Console.WriteLine($"Carrier name: {carrierInfo.Name}");
Expand All @@ -88,7 +91,7 @@ Console.WriteLine($"Carrier name: {carrierInfo.Name}");
### Company

```csharp
var client = new IpDataClient("API_KEY");
var client = new IPDataClient("API_KEY");

var companyInfo = await client.Company("69.78.70.144");
Console.WriteLine($"Company name: {companyInfo.Name}");
Expand All @@ -97,7 +100,7 @@ Console.WriteLine($"Company name: {companyInfo.Name}");
### ASN

```csharp
var client = new IpDataClient("API_KEY");
var client = new IPDataClient("API_KEY");

var asnInfo = await client.Asn("69.78.70.144");
Console.WriteLine($"ASN name: {asnInfo.Name}");
Expand All @@ -106,7 +109,7 @@ Console.WriteLine($"ASN name: {asnInfo.Name}");
### Timezone

```csharp
var client = new IpDataClient("API_KEY");
var client = new IPDataClient("API_KEY");

var timezoneInfo = await client.TimeZone("69.78.70.144");
Console.WriteLine($"TimeZone name: {timezoneInfo.Name}");
Expand All @@ -115,7 +118,7 @@ Console.WriteLine($"TimeZone name: {timezoneInfo.Name}");
### Currency

```csharp
var client = new IpDataClient("API_KEY");
var client = new IPDataClient("API_KEY");

var currencyInfo = await client.Currency("69.78.70.144");
Console.WriteLine($"Currency name: {currencyInfo.Name}");
Expand All @@ -124,7 +127,7 @@ Console.WriteLine($"Currency name: {currencyInfo.Name}");
### Threat

```csharp
var client = new IpDataClient("API_KEY");
var client = new IPDataClient("API_KEY");

var threatInfo = await client.Threat("69.78.70.144");
Console.WriteLine($"Threat is Tor: {threatInfo.IsTor}");
Expand All @@ -135,11 +138,52 @@ Console.WriteLine($"Threat is Tor: {threatInfo.IsTor}");
To ensure your data stays in the EU, use the EU endpoint by passing a custom base URL:

```csharp
var client = new IpDataClient("API_KEY", new Uri("https://eu-api.ipdata.co"));
var client = new IPDataClient("API_KEY", new Uri("https://eu-api.ipdata.co"));

var ipInfo = await client.Lookup("8.8.8.8");
```

## Migrating from v2 to v3

v3.0.0 renames all public types to follow [.NET naming conventions](https://learn.microsoft.com/en-us/dotnet/standard/design-guidelines/capitalization-conventions) for two-letter acronyms. It also adds EU endpoint support and a `Company` lookup.

### Renamed types

| v2 | v3 |
|---|---|
| `IpDataClient` | `IPDataClient` |
| `IIpDataClient` | `IIPDataClient` |
| `IpInfo` | `IPLookupResult` |

### Namespace change

```diff
- using IpData;
- using IpData.Models;
+ using IPData;
+ using IPData.Models;
```

### NuGet package

The package ID has changed from `IpData` to `IPData`:

```bash
dotnet remove package IpData
dotnet add package IPData --version 3.0.0
```

### New features in v3

- **EU endpoint** — Pass a custom base URL to route requests through EU servers:
```csharp
var client = new IPDataClient("API_KEY", new Uri("https://eu-api.ipdata.co"));
```
- **Company lookup** — Fetch company info for an IP:
```csharp
var companyInfo = await client.Company("8.8.8.8");
```

## Contributing

Please read [CONTRIBUTING.md][CONTRIBUTING] for details on our code of conduct, and the process for submitting pull requests to us.
Expand All @@ -153,8 +197,8 @@ We use [SemVer] for versioning. For the versions available, see the tags on this
This project is licensed under the MIT License - see the [LICENSE.md][LICENSE] file for details


[AzureStatus]: https://dev.azure.com/alexkhildev/IpData/_apis/build/status/gated?branchName=master
[IpDataLogo]: https://image.ibb.co/iDQdUS/ipdatalogo.png
[AzureStatus]: https://dev.azure.com/alexkhildev/IPData/_apis/build/status/gated?branchName=master
[IPDataLogo]: https://image.ibb.co/iDQdUS/ipdatalogo.png
[SemVer]: http://semver.org/
[CONTRIBUTING]: https://github.com/alexkhil/IpData/blob/master/.github/CONTRIBUTING.md
[LICENSE]: https://github.com/alexkhil/IpData/blob/master/LICENSE
[CONTRIBUTING]: https://github.com/alexkhil/IPData/blob/master/.github/CONTRIBUTING.md
[LICENSE]: https://github.com/alexkhil/IPData/blob/master/LICENSE
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --configuration Release --no-restore

- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish to NuGet

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --configuration Release --no-restore

- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal

- name: Pack
run: dotnet pack src/IPData/IPData.csproj --configuration Release --no-build --output ./nupkg

- name: Publish to NuGet
run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
52 changes: 5 additions & 47 deletions IpData.sln → IPData.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28902.138
Expand All @@ -9,43 +9,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{E961
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0FD24B4A-2B2B-4DCC-88F4-F13398F0CB18}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{CFFA9471-EC37-451E-BA20-3DA090F0A683}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tasks", "Tasks", "{C0FF3B0D-BE20-4F54-ACD3-D8B45CAD5B57}"
ProjectSection(SolutionItems) = preProject
build\cake\Tasks\build.cake = build\cake\Tasks\build.cake
build\cake\Tasks\clean.cake = build\cake\Tasks\clean.cake
build\cake\Tasks\create-nuget-package.cake = build\cake\Tasks\create-nuget-package.cake
build\cake\Tasks\default.cake = build\cake\Tasks\default.cake
build\cake\Tasks\publish-nuget-package.cake = build\cake\Tasks\publish-nuget-package.cake
build\cake\Tasks\restore-nuget-packages.cake = build\cake\Tasks\restore-nuget-packages.cake
build\cake\Tasks\run-unit-tests.cake = build\cake\Tasks\run-unit-tests.cake
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cake", "cake", "{5CF04261-17B9-44F2-AD3F-C19C92796442}"
ProjectSection(SolutionItems) = preProject
build\cake\build.cake = build\cake\build.cake
build\cake\build.ps1 = build\cake\build.ps1
build\cake\build.sh = build\cake\build.sh
build\cake\cake.config = build\cake\cake.config
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Unit", "Unit", "{6F037AC1-A8B5-4D89-B33A-BCDDB78553A6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IpData", "src\IpData\IpData.csproj", "{7EE175C0-1309-4AA7-BC80-2F01A3855D9A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IpData.Tests", "test\Unit\IpData.Tests\IpData.Tests.csproj", "{65B7BCF3-82C8-480E-ADC3-B45DD67BD565}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{049BFCD0-AD71-4357-91CF-62CC03D8FB39}"
ProjectSection(SolutionItems) = preProject
build\cake\tools\packages.config = build\cake\tools\packages.config
EndProjectSection
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IPData", "src\IPData\IPData.csproj", "{7EE175C0-1309-4AA7-BC80-2F01A3855D9A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "azure-devops", "azure-devops", "{3A111F6A-56C3-4952-B45F-5CDA714D059F}"
ProjectSection(SolutionItems) = preProject
build\azure-devops\gated.yaml = build\azure-devops\gated.yaml
build\azure-devops\outer-loop.yaml = build\azure-devops\outer-loop.yaml
EndProjectSection
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IPData.Tests", "test\Unit\IPData.Tests\IPData.Tests.csproj", "{65B7BCF3-82C8-480E-ADC3-B45DD67BD565}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{3B7FCB46-B3B6-41EF-9495-3FA4D027E3FC}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -61,19 +29,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ISSUE_TEMPLATE", "ISSUE_TEM
.github\ISSUE_TEMPLATE\Feature_request.md = .github\ISSUE_TEMPLATE\Feature_request.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utils", "Utils", "{4C55C81D-E924-4BA9-9A6C-92B74EC4F7AE}"
ProjectSection(SolutionItems) = preProject
build\cake\Utils\paths.cake = build\cake\Utils\paths.cake
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{70F5FBDA-9DAA-4675-938E-EC6E450852CE}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
LICENSE = LICENSE
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IpData.Lookup", "samples\IpData.Lookup\IpData.Lookup.csproj", "{3546F4B5-7D43-4332-914A-6A657D95CEB1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IPData.Lookup", "samples\IPData.Lookup\IPData.Lookup.csproj", "{3546F4B5-7D43-4332-914A-6A657D95CEB1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -98,15 +61,10 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C0FF3B0D-BE20-4F54-ACD3-D8B45CAD5B57} = {5CF04261-17B9-44F2-AD3F-C19C92796442}
{5CF04261-17B9-44F2-AD3F-C19C92796442} = {CFFA9471-EC37-451E-BA20-3DA090F0A683}
{6F037AC1-A8B5-4D89-B33A-BCDDB78553A6} = {0FD24B4A-2B2B-4DCC-88F4-F13398F0CB18}
{7EE175C0-1309-4AA7-BC80-2F01A3855D9A} = {6EF86008-5993-4F7A-8B4B-F30A85BC6EE8}
{65B7BCF3-82C8-480E-ADC3-B45DD67BD565} = {6F037AC1-A8B5-4D89-B33A-BCDDB78553A6}
{049BFCD0-AD71-4357-91CF-62CC03D8FB39} = {5CF04261-17B9-44F2-AD3F-C19C92796442}
{3A111F6A-56C3-4952-B45F-5CDA714D059F} = {CFFA9471-EC37-451E-BA20-3DA090F0A683}
{6F037AC1-A8B5-4D89-B33A-BCDDB78553A6} = {0FD24B4A-2B2B-4DCC-88F4-F13398F0CB18}
{C92F6AF1-C354-4965-AD3C-938BC870F853} = {3B7FCB46-B3B6-41EF-9495-3FA4D027E3FC}
{4C55C81D-E924-4BA9-9A6C-92B74EC4F7AE} = {5CF04261-17B9-44F2-AD3F-C19C92796442}
{3546F4B5-7D43-4332-914A-6A657D95CEB1} = {E961F502-9430-4E81-95AE-C202E0AE643F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
Expand Down
14 changes: 0 additions & 14 deletions build/azure-devops/gated.yaml

This file was deleted.

28 changes: 0 additions & 28 deletions build/azure-devops/outer-loop.yaml

This file was deleted.

Loading
Loading