@@ -47,7 +47,7 @@ pub(crate) mod proto {
4747 use super :: * ;
4848 use crate :: {
4949 proto:: { BackendSet , InvalidBackend , InvalidDistribution , InvalidMeta } ,
50- Meta , RouteBackend , RouteDistribution ,
50+ ClientPolicyOverrides , Meta , RouteBackend , RouteDistribution ,
5151 } ;
5252 use linkerd2_proxy_api:: outbound:: { self , tls_route} ;
5353 use linkerd_tls_route:: sni:: proto:: InvalidSniMatch ;
@@ -88,28 +88,30 @@ pub(crate) mod proto {
8888 Missing ,
8989 }
9090
91- impl TryFrom < outbound:: proxy_protocol:: Tls > for Tls {
92- type Error = InvalidTlsRoute ;
93- fn try_from ( proto : outbound:: proxy_protocol:: Tls ) -> Result < Self , Self :: Error > {
91+ impl Tls {
92+ pub fn try_from (
93+ overrides : ClientPolicyOverrides ,
94+ proto : outbound:: proxy_protocol:: Tls ,
95+ ) -> Result < Self , InvalidTlsRoute > {
9496 let routes = proto
9597 . routes
9698 . into_iter ( )
97- . map ( try_route)
99+ . map ( |p| try_route ( p , overrides ) )
98100 . collect :: < Result < Arc < [ _ ] > , _ > > ( ) ?;
99-
100101 Ok ( Self { routes } )
101102 }
102- }
103103
104- impl Tls {
105104 pub fn fill_backends ( & self , set : & mut BackendSet ) {
106105 for Route { ref policy, .. } in & * self . routes {
107106 policy. distribution . fill_backends ( set) ;
108107 }
109108 }
110109 }
111110
112- fn try_route ( proto : outbound:: TlsRoute ) -> Result < Route , InvalidTlsRoute > {
111+ fn try_route (
112+ proto : outbound:: TlsRoute ,
113+ overrides : ClientPolicyOverrides ,
114+ ) -> Result < Route , InvalidTlsRoute > {
113115 let outbound:: TlsRoute {
114116 rules,
115117 snis,
@@ -135,7 +137,7 @@ pub(crate) mod proto {
135137
136138 let policy = rules
137139 . into_iter ( )
138- . map ( |rule| try_rule ( & meta, rule) )
140+ . map ( |rule| try_rule ( & meta, rule, overrides ) )
139141 . next ( )
140142 . ok_or ( InvalidTlsRoute :: OnlyOneRule ( 0 ) ) ??;
141143
@@ -145,6 +147,7 @@ pub(crate) mod proto {
145147 fn try_rule (
146148 meta : & Arc < Meta > ,
147149 tls_route:: Rule { backends, filters } : tls_route:: Rule ,
150+ overrides : ClientPolicyOverrides ,
148151 ) -> Result < Policy , InvalidTlsRoute > {
149152 let distribution = backends
150153 . ok_or ( InvalidTlsRoute :: Missing ( "distribution" ) ) ?
@@ -158,11 +161,24 @@ pub(crate) mod proto {
158161 Ok ( Policy {
159162 meta : meta. clone ( ) ,
160163 filters,
161- params : Default :: default ( ) ,
164+ params : RouteParams :: try_from_proto ( overrides ) ? ,
162165 distribution,
163166 } )
164167 }
165168
169+ impl RouteParams {
170+ fn try_from_proto (
171+ ClientPolicyOverrides {
172+ export_hostname_labels,
173+ ..
174+ } : ClientPolicyOverrides ,
175+ ) -> Result < Self , InvalidTlsRoute > {
176+ Ok ( Self {
177+ export_hostname_labels,
178+ } )
179+ }
180+ }
181+
166182 impl TryFrom < tls_route:: Distribution > for RouteDistribution < Filter > {
167183 type Error = InvalidDistribution ;
168184 fn try_from ( distribution : tls_route:: Distribution ) -> Result < Self , Self :: Error > {
0 commit comments