Feature/gateway provider merge (#208)
* Initial draft for ClientsHandler * Created listener struct * typo * Stateful websocket connection handler * Exposing modules * Depdendencies updates * Moved listener to correct file + made start consume listener * Main starting new listener * Catching sigint * Copied client storage from provider into gateway * Exposed websocket listener type for nicer import path * Defined websocket message receiver concrete type * Client ledger struct without implementation * ClientsHandler using more concrete types * Mixnet sender + receiver and exposed listener type * Handling mix packets * Ability to forward mix packets * "starting" both listeners at main * Depedencies updates * Initial type definitions for client messages * Initial "gateway-requests" with AuthToken * ibid. * Restored most of ledger's functionalities * Ability to retrieve all messages regardless of rate limit * ClientsHandler request handling logic * Required 'new' dependencies * Main changes required for compilation * PacketProcessor getting private key pointer * "moved" types into gateway requests crate * Moved and renamed types * ibid. * Added required serde_json dependency * Skeleton for websocket request handling * helper methods on ServerResponse * WebSocket Handler pushing received mix messages directly to client * PacketForwarder returning JoinHandle alongside the channel * ClientsHandler following the same pattern * Made websocket listener start method consistent with mix listener * Syntax error + formatting * Websocket handler having access to mix forwarder * Minimal binary request parsing * Implicitly derived std::error::Error on GatewayRequestsError * Handling of all websocket requests * Types import cleanup * Updated placeholder fields * Everything put into main * Missing license notices * Cleaned up unused code * Copied and did initial minor changes to commands and config * It's actually gateway * Gateway sending its regular presence to directory server * Re-organisation of gateway code + Gateway struct * Updated provider argument description * Restored duplicate ip check without importing NymTopology trait * Moved hardcoded values into config * Cargo fmt * Compilation errors in other crates due to topology adjustments * Test fixes * Initial gateway-client * Seemingly working version with bunch of hardcoded and temporary values * cargo fmt * Removed provider poller * Updated config with gateway values instead of provider * Gateway address including ws * Removed hardcoded gateway address * Properly skipping loop cover messages * Updated log filter with tokio tungstenite related modules * Updated sphinx version used * Very minor cleanup * unused import
This commit is contained in:
committed by
GitHub
parent
903ef44328
commit
abbf7041a4
@@ -16,7 +16,9 @@ use crate::node::metrics;
|
||||
use crypto::encryption;
|
||||
use log::*;
|
||||
use nymsphinx::addressing::nodes::{NymNodeRoutingAddress, NymNodeRoutingAddressError};
|
||||
use nymsphinx::{Delay as SphinxDelay, NodeAddressBytes, ProcessedPacket, SphinxPacket};
|
||||
use nymsphinx::{
|
||||
Delay as SphinxDelay, Error as SphinxError, NodeAddressBytes, ProcessedPacket, SphinxPacket,
|
||||
};
|
||||
use std::convert::TryFrom;
|
||||
use std::net::SocketAddr;
|
||||
use std::ops::Deref;
|
||||
@@ -24,9 +26,8 @@ use std::sync::Arc;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum MixProcessingError {
|
||||
SphinxRecoveryError,
|
||||
ReceivedFinalHopError,
|
||||
SphinxProcessingError,
|
||||
SphinxProcessingError(SphinxError),
|
||||
InvalidHopAddress,
|
||||
}
|
||||
|
||||
@@ -36,12 +37,12 @@ pub enum MixProcessingResult {
|
||||
LoopMessage,
|
||||
}
|
||||
|
||||
impl From<nymsphinx::ProcessingError> for MixProcessingError {
|
||||
// for time being just have a single error instance for all possible results of nymsphinx::ProcessingError
|
||||
fn from(_: nymsphinx::ProcessingError) -> Self {
|
||||
impl From<SphinxError> for MixProcessingError {
|
||||
// for time being just have a single error instance for all possible results of SphinxError
|
||||
fn from(err: SphinxError) -> Self {
|
||||
use MixProcessingError::*;
|
||||
|
||||
SphinxRecoveryError
|
||||
SphinxProcessingError(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ impl PacketProcessor {
|
||||
}
|
||||
Err(e) => {
|
||||
warn!("Failed to unwrap Sphinx packet: {:?}", e);
|
||||
Err(MixProcessingError::SphinxProcessingError)
|
||||
Err(MixProcessingError::SphinxProcessingError(e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user