feat: add in flight connection middleware

This commit is contained in:
Tom Moulard
2021-11-29 17:12:06 +01:00
committed by GitHub
parent 95fabeae73
commit 93de7cf0c0
14 changed files with 326 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ import (
"strings"
"github.com/traefik/traefik/v2/pkg/config/runtime"
inflightconn "github.com/traefik/traefik/v2/pkg/middlewares/tcp/inflightconn"
ipwhitelist "github.com/traefik/traefik/v2/pkg/middlewares/tcp/ipwhitelist"
"github.com/traefik/traefik/v2/pkg/server/provider"
"github.com/traefik/traefik/v2/pkg/tcp"
@@ -86,6 +87,13 @@ func (b *Builder) buildConstructor(ctx context.Context, middlewareName string) (
var middleware tcp.Constructor
// InFlightConn
if config.InFlightConn != nil {
middleware = func(next tcp.Handler) (tcp.Handler, error) {
return inflightconn.New(ctx, next, *config.InFlightConn, middlewareName)
}
}
// IPWhiteList
if config.IPWhiteList != nil {
middleware = func(next tcp.Handler) (tcp.Handler, error) {