Client Policy
Some checks failed
CI / checks (push) Failing after 2m19s

This commit is contained in:
Alex Emmet 2026-07-03 19:00:23 +02:00
commit 0679a241c2

View file

@ -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);