@@ -42,10 +42,23 @@ use crate::{
4242
4343mod rtt_actor;
4444
45+ pub use bytes:: Bytes ;
4546pub use iroh_base:: node_addr:: { AddrInfo , NodeAddr } ;
47+ // Missing still: SendDatagram and ConnectionClose::frame_type's Type.
4648pub 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 ,
4962} ;
5063
5164use self :: rtt_actor:: RttMessage ;
@@ -414,7 +427,7 @@ struct StaticConfig {
414427
415428impl StaticConfig {
416429 /// 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 > {
418431 let server_config = make_server_config (
419432 & self . secret_key ,
420433 alpn_protocols,
@@ -425,18 +438,18 @@ impl StaticConfig {
425438 }
426439}
427440
428- /// Creates a [`quinn:: ServerConfig`] with the given secret key and limits.
441+ /// Creates a [`ServerConfig`] with the given secret key and limits.
429442// This return type can not longer be used anywhere in our public API. It is however still
430443// used by iroh::node::Node (or rather iroh::node::Builder) to create a plain Quinn
431444// endpoint.
432445pub fn make_server_config (
433446 secret_key : & SecretKey ,
434447 alpn_protocols : Vec < Vec < u8 > > ,
435- transport_config : Arc < quinn :: TransportConfig > ,
448+ transport_config : Arc < TransportConfig > ,
436449 keylog : bool ,
437- ) -> Result < quinn :: ServerConfig > {
450+ ) -> Result < ServerConfig > {
438451 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) ) ;
440453 server_config. transport_config ( transport_config) ;
441454
442455 Ok ( server_config)
@@ -560,11 +573,7 @@ impl Endpoint {
560573 /// endpoint must support this `alpn`, otherwise the connection attempt will fail with
561574 /// an error.
562575 #[ 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 > {
568577 let node_addr = node_addr. into ( ) ;
569578 tracing:: Span :: current ( ) . record ( "remote" , node_addr. node_id . fmt_short ( ) ) ;
570579 // Connecting to ourselves is not supported.
@@ -621,11 +630,7 @@ impl Endpoint {
621630 since = "0.27.0" ,
622631 note = "Please use `connect` directly with a NodeId. This fn will be removed in 0.28.0."
623632 ) ]
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 > {
629634 let addr = NodeAddr :: new ( node_id) ;
630635 self . connect ( addr, alpn) . await
631636 }
@@ -639,7 +644,7 @@ impl Endpoint {
639644 node_id : NodeId ,
640645 alpn : & [ u8 ] ,
641646 addr : QuicMappedAddr ,
642- ) -> Result < quinn :: Connection > {
647+ ) -> Result < Connection > {
643648 debug ! ( "Attempting connection..." ) ;
644649 let client_config = {
645650 let alpn_protocols = vec ! [ alpn. to_vec( ) ] ;
@@ -1210,7 +1215,7 @@ pub struct Connecting {
12101215
12111216impl Connecting {
12121217 /// 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 > {
12141219 match self . inner . into_0rtt ( ) {
12151220 Ok ( ( conn, zrtt_accepted) ) => {
12161221 try_send_rtt_msg ( & conn, & self . ep ) ;
@@ -1221,7 +1226,7 @@ impl Connecting {
12211226 }
12221227
12231228 /// 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 > {
12251230 self . inner . handshake_data ( ) . await
12261231 }
12271232
@@ -1251,7 +1256,7 @@ impl Connecting {
12511256}
12521257
12531258impl Future for Connecting {
1254- type Output = Result < quinn :: Connection , quinn :: ConnectionError > ;
1259+ type Output = Result < Connection , ConnectionError > ;
12551260
12561261 fn poll ( self : Pin < & mut Self > , cx : & mut std:: task:: Context < ' _ > ) -> Poll < Self :: Output > {
12571262 let this = self . project ( ) ;
@@ -1268,7 +1273,7 @@ impl Future for Connecting {
12681273
12691274/// Extract the [`PublicKey`] from the peer's TLS certificate.
12701275// 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 > {
12721277 let data = connection. peer_identity ( ) ;
12731278 match data {
12741279 None => bail ! ( "no peer certificate found" ) ,
@@ -1292,7 +1297,7 @@ pub fn get_remote_node_id(connection: &quinn::Connection) -> Result<PublicKey> {
12921297///
12931298/// If we can't notify the actor that will impact performance a little, but we can still
12941299/// function.
1295- fn try_send_rtt_msg ( conn : & quinn :: Connection , magic_ep : & Endpoint ) {
1300+ fn try_send_rtt_msg ( conn : & Connection , magic_ep : & Endpoint ) {
12961301 // If we can't notify the rtt-actor that's not great but not critical.
12971302 let Ok ( peer_id) = get_remote_node_id ( conn) else {
12981303 warn ! ( ?conn, "failed to get remote node id" ) ;
0 commit comments