@@ -26,7 +26,6 @@ import (
26
26
v3listenerpb "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
27
27
v3tlspb "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3"
28
28
"github.com/golang/protobuf/proto"
29
-
30
29
"google.golang.org/grpc/xds/internal/version"
31
30
)
32
31
@@ -50,14 +49,11 @@ const (
50
49
51
50
// FilterChain captures information from within a FilterChain message in a
52
51
// Listener resource.
53
- //
54
- // Currently, this simply contains the security configuration found in the
55
- // 'transport_socket' field of the filter chain. The actual set of filters
56
- // associated with this filter chain are not captured here, since we do not
57
- // support these filters on the server-side yet.
58
52
type FilterChain struct {
59
53
// SecurityCfg contains transport socket security configuration.
60
54
SecurityCfg * SecurityConfig
55
+ // HTTPFilters represent the HTTP Filters that comprise this FilterChain.
56
+ HTTPFilters []HTTPFilter
61
57
}
62
58
63
59
// SourceType specifies the connection source IP match type.
@@ -395,16 +391,20 @@ func (fci *FilterChainManager) addFilterChainsForSourcePorts(srcEntry *sourcePre
395
391
}
396
392
397
393
// filterChainFromProto extracts the relevant information from the FilterChain
398
- // proto and stores it in our internal representation. Currently, we only
399
- // process the security configuration stored in the transport_socket field.
394
+ // proto and stores it in our internal representation.
400
395
func filterChainFromProto (fc * v3listenerpb.FilterChain ) (* FilterChain , error ) {
396
+ httpFilters , err := processNetworkFilters (fc .GetFilters ())
397
+ if err != nil {
398
+ return nil , err
399
+ }
400
+ filterChain := & FilterChain {HTTPFilters : httpFilters }
401
401
// If the transport_socket field is not specified, it means that the control
402
402
// plane has not sent us any security config. This is fine and the server
403
403
// will use the fallback credentials configured as part of the
404
404
// xdsCredentials.
405
405
ts := fc .GetTransportSocket ()
406
406
if ts == nil {
407
- return & FilterChain {} , nil
407
+ return filterChain , nil
408
408
}
409
409
if name := ts .GetName (); name != transportSocketName {
410
410
return nil , fmt .Errorf ("transport_socket field has unexpected name: %s" , name )
@@ -431,7 +431,8 @@ func filterChainFromProto(fc *v3listenerpb.FilterChain) (*FilterChain, error) {
431
431
if sc .RequireClientCert && sc .RootInstanceName == "" {
432
432
return nil , errors .New ("security configuration on the server-side does not contain root certificate provider instance name, but require_client_cert field is set" )
433
433
}
434
- return & FilterChain {SecurityCfg : sc }, nil
434
+ filterChain .SecurityCfg = sc
435
+ return filterChain , nil
435
436
}
436
437
437
438
// FilterChainLookupParams wraps parameters to be passed to Lookup.
0 commit comments