FastATP

0002: Key-derived overlay addresses

Problem

WireGuard's handshake agrees on session keys, not on addresses. Each side must already know the inner address the other will use: the host programs "key K may send from address A", and the peer puts A on its own interface. Someone has to make the two ends agree on A.

Before this record, FastATP had two ways, both wrong once a peer serves repos for pens it does not carry (docs/decisions/0001):

Both were symptoms of one thing: an address that lives in a record is a claim, and any repo can write any claim.

Decision

An address is a pure function of a key. Every peer's overlay address is

OVERLAY_PREFIX + first 64 bits of SHA-256(raw 32-byte WireGuard public key)

where OVERLAY_PREFIX is one IPv6 unique-local /64 (RFC 4193), chosen at random once and fixed in the source. Both ends of every tunnel compute each other's address from keys they already exchange, so no address is ever assigned, published, negotiated or stored. overlay_address is the function; a vector pins it, because a change to it is a change to every peer's address at once.

Consequences in the code:

Why not the alternatives

Deriving from the key is established practice: IPv6 cryptographically generated addresses (RFC 3972), and mesh networks such as Yggdrasil and cjdns, where the whole address space is a hash of the public key.

Consequences and limits