Struct electrum_client::Socks5Config
source · pub struct Socks5Config {
pub addr: String,
pub credentials: Option<Socks5Credential>,
}
Expand description
Configuration for Socks5
Fields§
§addr: String
The address of the socks5 service
credentials: Option<Socks5Credential>
Optional credential for the service
Implementations§
source§impl Socks5Config
impl Socks5Config
sourcepub fn new(addr: impl ToString) -> Self
pub fn new(addr: impl ToString) -> Self
Socks5Config constructor without credentials
Examples found in repository?
examples/tor.rs (line 8)
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
fn main() {
// NOTE: This assumes Tor is running localy, with an unauthenticated Socks5 listening at
// localhost:9050
let proxy = Socks5Config::new("127.0.0.1:9050");
let config = ConfigBuilder::new().socks5(Some(proxy)).build();
let client = Client::from_config("tcp://explorernuoc63nb.onion:110", config.clone()).unwrap();
let res = client.server_features();
println!("{:#?}", res);
// works both with onion v2/v3 (if your Tor supports them)
let client = Client::from_config(
"tcp://explorerzydxu5ecjrkwceayqybizmpjjznk5izmitf2modhcusuqlid.onion:110",
config,
)
.unwrap();
let res = client.server_features();
println!("{:#?}", res);
}
sourcepub fn with_credentials(
addr: impl ToString,
username: String,
password: String,
) -> Self
pub fn with_credentials( addr: impl ToString, username: String, password: String, ) -> Self
Socks5Config constructor if we have credentials
Trait Implementations§
source§impl Clone for Socks5Config
impl Clone for Socks5Config
source§fn clone(&self) -> Socks5Config
fn clone(&self) -> Socks5Config
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for Socks5Config
impl RefUnwindSafe for Socks5Config
impl Send for Socks5Config
impl Sync for Socks5Config
impl Unpin for Socks5Config
impl UnwindSafe for Socks5Config
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)