This commit is contained in:
parent
bed73a82f1
commit
7ffc1ab3fe
2 changed files with 12 additions and 2 deletions
|
|
@ -1,11 +1,13 @@
|
||||||
use mtp_codec::{CommunicationValue, DataType, DataValue, PROTOCOL_VERSION, Version};
|
use mtp_codec::{CommunicationValue, DataType, DataValue, PROTOCOL_VERSION, Version};
|
||||||
use mtp_common::CommunicationError;
|
use mtp_common::CommunicationError;
|
||||||
use mtp_transport::{Policy, Receiver, Sender};
|
use mtp_transport::Policy;
|
||||||
#[cfg(feature = "crypto")]
|
#[cfg(feature = "crypto")]
|
||||||
use tokio::time::Duration;
|
use tokio::time::Duration;
|
||||||
|
|
||||||
pub use MTPClient as Client;
|
pub use MTPClient as Client;
|
||||||
pub use MTPConnection as Connection;
|
pub use MTPConnection as Connection;
|
||||||
|
pub use mtp_transport::Receiver;
|
||||||
|
pub use mtp_transport::Sender;
|
||||||
|
|
||||||
#[cfg(feature = "crypto")]
|
#[cfg(feature = "crypto")]
|
||||||
fn unexpected_response_type_error(
|
fn unexpected_response_type_error(
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,8 @@ pub struct HostConfig {
|
||||||
pub tls_fullchain: Vec<u8>,
|
pub tls_fullchain: Vec<u8>,
|
||||||
pub tls_key: Vec<u8>,
|
pub tls_key: Vec<u8>,
|
||||||
|
|
||||||
|
pub policy: Policy,
|
||||||
|
|
||||||
#[cfg(feature = "crypto")]
|
#[cfg(feature = "crypto")]
|
||||||
pub authentication_policy: AuthenticationPolicy,
|
pub authentication_policy: AuthenticationPolicy,
|
||||||
#[cfg(feature = "crypto")]
|
#[cfg(feature = "crypto")]
|
||||||
|
|
@ -72,6 +74,7 @@ impl HostConfig {
|
||||||
port,
|
port,
|
||||||
tls_fullchain,
|
tls_fullchain,
|
||||||
tls_key,
|
tls_key,
|
||||||
|
policy: Policy::default(),
|
||||||
#[cfg(feature = "crypto")]
|
#[cfg(feature = "crypto")]
|
||||||
authentication_policy: AuthenticationPolicy::Unauthenticated,
|
authentication_policy: AuthenticationPolicy::Unauthenticated,
|
||||||
#[cfg(feature = "crypto")]
|
#[cfg(feature = "crypto")]
|
||||||
|
|
@ -92,6 +95,11 @@ impl HostConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn with_policy(mut self, policy: Policy) -> Self {
|
||||||
|
self.policy = policy;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "crypto")]
|
#[cfg(feature = "crypto")]
|
||||||
pub fn with_authentication(
|
pub fn with_authentication(
|
||||||
mut self,
|
mut self,
|
||||||
|
|
@ -190,7 +198,7 @@ impl MTPHost {
|
||||||
config.port,
|
config.port,
|
||||||
config.tls_fullchain.clone(),
|
config.tls_fullchain.clone(),
|
||||||
config.tls_key.clone(),
|
config.tls_key.clone(),
|
||||||
Policy::default(),
|
config.policy,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue