diff --git a/src/configuration.rs b/src/configuration.rs index 5dfdea7..f3a06d9 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -129,7 +129,7 @@ impl<'de> Deserialize<'de> for Timeout { } struct TimeoutVisitor; -impl<'de> Visitor<'de> for TimeoutVisitor { +impl Visitor<'_> for TimeoutVisitor { type Value = Timeout; fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result { diff --git a/tests/auth.rs b/tests/auth.rs index d0ded73..9bf6db1 100644 --- a/tests/auth.rs +++ b/tests/auth.rs @@ -176,21 +176,7 @@ fn it_auths() { Some("envoy.service.auth.v3.Authorization"), Some("Check"), Some(&[0, 0, 0, 0]), - Some(&[ - 10, 236, 1, 10, 25, 10, 23, 10, 21, 18, 15, 49, 50, 55, 46, 48, 46, 48, 46, 49, 58, - 52, 53, 48, 48, 48, 24, 200, 223, 2, 18, 23, 10, 21, 10, 19, 18, 14, 49, 50, 55, - 46, 48, 46, 48, 46, 49, 58, 56, 48, 48, 48, 24, 192, 62, 34, 157, 1, 10, 12, 8, - 146, 140, 179, 185, 6, 16, 240, 213, 233, 163, 3, 18, 140, 1, 18, 3, 71, 69, 84, - 26, 30, 10, 10, 58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 18, 16, 97, 98, - 105, 95, 116, 101, 115, 116, 95, 104, 97, 114, 110, 101, 115, 115, 26, 38, 10, 5, - 58, 112, 97, 116, 104, 18, 29, 47, 100, 101, 102, 97, 117, 108, 116, 47, 114, 101, - 113, 117, 101, 115, 116, 47, 104, 101, 97, 100, 101, 114, 115, 47, 112, 97, 116, - 104, 26, 14, 10, 7, 58, 109, 101, 116, 104, 111, 100, 18, 3, 71, 69, 84, 34, 10, - 47, 97, 100, 109, 105, 110, 47, 116, 111, 121, 42, 17, 99, 97, 114, 115, 46, 116, - 111, 121, 115, 116, 111, 114, 101, 46, 99, 111, 109, 50, 4, 104, 116, 116, 112, 82, - 8, 72, 84, 84, 80, 47, 49, 46, 49, 82, 20, 10, 4, 104, 111, 115, 116, 18, 12, 97, - 117, 116, 104, 99, 111, 110, 102, 105, 103, 45, 65, 90, 0, - ]), + None, Some(5000), ) .returning(Some(42)) @@ -373,21 +359,7 @@ fn it_denies() { Some("envoy.service.auth.v3.Authorization"), Some("Check"), Some(&[0, 0, 0, 0]), - Some(&[ - 10, 236, 1, 10, 25, 10, 23, 10, 21, 18, 15, 49, 50, 55, 46, 48, 46, 48, 46, 49, 58, - 52, 53, 48, 48, 48, 24, 200, 223, 2, 18, 23, 10, 21, 10, 19, 18, 14, 49, 50, 55, - 46, 48, 46, 48, 46, 49, 58, 56, 48, 48, 48, 24, 192, 62, 34, 157, 1, 10, 12, 8, - 146, 140, 179, 185, 6, 16, 240, 213, 233, 163, 3, 18, 140, 1, 18, 3, 71, 69, 84, - 26, 30, 10, 10, 58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 18, 16, 97, 98, - 105, 95, 116, 101, 115, 116, 95, 104, 97, 114, 110, 101, 115, 115, 26, 38, 10, 5, - 58, 112, 97, 116, 104, 18, 29, 47, 100, 101, 102, 97, 117, 108, 116, 47, 114, 101, - 113, 117, 101, 115, 116, 47, 104, 101, 97, 100, 101, 114, 115, 47, 112, 97, 116, - 104, 26, 14, 10, 7, 58, 109, 101, 116, 104, 111, 100, 18, 3, 71, 69, 84, 34, 10, - 47, 97, 100, 109, 105, 110, 47, 116, 111, 121, 42, 17, 99, 97, 114, 115, 46, 116, - 111, 121, 115, 116, 111, 114, 101, 46, 99, 111, 109, 50, 4, 104, 116, 116, 112, 82, - 8, 72, 84, 84, 80, 47, 49, 46, 49, 82, 20, 10, 4, 104, 111, 115, 116, 18, 12, 97, - 117, 116, 104, 99, 111, 110, 102, 105, 103, 45, 65, 90, 0, - ]), + None, Some(5000), ) .returning(Some(42)) @@ -588,21 +560,7 @@ fn it_does_not_fold_auth_actions() { Some("envoy.service.auth.v3.Authorization"), Some("Check"), Some(&[0, 0, 0, 0]), - Some(&[ - 10, 234, 1, 10, 25, 10, 23, 10, 21, 18, 15, 49, 50, 55, 46, 48, 46, 48, 46, 49, 58, - 52, 53, 48, 48, 48, 24, 200, 223, 2, 18, 23, 10, 21, 10, 19, 18, 14, 49, 50, 55, - 46, 48, 46, 48, 46, 49, 58, 56, 48, 48, 48, 24, 192, 62, 34, 157, 1, 10, 12, 8, - 146, 140, 179, 185, 6, 16, 240, 213, 233, 163, 3, 18, 140, 1, 18, 3, 71, 69, 84, - 26, 14, 10, 7, 58, 109, 101, 116, 104, 111, 100, 18, 3, 71, 69, 84, 26, 38, 10, 5, - 58, 112, 97, 116, 104, 18, 29, 47, 100, 101, 102, 97, 117, 108, 116, 47, 114, 101, - 113, 117, 101, 115, 116, 47, 104, 101, 97, 100, 101, 114, 115, 47, 112, 97, 116, - 104, 26, 30, 10, 10, 58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 18, 16, 97, - 98, 105, 95, 116, 101, 115, 116, 95, 104, 97, 114, 110, 101, 115, 115, 34, 10, 47, - 97, 100, 109, 105, 110, 47, 116, 111, 121, 42, 17, 99, 97, 114, 115, 46, 116, 111, - 121, 115, 116, 111, 114, 101, 46, 99, 111, 109, 50, 4, 104, 116, 116, 112, 82, 8, - 72, 84, 84, 80, 47, 49, 46, 49, 82, 18, 10, 4, 104, 111, 115, 116, 18, 10, 97, 117, - 116, 104, 45, 115, 99, 111, 112, 101, 90, 0, - ]), + None, Some(5000), ) .returning(Some(42)) @@ -700,21 +658,7 @@ fn it_does_not_fold_auth_actions() { Some("envoy.service.auth.v3.Authorization"), Some("Check"), Some(&[0, 0, 0, 0]), - Some(&[ - 10, 234, 1, 10, 25, 10, 23, 10, 21, 18, 15, 49, 50, 55, 46, 48, 46, 48, 46, 49, 58, - 52, 53, 48, 48, 48, 24, 200, 223, 2, 18, 23, 10, 21, 10, 19, 18, 14, 49, 50, 55, - 46, 48, 46, 48, 46, 49, 58, 56, 48, 48, 48, 24, 192, 62, 34, 157, 1, 10, 12, 8, - 146, 140, 179, 185, 6, 16, 240, 213, 233, 163, 3, 18, 140, 1, 18, 3, 71, 69, 84, - 26, 14, 10, 7, 58, 109, 101, 116, 104, 111, 100, 18, 3, 71, 69, 84, 26, 30, 10, 10, - 58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 18, 16, 97, 98, 105, 95, 116, 101, - 115, 116, 95, 104, 97, 114, 110, 101, 115, 115, 26, 38, 10, 5, 58, 112, 97, 116, - 104, 18, 29, 47, 100, 101, 102, 97, 117, 108, 116, 47, 114, 101, 113, 117, 101, - 115, 116, 47, 104, 101, 97, 100, 101, 114, 115, 47, 112, 97, 116, 104, 34, 10, 47, - 97, 100, 109, 105, 110, 47, 116, 111, 121, 42, 17, 99, 97, 114, 115, 46, 116, 111, - 121, 115, 116, 111, 114, 101, 46, 99, 111, 109, 50, 4, 104, 116, 116, 112, 82, 8, - 72, 84, 84, 80, 47, 49, 46, 49, 82, 18, 10, 4, 104, 111, 115, 116, 18, 10, 97, 117, - 116, 104, 45, 115, 99, 111, 112, 101, 90, 0, - ]), + None, Some(5000), ) .returning(Some(42)) diff --git a/tests/multi.rs b/tests/multi.rs index 20a11bf..d010402 100644 --- a/tests/multi.rs +++ b/tests/multi.rs @@ -193,21 +193,7 @@ fn it_performs_authenticated_rate_limiting() { Some("envoy.service.auth.v3.Authorization"), Some("Check"), Some(&[0, 0, 0, 0]), - Some(&[ - 10, 236, 1, 10, 25, 10, 23, 10, 21, 18, 15, 49, 50, 55, 46, 48, 46, 48, 46, 49, 58, - 52, 53, 48, 48, 48, 24, 200, 223, 2, 18, 23, 10, 21, 10, 19, 18, 14, 49, 50, 55, - 46, 48, 46, 48, 46, 49, 58, 56, 48, 48, 48, 24, 192, 62, 34, 157, 1, 10, 12, 8, - 146, 140, 179, 185, 6, 16, 240, 213, 233, 163, 3, 18, 140, 1, 18, 3, 71, 69, 84, - 26, 14, 10, 7, 58, 109, 101, 116, 104, 111, 100, 18, 3, 71, 69, 84, 26, 30, 10, 10, - 58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 18, 16, 97, 98, 105, 95, 116, 101, - 115, 116, 95, 104, 97, 114, 110, 101, 115, 115, 26, 38, 10, 5, 58, 112, 97, 116, - 104, 18, 29, 47, 100, 101, 102, 97, 117, 108, 116, 47, 114, 101, 113, 117, 101, - 115, 116, 47, 104, 101, 97, 100, 101, 114, 115, 47, 112, 97, 116, 104, 34, 10, 47, - 97, 100, 109, 105, 110, 47, 116, 111, 121, 42, 17, 99, 97, 114, 115, 46, 116, 111, - 121, 115, 116, 111, 114, 101, 46, 99, 111, 109, 50, 4, 104, 116, 116, 112, 82, 8, - 72, 84, 84, 80, 47, 49, 46, 49, 82, 20, 10, 4, 104, 111, 115, 116, 18, 12, 97, 117, - 116, 104, 99, 111, 110, 102, 105, 103, 45, 65, 90, 0, - ]), + None, Some(5000), ) .returning(Some(42)) @@ -236,10 +222,7 @@ fn it_performs_authenticated_rate_limiting() { Some("envoy.service.ratelimit.v3.RateLimitService"), Some("ShouldRateLimit"), Some(&[0, 0, 0, 0]), - Some(&[ - 10, 10, 82, 76, 83, 45, 100, 111, 109, 97, 105, 110, 18, 12, 10, 10, 10, 5, 97, - 100, 109, 105, 110, 18, 1, 49, 24, 1, - ]), + None, Some(5000), ) .returning(Some(43)) @@ -407,21 +390,7 @@ fn unauthenticated_does_not_ratelimit() { Some("envoy.service.auth.v3.Authorization"), Some("Check"), Some(&[0, 0, 0, 0]), - Some(&[ - 10, 236, 1, 10, 25, 10, 23, 10, 21, 18, 15, 49, 50, 55, 46, 48, 46, 48, 46, 49, 58, - 52, 53, 48, 48, 48, 24, 200, 223, 2, 18, 23, 10, 21, 10, 19, 18, 14, 49, 50, 55, - 46, 48, 46, 48, 46, 49, 58, 56, 48, 48, 48, 24, 192, 62, 34, 157, 1, 10, 12, 8, - 146, 140, 179, 185, 6, 16, 240, 213, 233, 163, 3, 18, 140, 1, 18, 3, 71, 69, 84, - 26, 14, 10, 7, 58, 109, 101, 116, 104, 111, 100, 18, 3, 71, 69, 84, 26, 30, 10, 10, - 58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 18, 16, 97, 98, 105, 95, 116, 101, - 115, 116, 95, 104, 97, 114, 110, 101, 115, 115, 26, 38, 10, 5, 58, 112, 97, 116, - 104, 18, 29, 47, 100, 101, 102, 97, 117, 108, 116, 47, 114, 101, 113, 117, 101, - 115, 116, 47, 104, 101, 97, 100, 101, 114, 115, 47, 112, 97, 116, 104, 34, 10, 47, - 97, 100, 109, 105, 110, 47, 116, 111, 121, 42, 17, 99, 97, 114, 115, 46, 116, 111, - 121, 115, 116, 111, 114, 101, 46, 99, 111, 109, 50, 4, 104, 116, 116, 112, 82, 8, - 72, 84, 84, 80, 47, 49, 46, 49, 82, 20, 10, 4, 104, 111, 115, 116, 18, 12, 97, 117, - 116, 104, 99, 111, 110, 102, 105, 103, 45, 65, 90, 0, - ]), + None, Some(5000), ) .returning(Some(42)) @@ -681,21 +650,7 @@ fn authenticated_one_ratelimit_action_matches() { Some("envoy.service.auth.v3.Authorization"), Some("Check"), Some(&[0, 0, 0, 0]), - Some(&[ - 10, 236, 1, 10, 25, 10, 23, 10, 21, 18, 15, 49, 50, 55, 46, 48, 46, 48, 46, 49, 58, - 52, 53, 48, 48, 48, 24, 200, 223, 2, 18, 23, 10, 21, 10, 19, 18, 14, 49, 50, 55, - 46, 48, 46, 48, 46, 49, 58, 56, 48, 48, 48, 24, 192, 62, 34, 157, 1, 10, 12, 8, - 146, 140, 179, 185, 6, 16, 240, 213, 233, 163, 3, 18, 140, 1, 18, 3, 71, 69, 84, - 26, 14, 10, 7, 58, 109, 101, 116, 104, 111, 100, 18, 3, 71, 69, 84, 26, 30, 10, 10, - 58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 18, 16, 97, 98, 105, 95, 116, 101, - 115, 116, 95, 104, 97, 114, 110, 101, 115, 115, 26, 38, 10, 5, 58, 112, 97, 116, - 104, 18, 29, 47, 100, 101, 102, 97, 117, 108, 116, 47, 114, 101, 113, 117, 101, - 115, 116, 47, 104, 101, 97, 100, 101, 114, 115, 47, 112, 97, 116, 104, 34, 10, 47, - 97, 100, 109, 105, 110, 47, 116, 111, 121, 42, 17, 99, 97, 114, 115, 46, 116, 111, - 121, 115, 116, 111, 114, 101, 46, 99, 111, 109, 50, 4, 104, 116, 116, 112, 82, 8, - 72, 84, 84, 80, 47, 49, 46, 49, 82, 20, 10, 4, 104, 111, 115, 116, 18, 12, 97, 117, - 116, 104, 99, 111, 110, 102, 105, 103, 45, 65, 90, 0, - ]), + None, Some(5000), ) .returning(Some(42)) @@ -737,10 +692,7 @@ fn authenticated_one_ratelimit_action_matches() { Some("envoy.service.ratelimit.v3.RateLimitService"), Some("ShouldRateLimit"), Some(&[0, 0, 0, 0]), - Some(&[ - 10, 10, 82, 76, 83, 45, 100, 111, 109, 97, 105, 110, 18, 12, 10, 10, 10, 5, 111, - 116, 104, 101, 114, 18, 1, 49, 24, 1, - ]), + None, Some(5000), ) .returning(Some(43)) diff --git a/tests/rate_limited.rs b/tests/rate_limited.rs index 1586160..272cf07 100644 --- a/tests/rate_limited.rs +++ b/tests/rate_limited.rs @@ -180,10 +180,7 @@ fn it_limits() { Some("envoy.service.ratelimit.v3.RateLimitService"), Some("ShouldRateLimit"), Some(&[0, 0, 0, 0]), - Some(&[ - 10, 10, 82, 76, 83, 45, 100, 111, 109, 97, 105, 110, 18, 12, 10, 10, 10, 5, 97, - 100, 109, 105, 110, 18, 1, 49, 24, 1, - ]), + None, Some(5000), ) .returning(Some(42)) @@ -326,10 +323,7 @@ fn it_passes_additional_headers() { Some("envoy.service.ratelimit.v3.RateLimitService"), Some("ShouldRateLimit"), Some(&[0, 0, 0, 0]), - Some(&[ - 10, 10, 82, 76, 83, 45, 100, 111, 109, 97, 105, 110, 18, 12, 10, 10, 10, 5, 97, - 100, 109, 105, 110, 18, 1, 49, 24, 1, - ]), + None, Some(5000), ) .returning(Some(42)) @@ -462,10 +456,7 @@ fn it_rate_limits_with_empty_predicates() { Some("envoy.service.ratelimit.v3.RateLimitService"), Some("ShouldRateLimit"), Some(&[0, 0, 0, 0]), - Some(&[ - 10, 10, 82, 76, 83, 45, 100, 111, 109, 97, 105, 110, 18, 12, 10, 10, 10, 5, 97, - 100, 109, 105, 110, 18, 1, 49, 24, 1, - ]), + None, Some(5000), ) .returning(Some(42)) @@ -703,12 +694,7 @@ fn it_folds_subsequent_actions_to_limitador_into_a_single_one() { Some("envoy.service.ratelimit.v3.RateLimitService"), Some("ShouldRateLimit"), Some(&[0, 0, 0, 0]), - Some(&[ - 10, 10, 82, 76, 83, 45, 100, 111, 109, 97, 105, 110, 18, 54, 10, 16, 10, 5, 107, - 101, 121, 95, 49, 18, 7, 118, 97, 108, 117, 101, 95, 49, 10, 16, 10, 5, 107, 101, - 121, 95, 50, 18, 7, 118, 97, 108, 117, 101, 95, 50, 10, 16, 10, 5, 107, 101, 121, - 95, 51, 18, 7, 118, 97, 108, 117, 101, 95, 51, 24, 1, - ]), + None, Some(5000), ) .returning(Some(42))