Agash.StreamTransport.Stun
0.2.0-dev2
See the version list below for details.
dotnet add package Agash.StreamTransport.Stun --version 0.2.0-dev2
NuGet\Install-Package Agash.StreamTransport.Stun -Version 0.2.0-dev2
<PackageReference Include="Agash.StreamTransport.Stun" Version="0.2.0-dev2" />
<PackageVersion Include="Agash.StreamTransport.Stun" Version="0.2.0-dev2" />
<PackageReference Include="Agash.StreamTransport.Stun" />
paket add Agash.StreamTransport.Stun --version 0.2.0-dev2
#r "nuget: Agash.StreamTransport.Stun, 0.2.0-dev2"
#:package Agash.StreamTransport.Stun@0.2.0-dev2
#addin nuget:?package=Agash.StreamTransport.Stun&version=0.2.0-dev2&prerelease
#tool nuget:?package=Agash.StreamTransport.Stun&version=0.2.0-dev2&prerelease
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.
StaticIceServerProviderreturns a fixed list: STUN only, or TURN with static credentials.StaticIceServerProvider.Stun("stun:stun.example.com:3478")makes a STUN-only list.CoturnSharedSecretIceServerProvideradvertises an external, self-hosted coturn server configured withstatic-auth-secret. It uses the TURN REST API ephemeral-credential scheme:username = "{unixExpiry}"andcredential = 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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Agash.StreamTransport.Abstractions (>= 0.2.0-dev2)
- System.IO.Hashing (>= 11.0.0-rc.3.26522.148)
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 |