Moved mix client to separate crate

This commit is contained in:
Jedrzej Stuczynski
2020-01-08 11:45:43 +00:00
parent 9ba1ea203b
commit 883ce22c5b
5 changed files with 27 additions and 5 deletions
Generated
+5
View File
@@ -1046,6 +1046,10 @@ dependencies = [
[[package]]
name = "mix_client"
version = "0.1.0"
dependencies = [
"sphinx 0.1.0",
"tokio 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "mockito"
@@ -1129,6 +1133,7 @@ dependencies = [
"dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"mix_client 0.1.0",
"mockito 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pem 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
+8 -2
View File
@@ -24,11 +24,17 @@ rand_distr = "0.2.2"
reqwest = "0.9.22"
serde = { version = "1.0.104", features = ["derive"] }
serde_json = "1.0.44"
sphinx = { path = "../../sphinx" }
sfw-provider-requests = { path = "../sfw-provider/sfw-provider-requests" }
tokio = { version = "0.2", features = ["full"] }
tungstenite = "0.9.2"
## internal
directory_client = { path = "directory_client" }
mix_client = { path = "mix_client" }
sfw-provider-requests = { path = "../sfw-provider/sfw-provider-requests" }
## will be moved to proper dependencies once released
sphinx = { path = "../../sphinx" }
# putting this explicitly below everything and most likely, the next time we look into it, it will already have a proper release
tokio-tungstenite = { git = "https://github.com/dbcfd/tokio-tungstenite", rev="6dc2018cbfe8fe7ddd75ff977343086503135b38" }
+13
View File
@@ -0,0 +1,13 @@
[package]
name = "mix_client"
version = "0.1.0"
authors = ["Jedrzej Stuczynski <andrew@nymtech.net"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "0.2", features = ["full"] }
## will be moved to proper dependencies once released
sphinx = { path = "../../../sphinx" }
+1 -3
View File
@@ -1,4 +1,3 @@
use crate::clients::mix::MixClient;
use crate::clients::provider::ProviderClient;
use crate::sockets::tcp;
use crate::sockets::ws;
@@ -18,7 +17,6 @@ use std::sync::Arc;
use std::time::Duration;
use tokio::runtime::Runtime;
pub mod mix;
pub mod provider;
pub mod validator;
@@ -43,7 +41,7 @@ struct MixTrafficController;
impl MixTrafficController {
// this was way more difficult to implement than what this code may suggest...
async fn run(mut rx: mpsc::UnboundedReceiver<MixMessage>) {
let mix_client = MixClient::new();
let mix_client = mix_client::MixClient::new();
while let Some(mix_message) = rx.next().await {
println!(
"[MIX TRAFFIC CONTROL] - got a mix_message for {:?}",