Xobex.Net.Whois 1.0.0

dotnet add package Xobex.Net.Whois --version 1.0.0
                    
NuGet\Install-Package Xobex.Net.Whois -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Xobex.Net.Whois" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Xobex.Net.Whois" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Xobex.Net.Whois" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Xobex.Net.Whois --version 1.0.0
                    
#r "nuget: Xobex.Net.Whois, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Xobex.Net.Whois@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Xobex.Net.Whois&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Xobex.Net.Whois&version=1.0.0
                    
Install as a Cake Tool

Xobex.Net.Whois

Xobex.Net.Whois is a small .NET library for performing WHOIS queries and parsing WHOIS responses. It provides an asynchronous API to query WHOIS servers over TCP and follows referral servers when present.

Target framework

  • .NET 10

Features

  • Asynchronous WHOIS queries (QueryAsync) for domains and IP addresses
  • Follows referral (refer / whois / ReferralServer) chains up to a configurable depth
  • Simple response parser that extracts header:value pairs and collects comment lines

Getting started

Requirements:

  • .NET 10 SDK

Build the solution from the repository root:

dotnet build

Using the library

The library exposes a single primary API surface: the WhoisClient class.

Example (async usage):

using System;
using System.Net;
using System.Threading;
using Xobex.Net.Whois;

class Example
{
    public static async Task Main()
    {
        var client = new WhoisClient();
        using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));

        // Query by domain or IP (string overload)
        string raw = await client.QueryAsync("8.8.8.8", cts.Token);

        // Or query by IPAddress
        // var raw = await client.QueryAsync(IPAddress.Parse("8.8.8.8"), cts.Token);

        // Parse into key/value pairs
        var fields = WhoisClient.Parse(raw);

        Console.WriteLine("Raw response:\n" + raw);
        Console.WriteLine("Parsed fields:");
        foreach (var kv in fields)
        {
            Console.WriteLine($"{kv.Key}: {kv.Value}");
        }
    }
}

Example project (console)

This repository includes a small example console application in src/Whois that demonstrates using the library. To run the example use:

dotnet run --project src/Whois/Whois.csproj -- 8.8.8.8

Replace 8.8.8.8 with the address or domain you want to query.

Notes on behavior

  • QueryAsync performs network I/O and may throw OperationCanceledException, TimeoutException or SocketException. Handle these in your calling code.
  • Parse returns a case-insensitive dictionary where the last seen header value wins. Comment lines are collected under the #comments key.
  • The client follows referrals up to a fixed maximum depth to avoid infinite loops.

Running tests

Run unit tests with:

dotnet test

Contributing

Contributions welcome — open issues or pull requests.

License

See LICENSE file if present in the repository.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 135 4/17/2026