RateControl

This commit is contained in:
2026-07-14 02:27:33 +03:00
parent 4f6d2d0801
commit 1ca9fc477b
19 changed files with 879 additions and 146 deletions
@@ -8,6 +8,45 @@ namespace Esiur.Resource;
public sealed class WarehouseConfiguration
{
public RateControlConfiguration RateControl { get; set; } = new RateControlConfiguration();
public ParserConfiguration Parser { get; set; } = new ParserConfiguration();
public ResourceAttachmentConfiguration ResourceAttachments { get; set; } = new ResourceAttachmentConfiguration();
public ConnectionConfiguration Connections { get; set; } = new ConnectionConfiguration();
}
/// <summary>
/// Limits memory and object amplification while parsing untrusted packets.
/// A value of zero disables the corresponding limit.
/// </summary>
public sealed class ParserConfiguration
{
/// <summary>Maximum declared TDU payload retained for one packet.</summary>
public uint MaximumPacketSize { get; set; } = 8 * 1024 * 1024;
/// <summary>Maximum allocation produced by one decoded value.</summary>
public uint MaximumAllocationSize { get; set; } = 4 * 1024 * 1024;
/// <summary>Maximum number of values decoded into one collection.</summary>
public int MaximumCollectionItems { get; set; } = 65_536;
}
/// <summary>
/// Limits resources imported from, or attached by, one remote connection.
/// A value of zero disables the corresponding limit.
/// </summary>
public sealed class ResourceAttachmentConfiguration
{
public int MaximumAttachedResourcesPerConnection { get; set; } = 4_096;
public int MaximumPendingAttachmentsPerConnection { get; set; } = 128;
public bool RejectDuplicateAttachments { get; set; } = true;
}
/// <summary>
/// Configures network connection admission limits.
/// A value of zero disables the corresponding limit.
/// </summary>
public sealed class ConnectionConfiguration
{
public int MaximumConnectionsPerIpAddress { get; set; } = 64;
}
/// <summary>