@@ -22,8 +22,8 @@ use std::{
22
22
net:: { IpAddr , Ipv4Addr , Ipv6Addr , SocketAddr , SocketAddrV4 , SocketAddrV6 } ,
23
23
pin:: Pin ,
24
24
sync:: {
25
- atomic:: { AtomicBool , AtomicU64 , Ordering } ,
26
25
Arc , Mutex , RwLock ,
26
+ atomic:: { AtomicBool , AtomicU64 , Ordering } ,
27
27
} ,
28
28
task:: { Context , Poll } ,
29
29
} ;
@@ -33,24 +33,24 @@ use data_encoding::HEXLOWER;
33
33
use iroh_base:: { NodeAddr , NodeId , PublicKey , RelayUrl , SecretKey } ;
34
34
use iroh_relay:: RelayMap ;
35
35
use n0_future:: {
36
+ StreamExt ,
36
37
boxed:: BoxStream ,
37
38
task:: { self , AbortOnDropHandle } ,
38
39
time:: { self , Duration , Instant } ,
39
- StreamExt ,
40
40
} ;
41
41
use n0_watcher:: { self , Watchable , Watcher } ;
42
42
use nested_enum_utils:: common_fields;
43
43
use netwatch:: netmon;
44
44
#[ cfg( not( wasm_browser) ) ]
45
- use netwatch:: { ip:: LocalAddresses , UdpSocket } ;
45
+ use netwatch:: { UdpSocket , ip:: LocalAddresses } ;
46
46
use quinn:: { AsyncUdpSocket , ServerConfig } ;
47
47
use rand:: Rng ;
48
48
use smallvec:: SmallVec ;
49
49
use snafu:: { ResultExt , Snafu } ;
50
- use tokio:: sync:: { mpsc , Mutex as AsyncMutex } ;
50
+ use tokio:: sync:: { Mutex as AsyncMutex , mpsc } ;
51
51
use tokio_util:: sync:: CancellationToken ;
52
52
use tracing:: {
53
- debug, error, event, info, info_span, instrument, trace, trace_span, warn, Instrument , Level ,
53
+ Instrument , Level , debug, error, event, info, info_span, instrument, trace, trace_span, warn,
54
54
} ;
55
55
use transports:: LocalAddrsWatch ;
56
56
use url:: Url ;
@@ -72,7 +72,7 @@ use crate::{
72
72
defaults:: timeouts:: NET_REPORT_TIMEOUT ,
73
73
disco:: { self , SendAddr } ,
74
74
discovery:: { Discovery , DiscoveryItem , DiscoverySubscribers , NodeData , UserData } ,
75
- key:: { public_ed_box , secret_ed_box , DecryptionError , SharedSecret } ,
75
+ key:: { DecryptionError , SharedSecret , public_ed_box , secret_ed_box } ,
76
76
metrics:: EndpointMetrics ,
77
77
net_report:: { self , IfStateDetails , IpMappedAddresses , Report } ,
78
78
} ;
@@ -2415,22 +2415,23 @@ mod tests {
2415
2415
2416
2416
use data_encoding:: HEXLOWER ;
2417
2417
use iroh_base:: { NodeAddr , NodeId , PublicKey } ;
2418
- use n0_future:: { time , StreamExt } ;
2418
+ use n0_future:: { StreamExt , time } ;
2419
2419
use n0_snafu:: { Result , ResultExt } ;
2420
2420
use n0_watcher:: Watcher ;
2421
2421
use quinn:: ServerConfig ;
2422
2422
use rand:: { Rng , RngCore } ;
2423
2423
use tokio:: task:: JoinSet ;
2424
2424
use tokio_util:: task:: AbortOnDropHandle ;
2425
- use tracing:: { error, info, info_span, instrument, Instrument } ;
2425
+ use tracing:: { Instrument , error, info, info_span, instrument} ;
2426
2426
use tracing_test:: traced_test;
2427
2427
2428
2428
use super :: { NodeIdMappedAddr , Options } ;
2429
2429
use crate :: {
2430
+ Endpoint , RelayMap , RelayMode , SecretKey ,
2430
2431
dns:: DnsResolver ,
2431
2432
endpoint:: { DirectAddr , PathSelection , Source } ,
2432
- magicsock:: { node_map , Handle , MagicSock } ,
2433
- tls, Endpoint , RelayMap , RelayMode , SecretKey ,
2433
+ magicsock:: { Handle , MagicSock , node_map } ,
2434
+ tls,
2434
2435
} ;
2435
2436
2436
2437
const ALPN : & [ u8 ] = b"n0/test/1" ;
@@ -2626,10 +2627,12 @@ mod tests {
2626
2627
info ! ( "stats: {:#?}" , stats) ;
2627
2628
// TODO: ensure panics in this function are reported ok
2628
2629
if matches ! ( loss, ExpectedLoss :: AlmostNone ) {
2629
- assert ! (
2630
- stats. path. lost_packets < 10 ,
2631
- "[receiver] should not loose many packets" ,
2632
- ) ;
2630
+ for ( id, path) in & stats. paths {
2631
+ assert ! (
2632
+ path. lost_packets < 10 ,
2633
+ "[receiver] path {id:?} should not loose many packets" ,
2634
+ ) ;
2635
+ }
2633
2636
}
2634
2637
2635
2638
info ! ( "close" ) ;
@@ -2677,10 +2680,12 @@ mod tests {
2677
2680
let stats = conn. stats ( ) ;
2678
2681
info ! ( "stats: {:#?}" , stats) ;
2679
2682
if matches ! ( loss, ExpectedLoss :: AlmostNone ) {
2680
- assert ! (
2681
- stats. path. lost_packets < 10 ,
2682
- "[sender] should not loose many packets" ,
2683
- ) ;
2683
+ for ( id, path) in & stats. paths {
2684
+ assert ! (
2685
+ path. lost_packets < 10 ,
2686
+ "[sender] path {id:?} should not loose many packets" ,
2687
+ ) ;
2688
+ }
2684
2689
}
2685
2690
2686
2691
info ! ( "close" ) ;
@@ -3272,10 +3277,11 @@ mod tests {
3272
3277
. magic_sock ( )
3273
3278
. add_node_addr ( empty_addr, node_map:: Source :: App )
3274
3279
. unwrap_err ( ) ;
3275
- assert ! ( err
3276
- . to_string( )
3277
- . to_lowercase( )
3278
- . contains( "empty addressing info" ) ) ;
3280
+ assert ! (
3281
+ err. to_string( )
3282
+ . to_lowercase( )
3283
+ . contains( "empty addressing info" )
3284
+ ) ;
3279
3285
3280
3286
// relay url only
3281
3287
let addr = NodeAddr {
0 commit comments