---
title: How it works
description: How minipaw connects two machines, a relay first and then a hole-punched direct path, and how sessions resume, apply backpressure and stay encrypted.
---

1. **Listen**

    The listener reserves a slot on a [Circuit Relay
    v2](https://github.com/libp2p/specs/blob/master/relay/circuit-v2.md) server
    (by default `relay.minip2p.com`) and prints a [ticket](/docs/tickets) with
    its peer ID, a random token, and the relay if it isn't the default.

2. **Dial**

    The other side connects through the relay with the ticket.

3. **Go direct**

    DCUtR hole punching upgrades the connection to a direct QUIC path when the
    networks allow. The session moves to the direct path mid-transfer without
    losing or repeating a byte.

## Resumable sessions

If the connection drops (a relay cutting a circuit, a path upgrade, a network
blip), the client reconnects and both sides resume from the last byte the
other received, for up to 60 seconds.

A quiet session pings every few seconds, so a connection that dies without a
word is noticed within 20 seconds too.

## Backpressure

The receiver acknowledges bytes only once they are written to its stdout, so
a slow reader slows the sender instead of filling memory.

## Encryption

Direct paths are QUIC (TLS 1.3); relayed paths run an end-to-end Noise
session through the relay. Either way the relay sees only encrypted traffic,
and both sides are authenticated by their peer IDs.
