Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated packages, fixed some bugs, added new functionality, and generated new NuGet packages #2

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2d9fc60
Updated NuGet packages.
keithjjones Jan 13, 2016
a94b6a5
Fixed references for new NuGet packages.
keithjjones Jan 13, 2016
70cffa3
Fixed bug with sometimes array and sometimes item for netblocks.
keithjjones Jan 13, 2016
aef640f
Fixed bugs and generated new NuGet package.
keithjjones Jan 13, 2016
5b5213e
Possible compilation bug fixed.
keithjjones Jan 13, 2016
63f9ca7
Fixed bugs with organizational lookups. Added some tests. Added addi…
keithjjones Jan 14, 2016
7819153
Changed version of NuGet package. Created new NuGet package because …
keithjjones Jan 14, 2016
4060e77
Added new NuGet for public repository as a fork.
keithjjones Jan 14, 2016
d49c36d
Added new test case. Fixed parser to read multi-line addresses.
keithjjones Jan 14, 2016
893a16d
Built new NuGet package.
keithjjones Jan 14, 2016
b20b663
Added customer record functionality.
keithjjones Jan 14, 2016
4648182
Added information to the readme.
keithjjones Jan 14, 2016
815ee64
Made new NuGet package.
keithjjones Jan 14, 2016
6a863bf
Made new NuGet package.
keithjjones Jan 14, 2016
071c034
Added contributor to readme.
keithjjones Jan 14, 2016
dfa3c66
Fixed up a few small things.
keithjjones Jan 14, 2016
e81c9bf
Added reference to ARIN's documentation in readme.
keithjjones Jan 14, 2016
004c567
Removed code no longer needed. Created NuGet package.
keithjjones Jan 14, 2016
abecde8
Changed release notes. Generated new NuGet package.
keithjjones Jan 14, 2016
b7cc62f
Corrected ordering of Asserts in tests.
keithjjones Jan 15, 2016
0e6e4fd
Added additional testing.
keithjjones Jan 15, 2016
b04b0e8
Changed up readme.
keithjjones Jan 15, 2016
5ed864c
Changed the NuGet package to have a slightly different name than the …
keithjjones Jan 15, 2016
cce72d8
Improved NuGet metadata.
keithjjones Jan 15, 2016
e7c7574
Updated NuGet metadata.
keithjjones Jan 15, 2016
6ace348
Added contributing doc.
keithjjones Jan 18, 2016
b80efad
Changed metadata for NuGet.
keithjjones Jan 18, 2016
6bb9340
Added multi-line test for street address.
keithjjones Jan 18, 2016
c1f71cf
Changed link to license file.
keithjjones Jan 18, 2016
cedfd1f
Added KJJ to License.
keithjjones Jan 18, 2016
75c59cc
Added IntelliSense information.
keithjjones Jan 19, 2016
6233342
Made new NuGet package.
keithjjones Jan 19, 2016
b3e1644
Made new NuGet package.
keithjjones Jan 19, 2016
53ef920
Added more IntelliSense information.
keithjjones Jan 19, 2016
bb1f7b3
Enabled IntelliSense XML output.
keithjjones Jan 19, 2016
64da764
Made nuget.exe changes.
keithjjones Jan 19, 2016
8cdda2b
Fixed up nuget.exe.
keithjjones Jan 19, 2016
02deda4
Added assembly information and new package.
keithjjones Jan 19, 2016
f66a1f2
Slight bug in post build.
keithjjones Jan 19, 2016
f804b09
Removed NuGet packages from Git.
keithjjones Jan 19, 2016
2d36485
Fixed up post build.
keithjjones Jan 19, 2016
a57826a
Changed assembly information.
keithjjones Jan 20, 2016
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ publish/
*.[Pp]ublish.xml
*.azurePubxml

# NuGet Packages
*.nupkg

# NuGet Packages Directory
packages/
## TODO: If the tool you use requires repositories.config uncomment the next line
Expand Down
7 changes: 7 additions & 0 deletions Contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Open TODO file, if there is one, and see if there is anywhere you can help. Otherwise, look at the issues.
If you want to contribute, fork https://github.com/keithjjones/ArinWhois.NET and perform your modifications on the "devel" branch.
If you send a pull request we will review the changes and merge them appropriately.

The "master" branch is always the working code. The "devel" branch is working code, but it hasn't been accepted into "master" for the entire project.
Any other branch consisting of new features typically starts with "devel-" and contains the feature's name. It may or may not be working depending on the contributor. These
branches are branched from the "devel" branch.
2 changes: 1 addition & 1 deletion LICENSE → License.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014 MaxHorstmann
Copyright (c) 2014 MaxHorstmann, 2016 Keith J. Jones

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
50 changes: 34 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,64 @@ This is a simple .NET client to access the RESTful API programmatically with a s
Install
============

