electrum/
lib.rs

1#![warn(missing_docs)]
2
3//! This library provides an extendable Bitcoin-Electrum client that supports batch calls,
4//! notifications and multiple transport methods.
5//!
6//! By default this library is compiled with support for SSL servers using [`rustls`](https://docs.rs/rustls) and support for
7//! plaintext connections over a socks proxy, useful for Onion servers. Using different features,
8//! the SSL implementation can be removed or replaced with [`openssl`](https://docs.rs/openssl).
9//!
10//! A `minimal` configuration is also provided, which only includes the plaintext TCP client.
11//!
12//! # Example
13//!
14//! ```no_run
15//! use electrum::{Client, ElectrumApi};
16//!
17//! let mut client = Client::new("tcp://electrum.blockstream.info:50001")?;
18//! let response = client.server_features()?;
19//! # Ok::<(), electrum::Error>(())
20//! ```
21
22extern crate core;
23extern crate log;
24#[cfg(feature = "use-openssl")]
25extern crate openssl;
26#[cfg(all(
27    any(feature = "default", feature = "use-rustls"),
28    not(feature = "use-openssl")
29))]
30extern crate rustls;
31extern crate serde;
32extern crate serde_json;
33
34#[cfg(any(feature = "use-rustls", feature = "default"))]
35extern crate webpki_roots;
36
37#[cfg(any(feature = "default", feature = "proxy"))]
38extern crate byteorder;
39
40extern crate amplify;
41extern crate bpstd;
42#[cfg(all(unix, any(feature = "default", feature = "proxy")))]
43extern crate libc;
44extern crate sha2;
45#[cfg(all(windows, any(feature = "default", feature = "proxy")))]
46extern crate winapi;
47
48#[cfg(any(feature = "default", feature = "proxy"))]
49pub mod socks;
50
51mod api;
52mod batch;
53
54#[cfg(any(
55    all(feature = "proxy", feature = "use-openssl"),
56    all(feature = "proxy", feature = "use-rustls")
57))]
58pub mod client;
59
60mod config;
61
62pub mod raw_client;
63mod stream;
64mod types;
65#[cfg(test)]
66pub mod utils;
67
68pub use api::ElectrumApi;
69pub use batch::Batch;
70#[cfg(any(
71    all(feature = "proxy", feature = "use-openssl"),
72    all(feature = "proxy", feature = "use-rustls")
73))]
74pub use client::*;
75pub use config::{Config, ConfigBuilder, Socks5Config};
76pub use types::*;