Package-level declarations

Useful methods to slow down http requests and prevent IP-ban or accidental DDoS.

Functions

Link copied to clipboard
fun OkHttpClient.Builder.rateLimit(permits: Int, period: Duration = 1.seconds): OkHttpClient.Builder
fun OkHttpClient.Builder.rateLimit(permits: Int, period: Long = 1, unit: TimeUnit = TimeUnit.SECONDS): OkHttpClient.Builder

An OkHttp interceptor that handles rate limiting.

Link copied to clipboard
fun OkHttpClient.Builder.rateLimitHost(url: String, permits: Int, period: Duration = 1.seconds): OkHttpClient.Builder
fun OkHttpClient.Builder.rateLimitHost(httpUrl: HttpUrl, permits: Int, period: Duration = 1.seconds): OkHttpClient.Builder
fun OkHttpClient.Builder.rateLimitHost(httpUrl: HttpUrl, permits: Int, period: Long = 1, unit: TimeUnit = TimeUnit.SECONDS): OkHttpClient.Builder

An OkHttp interceptor that handles given url host's rate limiting.