@@ -451,15 +451,16 @@ impl DemandProxyState {
451
451
target_addr : & NetworkAddress ,
452
452
waypoint_addr : & NetworkAddress ,
453
453
) -> Option < GatewayAddress > {
454
- let fetch =
455
- |target_addr : & NetworkAddress , waypoint_addr : & NetworkAddress | -> Result < Option < GatewayAddress > , Error > {
456
- let state = self . state . read ( ) . unwrap ( ) ;
454
+ let fetch = |target_addr : & NetworkAddress ,
455
+ waypoint_addr : & NetworkAddress |
456
+ -> Result < Option < GatewayAddress > , Error > {
457
+ let state = self . state . read ( ) . unwrap ( ) ;
457
458
458
- // Collect all the possible waypoints for the target.
459
- let Some ( target) = state. find_address ( target_addr) else {
459
+ // Collect all the possible waypoints for the target.
460
+ let Some ( target) = state. find_address ( target_addr) else {
460
461
return Err ( Error :: UnknownDestination ( target_addr. address ) ) ;
461
462
} ;
462
- let Some ( mut target_waypoints) = ( match target {
463
+ let Some ( mut target_waypoints) = ( match target {
463
464
Address :: Workload ( wl) => wl
464
465
. waypoint
465
466
. map ( |addr| vec ! [ ( addr. destination. clone( ) , ( 1 , addr) ) ] . into_iter ( ) . collect ( ) ) ,
@@ -468,27 +469,35 @@ impl DemandProxyState {
468
469
debug ! ( "No waypoints for target workload: {target_addr}" ) ;
469
470
return Ok ( None ) ;
470
471
} ;
471
- if target_waypoints. is_empty ( ) {
472
- debug ! ( "No waypoints for target service: {target_addr}" ) ;
473
- return Ok ( None ) ;
474
- }
472
+ if target_waypoints. is_empty ( ) {
473
+ debug ! ( "No waypoints for target service: {target_addr}" ) ;
474
+ return Ok ( None ) ;
475
+ }
475
476
476
- // Waypoint instance is referenced directly
477
- if let Some ( ( _, gw_addr) ) = target_waypoints. remove ( & Destination :: Address ( waypoint_addr. clone ( ) ) ) {
478
- return Ok ( Some ( gw_addr) ) ;
479
- }
477
+ // Waypoint instance is referenced directly
478
+ if let Some ( ( _, gw_addr) ) =
479
+ target_waypoints. remove ( & Destination :: Address ( waypoint_addr. clone ( ) ) )
480
+ {
481
+ return Ok ( Some ( gw_addr) ) ;
482
+ }
480
483
481
- // Waypoint is referenced by the service it's part of
482
- Ok ( state. workloads . find_address ( waypoint_addr) . map ( |wl| {
484
+ // Waypoint is referenced by the service it's part of
485
+ Ok ( state
486
+ . workloads
487
+ . find_address ( waypoint_addr)
488
+ . map ( |wl| {
483
489
state
484
490
. services
485
491
. get_by_workload ( & wl)
486
492
. iter ( )
487
493
. flat_map ( |svc| & svc. vips )
488
- . find_map ( |wp_vip| target_waypoints. remove ( & Destination :: Address ( wp_vip. clone ( ) ) ) )
494
+ . find_map ( |wp_vip| {
495
+ target_waypoints. remove ( & Destination :: Address ( wp_vip. clone ( ) ) )
496
+ } )
489
497
. map ( |el| el. 1 )
490
- } ) . flatten ( ) )
491
- } ;
498
+ } )
499
+ . flatten ( ) )
500
+ } ;
492
501
if let Ok ( result) = fetch ( target_addr, waypoint_addr) {
493
502
return result;
494
503
}
@@ -565,7 +574,12 @@ impl DemandProxyState {
565
574
) ) ;
566
575
}
567
576
} ;
568
- let wp_socket_addr = SocketAddr :: new ( wp_nw_addr. address , gw_address. hbone_mtls_port ) ;
577
+ let wp_socket_addr = SocketAddr :: new (
578
+ wp_nw_addr. address ,
579
+ gw_address
580
+ . proxy_protocol_port
581
+ . unwrap_or ( gw_address. hbone_mtls_port ) ,
582
+ ) ;
569
583
match self
570
584
. fetch_upstream ( & wp_nw_addr. network , wp_socket_addr)
571
585
. await
0 commit comments