pub fn connect_isolated(
    conn: TcpStream,
    user_agent: String,
) -> impl Future<
    Output = Result<
        BoxService<Request, Response, Box<dyn std::error::Error + Send + Sync + 'static>>,
        Box<dyn std::error::Error + Send + Sync + 'static>,
    >,
> {
    let handshake = peer::Handshake::builder()
        .with_config(Config::default())
        .with_inbound_service(tower::service_fn(|_req| async move {
            Ok::<Response, Box<dyn std::error::Error + Send + Sync + 'static>>(Response::Nil)
        }))
        .with_user_agent(user_agent)
        .with_latest_chain_tip(NoChainTip)
        .finish()
        .expect("provided mandatory builder parameters");

    // Don't send or track any metadata about the connection
    let connected_addr = ConnectedAddr::new_isolated();
    let connection_tracker = ActiveConnectionCounter::new_counter().track_connection();

    Oneshot::new(
        handshake,
        HandshakeRequest {
            tcp_stream: conn,
            connected_addr,
            connection_tracker,
        },
    )
    .map_ok(|client| BoxService::new(Wrapper(client)))
}
/// Use the provided TCP connection to create a Zcash connection completely
/// isolated from all other node state.
///
/// The connection pool returned by `init` should be used for all requests that
/// don't require isolated state or use of an existing TCP connection. However,
/// this low-level API is useful for custom network crawlers or Tor connections.
///
/// In addition to being completely isolated from all other node state, this
/// method also aims to be minimally distinguishable from other clients.
///
/// Note that this method does not implement any timeout behavior, so callers may
/// want to layer it with a timeout as appropriate for their application.
///
/// # Inputs
///
/// - `conn`: an existing TCP connection to use. Passing an existing TCP
/// connection allows this method to be used with clearnet or Tor transports.
///
/// - `user_agent`: a valid BIP14 user-agent, e.g., the empty string.
///
/// # Bug
///
/// `connect_isolated` only works on `Mainnet`, see #1687.
Use the provided TCP connection to create a Zcash connection completely
isolated from all other node state.

The connection pool returned by `init` should be used for all requests that
don't require isolated state or use of an existing TCP connection. However,
this low-level API is useful for custom network crawlers or Tor connections.

In addition to being completely isolated from all other node state, this
method also aims to be minimally distinguishable from other clients.

Note that this method does not implement any timeout behavior, so callers may
want to layer it with a timeout as appropriate for their application.
Use the provided TCP connection to create a Zcash connection completely isolated from all other node state . The connection pool returned by ` init ` should be used for all requests that don ' t require isolated state or use of an existing TCP connection . However this low - level API is useful for custom network crawlers or Tor connections . In addition to being completely isolated from all other node state this method also aims to be minimally distinguishable from other clients . Note that this method does not implement any timeout behavior so callers may want to layer it with a timeout as appropriate for their application .
pub fn connect_isolated(
    conn: TcpStream,
    user_agent: String,
) -> impl Future<
    Output = Result<
        BoxService<Request, Response, Box<dyn std::error::Error + Send + Sync + 'static>>,
        Box<dyn std::error::Error + Send + Sync + 'static>,
    >,
> {
    let handshake = peer::Handshake::builder()
        .with_config(Config::default())
        .with_inbound_service(tower::service_fn(|_req| async move {
            Ok::<Response, Box<dyn std::error::Error + Send + Sync + 'static>>(Response::Nil)
        }))
        .with_user_agent(user_agent)
        .with_latest_chain_tip(NoChainTip)
        .finish()
        .expect("provided mandatory builder parameters");
    // Don't send or track any metadata about the connection
    let connected_addr = ConnectedAddr::new_isolated();
    let connection_tracker = ActiveConnectionCounter::new_counter().track_connection();
    Oneshot::new(
        handshake,
        HandshakeRequest {
            tcp_stream: conn,
            connected_addr,
            connection_tracker,
        },
    )
    .map_ok(|client| BoxService::new(Wrapper(client)))
}
pub fn connect_isolated ( conn : TcpStream , user_agent : String , ) -> impl Future < Output = Result < BoxService < Request , Response , Box < dyn std :: error :: Error + Send + Sync + ' static > > , Box < dyn std :: error :: Error + Send + Sync + ' static > , > , > { let handshake = peer :: Handshake :: builder ( ) . with_config ( Config :: default ( ) ) . with_inbound_service ( tower :: service_fn ( | _req | async move { Ok :: < Response , Box < dyn std :: error :: Error + Send + Sync + ' static > > ( Response :: Nil ) } ) ) . with_user_agent ( user_agent ) . with_latest_chain_tip ( NoChainTip ) . finish ( ) . expect ( " " ) ; // Don't send or track any metadata about the connection let connected_addr = ConnectedAddr :: new_isolated ( ) ; let connection_tracker = ActiveConnectionCounter :: new_counter ( ) . track_connection ( ) ; Oneshot :: new ( handshake , HandshakeRequest { tcp_stream : conn , connected_addr , connection_tracker , } , ) . map_ok ( | client | BoxService :: new ( Wrapper ( client ) ) ) }
Use the provided TCP connection to create a Zcash connection completely
isolated from all other node state.
Use the provided TCP connection to create a Zcash connection completely isolated from all other node state .
conn
TcpStream
user_agent
String
inputs
`conn`: an existing TCP connection to use. Passing an existing TCP
connection allows this method to be used with clearnet or Tor transports.

`user_agent`: a valid BIP14 user-agent, e.g., the empty string.
` conn ` : an existing TCP connection to use . Passing an existing TCP connection allows this method to be used with clearnet or Tor transports . ` user_agent ` : a valid BIP14 user - agent e . g . the empty string .
bug
`connect_isolated` only works on `Mainnet`, see #1687.
` connect_isolated ` only works on ` Mainnet ` see #1687 .