@@ -8,6 +8,7 @@ pub struct DnsPhase<T> {
88
99#[ cfg( all( not( target_arch = "wasm32" ) , feature = "async-std" , feature = "dns" ) ) ]
1010impl < T : AuthenticatedMultiplexedTransport > SwarmBuilder < super :: provider:: AsyncStd , DnsPhase < T > > {
11+ // TODO: Remove `async`
1112 pub async fn with_dns (
1213 self ,
1314 ) -> Result <
@@ -21,7 +22,7 @@ impl<T: AuthenticatedMultiplexedTransport> SwarmBuilder<super::provider::AsyncSt
2122 keypair : self . keypair ,
2223 phantom : PhantomData ,
2324 phase : WebsocketPhase {
24- transport : libp2p_dns:: async_std:: Transport :: system ( self . phase . transport ) . await ?,
25+ transport : libp2p_dns:: async_std:: Transport :: system2 ( self . phase . transport ) ?,
2526 } ,
2627 } )
2728 }
@@ -48,6 +49,48 @@ impl<T: AuthenticatedMultiplexedTransport> SwarmBuilder<super::provider::Tokio,
4849 }
4950}
5051
52+ #[ cfg( all( not( target_arch = "wasm32" ) , feature = "async-std" , feature = "dns" ) ) ]
53+ impl < T : AuthenticatedMultiplexedTransport > SwarmBuilder < super :: provider:: AsyncStd , DnsPhase < T > > {
54+ pub fn with_dns_config (
55+ self ,
56+ cfg : libp2p_dns:: ResolverConfig ,
57+ opts : libp2p_dns:: ResolverOpts ,
58+ ) -> SwarmBuilder <
59+ super :: provider:: AsyncStd ,
60+ WebsocketPhase < impl AuthenticatedMultiplexedTransport > ,
61+ > {
62+ SwarmBuilder {
63+ keypair : self . keypair ,
64+ phantom : PhantomData ,
65+ phase : WebsocketPhase {
66+ transport : libp2p_dns:: async_std:: Transport :: custom2 (
67+ self . phase . transport ,
68+ cfg,
69+ opts,
70+ ) ,
71+ } ,
72+ }
73+ }
74+ }
75+
76+ #[ cfg( all( not( target_arch = "wasm32" ) , feature = "tokio" , feature = "dns" ) ) ]
77+ impl < T : AuthenticatedMultiplexedTransport > SwarmBuilder < super :: provider:: Tokio , DnsPhase < T > > {
78+ pub fn with_dns_config (
79+ self ,
80+ cfg : libp2p_dns:: ResolverConfig ,
81+ opts : libp2p_dns:: ResolverOpts ,
82+ ) -> SwarmBuilder < super :: provider:: Tokio , WebsocketPhase < impl AuthenticatedMultiplexedTransport > >
83+ {
84+ SwarmBuilder {
85+ keypair : self . keypair ,
86+ phantom : PhantomData ,
87+ phase : WebsocketPhase {
88+ transport : libp2p_dns:: tokio:: Transport :: custom ( self . phase . transport , cfg, opts) ,
89+ } ,
90+ }
91+ }
92+ }
93+
5194impl < Provider , T > SwarmBuilder < Provider , DnsPhase < T > > {
5295 pub ( crate ) fn without_dns ( self ) -> SwarmBuilder < Provider , WebsocketPhase < T > > {
5396 SwarmBuilder {
0 commit comments