Earendil docs
English
English
  • About
  • getting started
    • Installation
    • Quick start
    • Host a web proxy
    • Visit and host havens
    • Chat
    • Run a relay
    • Pay and get paid
    • Config file
  • FAQ
    • 1+ nodes on 1 machine
  • 📖wiki
    • Type-I and II censorship resistance
    • Network architecture
    • Protocols
      • N2R (node-to-relay) protocol
      • GlobalRPC
      • Haven protocol
      • Link protocol
      • Stream protocol
      • WIP: Debt accounting
    • Onion packet format
      • Reply blocks
      • Earendil packet vs. Sphinx
    • Relay configuration
Powered by GitBook
On this page
  • Taking ownership of sockets
  • Opening streams
  • Sending data
  • Closing the connection
Edit on GitHub
  1. wiki
  2. Protocols

Stream protocol

The stream protocol is built on top of the unified socket abstraction, and is used to run reliable, TCP-like communication.

Overall, we steal the same construction as the streams used in sosistab2, except without any multiplexing on top of the same fingerprint-dock-fingerprint-dock 4-tuple.

Taking ownership of sockets

A socket can be passed into either a listener (for the server) or connected to a server (for the client).

Opening streams

While connecting to the server, the client sends a SYN message to the server endpoint.

The server responds with SYN-ACK, and the connection is now open.

A random stream-ID must be chosen.

Sending data

Data is sent as usual. The stream-ID must stay the same.

Closing the connection

When the connection is closed, FIN or RST is sent.

The underlying socket (or forwarding table entry) of each connection must be kept alive for at least 60 seconds, even after the connection is closed. A loop then responds to every incoming packet that is not itself an RST with an RST. This is so that the dock number is kept occupied, and so that the other side realizes that the connection is closed.

Last updated 1 year ago

📖