Moved subclients into their own directory
This commit is contained in:
@@ -22,7 +22,17 @@ impl DirectoryClient {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn fake_directory_mixes() -> Vec<SphinxNode> {
|
||||
let node1 = sphinx::route::Node{
|
||||
address: [0u8; 32], //"127.0.0.1:8080".as_bytes(), // start here tomorrow :)
|
||||
pub_key: Default::default()
|
||||
};
|
||||
let node2 = sphinx::route::Node{
|
||||
address: [1u8;32],
|
||||
pub_key: Default::default()
|
||||
};
|
||||
vec![node1, node2]
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod retrieving_mixnode_list {
|
||||
@@ -57,14 +67,3 @@ mod retrieving_destinations {
|
||||
}
|
||||
}
|
||||
|
||||
fn fake_directory_mixes() -> Vec<SphinxNode> {
|
||||
let node1 = sphinx::route::Node{
|
||||
address: [0u8;32],
|
||||
pub_key: Default::default()
|
||||
};
|
||||
let node2 = sphinx::route::Node{
|
||||
address: [1u8;32],
|
||||
pub_key: Default::default()
|
||||
};
|
||||
vec![node1, node2]
|
||||
}
|
||||
@@ -1,17 +1,23 @@
|
||||
use crate::directory::DirectoryClient;
|
||||
use crate::clients::directory::DirectoryClient;
|
||||
use sphinx::SphinxPacket;
|
||||
use sphinx::route::Node;
|
||||
use sphinx::route::Node as MixNode;
|
||||
use tokio::net::TcpStream;
|
||||
use tokio::prelude::*;
|
||||
|
||||
struct MixClient {}
|
||||
pub struct MixClient {}
|
||||
|
||||
impl MixClient {
|
||||
fn new() -> MixClient {
|
||||
pub fn new() -> MixClient {
|
||||
MixClient {}
|
||||
}
|
||||
|
||||
fn send(&self, packet: SphinxPacket, mix: &Node) {
|
||||
pub async fn send(&self, packet: SphinxPacket, mix: &MixNode) -> Result<(), Box<dyn std::error::Error>>{
|
||||
let bytes = packet.to_bytes();
|
||||
|
||||
// now we shoot it into space!
|
||||
let mut stream = TcpStream::connect("127.0.0.1:8080").await?;
|
||||
stream.write_all(&bytes[..]).await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
pub mod directory;
|
||||
pub mod mix;
|
||||
mod validator;
|
||||
Reference in New Issue
Block a user