27
27
use std:: net:: SocketAddr ;
28
28
use std:: str:: FromStr ;
29
29
30
+ use itertools:: Itertools ;
31
+ use quiche:: CIDSeq ;
32
+ use quiche:: PathId ;
33
+
30
34
use super :: common:: alpns;
31
35
32
36
pub trait Args {
@@ -300,8 +304,9 @@ Options:
300
304
--perform-migration Perform connection migration on another source port.
301
305
--initial-max-path-id NUM Enable multipath support up to the number of paths.
302
306
-A --address ADDR ... Specify addresses to be used instead of the unspecified address. Non-routable addresses will lead to connectivity issues.
303
- -R --rm-addr TIMEADDR ... Specify addresses to stop using after the provided time (format time,addr).
304
- -S --status TIMEADDRSTAT ... Specify availability status to advertise to the peer after the provided time (format time,addr,available).
307
+ -R --rm-addr TIMEADDR ... Specify addresses to stop using after the provided time (format ms time,addr).
308
+ -S --status TIMEADDRSTAT ... Specify availability status to advertise to the peer after the provided time (format ms time,addr,available).
309
+ -T --retire-dcid TIMEPIDCID ... Specify CIDs to be retired on a specific path ID (format ms time,path id,CID).
305
310
-H --header HEADER ... Add a request header.
306
311
-n --requests REQUESTS Send the given number of identical requests [default: 1].
307
312
--send-priority-update Send HTTP/3 priority updates if the query string params 'u' or 'i' are present in URLs
@@ -334,6 +339,7 @@ pub struct ClientArgs {
334
339
pub addrs : Vec < SocketAddr > ,
335
340
pub rm_addrs : Vec < ( std:: time:: Duration , SocketAddr ) > ,
336
341
pub status : Vec < ( std:: time:: Duration , SocketAddr , bool ) > ,
342
+ pub retire_dcids : Vec < ( std:: time:: Duration , PathId , CIDSeq ) > ,
337
343
}
338
344
339
345
impl Args for ClientArgs {
@@ -425,15 +431,15 @@ impl Args for ClientArgs {
425
431
if s. len ( ) != 2 {
426
432
return None ;
427
433
}
428
- let secs = match s[ 0 ] . parse :: < u64 > ( ) {
434
+ let millis = match s[ 0 ] . parse :: < u64 > ( ) {
429
435
Ok ( s) => s,
430
436
Err ( _) => return None ,
431
437
} ;
432
438
let addr = match SocketAddr :: from_str ( s[ 1 ] ) {
433
439
Ok ( a) => a,
434
440
Err ( _) => return None ,
435
441
} ;
436
- Some ( ( std:: time:: Duration :: from_secs ( secs ) , addr) )
442
+ Some ( ( std:: time:: Duration :: from_millis ( millis ) , addr) )
437
443
} )
438
444
. collect ( ) ;
439
445
@@ -445,7 +451,7 @@ impl Args for ClientArgs {
445
451
if s. len ( ) != 3 {
446
452
return None ;
447
453
}
448
- let secs = match s[ 0 ] . parse :: < u64 > ( ) {
454
+ let millis = match s[ 0 ] . parse :: < u64 > ( ) {
449
455
Ok ( s) => s,
450
456
Err ( _) => return None ,
451
457
} ;
@@ -458,10 +464,34 @@ impl Args for ClientArgs {
458
464
Ok ( _) => true ,
459
465
Err ( _) => return None ,
460
466
} ;
461
- Some ( ( std:: time:: Duration :: from_secs ( secs ) , addr, status) )
467
+ Some ( ( std:: time:: Duration :: from_millis ( millis ) , addr, status) )
462
468
} )
463
469
. collect ( ) ;
464
470
471
+ let retire_dcids = args
472
+ . get_vec ( "--retire-dcid" )
473
+ . into_iter ( )
474
+ . filter_map ( |ta| {
475
+ let s = ta. split ( ',' ) . collect_vec ( ) ;
476
+ if s. len ( ) != 3 {
477
+ return None ;
478
+ }
479
+ let millis = match s[ 0 ] . parse :: < u64 > ( ) {
480
+ Ok ( s) => s,
481
+ Err ( _) => return None ,
482
+ } ;
483
+ let path_id = match s[ 1 ] . parse :: < PathId > ( ) {
484
+ Ok ( p) => p,
485
+ Err ( _) => return None ,
486
+ } ;
487
+ let cid_seq = match s[ 2 ] . parse :: < CIDSeq > ( ) {
488
+ Ok ( c) => c,
489
+ Err ( _) => return None ,
490
+ } ;
491
+ Some ( ( std:: time:: Duration :: from_millis ( millis) , path_id, cid_seq) )
492
+ } )
493
+ . collect_vec ( ) ;
494
+
465
495
ClientArgs {
466
496
version,
467
497
dump_response_path,
@@ -481,6 +511,7 @@ impl Args for ClientArgs {
481
511
addrs,
482
512
rm_addrs,
483
513
status,
514
+ retire_dcids,
484
515
}
485
516
}
486
517
}
@@ -506,6 +537,7 @@ impl Default for ClientArgs {
506
537
addrs : vec ! [ ] ,
507
538
rm_addrs : vec ! [ ] ,
508
539
status : vec ! [ ] ,
540
+ retire_dcids : vec ! [ ] ,
509
541
}
510
542
}
511
543
}
0 commit comments