NetworkInspector.Values 0.17.0

dotnet add package NetworkInspector.Values --version 0.17.0
                    
NuGet\Install-Package NetworkInspector.Values -Version 0.17.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="NetworkInspector.Values" Version="0.17.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NetworkInspector.Values" Version="0.17.0" />
                    
Directory.Packages.props
<PackageReference Include="NetworkInspector.Values" />
                    
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 NetworkInspector.Values --version 0.17.0
                    
#r "nuget: NetworkInspector.Values, 0.17.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 NetworkInspector.Values@0.17.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=NetworkInspector.Values&version=0.17.0
                    
Install as a Cake Addin
#tool nuget:?package=NetworkInspector.Values&version=0.17.0
                    
Install as a Cake Tool

NetworkInspector.Values

NuGet Downloads .NET 10 License: MIT

Small, fast value types for network identifiers and time: MacAddress, IPv4Address, IPv6Address, Eui64, Uuid, and Timestamp. They are the value types of the whole NetworkInspector stack and work just as well on their own.

Highlights

  • Value semantics. Every type is a readonly record struct: no allocation, equality and ordering built in (IEquatable<T>, IComparable<T>, <, >, <=, >=).
  • Allocation-free formatting and parsing. ISpanFormattable, IUtf8SpanFormattable, and ISpanParsable<T> let you format into and parse from spans without strings.
  • Stable text forms for logs and exports: RFC 5952 IPv6, colon-separated MAC, ISO-8601 timestamps with nanoseconds.
  • Address classification: broadcast, multicast, private, loopback, link-local, IPv4-mapped, and more.
  • Nanosecond timestamps with TimeSpan arithmetic.
  • Standalone. No dependency on the rest of NetworkInspector.

Install

dotnet add package NetworkInspector.Values

Quick Start

using NetworkInspector.Values;

MacAddress mac = MacAddress.FromBytes([0x00, 0x1A, 0x2B, 0x3C, 0x4D, 0x5E]);
IPv4Address ip4 = IPv4Address.FromBytes([192, 168, 1, 10]);
if (!IPv6Address.TryParse("2001:db8::1", out IPv6Address ip6))
{
    throw new FormatException("Invalid IPv6 address.");
}

Timestamp ts = Timestamp.FromSecs(1_700_000_000);

Console.WriteLine(mac); // 00:1A:2B:3C:4D:5E
Console.WriteLine(ip4); // 192.168.1.10
Console.WriteLine(ip6); // 2001:DB8::1
Console.WriteLine(ts);  // 2023-11-14T22:13:20.000000000Z

Types

Type Text form Create from
MacAddress 00:1A:2B:3C:4D:5E FromBytes, new(ulong) (lower 48 bits), TryParse
IPv4Address 192.168.1.10 FromBytes, new(uint) (big-endian value), TryParse
IPv6Address 2001:DB8::1 (RFC 5952) FromBytes, new(ulong high, ulong low), TryParse
Eui64 00:11:22:33:44:55:66:77 FromBytes, TryParse
Uuid 01020304-0506-0708-090A-0B0C0D0E0F10 FromBytes, TryParse
Timestamp 2023-11-14T22:13:20.000000000Z FromNanos, FromMicros, FromMillis, FromSecs, Now

Text output uses uppercase hex; TryParse accepts either case. Parse is available through the generic IParsable<T> / ISpanParsable<T> interfaces; call TryParse directly for untrusted text.

Common Tasks

Classify Addresses

if (ip4.IsPrivate || ip4.IsLoopback)
{
    Console.WriteLine("internal traffic");
}

Format Without Allocating

Span<char> buffer = stackalloc char[64];
if (ip6.TryFormat(buffer, out int written, default, null))
{
    Console.Out.Write(buffer[..written]);
}

Use As Keys

The types are equatable and comparable values, so they work as dictionary keys, in sorted sets, and in ORDER BY-style reports without custom comparers.

Limits And Thread-Safety Notes

  • Immutable values: safe to share across threads.
  • Timestamp.FromSecs and the other factories throw OverflowException outside the representable range.
  • Validate external text with TryParse instead of catching exceptions.

Learn More

License

MIT License

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.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on NetworkInspector.Values:

Package Downloads
NetworkInspector.Core

High-performance protocol analysis stack for network packet dissection. Provides the core framework for protocol registration, field trees, packet parsing, and cross-packet indexing. Includes a Roslyn source generator for declarative protocol definitions.

NetworkInspector.FrameBuilder

Typed, allocation-free frame-builder library for NetworkInspector. Compose protocol stacks and emit RFC-conformant wire frames with zero heap allocations on the hot path.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.17.0 50 10/17/2026
0.16.0 65 10/17/2026
0.15.0 156 10/9/2026
0.14.0 152 10/8/2026
0.13.0 163 9/27/2026
0.12.0 182 9/17/2026
0.11.0 205 9/10/2026
0.10.0 174 9/8/2026
0.9.0 176 9/2/2026
0.8.0 207 8/28/2026
0.7.0 186 8/27/2026
0.6.0 202 8/21/2026
0.5.0 206 7/11/2026
0.4.0 247 6/2/2026
0.3.0 187 5/21/2026
0.2.0 185 5/19/2026