@@ -42,10 +42,23 @@ use crate::{
42
42
43
43
mod rtt_actor;
44
44
45
+ pub use bytes:: Bytes ;
45
46
pub use iroh_base:: node_addr:: { AddrInfo , NodeAddr } ;
47
+ // Missing still: SendDatagram and ConnectionClose::frame_type's Type.
46
48
pub use quinn:: {
47
- ApplicationClose , Connection , ConnectionClose , ConnectionError , ReadError , RecvStream ,
48
- RetryError , SendStream , ServerConfig , TransportConfig , VarInt , WriteError ,
49
+ AcceptBi , AcceptUni , AckFrequencyConfig , ApplicationClose , Chunk , ClosedStream , Connection ,
50
+ ConnectionClose , ConnectionError , ConnectionStats , MtuDiscoveryConfig , OpenBi , OpenUni ,
51
+ ReadDatagram , ReadError , ReadExactError , ReadToEndError , RecvStream , ResetError , RetryError ,
52
+ SendDatagramError , SendStream , ServerConfig , StoppedError , StreamId , TransportConfig , VarInt ,
53
+ WeakConnectionHandle , WriteError , ZeroRttAccepted ,
54
+ } ;
55
+ pub use quinn_proto:: {
56
+ congestion:: { Controller , ControllerFactory } ,
57
+ crypto:: {
58
+ AeadKey , CryptoError , ExportKeyingMaterialError , HandshakeTokenKey ,
59
+ ServerConfig as CryptoServerConfig , UnsupportedVersion ,
60
+ } ,
61
+ FrameStats , PathStats , TransportError , TransportErrorCode , UdpStats , Written ,
49
62
} ;
50
63
51
64
use self :: rtt_actor:: RttMessage ;
@@ -414,7 +427,7 @@ struct StaticConfig {
414
427
415
428
impl StaticConfig {
416
429
/// Create a [`quinn::ServerConfig`] with the specified ALPN protocols.
417
- fn create_server_config ( & self , alpn_protocols : Vec < Vec < u8 > > ) -> Result < quinn :: ServerConfig > {
430
+ fn create_server_config ( & self , alpn_protocols : Vec < Vec < u8 > > ) -> Result < ServerConfig > {
418
431
let server_config = make_server_config (
419
432
& self . secret_key ,
420
433
alpn_protocols,
@@ -425,18 +438,18 @@ impl StaticConfig {
425
438
}
426
439
}
427
440
428
- /// Creates a [`quinn:: ServerConfig`] with the given secret key and limits.
441
+ /// Creates a [`ServerConfig`] with the given secret key and limits.
429
442
// This return type can not longer be used anywhere in our public API. It is however still
430
443
// used by iroh::node::Node (or rather iroh::node::Builder) to create a plain Quinn
431
444
// endpoint.
432
445
pub fn make_server_config (
433
446
secret_key : & SecretKey ,
434
447
alpn_protocols : Vec < Vec < u8 > > ,
435
- transport_config : Arc < quinn :: TransportConfig > ,
448
+ transport_config : Arc < TransportConfig > ,
436
449
keylog : bool ,
437
- ) -> Result < quinn :: ServerConfig > {
450
+ ) -> Result < ServerConfig > {
438
451
let quic_server_config = tls:: make_server_config ( secret_key, alpn_protocols, keylog) ?;
439
- let mut server_config = quinn :: ServerConfig :: with_crypto ( Arc :: new ( quic_server_config) ) ;
452
+ let mut server_config = ServerConfig :: with_crypto ( Arc :: new ( quic_server_config) ) ;
440
453
server_config. transport_config ( transport_config) ;
441
454
442
455
Ok ( server_config)
@@ -560,11 +573,7 @@ impl Endpoint {
560
573
/// endpoint must support this `alpn`, otherwise the connection attempt will fail with
561
574
/// an error.
562
575
#[ instrument( skip_all, fields( me = %self . node_id( ) . fmt_short( ) , alpn = ?String :: from_utf8_lossy( alpn) ) ) ]
563
- pub async fn connect (
564
- & self ,
565
- node_addr : impl Into < NodeAddr > ,
566
- alpn : & [ u8 ] ,
567
- ) -> Result < quinn:: Connection > {
576
+ pub async fn connect ( & self , node_addr : impl Into < NodeAddr > , alpn : & [ u8 ] ) -> Result < Connection > {
568
577
let node_addr = node_addr. into ( ) ;
569
578
tracing:: Span :: current ( ) . record ( "remote" , node_addr. node_id . fmt_short ( ) ) ;
570
579
// Connecting to ourselves is not supported.
@@ -621,11 +630,7 @@ impl Endpoint {
621
630
since = "0.27.0" ,
622
631
note = "Please use `connect` directly with a NodeId. This fn will be removed in 0.28.0."
623
632
) ]
624
- pub async fn connect_by_node_id (
625
- & self ,
626
- node_id : NodeId ,
627
- alpn : & [ u8 ] ,
628
- ) -> Result < quinn:: Connection > {
633
+ pub async fn connect_by_node_id ( & self , node_id : NodeId , alpn : & [ u8 ] ) -> Result < Connection > {
629
634
let addr = NodeAddr :: new ( node_id) ;
630
635
self . connect ( addr, alpn) . await
631
636
}
@@ -639,7 +644,7 @@ impl Endpoint {
639
644
node_id : NodeId ,
640
645
alpn : & [ u8 ] ,
641
646
addr : QuicMappedAddr ,
642
- ) -> Result < quinn :: Connection > {
647
+ ) -> Result < Connection > {
643
648
debug ! ( "Attempting connection..." ) ;
644
649
let client_config = {
645
650
let alpn_protocols = vec ! [ alpn. to_vec( ) ] ;
@@ -1210,7 +1215,7 @@ pub struct Connecting {
1210
1215
1211
1216
impl Connecting {
1212
1217
/// Convert into a 0-RTT or 0.5-RTT connection at the cost of weakened security.
1213
- pub fn into_0rtt ( self ) -> Result < ( quinn :: Connection , quinn :: ZeroRttAccepted ) , Self > {
1218
+ pub fn into_0rtt ( self ) -> Result < ( Connection , ZeroRttAccepted ) , Self > {
1214
1219
match self . inner . into_0rtt ( ) {
1215
1220
Ok ( ( conn, zrtt_accepted) ) => {
1216
1221
try_send_rtt_msg ( & conn, & self . ep ) ;
@@ -1221,7 +1226,7 @@ impl Connecting {
1221
1226
}
1222
1227
1223
1228
/// Parameters negotiated during the handshake
1224
- pub async fn handshake_data ( & mut self ) -> Result < Box < dyn Any > , quinn :: ConnectionError > {
1229
+ pub async fn handshake_data ( & mut self ) -> Result < Box < dyn Any > , ConnectionError > {
1225
1230
self . inner . handshake_data ( ) . await
1226
1231
}
1227
1232
@@ -1251,7 +1256,7 @@ impl Connecting {
1251
1256
}
1252
1257
1253
1258
impl Future for Connecting {
1254
- type Output = Result < quinn :: Connection , quinn :: ConnectionError > ;
1259
+ type Output = Result < Connection , ConnectionError > ;
1255
1260
1256
1261
fn poll ( self : Pin < & mut Self > , cx : & mut std:: task:: Context < ' _ > ) -> Poll < Self :: Output > {
1257
1262
let this = self . project ( ) ;
@@ -1268,7 +1273,7 @@ impl Future for Connecting {
1268
1273
1269
1274
/// Extract the [`PublicKey`] from the peer's TLS certificate.
1270
1275
// TODO: make this a method now
1271
- pub fn get_remote_node_id ( connection : & quinn :: Connection ) -> Result < PublicKey > {
1276
+ pub fn get_remote_node_id ( connection : & Connection ) -> Result < PublicKey > {
1272
1277
let data = connection. peer_identity ( ) ;
1273
1278
match data {
1274
1279
None => bail ! ( "no peer certificate found" ) ,
@@ -1292,7 +1297,7 @@ pub fn get_remote_node_id(connection: &quinn::Connection) -> Result<PublicKey> {
1292
1297
///
1293
1298
/// If we can't notify the actor that will impact performance a little, but we can still
1294
1299
/// function.
1295
- fn try_send_rtt_msg ( conn : & quinn :: Connection , magic_ep : & Endpoint ) {
1300
+ fn try_send_rtt_msg ( conn : & Connection , magic_ep : & Endpoint ) {
1296
1301
// If we can't notify the rtt-actor that's not great but not critical.
1297
1302
let Ok ( peer_id) = get_remote_node_id ( conn) else {
1298
1303
warn ! ( ?conn, "failed to get remote node id" ) ;
0 commit comments