@@ -170,91 +170,3 @@ pub use self::transport_ext::TransportExt;
170170pub use libp2p_identity as identity;
171171pub use libp2p_identity:: PeerId ;
172172pub use libp2p_swarm:: { Stream , StreamProtocol } ;
173-
174- /// Builds a `Transport` based on TCP/IP that supports the most commonly-used features of libp2p:
175- ///
176- /// * DNS resolution.
177- /// * Noise protocol encryption.
178- /// * Websockets.
179- /// * Yamux for substream multiplexing.
180- ///
181- /// All async I/O of the transport is based on `async-std`.
182- ///
183- /// > **Note**: This `Transport` is not suitable for production usage, as its implementation
184- /// > reserves the right to support additional protocols or remove deprecated protocols.
185- #[ deprecated( note = "Use `libp2p::SwarmBuilder` instead." ) ]
186- #[ cfg( all(
187- not( target_arch = "wasm32" ) ,
188- feature = "tcp" ,
189- feature = "dns" ,
190- feature = "websocket" ,
191- feature = "noise" ,
192- feature = "yamux" ,
193- feature = "async-std" ,
194- ) ) ]
195- pub async fn development_transport (
196- keypair : identity:: Keypair ,
197- ) -> std:: io:: Result < core:: transport:: Boxed < ( PeerId , core:: muxing:: StreamMuxerBox ) > > {
198- let transport = {
199- let dns_tcp = dns:: async_std:: Transport :: system ( tcp:: async_io:: Transport :: new (
200- tcp:: Config :: new ( ) . nodelay ( true ) ,
201- ) )
202- . await ?;
203- let ws_dns_tcp = websocket:: WsConfig :: new (
204- dns:: async_std:: Transport :: system ( tcp:: async_io:: Transport :: new (
205- tcp:: Config :: new ( ) . nodelay ( true ) ,
206- ) )
207- . await ?,
208- ) ;
209- dns_tcp. or_transport ( ws_dns_tcp)
210- } ;
211-
212- Ok ( transport
213- . upgrade ( core:: upgrade:: Version :: V1 )
214- . authenticate ( noise:: Config :: new ( & keypair) . unwrap ( ) )
215- . multiplex ( yamux:: Config :: default ( ) )
216- . timeout ( std:: time:: Duration :: from_secs ( 20 ) )
217- . boxed ( ) )
218- }
219-
220- /// Builds a `Transport` based on TCP/IP that supports the most commonly-used features of libp2p:
221- ///
222- /// * DNS resolution.
223- /// * Noise protocol encryption.
224- /// * Websockets.
225- /// * Yamux for substream multiplexing.
226- ///
227- /// All async I/O of the transport is based on `tokio`.
228- ///
229- /// > **Note**: This `Transport` is not suitable for production usage, as its implementation
230- /// > reserves the right to support additional protocols or remove deprecated protocols.
231- #[ deprecated( note = "Use `libp2p::SwarmBuilder` instead." ) ]
232- #[ cfg( all(
233- not( target_arch = "wasm32" ) ,
234- feature = "tcp" ,
235- feature = "dns" ,
236- feature = "websocket" ,
237- feature = "noise" ,
238- feature = "yamux" ,
239- feature = "tokio" ,
240- ) ) ]
241- pub fn tokio_development_transport (
242- keypair : identity:: Keypair ,
243- ) -> std:: io:: Result < core:: transport:: Boxed < ( PeerId , core:: muxing:: StreamMuxerBox ) > > {
244- let transport = {
245- let dns_tcp = dns:: tokio:: Transport :: system ( tcp:: tokio:: Transport :: new (
246- tcp:: Config :: new ( ) . nodelay ( true ) ,
247- ) ) ?;
248- let ws_dns_tcp = websocket:: WsConfig :: new ( dns:: tokio:: Transport :: system (
249- tcp:: tokio:: Transport :: new ( tcp:: Config :: new ( ) . nodelay ( true ) ) ,
250- ) ?) ;
251- dns_tcp. or_transport ( ws_dns_tcp)
252- } ;
253-
254- Ok ( transport
255- . upgrade ( core:: upgrade:: Version :: V1 )
256- . authenticate ( noise:: Config :: new ( & keypair) . unwrap ( ) )
257- . multiplex ( yamux:: Config :: default ( ) )
258- . timeout ( std:: time:: Duration :: from_secs ( 20 ) )
259- . boxed ( ) )
260- }
0 commit comments