1 /* 2 * Copyright (C) 2021, The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 //! Runtime configuration for DohFrontend. 18 19 use std::default::Default; 20 21 /// Default value for max_idle_timeout transport parameter. 22 pub const QUICHE_IDLE_TIMEOUT_MS: u64 = 10_000; 23 24 /// Default value for these transport parameters: 25 /// - initial_max_data 26 /// - initial_max_stream_data_bidi_local 27 /// - initial_max_stream_data_bidi_remote 28 /// - initial_max_stream_data_uni 29 const MAX_BUFFER_SIZE: u64 = 1_000_000; 30 31 /// Default value for initial_max_streams_bidi transport parameter. 32 pub const MAX_STREAMS_BIDI: u64 = 100; 33 34 #[derive(Debug, Default)] 35 pub struct Config { 36 pub delay_queries: i32, 37 pub block_sending: bool, 38 pub max_idle_timeout: u64, 39 pub max_buffer_size: u64, 40 pub max_streams_bidi: u64, 41 pub reset_stream_id: Option<u64>, 42 } 43 44 impl Config { new() -> Self45 pub fn new() -> Self { 46 Self { 47 max_idle_timeout: QUICHE_IDLE_TIMEOUT_MS, 48 max_buffer_size: MAX_BUFFER_SIZE, 49 max_streams_bidi: MAX_STREAMS_BIDI, 50 ..Default::default() 51 } 52 } 53 } 54