@@ -120,7 +120,7 @@ async fn main() -> Result<()> {
120120 "-" . to_string ( ) ,
121121 interface_configs
122122 . iter ( )
123- . map ( |config| config. binding . name . clone ( ) )
123+ . map ( |config| config. label . clone ( ) )
124124 . collect ( ) ,
125125 Some ( ui_command_tx) ,
126126 )
@@ -153,6 +153,7 @@ async fn main() -> Result<()> {
153153 binding,
154154 endpoint_id,
155155 secret_key,
156+ label : _,
156157 } = config;
157158 let path = match connect_path_with_secret (
158159 binding. clone ( ) ,
@@ -167,13 +168,13 @@ async fn main() -> Result<()> {
167168 . connection ( )
168169 . expect ( "newly connected path has a live connection" ) ;
169170 ctx. record_connection_paths (
170- path. interface_name . clone ( ) ,
171+ path. display_name . clone ( ) ,
171172 & endpoint_id,
172173 & connection,
173174 true ,
174175 ) ;
175176 ctx. connected_path (
176- & path. interface_name ,
177+ & path. display_name ,
177178 & endpoint_id,
178179 SocketAddr :: V4 (
179180 path. current_bound_addr ( )
@@ -184,10 +185,10 @@ async fn main() -> Result<()> {
184185 }
185186 Err ( err) => {
186187 ctx. record_send_error (
187- binding. name . clone ( ) ,
188+ binding. display_name . clone ( ) ,
188189 format ! ( "initial connect failed, retrying: {err}" ) ,
189190 ) ;
190- ctx. reconnect_failed ( & binding. name , & err. to_string ( ) ) ;
191+ ctx. reconnect_failed ( & binding. display_name , & err. to_string ( ) ) ;
191192 PathConnection :: pending ( binding, server_addr. clone ( ) , secret_key, & cli. relays )
192193 }
193194 } ;
@@ -208,7 +209,7 @@ async fn main() -> Result<()> {
208209 paths
209210 . iter ( )
210211 . zip ( health_endpoint_ids. iter ( ) )
211- . map ( |( path, endpoint_id) | ( path. interface_name . clone ( ) , endpoint_id. clone ( ) ) )
212+ . map ( |( path, endpoint_id) | ( path. display_name . clone ( ) , endpoint_id. clone ( ) ) )
212213 . collect ( ) ,
213214 Duration :: from_millis ( cli. tc_backlog_poll_ms ) ,
214215 cli. tc_backlog_degrade_bytes ,
@@ -218,12 +219,12 @@ async fn main() -> Result<()> {
218219 let health = spawn_health_receivers ( & paths, ctx. clone ( ) , strategy. clone ( ) ) ;
219220 for path in & paths {
220221 if path. reconnect_requested ( ) {
221- strategy. record_interface_reconnecting ( & path. interface_name ) ;
222+ strategy. record_interface_reconnecting ( & path. display_name ) ;
222223 }
223224 }
224225 let path_names = paths
225226 . iter ( )
226- . map ( |path| path. interface_name . clone ( ) )
227+ . map ( |path| path. display_name . clone ( ) )
227228 . collect :: < Vec < _ > > ( ) ;
228229 spawn_interface_watchers ( & paths, strategy. clone ( ) , ctx. clone ( ) ) ;
229230 spawn_reconnect_loops ( & paths, & health_endpoint_ids, strategy. clone ( ) , ctx. clone ( ) ) ;
@@ -255,6 +256,9 @@ async fn main() -> Result<()> {
255256 "tui hotkey" ,
256257 ) ;
257258 }
259+ tui:: UiCommand :: ToggleWeightedAuto => {
260+ strategy. toggle_weighted_auto_split ( & ctx) ;
261+ }
258262 }
259263 }
260264 } ) ;
@@ -324,7 +328,7 @@ async fn main() -> Result<()> {
324328
325329 for path in & paths {
326330 let path = path. clone ( ) ;
327- let interface_name = path. interface_name . clone ( ) ;
331+ let interface_name = path. display_name . clone ( ) ;
328332 let listen_socket = listen_socket. clone ( ) ;
329333 let last_ingest_peer = last_ingest_peer. clone ( ) ;
330334 let ctx = ctx. clone ( ) ;
@@ -429,11 +433,12 @@ fn spawn_interface_watchers(
429433 tokio:: time:: sleep ( INTERFACE_WATCH_INTERVAL ) . await ;
430434
431435 match resolve_interface_ipv4 ( & path. interface_name ) {
432- Ok ( binding) => {
436+ Ok ( mut binding) => {
437+ binding. display_name . clone_from ( & path. display_name ) ;
433438 if let Some ( endpoint) = path. mark_interface_changed ( binding. clone ( ) ) {
434- strategy. record_interface_reconnecting ( & path. interface_name ) ;
439+ strategy. record_interface_reconnecting ( & path. display_name ) ;
435440 ctx. record_send_error (
436- path. interface_name . clone ( ) ,
441+ path. display_name . clone ( ) ,
437442 format ! (
438443 "interface address changed, reconnecting: {}" ,
439444 binding. bind_addr
@@ -452,7 +457,7 @@ fn spawn_interface_watchers(
452457 } else {
453458 path. request_reconnect ( ) ;
454459 }
455- strategy. record_interface_dead ( & path. interface_name ) ;
460+ strategy. record_interface_dead ( & path. display_name ) ;
456461 }
457462 }
458463 }
@@ -478,7 +483,7 @@ fn spawn_connection_liveness(
478483 } ;
479484
480485 ctx. record_connection_paths (
481- path. interface_name . clone ( ) ,
486+ path. display_name . clone ( ) ,
482487 & endpoint_id,
483488 & connection,
484489 false ,
@@ -488,9 +493,9 @@ fn spawn_connection_liveness(
488493 } ;
489494
490495 let connection_id = connection. stable_id ( ) ;
491- strategy. record_interface_reconnecting ( & path. interface_name ) ;
496+ strategy. record_interface_reconnecting ( & path. display_name ) ;
492497 ctx. record_send_error (
493- path. interface_name . clone ( ) ,
498+ path. display_name . clone ( ) ,
494499 format ! ( "connection closed: {reason}" ) ,
495500 ) ;
496501 if let Some ( endpoint) = path. mark_failed ( Some ( connection_id) ) {
@@ -530,9 +535,9 @@ fn spawn_split_display_updates(
530535 !matches ! ( effective, PathStrategy :: Split )
531536 || split_interface_names
532537 . iter ( )
533- . any ( |name| name == & path. interface_name )
538+ . any ( |name| name == & path. display_name )
534539 } )
535- . map ( |path| path. interface_name . clone ( ) )
540+ . map ( |path| path. display_name . clone ( ) )
536541 . collect :: < Vec < _ > > ( ) ;
537542 ctx. record_split_percentages (
538543 & strategy. effective_split_percentages_for ( & displayed_split_names) ,
@@ -558,47 +563,47 @@ fn spawn_reconnect_loops(
558563 continue ;
559564 }
560565
561- strategy. record_interface_reconnecting ( & path. interface_name ) ;
566+ strategy. record_interface_reconnecting ( & path. display_name ) ;
562567 match tokio:: time:: timeout ( RECONNECT_ATTEMPT_TIMEOUT , path. reconnect ( ) ) . await {
563568 Ok ( Ok ( connection) ) => {
564569 retry_delay = Duration :: from_millis ( 250 ) ;
565- strategy. record_interface_success ( & path. interface_name ) ;
570+ strategy. record_interface_success ( & path. display_name ) ;
566571 ctx. record_connection_paths (
567- path. interface_name . clone ( ) ,
572+ path. display_name . clone ( ) ,
568573 & endpoint_id,
569574 & connection,
570575 true ,
571576 ) ;
572577 if let Some ( bound_addr) = path. current_bound_addr ( ) {
573578 ctx. connected_path (
574- & path. interface_name ,
579+ & path. display_name ,
575580 & endpoint_id,
576581 SocketAddr :: V4 ( bound_addr) ,
577582 ) ;
578583 }
579584 }
580585 Ok ( Err ( err) ) => {
581- strategy. record_interface_dead ( & path. interface_name ) ;
586+ strategy. record_interface_dead ( & path. display_name ) ;
582587 let error = err. to_string ( ) ;
583588 ctx. record_send_error (
584- path. interface_name . clone ( ) ,
589+ path. display_name . clone ( ) ,
585590 format ! ( "reconnect failed: {error}" ) ,
586591 ) ;
587- ctx. reconnect_failed ( & path. interface_name , & error) ;
592+ ctx. reconnect_failed ( & path. display_name , & error) ;
588593 tokio:: time:: sleep ( retry_delay) . await ;
589594 retry_delay = ( retry_delay * 2 ) . min ( Duration :: from_secs ( 5 ) ) ;
590595 }
591596 Err ( _) => {
592- strategy. record_interface_dead ( & path. interface_name ) ;
597+ strategy. record_interface_dead ( & path. display_name ) ;
593598 let error = format ! (
594599 "reconnect timed out after {}s" ,
595600 RECONNECT_ATTEMPT_TIMEOUT . as_secs( )
596601 ) ;
597602 ctx. record_send_error (
598- path. interface_name . clone ( ) ,
603+ path. display_name . clone ( ) ,
599604 format ! ( "reconnect failed: {error}" ) ,
600605 ) ;
601- ctx. reconnect_failed ( & path. interface_name , & error) ;
606+ ctx. reconnect_failed ( & path. display_name , & error) ;
602607 tokio:: time:: sleep ( retry_delay) . await ;
603608 retry_delay = ( retry_delay * 2 ) . min ( Duration :: from_secs ( 5 ) ) ;
604609 }
@@ -639,18 +644,18 @@ fn send_packet(
639644 . filter ( |path| {
640645 split_interface_names
641646 . iter ( )
642- . any ( |name| name == & path. interface_name )
647+ . any ( |name| name == & path. display_name )
643648 } )
644649 . collect :: < Vec < _ > > ( ) ;
645650 let displayed_split_names = if matches ! ( effective, PathStrategy :: Split ) {
646651 split_paths
647652 . iter ( )
648- . map ( |path| path. interface_name . clone ( ) )
653+ . map ( |path| path. display_name . clone ( ) )
649654 . collect :: < Vec < _ > > ( )
650655 } else {
651656 active_paths
652657 . iter ( )
653- . map ( |path| path. interface_name . clone ( ) )
658+ . map ( |path| path. display_name . clone ( ) )
654659 . collect :: < Vec < _ > > ( )
655660 } ;
656661 ctx. record_split_percentages ( & strategy. effective_split_percentages_for ( & displayed_split_names) ) ;
@@ -663,7 +668,7 @@ fn send_packet(
663668 . filter ( |path| {
664669 rescue_interface_names
665670 . iter ( )
666- . any ( |name| name == & path. interface_name )
671+ . any ( |name| name == & path. display_name )
667672 } )
668673 . collect :: < Vec < _ > > ( )
669674 } ;
@@ -677,11 +682,11 @@ fn send_packet(
677682 ) {
678683 let split_names = split_paths
679684 . iter ( )
680- . map ( |path| path. interface_name . clone ( ) )
685+ . map ( |path| path. display_name . clone ( ) )
681686 . collect :: < Vec < _ > > ( ) ;
682687 let fragments = u8:: try_from ( split_paths. len ( ) ) . expect ( "path count fits in u8" ) ;
683688 let split_ranges =
684- weighted_split_ranges ( payload. len ( ) , & strategy. split_weights ( & split_names) ) ;
689+ weighted_split_ranges ( payload. len ( ) , & strategy. active_split_weights ( & split_names) ) ;
685690 for ( fragment, path) in split_paths. iter ( ) . enumerate ( ) {
686691 let ( start, end) = split_ranges[ fragment] ;
687692 let packet = Arc :: new ( encode_packet (
@@ -758,24 +763,24 @@ fn send_on_path(
758763 let connection_id = path. connection_id ( ) ;
759764 match path. send ( packet) {
760765 Ok ( ( ) ) => {
761- strategy. record_interface_success ( & path. interface_name ) ;
762- strategy. record_interface_send ( & path. interface_name , packet_len) ;
763- ctx. record_send ( path. interface_name . clone ( ) , payload_len) ;
766+ strategy. record_interface_success ( & path. display_name ) ;
767+ strategy. record_interface_send ( & path. display_name , packet_len) ;
768+ ctx. record_send ( path. display_name . clone ( ) , payload_len) ;
764769 }
765770 Err ( err) => {
766- strategy. record_interface_failure ( & path. interface_name ) ;
771+ strategy. record_interface_failure ( & path. display_name ) ;
767772 if let Some ( endpoint) = path. mark_failed ( connection_id) {
768773 tokio:: spawn ( async move {
769774 endpoint. close ( ) . await ;
770775 } ) ;
771776 }
772- ctx. record_send_error ( path. interface_name . clone ( ) , err. to_string ( ) ) ;
773- ctx. send_failure ( & path. interface_name , seq, & err. to_string ( ) ) ;
777+ ctx. record_send_error ( path. display_name . clone ( ) , err. to_string ( ) ) ;
778+ ctx. send_failure ( & path. display_name , seq, & err. to_string ( ) ) ;
774779 strategy. degrade_to_redundant (
775780 ctx,
776781 format ! (
777782 "send error interface={} sequence={} error={err}" ,
778- path. interface_name , seq
783+ path. display_name , seq
779784 ) ,
780785 ) ;
781786 }
0 commit comments