Skip to content

Commit eb7266c

Browse files
authored
feat: local ratelimit support XRateLimitHeaders (#6059)
local ratelimit support XRateLimitHeaders Signed-off-by: zirain <[email protected]>
1 parent 0b139e7 commit eb7266c

30 files changed

+727
-388
lines changed

internal/xds/translator/api_key_auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func (*apiKeyAuth) patchResources(*types.ResourceVersionTable, []*ir.HTTPRoute)
8989

9090
// patchRoute patches the provided route with the apiKeyAuth config if applicable.
9191
// Note: this method overwrites the HCM level filter config with the per route filter config.
92-
func (*apiKeyAuth) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute) error {
92+
func (*apiKeyAuth) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute, _ *ir.HTTPListener) error {
9393
if route == nil {
9494
return errors.New("xds route is nil")
9595
}

internal/xds/translator/authorization.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func listenerContainsRBAC(irListener *ir.HTTPListener) bool {
107107
}
108108

109109
// patchRoute patches the provided route with the RBAC config if applicable.
110-
func (*rbac) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute) error {
110+
func (*rbac) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute, _ *ir.HTTPListener) error {
111111
if route == nil {
112112
return errors.New("xds route is nil")
113113
}

internal/xds/translator/basicauth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func (*basicAuth) patchResources(*types.ResourceVersionTable, []*ir.HTTPRoute) e
115115

116116
// patchRoute patches the provided route with the basicAuth config if applicable.
117117
// Note: this method overwrites the HCM level filter config with the per route filter config.
118-
func (*basicAuth) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute) error {
118+
func (*basicAuth) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute, _ *ir.HTTPListener) error {
119119
if route == nil {
120120
return errors.New("xds route is nil")
121121
}

internal/xds/translator/compressor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func (*compressor) patchResources(*types.ResourceVersionTable, []*ir.HTTPRoute)
143143

144144
// patchRoute patches the provided route with the compressor config if applicable.
145145
// Note: this method overwrites the HCM level filter config with the per route filter config.
146-
func (*compressor) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute) error {
146+
func (*compressor) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute, _ *ir.HTTPListener) error {
147147
if route == nil {
148148
return errors.New("xds route is nil")
149149
}

internal/xds/translator/cors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func listenerContainsCORS(irListener *ir.HTTPListener) bool {
105105
}
106106

107107
// patchRoute patches the provided route with the CORS config if applicable.
108-
func (*cors) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute) error {
108+
func (*cors) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute, _ *ir.HTTPListener) error {
109109
if route == nil {
110110
return errors.New("xds route is nil")
111111
}

internal/xds/translator/credentialInjector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func buildCredentialSecret(credentialInjection *ir.CredentialInjection) *tlsv3.S
141141

142142
// patchRoute patches the provided route with the credential injector filter if applicable.
143143
// Note: this method enables the corresponding credential injector filter for the provided route.
144-
func (*credentialInjector) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute) error {
144+
func (*credentialInjector) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute, _ *ir.HTTPListener) error {
145145
if route == nil {
146146
return errors.New("xds route is nil")
147147
}

internal/xds/translator/custom_response.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ func (c *customResponse) patchResources(tCtx *types.ResourceVersionTable,
426426

427427
// patchRoute patches the provided route with the customResponse config if applicable.
428428
// Note: this method enables the corresponding customResponse filter for the provided route.
429-
func (c *customResponse) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute) error {
429+
func (c *customResponse) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute, _ *ir.HTTPListener) error {
430430
if route == nil {
431431
return errors.New("xds route is nil")
432432
}

internal/xds/translator/extauth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func (*extAuth) patchResources(tCtx *types.ResourceVersionTable,
244244

245245
// patchRoute patches the provided route with the extAuth config if applicable.
246246
// Note: this method enables the corresponding extAuth filter for the provided route.
247-
func (*extAuth) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute) error {
247+
func (*extAuth) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute, _ *ir.HTTPListener) error {
248248
if route == nil {
249249
return errors.New("xds route is nil")
250250
}

internal/xds/translator/extproc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ func (*extProc) patchResources(tCtx *types.ResourceVersionTable,
212212

213213
// patchRoute patches the provided route with the extProc config if applicable.
214214
// Note: this method enables the corresponding extProc filter for the provided route.
215-
func (*extProc) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute) error {
215+
func (*extProc) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute, _ *ir.HTTPListener) error {
216216
if route == nil {
217217
return errors.New("xds route is nil")
218218
}

internal/xds/translator/fault.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (*fault) patchResources(*types.ResourceVersionTable, []*ir.HTTPRoute) error
106106

107107
// patchRoute patches the provided route with the fault config if applicable.
108108
// Note: this method enables the corresponding fault filter for the provided route.
109-
func (*fault) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute) error {
109+
func (*fault) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute, _ *ir.HTTPListener) error {
110110
if route == nil {
111111
return errors.New("xds route is nil")
112112
}

0 commit comments

Comments
 (0)