Eigenverft.WebLib.RequestTrafficShaping
1.0.0.5-g3f72d1412c
See the version list below for details.
dotnet add package Eigenverft.WebLib.RequestTrafficShaping --version 1.0.0.5-g3f72d1412c
NuGet\Install-Package Eigenverft.WebLib.RequestTrafficShaping -Version 1.0.0.5-g3f72d1412c
<PackageReference Include="Eigenverft.WebLib.RequestTrafficShaping" Version="1.0.0.5-g3f72d1412c" />
<PackageVersion Include="Eigenverft.WebLib.RequestTrafficShaping" Version="1.0.0.5-g3f72d1412c" />
<PackageReference Include="Eigenverft.WebLib.RequestTrafficShaping" />
paket add Eigenverft.WebLib.RequestTrafficShaping --version 1.0.0.5-g3f72d1412c
#r "nuget: Eigenverft.WebLib.RequestTrafficShaping, 1.0.0.5-g3f72d1412c"
#:package Eigenverft.WebLib.RequestTrafficShaping@1.0.0.5-g3f72d1412c
#addin nuget:?package=Eigenverft.WebLib.RequestTrafficShaping&version=1.0.0.5-g3f72d1412c&prerelease
#tool nuget:?package=Eigenverft.WebLib.RequestTrafficShaping&version=1.0.0.5-g3f72d1412c&prerelease
Eigenverft.WebLib.RequestTrafficShaping
ASP.NET Core rate limiting composed from per-client and server-wide token buckets plus an optional application-wide concurrency limit.
✨ At a glance
| Capability | Details |
|---|---|
| Registration | AddRequestTrafficShaping(...) binds and validates options from RequestTrafficShaping. |
| Pipeline | Activate the registered limiter with ASP.NET Core's app.UseRateLimiter(). |
| Defaults | Per-client: 10 requests/second, burst 40, queue 20; server-wide: 10,000 for rate, burst, and queue. |
| Concurrency | Optional GlobalConcurrencyLimit is off by default. Defaults are starting points, not capacity guarantees. |
📦 Installation
dotnet add package Eigenverft.WebLib.RequestTrafficShaping
🚀 Quick start
using Eigenverft.WebLib.RequestTrafficShaping;
builder.Services.AddRequestTrafficShaping(options =>
{
options.PerClient.BurstSize = 40;
options.PerClient.RequestsPerSecond = 10;
options.PerClient.QueueLimit = 20;
options.ServerWide.BurstSize = 10_000;
options.ServerWide.RequestsPerSecond = 10_000;
options.ServerWide.QueueLimit = 10_000;
// options.GlobalConcurrencyLimit = 500;
});
WebApplication app = builder.Build();
app.UseRateLimiter();
The same settings can be supplied under the RequestTrafficShaping configuration section. Class defaults are applied first, configuration binding next, and the optional callback last.
Limiter behavior and configuration
The chain is per-client token bucket, then aggregate server-wide token bucket, then the optional global concurrency limiter. Both token-bucket layers are enabled by default. Each uses a one-second replenishment period and a bounded oldest-first queue. Rejections return 429; a Retry-After header is added when native limiter metadata supplies a positive retry delay.
The per-client partition uses normalized HttpContext.Connection.RemoteIpAddress directly; this package does not depend on Eigenverft.WebLib.ClientNetwork. IPv4-mapped IPv6 is normalized to IPv4 and IPv6 scope IDs are ignored. When there is no peer IP, MissingClientIpBehavior.SharedPartition (the default) groups missing addresses together. BypassPerIpLimit skips only the per-client limiter; the server-wide and optional concurrency limits still apply.
When a trusted reverse proxy provides client IPs, configure ASP.NET Core Forwarded Headers and run it before UseRateLimiter(). Validate trust boundaries before accepting forwarded addresses.
Burst and request-rate values must be positive, queue limits non-negative, and BurstSize must be at least RequestsPerSecond. The optional concurrency limit must be positive when set. Options are validated on startup and construct the limiters then; changing configuration does not live-reconfigure running token buckets. Tune the generous server-wide starting values against representative application load.
🎯 Target frameworks
Targets net8.0 and net10.0; .NET 9 applications can consume the compatible net8.0 asset.
🔗 Project links
📄 License
MIT; see the repository license.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0.5-g40a2f17cdc | 0 | 9/28/2026 |
| 1.0.0.5-g3f72d1412c | 0 | 9/29/2026 |
| 1.0.0.2-gbfce1c5596 | 0 | 9/28/2026 |
| 1.0.0.2-g8afd56e9dc | 0 | 9/12/2026 |
Initial capability package extracted from Eigenverft.WebLib.Infrastructure.
- ASP.NET Core request traffic shaping with per-client and server-wide token-bucket rate limits and optional concurrency control.
- Public namespaces and behavior remain compatible with the original Infrastructure implementation.