Use the [NuGet](https://www.nuget.org/packages/ArinWhois) package, run the following command in the Package Manager Console:
Use the [NuGet](https://www.nuget.org/packages/ArinWhois-VS2015) package, run the following command in the Package Manager Console:

PM> Install-Package ArinWhois
PM> Install-Package ArinWhois-VS2015



Sample Usage
============

var arinClient = new ArinClient();

// Check single IP
var ipResponse = await arinClient.QueryIpAsync(IPAddress.Parse("69.63.176.0"));

Console.WriteLine(ipResponse.Network.Name);
Console.WriteLine(ipResponse.Network.NetBlocks.NetBlock.Cidr);

// Find out more about organization
var orgResponse = await arinClient.QueryResourceAsync(ipResponse.Network.OrgRef.Handle,
```csharp
var arinClient = new ArinClient();

// Check single IP
var ipResponse = await arinClient.QueryIpAsync(IPAddress.Parse("69.63.176.0"));

Console.WriteLine(ipResponse.Network.Name);
Console.WriteLine(ipResponse.Network.NetBlocks.NetBlock.Cidr);

// Find out more about organization or customer
if (ipResponse.Network.OrgRef != null)
{
var orgResponse = await arinClient.QueryResourceAsync(ipResponse.Network.OrgRef.Handle,
ArinClient.ResourceType.Organization);
Console.WriteLine(orgResponse.Organization.Name);
Console.WriteLine(orgResponse.Organization.City);

Console.WriteLine(orgResponse.Organization.Name);
Console.WriteLine(orgResponse.Organization.City);
}
else if (ipResponse.Network.CustomerRef != null)
{
var customerResponse = await arinClient.QueryResourceAsync(ipResponse.Network.CustomerRef.Handle,
ArinClient.ResourceType.Customer);
Console.WriteLine(customerResponse.Organization.Name);
Console.WriteLine(customerResponse.Organization.City);
}
```

If you don't wanna do async, use `.Result`:

```csharp
var response = arinClient.QueryIpAsync(IPAddress.Parse("69.63.176.0")).Result;

```

But you should do async, really.


Limitations
===========
* Read-only
* Make sure nuget.exe is in your path for building release.



Contributors
============
* [MaxHorstmann](https://github.com/MaxHorstmann) (Max Horstmann)
* [KeithJJones] (https://github.com/keithjjones) (Keith J. Jones)

More Reading
============
* [ARIN's Documentation on the RESTful Interface] (https://www.arin.net/resources/whoisrws/whois_api.html)


Binary file removed nuget/ArinWhois.0.1.nupkg
Binary file not shown.
Binary file removed nuget/ArinWhois.0.2.nupkg
Binary file not shown.
194 changes: 185 additions & 9 deletions src/ArinWhois.Tests/ApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,207 @@ public void TestIpFound()

Assert.IsTrue(ipResponse.Network.TermsOfUse.StartsWith("http"));
Assert.IsNotNull(ipResponse.Network.RegistrationDate.Value);
Assert.IsNotNull(ipResponse.Network.NetBlocks.NetBlock);
Assert.IsNotNull(ipResponse.Network.NetBlocks.NetBlock.CidrLength.Value);
Assert.IsNotNull(ipResponse.Network.NetBlocks.NetBlock.Description);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0]);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0].CidrLength.Value);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0].Description);

Assert.IsNotNull(ipResponse.Network.OrgRef.Name);
Assert.AreEqual(ipResponse.Network.OrgRef.Name, "Facebook, Inc.");
Assert.AreEqual("Facebook, Inc.", ipResponse.Network.OrgRef.Name);

var organizationHandle = ipResponse.Network.OrgRef.Handle;
var organizationResponse = arinClient.QueryResourceAsync(organizationHandle, ArinClient.ResourceType.Organization).Result;
var organizationResponse = arinClient.QueryResourceAsync(organizationHandle.ToString(), ArinClient.ResourceType.Organization).Result;

Assert.IsNotNull(organizationResponse);
Assert.AreEqual(organizationResponse.Organization.City.Value, "Menlo Park");
Assert.AreEqual("UNITED STATES", organizationResponse.Organization.iso3166_1.Name.Value);
Assert.AreEqual("Menlo Park", organizationResponse.Organization.City.Value);
Assert.AreEqual("CA", organizationResponse.Organization.iso3166_2.Value);
Assert.AreEqual("94025", organizationResponse.Organization.PostalCode.Value);
}

[TestMethod]
public void TestIp2Found()
{
var arinClient = new ArinClient();
var ipResponse = arinClient.QueryIpAsync(IPAddress.Parse("98.155.64.40")).Result;

Assert.IsNotNull(ipResponse);
Assert.IsNotNull(ipResponse.Network);

Assert.IsTrue(ipResponse.Network.TermsOfUse.StartsWith("http"));
Assert.IsNotNull(ipResponse.Network.RegistrationDate.Value);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0]);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0].CidrLength.Value);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0].Description);

