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

Feature/instant sending #359

Merged
merged 32 commits into from
Sep 30, 2020
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
80259ad
Ability to set client in vpn mode
jstuczyn Sep 17, 2020
b040ab8
Connection handler for mixnode
jstuczyn Sep 17, 2020
b64f004
Initial vpn mode for mixes
jstuczyn Sep 21, 2020
c62ae61
Updated SphinxCodec to contain more metadata
jstuczyn Sep 22, 2020
2138da3
Renaming
jstuczyn Sep 22, 2020
0bccb05
Removed handle from mixnet client and introduced forwarder
jstuczyn Sep 22, 2020
9d4fb7c
Mixnode using new forwarder
jstuczyn Sep 22, 2020
e812767
Mixnode common module containing shared packet processing
jstuczyn Sep 23, 2020
b460a00
ibid. incorporated inside mixnode
jstuczyn Sep 23, 2020
c470ee0
New processing for gateway
jstuczyn Sep 23, 2020
1cc652f
Type cleanup
jstuczyn Sep 24, 2020
5a75122
Wasm fix
jstuczyn Sep 24, 2020
372ab21
Fixed client config
jstuczyn Sep 24, 2020
6e742d0
Fixed mixnode runtime issues
jstuczyn Sep 24, 2020
baa503a
Formatting
jstuczyn Sep 24, 2020
e4f1f87
Client re-using secret on 'normal' packets
jstuczyn Sep 24, 2020
4eb0f7d
Using the same key for acks
jstuczyn Sep 24, 2020
cf51b66
WIP
jstuczyn Sep 28, 2020
e481d65
vpn key manager cleanup
jstuczyn Sep 29, 2020
e37b95c
wasm fix
jstuczyn Sep 29, 2020
115ebdd
VPN_KEY_REUSE_LIMIT moved to config
jstuczyn Sep 29, 2020
7984295
Moved AckDelayQueue to separate common crate
jstuczyn Sep 29, 2020
bad5888
Key cache invalidator
jstuczyn Sep 30, 2020
a666887
Updated dashmap used in gateway
jstuczyn Sep 30, 2020
1746950
Old typo
jstuczyn Sep 30, 2020
68c0843
Additional comment
jstuczyn Sep 30, 2020
3a3d213
Cargo fmt
jstuczyn Sep 30, 2020
cbad460
Fixed tests
jstuczyn Sep 30, 2020
2bb3a5c
Merge branch 'develop' into feature/instant_sending
jstuczyn Sep 30, 2020
4fe2124
Sphinx update
jstuczyn Sep 30, 2020
af0286e
cache ttl as config option
jstuczyn Sep 30, 2020
553b102
Cargo fmt
jstuczyn Sep 30, 2020
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
Prev Previous commit
Next Next commit
wasm fix
jstuczyn committed Sep 29, 2020
commit e37b95c705a01e2083a2a68c90d0af94869d54d8
15 changes: 10 additions & 5 deletions common/nymsphinx/src/preparer/vpn_manager.rs
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
use nymsphinx_types::EphemeralSecret;
use rand::{CryptoRng, Rng};
use std::sync::atomic::{AtomicUsize, Ordering};
#[cfg(not(target_arch = "wasm32"))]
use std::sync::Arc;
#[cfg(not(target_arch = "wasm32"))]
use tokio::sync::{RwLock, RwLockReadGuard};
@@ -25,9 +26,13 @@ pub(super) type SpinhxKeyRef<'a> = RwLockReadGuard<'a, EphemeralSecret>;
#[cfg(target_arch = "wasm32")]
pub(super) type SpinhxKeyRef<'a> = &'a EphemeralSecret;

#[derive(Clone)]
#[cfg_attr(not(target_arch = "wasm32"), derive(Clone))]
pub(super) struct VPNManager {
#[cfg(not(target_arch = "wasm32"))]
inner: Arc<Inner>,

#[cfg(target_arch = "wasm32")]
inner: Inner,
}

struct Inner {
@@ -73,11 +78,11 @@ impl VPNManager {
{
let initial_secret = EphemeralSecret::new_with_rng(&mut rng);
VPNManager {
inner: Arc::new(Inner {
inner: Inner {
secret_reuse_limit,
current_initial_secret: initial_secret,
packets_with_current_secret: AtomicUsize::new(0),
}),
},
}
}

@@ -103,11 +108,11 @@ impl VPNManager {
where
R: CryptoRng + Rng,
{
let new_secret = EphemeralSecret::new_with_rng(&mut self.rng);
let new_secret = EphemeralSecret::new_with_rng(&mut rng);
self.inner.current_initial_secret = new_secret;

// wasm is single-threaded so relaxed ordering is also fine here
vpn_key_inner
self.inner
.packets_with_current_secret
.store(0, Ordering::Relaxed);
}