Expand description
A minimum, userspace TCP based datagram stack
§Overview
fake-tcp is a reusable library that implements a minimum TCP stack in
user space using the Tun interface. It allows programs to send datagrams
as if they are part of a TCP connection. fake-tcp has been tested to
be able to pass through a variety of NAT and stateful firewalls while
fully preserves certain desirable behavior such as out of order delivery
and no congestion/flow controls.
§Core Concepts
The core of the fake-tcp crate compose of two structures. Stack and
Socket.
§Stack
Stack represents a virtual TCP stack that operates at
Layer 3. It is responsible for:
- TCP active and passive open and handshake
RSThandling- Interact with the Tun interface at Layer 3
- Distribute incoming datagrams to corresponding
Socket
§Socket
Socket represents a TCP connection. It registers the identifying
tuple (src_ip, src_port, dest_ip, dest_port) inside the Stack so
so that incoming packets can be distributed to the right Socket with
using a channel. It is also what the client should use for
sending/receiving datagrams.
§Examples
Please see client.rs
and server.rs files
from the phantun crate for how to use this library in client/server mode, respectively.