pub struct RawClient<S>{ /* private fields */ }
Expand description
Instance of an Electrum client
A Client
maintains a constant connection with an Electrum server and exposes methods to
interact with it. It can also subscribe and receive notifictations from the server about new
blocks or activity on a specific scriptPubKey.
The Client
is modeled in such a way that allows the external caller to have full control over
its functionality: no threads or tasks are spawned internally to monitor the state of the
connection.
More transport methods can be used by manually creating an instance of this struct with an
arbitray S
type.
Implementations§
Source§impl RawClient<ElectrumSslStream>
impl RawClient<ElectrumSslStream>
Sourcepub fn new_ssl<A: ToSocketAddrsDomain + Clone>(
socket_addrs: A,
validate_domain: bool,
timeout: Option<Duration>,
) -> Result<Self, Error>
pub fn new_ssl<A: ToSocketAddrsDomain + Clone>( socket_addrs: A, validate_domain: bool, timeout: Option<Duration>, ) -> Result<Self, Error>
Creates a new SSL client and tries to connect to socket_addr
. Optionally, if
validate_domain
is true
, validate the server’s certificate.
Sourcepub fn new_ssl_from_stream<A: ToSocketAddrsDomain>(
socket_addr: A,
validate_domain: bool,
tcp_stream: TcpStream,
) -> Result<Self, Error>
pub fn new_ssl_from_stream<A: ToSocketAddrsDomain>( socket_addr: A, validate_domain: bool, tcp_stream: TcpStream, ) -> Result<Self, Error>
Create a new SSL client using an existing TcpStream
Source§impl RawClient<ElectrumProxyStream>
impl RawClient<ElectrumProxyStream>
Sourcepub fn new_proxy<T: ToTargetAddr>(
target_addr: T,
proxy: &Socks5Config,
timeout: Option<Duration>,
) -> Result<Self, Error>
pub fn new_proxy<T: ToTargetAddr>( target_addr: T, proxy: &Socks5Config, timeout: Option<Duration>, ) -> Result<Self, Error>
Creates a new socks client and tries to connect to target_addr
using proxy_addr
as a
socks proxy server. The DNS resolution of target_addr
, if required, is done
through the proxy. This allows to specify, for instance, .onion
addresses.
Sourcepub fn new_proxy_ssl<T: ToTargetAddr>(
target_addr: T,
validate_domain: bool,
proxy: &Socks5Config,
timeout: Option<Duration>,
) -> Result<RawClient<ElectrumSslStream>, Error>
pub fn new_proxy_ssl<T: ToTargetAddr>( target_addr: T, validate_domain: bool, proxy: &Socks5Config, timeout: Option<Duration>, ) -> Result<RawClient<ElectrumSslStream>, Error>
Creates a new TLS client that connects to target_addr
using proxy_addr
as a socks proxy
server. The DNS resolution of target_addr
, if required, is done through the proxy. This
allows to specify, for instance, .onion
addresses.