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 client_id: u64,
|
||||
pub description: Option<String>,
|
||||
pub policy: Policy,
|
||||
#[cfg(feature = "crypto")]
|
||||
pub auth_timeout: Duration,
|
||||
}
|
||||
|
|
@ -46,6 +47,7 @@ impl ClientConfig {
|
|||
tls: ClientTlsConfig::SystemRoots,
|
||||
client_id: 0,
|
||||
description: None,
|
||||
policy: Policy::default(),
|
||||
#[cfg(feature = "crypto")]
|
||||
auth_timeout: Duration::from_secs(30),
|
||||
}
|
||||
|
|
@ -70,6 +72,11 @@ impl ClientConfig {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn with_policy(mut self, policy: Policy) -> Self {
|
||||
self.policy = policy;
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "crypto")]
|
||||
pub fn with_auth_timeout(mut self, timeout: Duration) -> Self {
|
||||
self.auth_timeout = timeout;
|
||||
|
|
@ -391,7 +398,7 @@ impl MTPClient {
|
|||
use mtp_crypto::auth;
|
||||
|
||||
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 version_str = format!("{}", PROTOCOL_VERSION);
|
||||
|
|
@ -533,7 +540,7 @@ impl MTPClient {
|
|||
use mtp_crypto::auth;
|
||||
|
||||
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 version_str = format!("{}", PROTOCOL_VERSION);
|
||||
|
|
|
|||
Loading…
Reference in a new issue