Xakpc.NetDiag.Client
1.0.0
dotnet add package Xakpc.NetDiag.Client --version 1.0.0
NuGet\Install-Package Xakpc.NetDiag.Client -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="Xakpc.NetDiag.Client" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Xakpc.NetDiag.Client" Version="1.0.0" />
<PackageReference Include="Xakpc.NetDiag.Client" />
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 Xakpc.NetDiag.Client --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Xakpc.NetDiag.Client, 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 Xakpc.NetDiag.Client@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=Xakpc.NetDiag.Client&version=1.0.0
#tool nuget:?package=Xakpc.NetDiag.Client&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Xakpc.NetDiag.Client
Official .NET client for the NetDiag API - network diagnostics as a service. Run distributed health checks (DNS, TLS, HTTP, Ping) from multiple geographic regions worldwide.
Install
dotnet add package Xakpc.NetDiag.Client
Quickstart
using Xakpc.NetDiag.Client;
// Create client (anonymous - limited requests/min)
var client = new NetDiagClient();
// Run diagnostics
var result = await client.CheckAsync("example.com");
Console.WriteLine($"Status: {result.Status}");
Console.WriteLine($"Quorum: {result.Quorum}");
foreach (var location in result.Locations)
{
Console.WriteLine($" {location.Region}: {location.Status}");
if (location.Ping != null)
Console.WriteLine($" Ping: {location.Ping.LatencyMs}ms");
if (location.Tls != null)
Console.WriteLine($" TLS: {location.Tls.DaysUntilExpiry} days until expiry");
}
With API Key
// Authenticated client
var client = new NetDiagClient("your-api-key");
// Or with full options
var client = new NetDiagClient(new NetDiagClientOptions
{
ApiKey = "your-api-key",
Timeout = TimeSpan.FromSeconds(60)
});
Dependency Injection
// In Program.cs or Startup.cs
builder.Services.AddNetDiagClient(options =>
{
options.ApiKey = builder.Configuration["NetDiag:ApiKey"];
});
// Inject INetDiagClient in your services
public class HealthCheckService(INetDiagClient netDiag)
{
public async Task<bool> IsServiceHealthy(string target)
{
return await netDiag.IsHealthyAsync(target);
}
}
Advanced Usage
// Check specific regions with custom parameters
var result = await client.CheckAsync(new ChecksRequest
{
Target = "api.example.com",
Regions = "us-east,eu-west",
Port = 8443,
PingCount = 10
});
// Quick health check
bool healthy = await client.IsHealthyAsync("example.com");
// Get status only
Status status = await client.GetStatusAsync("example.com");
// URLs are automatically normalized to hostnames
await client.CheckAsync("https://example.com/api/v1"); // checks "example.com"
Prometheus Output
// Get metrics in Prometheus text format
string metrics = await client.CheckPrometheusAsync("example.com");
// With custom parameters
string metrics = await client.CheckPrometheusAsync(new ChecksRequest
{
Target = "api.example.com",
Regions = "us-east,eu-west"
});
// Returns Prometheus text format:
// netdiag_status{target="example.com",region="us-east"} 1
// netdiag_ping_latency_ms{target="example.com",region="us-east"} 15.2
// ...
Documentation
Full documentation: https://netdiag.dev/docs/dotnet
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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.
-
net8.0
- Microsoft.Extensions.Http (>= 9.0.0)
- Microsoft.Extensions.Options (>= 9.0.0)
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 | 42 | 12/27/2025 |