Updating to work with constant sized packets
This commit is contained in:
Generated
+1
@@ -558,6 +558,7 @@ dependencies = [
|
||||
"aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"blake2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"chacha 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hkdf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
||||
+6
-3
@@ -1,7 +1,7 @@
|
||||
use tokio::net::TcpListener;
|
||||
use tokio::prelude::*;
|
||||
use crate::mix_peer::MixPeer;
|
||||
use sphinx::SphinxPacket;
|
||||
use sphinx::{SphinxPacket, ProcessedPacket};
|
||||
|
||||
mod mix_peer;
|
||||
|
||||
@@ -17,7 +17,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let (mut inbound, _) = listener.accept().await?;
|
||||
|
||||
tokio::spawn(async move {
|
||||
let mut buf = [0; 1024];
|
||||
let mut buf = [0; 1024 + 333];
|
||||
|
||||
loop {
|
||||
let _ = match inbound.read(&mut buf).await {
|
||||
@@ -28,7 +28,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
Ok(length) => {
|
||||
let packet = SphinxPacket::from_bytes(buf.to_vec()).unwrap();
|
||||
let (next_packet, _) = packet.process(Default::default());
|
||||
let next_packet = match packet.process(Default::default()){
|
||||
ProcessedPacket::ProcessedPacketForwardHop(packet,_,_) => Some(packet) ,
|
||||
_ => None,
|
||||
}.unwrap();
|
||||
|
||||
let next_mix = MixPeer::new();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user