/// Connects to LND using given address and credentials
///
/// This function does all required processing of the cert file and macaroon file, so that you
/// don't have to. The address must begin with "https://", though.
///
/// This is considered the recommended way to connect to LND. An alternative function to use
/// already-read certificate or macaroon data is currently **not** provided to discourage such use.
/// LND occasionally changes that data which would lead to errors and in turn in worse application.
///
/// If you have a motivating use case for use of direct data feel free to open an issue and
/// explain.
Connects to LND using given address and credentials
This function does all required processing of the cert file and macaroon file, so that you
don't have to. The address must begin with "https://", though.

This is considered the recommended way to connect to LND. An alternative function to use
already-read certificate or macaroon data is currently **not** provided to discourage such use.
LND occasionally changes that data which would lead to errors and in turn in worse application.

If you have a motivating use case for use of direct data feel free to open an issue and
explain.
Connects to LND using given address and credentials This function does all required processing of the cert file and macaroon file so that you don ' t have to . The address must begin with " https : // " though . This is considered the recommended way to connect to LND . An alternative function to use already - read certificate or macaroon data is currently ** not ** provided to discourage such use . LND occasionally changes that data which would lead to errors and in turn in worse application . If you have a motivating use case for use of direct data feel free to open an issue and explain .
pub async fn connect<A, CP, MP>(address: A, cert_file: CP, macaroon_file: MP) -> Result<Client, ConnectError> where A: TryInto<tonic::transport::Endpoint> + ToString, <A as TryInto<tonic::transport::Endpoint>>::Error: std::error::Error + Send + Sync + 'static, CP: AsRef<Path> + Into<PathBuf>, MP: AsRef<Path> + Into<PathBuf> {
    let address_str = address.to_string();
    let conn = try_map_err!(address
        .try_into(), |error| InternalConnectError::InvalidAddress { address: address_str.clone(), error: Box::new(error), })
        .tls_config(tls::config(cert_file).await?)
        .map_err(InternalConnectError::TlsConfig)?
        .connect()
        .await
        .map_err(|error| InternalConnectError::Connect { address: address_str, error, })?;
    let macaroon = load_macaroon(macaroon_file).await?;
    let interceptor = MacaroonInterceptor { macaroon, };
    Ok(rpc::lightning_client::LightningClient::with_interceptor(conn, interceptor))
}
pub async fn connect < A , CP , MP > ( address : A , cert_file : CP , macaroon_file : MP ) -> Result < Client , ConnectError > where A : TryInto < tonic :: transport :: Endpoint > + ToString , < A as TryInto < tonic :: transport :: Endpoint > > :: Error : std :: error :: Error + Send + Sync + ' static , CP : AsRef < Path > + Into < PathBuf > , MP : AsRef < Path > + Into < PathBuf > { let address_str = address . to_string ( ) ; let conn = try_map_err ! ( address try_into ( ) error InternalConnectError InvalidAddress { address address_str clone ( ) error Box new ( error ) } ) . tls_config ( tls :: config ( cert_file ) . await ? ) . map_err ( InternalConnectError :: TlsConfig ) ? . connect ( ) . await . map_err ( | error | InternalConnectError :: Connect { address : address_str , error , } ) ? ; let macaroon = load_macaroon ( macaroon_file ) . await ? ; let interceptor = MacaroonInterceptor { macaroon , } ; Ok ( rpc :: lightning_client :: LightningClient :: with_interceptor ( conn , interceptor ) ) }
Connects to LND using given address and credentials
This function does all required processing of the cert file and macaroon file, so that you
don't have to.
Connects to LND using given address and credentials This function does all required processing of the cert file and macaroon file so that you don ' t have to .
address
A
cert_file
CP
macaroon_file
MP