https://github.com/pableess/yamux-dotnet
Yamux protocol implementation for .NET
https://github.com/pableess/yamux-dotnet
networking-protocols yamux
Last synced: 11 months ago
JSON representation
Yamux protocol implementation for .NET
- Host: GitHub
- URL: https://github.com/pableess/yamux-dotnet
- Owner: pableess
- License: mit
- Created: 2025-06-18T11:30:55.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-06-20T03:03:34.000Z (12 months ago)
- Last Synced: 2025-06-20T04:19:22.214Z (12 months ago)
- Topics: networking-protocols, yamux
- Language: C#
- Homepage:
- Size: 48.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Yamux.NET
Yamux.NET is a .NET 9 library implementing the [Yamux multiplexing protocol](https://github.com/hashicorp/yamux/blob/master/spec.md), enabling multiple reliable, ordered, and independent streams (channels) over a single underlying connection (such as TCP). This is useful for building high-performance network applications, tunneling, or protocols that require multiplexed communication.
## Features
- Full-duplex, multiplexed streams over a single connection
- Channel-based abstraction (`SessionChannel`, `IDuplexSessionChannel`)
- Configurable flow control and window sizing
- Automatic window tuning for optimal throughput
- Keep-alive and round-trip time (RTT) measurement
- Bandwidth and statistics tracking
- .NET 9, async/await friendly
## Getting Started
### Install
Add a reference to the `Yamux` project or build from source for .NET 9.
### Basic Usage
```csharp
// Create a Yamux session over a stream (e.g., NetworkStream)
using var session = stream.AsYamuxSession(isClient: true, options: new SessionOptions { ... });
session.Start();
// Open a new channel
using var channel = await session.OpenChannelAsync();
// Write to the channel
await channel.WriteAsync(data, cancellationToken);
// Read from the channel
var result = await channel.Input.ReadAsync(cancellationToken);
```
See `samples/Sample` and `samples/FileTransfer` for more complete examples.
## Protocol
This library implements the [Yamux protocol specification](https://github.com/hashicorp/yamux/blob/master/spec.md) by HashiCorp.
## License
This project is licensed under the MIT License.