-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathagent_config.rs
37 lines (35 loc) · 1.44 KB
/
agent_config.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use crate::{
agent::{NonceFactory, NonceGenerator, Transport},
identity::{anonymous::AnonymousIdentity, Identity},
};
use std::{sync::Arc, time::Duration};
/// A configuration for an agent.
pub struct AgentConfig {
/// See [`with_nonce_factory`](super::AgentBuilder::with_nonce_factory).
pub nonce_factory: Arc<dyn NonceGenerator>,
/// See [`with_identity`](super::AgentBuilder::with_identity).
pub identity: Arc<dyn Identity>,
/// See [`with_ingress_expiry`](super::AgentBuilder::with_ingress_expiry).
pub ingress_expiry: Option<Duration>,
/// See [`with_transport`](super::AgentBuilder::with_transport).
pub transport: Option<Arc<dyn Transport>>,
/// See [`verify_query_signatures`](super::AgentBuilder::with_verify_query_signatures).
pub verify_query_signatures: bool,
/// See [`with_max_concurrent_requests`](super::AgentBuilder::with_max_concurrent_requests).
pub max_concurrent_requests: usize,
/// See [`with_auto_fetch_root_key`](super::AgentBuilder::with_auto_fetch_root_key).
pub auto_fetch_root_key: bool,
}
impl Default for AgentConfig {
fn default() -> Self {
Self {
nonce_factory: Arc::new(NonceFactory::random()),
identity: Arc::new(AnonymousIdentity {}),
ingress_expiry: None,
transport: None,
verify_query_signatures: true,
max_concurrent_requests: 50,
auto_fetch_root_key: false,
}
}
}