pub struct Client { /* private fields */ }
Expand description
Generalized Electrum client that supports multiple backends. Can re-instantiate client_type if connections drops
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(url: &str) -> Result<Self, Error>
pub fn new(url: &str) -> Result<Self, Error>
Default constructor supporting multiple backends by providing a prefix
Supported prefixes are:
- tcp:// for a TCP plaintext client.
- ssl:// for an SSL-encrypted client. The server certificate will be verified.
If no prefix is specified, then tcp://
is assumed.
See Client::from_config for more configuration options
Examples found in repository?
More examples
Sourcepub fn from_config(url: &str, config: Config) -> Result<Self, Error>
pub fn from_config(url: &str, config: Config) -> Result<Self, Error>
Generic constructor that supports multiple backends and allows configuration through the Config
Examples found in repository?
examples/tor.rs (line 9)
3fn main() {
4 // NOTE: This assumes Tor is running localy, with an unauthenticated Socks5 listening at
5 // localhost:9050
6 let proxy = Socks5Config::new("127.0.0.1:9050");
7 let config = ConfigBuilder::new().socks5(Some(proxy)).build();
8
9 let client = Client::from_config("tcp://explorernuoc63nb.onion:110", config.clone()).unwrap();
10 let res = client.ping();
11 println!("{:#?}", res);
12
13 // works both with onion v2/v3 (if your Tor supports them)
14 let client = Client::from_config(
15 "tcp://explorerzydxu5ecjrkwceayqybizmpjjznk5izmitf2modhcusuqlid.onion:110",
16 config,
17 )
18 .unwrap();
19 let res = client.ping();
20 println!("{:#?}", res);
21}
Trait Implementations§
Source§impl ElectrumApi for Client
impl ElectrumApi for Client
Source§fn raw_call(
&self,
method_name: &str,
params: impl IntoIterator<Item = Param>,
) -> Result<Value, Error>
fn raw_call( &self, method_name: &str, params: impl IntoIterator<Item = Param>, ) -> Result<Value, Error>
Executes the requested API call returning the raw answer.
Auto Trait Implementations§
impl !Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more