Assert.IsNotNull(ipResponse.Network.OrgRef.Name);
Assert.AreEqual("Time Warner Cable Internet LLC", ipResponse.Network.OrgRef.Name);

var organizationHandle = ipResponse.Network.OrgRef.Handle;
var organizationResponse = arinClient.QueryResourceAsync(organizationHandle.ToString(), ArinClient.ResourceType.Organization).Result;

Assert.IsNotNull(organizationResponse);
Assert.AreEqual("UNITED STATES", organizationResponse.Organization.iso3166_1.Name.Value);
Assert.AreEqual("Herndon", organizationResponse.Organization.City.Value);
Assert.AreEqual("VA", organizationResponse.Organization.iso3166_2.Value);
Assert.AreEqual("20171", organizationResponse.Organization.PostalCode.Value);
}

[TestMethod]
public void TestIpNotFound()
public void TestIp3Found()
{
var arinClient = new ArinClient();
var response = arinClient.QueryIpAsync(IPAddress.Parse("108.33.73.20")).Result;
Assert.IsNull(response);
var ipResponse = arinClient.QueryIpAsync(IPAddress.Parse("96.21.63.199")).Result;

Assert.IsNotNull(ipResponse);
Assert.IsNotNull(ipResponse.Network);

Assert.IsTrue(ipResponse.Network.TermsOfUse.StartsWith("http"));
Assert.IsNotNull(ipResponse.Network.RegistrationDate.Value);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0]);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0].CidrLength.Value);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0].Description);

Assert.IsNull(ipResponse.Network.OrgRef);

Assert.IsNotNull(ipResponse.Network.CustomerRef);

Assert.IsNotNull(ipResponse.Network.CustomerRef.Name);
Assert.AreEqual("Videotron Ltee", ipResponse.Network.CustomerRef.Name);

var customerHandle = ipResponse.Network.CustomerRef.Handle;
var customerResponse = arinClient.QueryResourceAsync(customerHandle.ToString(), ArinClient.ResourceType.Customer).Result;

Assert.IsNotNull(customerResponse);
Assert.AreEqual("CANADA", customerResponse.Customer.iso3166_1.Name.Value);
Assert.AreEqual("Montreal", customerResponse.Customer.City.Value);
Assert.AreEqual("QC", customerResponse.Customer.iso3166_2.Value);
Assert.AreEqual("H2X 3W4", customerResponse.Customer.PostalCode.Value);
}

[TestMethod]
public void TestIp4Found()
{
var arinClient = new ArinClient();
var ipResponse = arinClient.QueryIpAsync(IPAddress.Parse("98.176.133.1")).Result;

Assert.IsNotNull(ipResponse);
Assert.IsNotNull(ipResponse.Network);

Assert.IsTrue(ipResponse.Network.TermsOfUse.StartsWith("http"));
Assert.IsNotNull(ipResponse.Network.RegistrationDate.Value);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0]);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0].CidrLength.Value);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0].Description);

Assert.IsNull(ipResponse.Network.OrgRef);

Assert.IsNotNull(ipResponse.Network.CustomerRef);

Assert.IsNotNull(ipResponse.Network.CustomerRef.Name);
Assert.AreEqual("Cox Communications", ipResponse.Network.CustomerRef.Name);

var customerHandle = ipResponse.Network.CustomerRef.Handle;
var customerResponse = arinClient.QueryResourceAsync(customerHandle.ToString(), ArinClient.ResourceType.Customer).Result;

Assert.IsNotNull(customerResponse);
Assert.AreEqual("UNITED STATES", customerResponse.Customer.iso3166_1.Name.Value);
Assert.AreEqual("Atlanta", customerResponse.Customer.City.Value);
Assert.AreEqual("GA", customerResponse.Customer.iso3166_2.Value);
Assert.AreEqual("30319", customerResponse.Customer.PostalCode.Value);
}

[TestMethod]
public void TestIp5Found()
{
var arinClient = new ArinClient();
var ipResponse = arinClient.QueryIpAsync(IPAddress.Parse("108.234.177.20")).Result;

Assert.IsNotNull(ipResponse);
Assert.IsNotNull(ipResponse.Network);

Assert.IsTrue(ipResponse.Network.TermsOfUse.StartsWith("http"));
Assert.IsNotNull(ipResponse.Network.RegistrationDate.Value);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0]);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0].CidrLength.Value);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0].Description);

Assert.IsNotNull(ipResponse.Network.OrgRef);

Assert.IsNotNull(ipResponse.Network.OrgRef.Name);
Assert.AreEqual("AT&T Internet Services", ipResponse.Network.OrgRef.Name);

