diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml deleted file mode 100644 index de4f5535..00000000 --- a/.idea/libraries/Dart_Packages.xml +++ /dev/null @@ -1,596 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml deleted file mode 100644 index 2255dbd8..00000000 --- a/.idea/libraries/Dart_SDK.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 639900d1..00000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index af25876f..00000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/tests_in_security.xml b/.idea/runConfigurations/tests_in_security.xml deleted file mode 100644 index 85440c0d..00000000 --- a/.idea/runConfigurations/tests_in_security.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1ddf..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/example/rate_limit.dart b/example/rate_limit.dart new file mode 100644 index 00000000..c8a2387e --- /dev/null +++ b/example/rate_limit.dart @@ -0,0 +1,7 @@ +import 'package:angel_framework/angel_framework.dart'; +import 'package:angel_framework/http.dart'; +import 'package:angel_security/angel_security.dart'; + +main() async { + var app = Angel(), http = AngelHttp(app); +} diff --git a/lib/src/rate_limiter.dart b/lib/src/rate_limiter.dart index e7c08a88..20b58598 100644 --- a/lib/src/rate_limiter.dart +++ b/lib/src/rate_limiter.dart @@ -1,8 +1,13 @@ +import 'dart:async'; import 'package:angel_framework/angel_framework.dart'; /// A base class that facilitates rate limiting API's or endpoints, /// typically to prevent spam and abuse. -abstract class RateLimiter { +/// +/// The rate limiter operates under the assumption that a [User] object +/// can be computed from each request, as well as information about +/// the current rate-limiting window. +abstract class RateLimiter { /// The maximum number of requests allowed within the given [window]. final int maxRequestsPerWindow;