Agash.StreamTransport.Stun 0.2.0-dev5

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

Agash.StreamTransport.Stun

An embeddable STUN binding server and ICE-server providers for Agash.StreamTransport.

STUN messages

StunMessageReader and StunMessageWriter parse and build RFC 8489 messages in place over spans: attributes, XOR-MAPPED-ADDRESS, MESSAGE-INTEGRITY and FINGERPRINT (both verified on read). The ICE agent, the TURN client and the server below use them; they depend on nothing else in the stack.

StunMessageWriter writer = new(buffer, StunMessageClass.Request, StunMethod.Binding, transactionId);
writer.AddFingerprint();
if (StunMessageReader.TryParse(datagram, out StunMessageReader reply)
    && reply.TryGetXorMappedAddress(out IPEndPoint mapped)) { /* ... */ }

STUN server

StunBindingServer answers RFC 8489 binding requests with the caller's reflexive address, which is what ICE needs to gather server-reflexive candidates. It listens on one UDP port, runs on every platform, and does not detect NAT types (RFC 3489). Run one on a reachable UDP port, or alongside a relay, so peers discover their public address without a third-party STUN service.

await using var stun = new StunBindingServer(new IPEndPoint(IPAddress.Any, 3478));
stun.Start();

ICE-server providers

An IIceServerProvider plugged into the signaling router supplies the ICE servers that each peer receives in its Welcome.

  • StaticIceServerProvider returns a fixed list: STUN only, or TURN with static credentials. StaticIceServerProvider.Stun("stun:stun.example.com:3478") makes a STUN-only list.
  • CoturnSharedSecretIceServerProvider advertises an external, self-hosted coturn server configured with static-auth-secret. It uses the TURN REST API ephemeral-credential scheme: username = "{unixExpiry}" and credential = base64(HMAC-SHA1(secret, username)), so each peer gets fresh, time-limited credentials.
var ice = new CoturnSharedSecretIceServerProvider(
    stunUrls: ["stun:turn.example.com:3478"],
    turnUrls: ["turn:turn.example.com:3478?transport=udp"],
    sharedSecret: coturnStaticAuthSecret);
var router = new SignalingRouter(ice);

TURN relaying itself is done by the peer connection's TURN client against an external server such as coturn. This package does not host a relay.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Agash.StreamTransport.Stun:

Package Downloads
Agash.StreamTransport.WebRtc

A small, modern, libwebrtc-aligned WebRTC stack for .NET: ICE/STUN, SRTP, RTP/RTCP, SDP/JSEP and a peer connection. DTLS-SRTP over Dtls.Core; platform cryptography only. The first-party transport for Agash.StreamTransport.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0-dev5 73 11/11/2026
0.2.0-dev4 99 11/3/2026
0.2.0-dev3 88 11/3/2026
0.2.0-dev2 325 11/2/2026
0.2.0-dev1 83 11/2/2026
0.1.6-alpha 135 9/23/2026
0.1.5-alpha 108 8/31/2026
0.1.4-alpha 105 8/13/2026
0.1.3-alpha 209 8/12/2026
0.1.2-alpha 101 8/12/2026
0.1.0-alpha 116 6/20/2026
0.0.0-alpha.0 90 6/20/2026