< Summary

Information
Class: ProjectTemplate.Web.Options.ApplicationRateLimitingOptions
Assembly: ProjectTemplate.Web
File(s): /home/runner/work/NetCoreApplicationTemplate/NetCoreApplicationTemplate/src/ProjectTemplate.Web/Options/ApplicationRateLimitingOptions.cs
Line coverage
100%
Covered lines: 21
Uncovered lines: 0
Coverable lines: 21
Total lines: 63
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Enabled()100%11100%
get_UseGlobalLimiter()100%11100%
get_UseSharedUnknownClientPartition()100%11100%
get_UnknownClientPartitionKey()100%11100%
get_GlobalFixedWindow()100%11100%
.ctor()100%11100%
get_FixedWindowPolicy()100%11100%
get_ConcurrencyPolicy()100%11100%

File(s)

/home/runner/work/NetCoreApplicationTemplate/NetCoreApplicationTemplate/src/ProjectTemplate.Web/Options/ApplicationRateLimitingOptions.cs

#LineLine coverage
 1namespace ProjectTemplate.Web.Options;
 2
 3/// <summary>
 4/// Represents template-level rate limiting configuration.
 5/// </summary>
 6public sealed class ApplicationRateLimitingOptions
 7{
 8    /// <summary>
 9    /// Configuration section name for rate limiting settings.
 10    /// </summary>
 11    public const string SectionName = "ProjectTemplate:RateLimiting";
 12
 13    /// <summary>
 14    /// Gets or sets a value indicating whether rate limiting is enabled.
 15    /// </summary>
 169216    public bool Enabled { get; set; } = true;
 17
 18    /// <summary>
 19    /// Gets or sets a value indicating whether to use the global limiter.
 20    /// When true, <see cref="GlobalFixedWindow"/> is used as a global limiter.
 21    /// </summary>
 155822    public bool UseGlobalLimiter { get; set; } = true;
 23
 24    /// <summary>
 25    /// Gets or sets a value indicating whether requests without a resolved client IP address
 26    /// should use one shared fallback partition key.
 27    /// </summary>
 111228    public bool UseSharedUnknownClientPartition { get; set; }
 29
 30    /// <summary>
 31    /// Gets or sets the base fallback partition key used when the client IP address cannot be resolved.
 32    /// </summary>
 196433    public string UnknownClientPartitionKey { get; set; } = "unknown-client";
 34
 35    /// <summary>
 36    /// Gets or sets the global fixed-window rate limiting options.
 37    /// </summary>
 375438    public FixedWindowRateLimitingOptions GlobalFixedWindow { get; set; } = new()
 57439    {
 57440        PermitLimit = 60,
 57441        WindowSeconds = 60,
 57442        QueueLimit = 0
 57443    };
 44
 45    /// <summary>
 46    /// Gets or sets the fixed-window rate limiting options applied at the template level.
 47    /// </summary>
 366248    public FixedWindowRateLimitingOptions FixedWindowPolicy { get; set; } = new()
 57449    {
 57450        PermitLimit = 60,
 57451        WindowSeconds = 60,
 57452        QueueLimit = 0
 57453    };
 54
 55    /// <summary>
 56    /// Gets or sets the concurrency-based rate limiting options applied at the template level.
 57    /// </summary>
 282058    public ConcurrencyRateLimitingOptions ConcurrencyPolicy { get; set; } = new()
 57459    {
 57460        PermitLimit = 10,
 57461        QueueLimit = 0
 57462    };
 63}