Eigenverft.WebLib.RequestTrafficShaping 1.0.0.5-g40a2f17cdc

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

Eigenverft.WebLib.RequestTrafficShaping

NuGet Version NuGet Downloads Repository CI Targets License

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.

📄 License

MIT; see the repository license.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.