This commit is contained in:
parent
75f4139dea
commit
0679a241c2
1 changed files with 9 additions and 2 deletions
|
|
@ -29,6 +29,7 @@ pub struct ClientConfig {
|
||||||
pub tls: ClientTlsConfig,
|
pub tls: ClientTlsConfig,
|
||||||
pub client_id: u64,
|
pub client_id: u64,
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
|
pub policy: Policy,
|
||||||
#[cfg(feature = "crypto")]
|
#[cfg(feature = "crypto")]
|
||||||
pub auth_timeout: Duration,
|
pub auth_timeout: Duration,
|
||||||
}
|
}
|
||||||
|
|
@ -46,6 +47,7 @@ impl ClientConfig {
|
||||||
tls: ClientTlsConfig::SystemRoots,
|
tls: ClientTlsConfig::SystemRoots,
|
||||||
client_id: 0,
|
client_id: 0,
|
||||||
description: None,
|
description: None,
|
||||||
|
policy: Policy::default(),
|
||||||
#[cfg(feature = "crypto")]
|
#[cfg(feature = "crypto")]
|
||||||
auth_timeout: Duration::from_secs(30),
|
auth_timeout: Duration::from_secs(30),
|
||||||
}
|
}
|
||||||
|
|
@ -70,6 +72,11 @@ impl ClientConfig {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn with_policy(mut self, policy: Policy) -> Self {
|
||||||
|
self.policy = policy;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "crypto")]
|
#[cfg(feature = "crypto")]
|
||||||
pub fn with_auth_timeout(mut self, timeout: Duration) -> Self {
|
pub fn with_auth_timeout(mut self, timeout: Duration) -> Self {
|
||||||
self.auth_timeout = timeout;
|
self.auth_timeout = timeout;
|
||||||
|
|
@ -391,7 +398,7 @@ impl MTPClient {
|
||||||
use mtp_crypto::auth;
|
use mtp_crypto::auth;
|
||||||
|
|
||||||
let (sender, receiver) =
|
let (sender, receiver) =
|
||||||
mtp_transport::connect(&config.url, config.server_cert(), Policy::default()).await?;
|
mtp_transport::connect(&config.url, config.server_cert(), config.policy).await?;
|
||||||
|
|
||||||
let tm = mtp_codec::TypeMap::latest();
|
let tm = mtp_codec::TypeMap::latest();
|
||||||
let version_str = format!("{}", PROTOCOL_VERSION);
|
let version_str = format!("{}", PROTOCOL_VERSION);
|
||||||
|
|
@ -533,7 +540,7 @@ impl MTPClient {
|
||||||
use mtp_crypto::auth;
|
use mtp_crypto::auth;
|
||||||
|
|
||||||
let (sender, receiver) =
|
let (sender, receiver) =
|
||||||
mtp_transport::connect(&config.url, config.server_cert(), Policy::default()).await?;
|
mtp_transport::connect(&config.url, config.server_cert(), config.policy).await?;
|
||||||
|
|
||||||
let tm = mtp_codec::TypeMap::latest();
|
let tm = mtp_codec::TypeMap::latest();
|
||||||
let version_str = format!("{}", PROTOCOL_VERSION);
|
let version_str = format!("{}", PROTOCOL_VERSION);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue