channel: Introduce padding config

Nothing actually reads this yet, and we also want a client-global
default for padding.
This commit is contained in:
Ian Jackson 2022-07-26 17:12:55 +01:00
parent 76a1c45202
commit 498d39626f
2 changed files with 19 additions and 7 deletions

View File

@ -208,7 +208,19 @@
# Channels and their behaviour
[channel]
# (currently no settings: TODO)
# Should we use reduced channel padding? (This roughly halves the padding
# cell frequency, and makes the padding unidrecteional, increasing the
# traceability of the client connections.)
# Or disable it entirely?
#
#padding = "normal"
# padding = "reduced"
# padding = "none"
# Full manual control of the precise padding timing parameters is available
# by setting `override_net_params.nf_ito_low` et al.
# (See torpsec/padding-spec.txt section 3.4.)
# Rules for how long circuits should survive, and how long pending
# requests should wait for a circuit.

View File

@ -5,7 +5,7 @@
//! Most types in this module are re-exported by `arti-client`.
use tor_config::impl_standard_builder;
use tor_config::ConfigBuildError;
use tor_config::{ConfigBuildError, PaddingLevel};
use derive_builder::Builder;
use serde::{Deserialize, Serialize};
@ -17,10 +17,10 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Builder, Eq, PartialEq)]
#[builder(build_fn(error = "ConfigBuildError"))]
#[builder(derive(Debug, Serialize, Deserialize))]
#[non_exhaustive] // TODO needed until there are fields
#[builder_struct_attr(non_exhaustive)] // TODO needed until there are fields
pub struct ChannelConfig {
// TODO
/// Control of channel padding
#[builder(default)]
pub(crate) padding: PaddingLevel,
}
impl_standard_builder! { ChannelConfig }
@ -38,8 +38,8 @@ mod test {
#[test]
fn channel_config() {
let _config = ChannelConfig::default();
let config = ChannelConfig::default();
// TODO
assert_eq!(PaddingLevel::Normal, config.padding);
}
}