File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed
Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ func CORSMiddleware(next http.Handler) http.Handler {
3333
3434func hello (w http.ResponseWriter , req * http.Request ) {
3535 token := req .Header .Get ("Authorization" )
36- w .Write ([]byte ("Hello, " + token + ", welcome to dockercon 2020 !" ))
36+ w .Write ([]byte ("Hello, " + token + ", welcome to Istiocon 2021 !" ))
3737}
3838
3939func auth (w http.ResponseWriter , req * http.Request ) {
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ impl HttpContext for UpstreamCall {
7676 }
7777
7878 fn on_http_response_headers ( & mut self , _num_headers : usize ) -> Action {
79- self . set_http_response_header ( "x-app-response " , Some ( "reply from the filter" ) ) ;
79+ self . set_http_response_header ( "x-app-serving " , Some ( "rate-limit- filter" ) ) ;
8080 proxy_wasm:: hostcalls:: log ( LogLevel :: Debug , format ! ( "RESPONDING" ) . as_str ( ) ) . ok ( ) ;
8181 Action :: Continue
8282 }
Original file line number Diff line number Diff line change @@ -14,8 +14,9 @@ pub struct RateLimiter {
1414impl RateLimiter {
1515 fn new ( key : & String , plan : & String ) -> Self {
1616 let limit = match plan. as_str ( ) {
17- "group" => Some ( 100 ) ,
18- "user" => Some ( 10 ) ,
17+ "Enterprise" => Some ( 100 ) ,
18+ "Team" => Some ( 50 ) ,
19+ "Personal" => Some ( 10 ) ,
1920 _ => None ,
2021 } ;
2122 Self {
@@ -31,8 +32,9 @@ impl RateLimiter {
3132 let data: Option < Self > = bincode:: deserialize ( & data) . unwrap_or ( None ) ;
3233 if let Some ( mut obj) = data {
3334 let limit = match plan. as_str ( ) {
34- "group" => Some ( 100 ) ,
35- "user" => Some ( 10 ) ,
35+ "Enterprise" => Some ( 100 ) ,
36+ "Team" => Some ( 50 ) ,
37+ "Personal" => Some ( 10 ) ,
3638 _ => None ,
3739 } ;
3840 obj. rpm = limit;
You can’t perform that action at this time.
0 commit comments