ratelimit.proto 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. syntax = "proto3";
  2. package envoy.api.v2.ratelimit;
  3. import "udpa/annotations/migrate.proto";
  4. import "udpa/annotations/status.proto";
  5. import "validate/validate.proto";
  6. option java_package = "io.envoyproxy.envoy.api.v2.ratelimit";
  7. option java_outer_classname = "RatelimitProto";
  8. option java_multiple_files = true;
  9. option go_package = "github.com/envoyproxy/go-control-plane/envoy/api/v2/ratelimit";
  10. option (udpa.annotations.file_migrate).move_to_package = "envoy.extensions.common.ratelimit.v3";
  11. option (udpa.annotations.file_status).package_version_status = FROZEN;
  12. // [#protodoc-title: Common rate limit components]
  13. // A RateLimitDescriptor is a list of hierarchical entries that are used by the service to
  14. // determine the final rate limit key and overall allowed limit. Here are some examples of how
  15. // they might be used for the domain "envoy".
  16. //
  17. // .. code-block:: cpp
  18. //
  19. // ["authenticated": "false"], ["remote_address": "10.0.0.1"]
  20. //
  21. // What it does: Limits all unauthenticated traffic for the IP address 10.0.0.1. The
  22. // configuration supplies a default limit for the *remote_address* key. If there is a desire to
  23. // raise the limit for 10.0.0.1 or block it entirely it can be specified directly in the
  24. // configuration.
  25. //
  26. // .. code-block:: cpp
  27. //
  28. // ["authenticated": "false"], ["path": "/foo/bar"]
  29. //
  30. // What it does: Limits all unauthenticated traffic globally for a specific path (or prefix if
  31. // configured that way in the service).
  32. //
  33. // .. code-block:: cpp
  34. //
  35. // ["authenticated": "false"], ["path": "/foo/bar"], ["remote_address": "10.0.0.1"]
  36. //
  37. // What it does: Limits unauthenticated traffic to a specific path for a specific IP address.
  38. // Like (1) we can raise/block specific IP addresses if we want with an override configuration.
  39. //
  40. // .. code-block:: cpp
  41. //
  42. // ["authenticated": "true"], ["client_id": "foo"]
  43. //
  44. // What it does: Limits all traffic for an authenticated client "foo"
  45. //
  46. // .. code-block:: cpp
  47. //
  48. // ["authenticated": "true"], ["client_id": "foo"], ["path": "/foo/bar"]
  49. //
  50. // What it does: Limits traffic to a specific path for an authenticated client "foo"
  51. //
  52. // The idea behind the API is that (1)/(2)/(3) and (4)/(5) can be sent in 1 request if desired.
  53. // This enables building complex application scenarios with a generic backend.
  54. message RateLimitDescriptor {
  55. message Entry {
  56. // Descriptor key.
  57. string key = 1 [(validate.rules).string = {min_bytes: 1}];
  58. // Descriptor value.
  59. string value = 2 [(validate.rules).string = {min_bytes: 1}];
  60. }
  61. // Descriptor entries.
  62. repeated Entry entries = 1 [(validate.rules).repeated = {min_items: 1}];
  63. }