use crate::h3::settings::LocalSettings;
pub struct Http3Options {
pub(super) local_settings: LocalSettings,
pub(super) accept_timeout: Option<std::time::Duration>,
pub(super) handshake_timeout: Option<std::time::Duration>,
pub(super) send_continue_response: bool,
pub(super) send_date_header: bool,
}
impl Http3Options {
#[inline]
pub fn new() -> Self {
Self {
local_settings: LocalSettings::default(),
accept_timeout: Some(std::time::Duration::from_secs(30)),
handshake_timeout: Some(std::time::Duration::from_secs(30)),
send_continue_response: true,
send_date_header: true,
}
}
#[inline]
pub fn qpack_max_table_capacity(mut self, capacity: u64) -> Self {
self.local_settings.qpack_max_table_capacity = capacity;
self
}
#[inline]
pub fn qpack_blocked_streams(mut self, max: u64) -> Self {
self.local_settings.qpack_blocked_streams = max;
self
}
#[inline]
pub fn max_field_section_size(mut self, max: Option<u64>) -> Self {
self.local_settings.max_field_section_size = max;
self
}
#[inline]
pub fn enable_connect_protocol(mut self, enable: bool) -> Self {
self.local_settings.enable_connect_protocol = enable;
self
}
#[inline]
pub fn accept_timeout(mut self, timeout: Option<std::time::Duration>) -> Self {
self.accept_timeout = timeout;
self
}
#[inline]
pub fn handshake_timeout(mut self, timeout: Option<std::time::Duration>) -> Self {
self.handshake_timeout = timeout;
self
}
#[inline]
pub fn send_continue_response(mut self, send: bool) -> Self {
self.send_continue_response = send;
self
}
#[inline]
pub fn send_date_header(mut self, send: bool) -> Self {
self.send_date_header = send;
self
}
}
impl Default for Http3Options {
#[inline]
fn default() -> Self {
Self::new()
}
}