1- use crate :: { stack_labels, Inbound } ;
1+ use crate :: { policy , stack_labels, Inbound } ;
22use linkerd_app_core:: {
33 classify, dst, http_tracing, io, metrics,
44 profiles:: { self , DiscoveryRejected } ,
@@ -16,14 +16,14 @@ use tracing::{debug, debug_span};
1616pub struct Http {
1717 port : u16 ,
1818 settings : http:: client:: Settings ,
19- tls : tls :: ConditionalServerTls ,
19+ permit : policy :: Permit ,
2020}
2121
2222/// Builds `Logical` targets for each HTTP request.
2323#[ derive( Clone , Debug ) ]
2424struct LogicalPerRequest {
2525 addr : Remote < ServerAddr > ,
26- tls : tls :: ConditionalServerTls ,
26+ permit : policy :: Permit ,
2727}
2828
2929/// Describes a logical request target.
@@ -33,7 +33,7 @@ struct Logical {
3333 logical : Option < NameAddr > ,
3434 addr : Remote < ServerAddr > ,
3535 http : http:: Version ,
36- tls : tls :: ConditionalServerTls ,
36+ permit : policy :: Permit ,
3737}
3838
3939/// Describes a resolved profile for a logical service.
@@ -47,7 +47,7 @@ struct Profile {
4747// === impl Inbound ===
4848
4949impl < C > Inbound < C > {
50- pub fn push_http_router < T , P > (
50+ pub ( crate ) fn push_http_router < T , P > (
5151 self ,
5252 profiles : P ,
5353 ) -> Inbound <
@@ -65,7 +65,7 @@ impl<C> Inbound<C> {
6565 T : Param < http:: Version >
6666 + Param < Remote < ServerAddr > >
6767 + Param < Remote < ClientAddr > >
68- + Param < tls :: ConditionalServerTls > ,
68+ + Param < policy :: Permit > ,
6969 T : Clone + Send + ' static ,
7070 P : profiles:: GetProfile < profiles:: LookupAddr > + Clone + Send + Sync + ' static ,
7171 P :: Future : Send ,
@@ -219,10 +219,10 @@ impl<C> Inbound<C> {
219219 . push ( svc:: BoxNewService :: layer ( ) )
220220 . push ( svc:: NewRouter :: layer ( |t : T | LogicalPerRequest {
221221 addr : t. param ( ) ,
222- tls : t. param ( ) ,
222+ permit : t. param ( ) ,
223223 } ) )
224224 // Used by tap.
225- . push_http_insert_target :: < tls :: ConditionalServerTls > ( )
225+ . push_http_insert_target :: < policy :: Permit > ( )
226226 . push_http_insert_target :: < Remote < ClientAddr > > ( )
227227 . push ( svc:: BoxNewService :: layer ( ) )
228228 } )
@@ -259,7 +259,7 @@ impl<A> svc::stack::RecognizeRoute<http::Request<A>> for LogicalPerRequest {
259259 Ok ( Logical {
260260 logical,
261261 addr : self . addr ,
262- tls : self . tls . clone ( ) ,
262+ permit : self . permit . clone ( ) ,
263263 // Use the request's HTTP version (i.e. as modified by orig-proto downgrading).
264264 http : req
265265 . version ( )
@@ -300,9 +300,13 @@ impl Param<transport::labels::Key> for Logical {
300300impl Param < metrics:: EndpointLabels > for Logical {
301301 fn param ( & self ) -> metrics:: EndpointLabels {
302302 metrics:: InboundEndpointLabels {
303- tls : self . tls . clone ( ) ,
303+ tls : self . permit . tls . clone ( ) ,
304304 authority : self . logical . as_ref ( ) . map ( |d| d. as_http_authority ( ) ) ,
305305 target_addr : self . addr . into ( ) ,
306+ policy : metrics:: PolicyLabels {
307+ server : self . permit . server_labels . clone ( ) ,
308+ authz : self . permit . authz_labels . clone ( ) ,
309+ } ,
306310 }
307311 . into ( )
308312 }
@@ -325,8 +329,8 @@ impl tap::Inspect for Logical {
325329
326330 fn src_tls < B > ( & self , req : & http:: Request < B > ) -> tls:: ConditionalServerTls {
327331 req. extensions ( )
328- . get :: < tls :: ConditionalServerTls > ( )
329- . cloned ( )
332+ . get :: < policy :: Permit > ( )
333+ . map ( |p| p . tls . clone ( ) )
330334 . unwrap_or_else ( || tls:: ConditionalServerTls :: None ( tls:: NoServerTls :: Disabled ) )
331335 }
332336
@@ -372,7 +376,7 @@ impl From<Logical> for Http {
372376 Self {
373377 port : l. addr . as_ref ( ) . port ( ) ,
374378 settings : l. http . into ( ) ,
375- tls : l. tls ,
379+ permit : l. permit ,
376380 }
377381 }
378382}
0 commit comments