Connection Ban Store Options
On this page
Namespace: Nalix.Network.Options
Assembly: Nalix.Network
ConnectionBanStoreOptions configures disk persistence (NetworkBanRepository) for dynamic, progressive IP bans generated by ConnectionGuard when peers violate connection rate limits, error thresholds, or packet flood quotas.
Source Mapping
src/Nalix.Network/Options/ConnectionBanStoreOptions.cssrc/Nalix.Network/Internal/Security/NetworkBanRepository.cssrc/Nalix.Network/RateLimiting/Connection.Guard.cs
Defaults and Validation
| Property | Type | Default | Validation | Description |
|---|---|---|---|---|
Enabled | bool | true | None | Enables or disables persisting dynamic IP bans to disk across server restarts. |
AutoSaveInterval | TimeSpan | 00:05:00 (5 min) | [DurationRange("00:01:00", "01:00:00")] | Recurring interval at which dirty ban records are flushed to disk (1 minute to 1 hour). |
StoreFileName | string | "banned_ips.bin" | None | Binary database filename stored inside Directories.DataDirectory. |
BanCountDecayWindow | TimeSpan | 7.00:00:00 (7 days) | [DurationRange("01:00:00", "30.00:00:00")] | Duration of clean behavior required before an IP’s progressive strike count decays (1 hour to 30 days). |
MaxPersistedBans | int | 100_000 | [ValueRange(10, 1_000_000)] | Maximum number of ban records loaded into memory or written to disk to prevent memory exhaustion. |
Validate() executes this.ValidateDataAnnotations() and throws ValidationException when constraints are violated.
Configuration Examples
Programmatic Configuration
using System;
using Nalix.Hosting;
using Nalix.Network.Options;
INetworkApplicationBuilder builder = NetworkApplication.CreateBuilder();
builder.Configure<ConnectionBanStoreOptions>(options =>
{
options.Enabled = true;
options.AutoSaveInterval = TimeSpan.FromMinutes(10);
options.StoreFileName = "banned_ips.bin";
options.BanCountDecayWindow = TimeSpan.FromDays(14);
options.MaxPersistedBans = 50_000;
});
INI Configuration (default.ini)
[ConnectionBanStore]
Enabled = true
AutoSaveInterval = 00:05:00
StoreFileName = banned_ips.bin
BanCountDecayWindow = 7.00:00:00
MaxPersistedBans = 100000