var organizationHandle = ipResponse.Network.OrgRef.Handle;
var organizationResponse = arinClient.QueryResourceAsync(organizationHandle.ToString(), ArinClient.ResourceType.Organization).Result;

Assert.IsNotNull(organizationResponse);
Assert.AreEqual("UNITED STATES", organizationResponse.Organization.iso3166_1.Name.Value);
Assert.AreEqual("Richardson", organizationResponse.Organization.City.Value);
Assert.AreEqual("TX", organizationResponse.Organization.iso3166_2.Value);
Assert.AreEqual("75082", organizationResponse.Organization.PostalCode.Value);
}

[TestMethod]
public void TestIp6Found()
{
var arinClient = new ArinClient();
var ipResponse = arinClient.QueryIpAsync(IPAddress.Parse("174.65.101.118")).Result;

Assert.IsNotNull(ipResponse);
Assert.IsNotNull(ipResponse.Network);

Assert.IsTrue(ipResponse.Network.TermsOfUse.StartsWith("http"));
Assert.IsNotNull(ipResponse.Network.RegistrationDate.Value);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0]);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0].CidrLength.Value);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0].Description);

Assert.IsNull(ipResponse.Network.OrgRef);

Assert.IsNotNull(ipResponse.Network.CustomerRef);

Assert.IsNotNull(ipResponse.Network.CustomerRef.Name);
Assert.AreEqual("Cox Communications", ipResponse.Network.CustomerRef.Name);

var customerHandle = ipResponse.Network.CustomerRef.Handle;
var customerResponse = arinClient.QueryResourceAsync(customerHandle.ToString(), ArinClient.ResourceType.Customer).Result;

Assert.IsNotNull(customerResponse);
Assert.AreEqual("UNITED STATES", customerResponse.Customer.iso3166_1.Name.Value);
Assert.AreEqual("Atlanta", customerResponse.Customer.City.Value);
Assert.AreEqual("GA", customerResponse.Customer.iso3166_2.Value);
Assert.AreEqual("30319", customerResponse.Customer.PostalCode.Value);
}

[TestMethod]
public void TestIp7Found()
{
var arinClient = new ArinClient();
var ipResponse = arinClient.QueryIpAsync(IPAddress.Parse("174.34.144.69")).Result;

Assert.IsNotNull(ipResponse);
Assert.IsNotNull(ipResponse.Network);

Assert.IsTrue(ipResponse.Network.TermsOfUse.StartsWith("http"));
Assert.IsNotNull(ipResponse.Network.RegistrationDate.Value);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0]);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0].CidrLength.Value);
Assert.IsNotNull(ipResponse.Network.NetBlocks[0].Description);

Assert.IsNotNull(ipResponse.Network.OrgRef);

Assert.IsNotNull(ipResponse.Network.OrgRef.Name);
Assert.AreEqual("Ubiquity Server Solutions Seattle", ipResponse.Network.OrgRef.Name);

var organizationHandle = ipResponse.Network.OrgRef.Handle;
var organizationResponse = arinClient.QueryResourceAsync(organizationHandle.ToString(), ArinClient.ResourceType.Organization).Result;

Assert.IsNotNull(organizationResponse);
Assert.AreEqual("12101 Tukwila International Blvd", organizationResponse.Organization.StreetAddress.Line[0].Value.Trim());
Assert.AreEqual("Suite 100", organizationResponse.Organization.StreetAddress.Line[1].Value.Trim());
Assert.AreEqual("UNITED STATES", organizationResponse.Organization.iso3166_1.Name.Value);
Assert.AreEqual("Tukwila", organizationResponse.Organization.City.Value);
Assert.AreEqual("WA", organizationResponse.Organization.iso3166_2.Value);
Assert.AreEqual("98168", organizationResponse.Organization.PostalCode.Value);
}
}
}
14 changes: 14 additions & 0 deletions src/ArinWhois.Tests/ArinWhois.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,17 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Jil, Version=2.12.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Jil.2.12.1\lib\net45\Jil.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Sigil, Version=4.5.1.0, Culture=neutral, PublicKeyToken=2d06c3494341c8ab, processorArchitecture=MSIL">
<HintPath>..\packages\Sigil.4.5.1\lib\net45\Sigil.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Runtime.Serialization" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
Expand All @@ -59,6 +69,10 @@
<Name>ArinWhois</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
Expand Down
11 changes: 11 additions & 0 deletions src/ArinWhois.Tests/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Sigil" publicKeyToken="2d06c3494341c8ab" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.1.0" newVersion="4.5.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
5 changes: 5 additions & 0 deletions src/ArinWhois.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Jil" version="2.12.1" targetFramework="net45" />
<package id="Sigil" version="4.5.1" targetFramework="net45" />
</packages>
Loading