Package-level declarations

Types

Link copied to clipboard
internal typealias CallWeight = suspend (<Error class: unknown class>) -> Int

Calculates the weight of a call as an integer. The weight determines how many permits a call consumes in rate limiting.

Link copied to clipboard
internal typealias ExcludePredicate = suspend (<Error class: unknown class>) -> Boolean

A predicate that determines whether a specific request should be excluded from rate limiting.

Link copied to clipboard
internal typealias InterceptPhase = <Error class: unknown class><suspend (<Error class: unknown class>) -> Unit>

A Ktor Hook that intercepts a phase in the application pipeline to apply rate limiting.

Link copied to clipboard
internal typealias KeyResolver = suspend (<Error class: unknown class>) -> Any

A function that resolves a key for rate limiting from the application call (e.g., an IP address).

Link copied to clipboard
internal typealias OnRejectedCall = suspend (<Error class: unknown class>, <Error class: unknown class>) -> Unit

A callback that handles a request that has been rejected due to rate limiting.

Link copied to clipboard
internal typealias OnSuccessCall = suspend (<Error class: unknown class>) -> Unit

A callback that handles a successful request that has passed rate limiting.

Link copied to clipboard
data class RateLimiterPluginConfig(val rateLimiterConfig: <Error class: unknown class>, val keyResolver: KeyResolver, val onRejectedCall: OnRejectedCall, val onSuccessCall: OnSuccessCall, val excludePredicate: ExcludePredicate, val interceptPhase: <Error class: unknown class><suspend (<Error class: unknown class>) -> Unit>, val callWeight: CallWeight)

Configuration for the KresilRateLimiterPlugin.

Link copied to clipboard

Builder for configuring the KresilRateLimiterPlugin.