Some adaption and alligned to the source code from dndx

This commit is contained in:
Luca Ferrarotti
2023-10-14 14:14:36 +02:00
parent 422a465d6e
commit 1fea277103
10 changed files with 21 additions and 19 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "fake-tcp"
version = "0.5.0"
version = "0.5.5"
edition = "2021"
authors = ["Datong Sun <dndx@idndx.com>"]
license = "MIT OR Apache-2.0"
@@ -16,10 +16,10 @@ benchmark = []
[dependencies]
bytes = "1.4.0"
pnet = "0.33.0"
pnet = "0.34.0"
tokio = { version = "1.28.0", features = ["full"] }
rand = { version = "0.8.5", features = ["small_rng"] }
log = "0.4.17"
internet-checksum = "0.2.1"
tokio-tun = "0.7"
flume = "0.10.14"
tokio-tun = "0.9.1"
flume ="0.11.0"

View File

@@ -146,7 +146,7 @@ impl Socket {
)
}
fn build_tcp_packet(&self, flags: u16, payload: Option<&[u8]>) -> Bytes {
fn build_tcp_packet(&self, flags: u8, payload: Option<&[u8]>) -> Bytes {
let ack = self.ack.load(Ordering::Relaxed);
self.last_ack.store(ack, Ordering::Relaxed);

View File

@@ -36,7 +36,7 @@ pub fn build_tcp_packet(
remote_addr: SocketAddr,
seq: u32,
ack: u32,
flags: u16,
flags: u8,
payload: Option<&[u8]>,
) -> Bytes {
let ip_header_len = match local_addr {