Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

.NET client

NuGet

The .NET client (dotnet add package Varta.Client) is a first-class peer of the Rust varta-client crate. It tracks the same wire-format contract, passes the same tools/vlp-test-vectors.json conformance suite, and interoperates with the same varta-watch observer binary.

Install

dotnet add package Varta.Client

Targets net8.0 (LTS) and net10.0 (LTS). Pure managed code — ChaCha20-Poly1305 (System.Security.Cryptography.ChaCha20Poly1305), HKDF-SHA256 (System.Security.Cryptography.HKDF), and POSIX signals (System.Runtime.InteropServices.PosixSignalRegistration) all come from the BCL. Zero native dependencies.

20-line example

using Varta;

using var agent = global::Varta.Varta.Connect("/run/varta/observer.sock");

while (true)
{
    BeatOutcome outcome = agent.Beat(Status.Ok, payload: 0);
    if (outcome.IsDropped)
    {
        // Four-way taxonomy mirrors the Rust client:
        DropReason _ = outcome.Reason;
    }
    else if (outcome.IsFailed)
    {
        Console.Error.WriteLine($"varta beat failed: {outcome.Error}");
    }
    await Task.Delay(500);
}

For secure UDP, fork-safety, the signal-handler family, and the full parity matrix see the package README in the repo: clients/dotnet/README.md.

Transports

TransportStatusNotes
Unix Domain SocketsSupported (Linux, macOS)Varta.Connect(path). Classified BeatOrigin::KernelAttested only on observer platforms with pathname-UDS peer credentials; macOS observers treat pathname UDS as socket-mode-only, so recovery is refused. PlatformNotSupportedException on Windows.
Plaintext UDPSupportedVarta.ConnectUdp(host, port). Connected-mode socket; on Linux ICMP port unreachable surfaces as DropReason.NoObserver on a subsequent beat.
Secure UDP (ChaCha20-Poly1305)SupportedVarta.ConnectSecureUdp(host, port, key)
Master-key secure UDPSupportedVarta.ConnectSecureUdpWithMaster(host, port, masterKey)

Stability

Source