Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport magura fixes to aero #5095

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/authenticator-requests/src/v2/registration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub type HmacSha256 = Hmac<Sha256>;
pub type Nonce = u64;
pub type Taken = Option<SystemTime>;

pub const BANDWIDTH_CAP_PER_DAY: u64 = 1024 * 1024 * 1024; // 1 GB
pub const BANDWIDTH_CAP_PER_DAY: u64 = 250 * 1024 * 1024 * 1024; // 250 GB

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct InitMessage {
Expand Down
6 changes: 2 additions & 4 deletions common/wireguard/src/peer_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ use defguard_wireguard_rs::{
WireguardInterfaceApi,
};
use futures::channel::oneshot;
use nym_authenticator_requests::{
v1::registration::BANDWIDTH_CAP_PER_DAY, v2::registration::RemainingBandwidthData,
};
use nym_authenticator_requests::v2::registration::{RemainingBandwidthData, BANDWIDTH_CAP_PER_DAY};
use nym_credential_verification::{
bandwidth_storage_manager::BandwidthStorageManager, BandwidthFlushingBehaviourConfig,
ClientBandwidth,
Expand Down Expand Up @@ -229,7 +227,7 @@ impl<St: Storage + Clone + 'static> PeerController<St> {
// host information not updated yet
return Ok(None);
};
BANDWIDTH_CAP_PER_DAY.saturating_sub((peer.rx_bytes + peer.tx_bytes) as i64)
BANDWIDTH_CAP_PER_DAY.saturating_sub(peer.rx_bytes + peer.tx_bytes) as i64
};

Ok(Some(RemainingBandwidthData {
Expand Down
4 changes: 2 additions & 2 deletions common/wireguard/src/peer_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use tokio::sync::{mpsc, RwLock};
use tokio_stream::{wrappers::IntervalStream, StreamExt};

pub(crate) type SharedBandwidthStorageManager<St> = Arc<RwLock<BandwidthStorageManager<St>>>;
const AUTO_REMOVE_AFTER: Duration = Duration::from_secs(60 * 60 * 24); // 24 hours
const AUTO_REMOVE_AFTER: Duration = Duration::from_secs(60 * 60 * 24 * 30); // 30 days

pub struct PeerHandle<St> {
storage: St,
Expand Down Expand Up @@ -97,7 +97,7 @@ impl<St: Storage + Clone + 'static> PeerHandle<St> {
} else {
if SystemTime::now().duration_since(self.startup_timestamp)? >= AUTO_REMOVE_AFTER {
log::debug!(
"Peer {} has been present for 24 hours, removing it",
"Peer {} has been present for 30 days, removing it",
self.public_key.to_string()
);
let success = self.remove_peer().await?;
Expand Down
6 changes: 5 additions & 1 deletion nym-node/src/config/entry_gateway.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ pub fn ephemeral_entry_gateway_config(
config: Config,
mnemonic: &bip39::Mnemonic,
) -> Result<EphemeralConfig, EntryGatewayError> {
let auth_opts = LocalAuthenticatorOpts {
let mut auth_opts = LocalAuthenticatorOpts {
config: nym_authenticator::Config {
base: nym_client_core_config_types::Config {
client: base_client_config(&config),
Expand All @@ -173,6 +173,10 @@ pub fn ephemeral_entry_gateway_config(
custom_mixnet_path: None,
};

if config.authenticator.debug.disable_poisson_rate {
auth_opts.config.base.set_no_poisson_process();
}

let wg_opts = LocalWireguardOpts {
config: super::Wireguard {
enabled: config.wireguard.enabled,
Expand Down
6 changes: 5 additions & 1 deletion nym-node/src/config/exit_gateway.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ pub fn ephemeral_exit_gateway_config(
ipr_opts.config.base.set_no_poisson_process()
}

let auth_opts = LocalAuthenticatorOpts {
let mut auth_opts = LocalAuthenticatorOpts {
config: nym_authenticator::Config {
base: nym_client_core_config_types::Config {
client: base_client_config(&config),
Expand All @@ -262,6 +262,10 @@ pub fn ephemeral_exit_gateway_config(
custom_mixnet_path: None,
};

if config.authenticator.debug.disable_poisson_rate {
auth_opts.config.base.set_no_poisson_process();
}

let pub_id_path = config
.storage_paths
.keys
Expand Down
Loading