Files
xCommons/Configurations/XRateLimitConfiguration.cs
T
2026-11-09 15:40:10 +03:30

26 lines
983 B
C#

using xCommons.Constants;
using System.Collections.Generic;
namespace xCommons.Configurations
{
public class XRateLimitConfiguration
{
public bool Enabled { get; set; } = false;
public int StatusCode { get; set; } = 429;
public int DefaultLimit { get; set; } = 60;
public int DefaultPeriodSeconds { get; set; } = 60;
public bool ApplyToAllRoutes { get; set; } = false;
public ICollection<XRateLimitRule> Rules { get; set; } = [];
public XRateLimitKeyMode DefaultKeyMode { get; set; } = XRateLimitKeyMode.Ip;
}
public partial class XRateLimitRule
{
public int Limit { get; set; } = 60;
public bool Enabled { get; set; } = true;
public int PeriodSeconds { get; set; } = 60;
public string PathPrefix { get; set; } = "/";
public string Name { get; set; } = string.Empty;
public XRateLimitKeyMode KeyMode { get; set; } = XRateLimitKeyMode.Ip;
}
}