offline/online toggle for gateway
This commit is contained in:
@@ -40,6 +40,7 @@ pub(crate) struct OverrideConfig {
|
||||
pub(crate) mnemonic: Option<bip39::Mnemonic>,
|
||||
pub(crate) nyxd_urls: Option<Vec<url::Url>>,
|
||||
pub(crate) only_coconut_credentials: Option<bool>,
|
||||
pub(crate) offline_credential_verification: Option<bool>,
|
||||
pub(crate) with_network_requester: Option<bool>,
|
||||
pub(crate) with_ip_packet_router: Option<bool>,
|
||||
}
|
||||
@@ -76,6 +77,10 @@ impl OverrideConfig {
|
||||
Config::with_only_coconut_credentials,
|
||||
self.only_coconut_credentials,
|
||||
)
|
||||
.with_optional(
|
||||
Config::with_offline_credential_verification,
|
||||
self.offline_credential_verification,
|
||||
)
|
||||
.with_optional(
|
||||
Config::with_enabled_network_requester,
|
||||
self.with_network_requester,
|
||||
|
||||
@@ -73,6 +73,10 @@ pub struct Init {
|
||||
#[clap(long, hide = true)]
|
||||
only_coconut_credentials: Option<bool>,
|
||||
|
||||
/// Set this gateway to use offline credentials verification
|
||||
#[clap(long, hide = true)]
|
||||
offline_credential_verification: Option<bool>,
|
||||
|
||||
/// Enable/disable gateway anonymized statistics that get sent to a statistics aggregator server
|
||||
#[clap(long)]
|
||||
enabled_statistics: Option<bool>,
|
||||
@@ -160,6 +164,7 @@ impl From<Init> for OverrideConfig {
|
||||
|
||||
nyxd_urls: init_config.nyxd_urls,
|
||||
only_coconut_credentials: init_config.only_coconut_credentials,
|
||||
offline_credential_verification: init_config.offline_credential_verification,
|
||||
with_network_requester: Some(init_config.with_network_requester),
|
||||
with_ip_packet_router: Some(init_config.with_ip_packet_router),
|
||||
}
|
||||
@@ -292,6 +297,7 @@ mod tests {
|
||||
enabled_statistics: None,
|
||||
nyxd_urls: None,
|
||||
only_coconut_credentials: None,
|
||||
offline_credential_verification: None,
|
||||
output: Default::default(),
|
||||
with_network_requester: false,
|
||||
with_ip_packet_router: false,
|
||||
|
||||
@@ -78,6 +78,10 @@ pub struct Run {
|
||||
#[arg(long, hide = true)]
|
||||
only_coconut_credentials: Option<bool>,
|
||||
|
||||
/// Set this gateway to use offline credentials verification
|
||||
#[clap(long, hide = true)]
|
||||
offline_credential_verification: Option<bool>,
|
||||
|
||||
/// Enable/disable gateway anonymized statistics that get sent to a statistics aggregator server
|
||||
#[arg(long)]
|
||||
enabled_statistics: Option<bool>,
|
||||
@@ -162,6 +166,7 @@ impl From<Run> for OverrideConfig {
|
||||
statistics_service_url: run_config.statistics_service_url,
|
||||
nyxd_urls: run_config.nyxd_urls,
|
||||
only_coconut_credentials: run_config.only_coconut_credentials,
|
||||
offline_credential_verification: run_config.offline_credential_verification,
|
||||
with_network_requester: run_config.with_network_requester,
|
||||
with_ip_packet_router: run_config.with_ip_packet_router,
|
||||
}
|
||||
|
||||
@@ -217,6 +217,14 @@ impl Config {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_offline_credential_verification(
|
||||
mut self,
|
||||
offline_credential_verification: bool,
|
||||
) -> Self {
|
||||
self.gateway.offline_credential_verification = offline_credential_verification;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_enabled_statistics(mut self, enabled_statistics: bool) -> Self {
|
||||
self.gateway.enabled_statistics = enabled_statistics;
|
||||
self
|
||||
@@ -299,6 +307,10 @@ pub struct Gateway {
|
||||
#[serde(default)]
|
||||
pub only_coconut_credentials: bool,
|
||||
|
||||
/// Indicates whether this gateway is using offline mode for credential verification
|
||||
#[serde(default)]
|
||||
pub offline_credential_verification: bool,
|
||||
|
||||
/// Address to which this mixnode will bind to and will be listening for packets.
|
||||
#[zeroize(skip)]
|
||||
pub listening_address: IpAddr,
|
||||
@@ -347,6 +359,7 @@ impl Gateway {
|
||||
version: env!("CARGO_PKG_VERSION").to_string(),
|
||||
id: id.into(),
|
||||
only_coconut_credentials: false,
|
||||
offline_credential_verification: false,
|
||||
listening_address: inaddr_any(),
|
||||
mix_port: DEFAULT_MIX_LISTENING_PORT,
|
||||
clients_port: DEFAULT_CLIENT_LISTENING_PORT,
|
||||
|
||||
@@ -127,6 +127,9 @@ impl From<ConfigV1_1_29> for ConfigV1_1_31 {
|
||||
version: value.gateway.version,
|
||||
id: value.gateway.id,
|
||||
only_coconut_credentials: value.gateway.only_coconut_credentials,
|
||||
// \/ ADDED
|
||||
offline_credential_verification: false,
|
||||
// /\ ADDED
|
||||
listening_address: value.gateway.listening_address,
|
||||
mix_port: value.gateway.mix_port,
|
||||
clients_port: value.gateway.clients_port,
|
||||
|
||||
@@ -33,6 +33,9 @@ id = '{{ gateway.id }}'
|
||||
# the mixnet, or if it also accepts non-paying clients
|
||||
only_coconut_credentials = {{ gateway.only_coconut_credentials }}
|
||||
|
||||
# Indicates whether this gateway is using offline mode for credential verification
|
||||
offline_credential_verification = {{ gateway.offline_credential_verification }}
|
||||
|
||||
# Socket address to which this gateway will bind to and will be listening for packets.
|
||||
listening_address = '{{ gateway.listening_address }}'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user