lokinet/docs/dht_v0.txt
Jeff a582983a63 place protocol spec into public domain with CC0
update readmes, move doc -> docs

add symlink from doc to docs
2018-10-08 08:15:08 -04:00

118 lines
2.3 KiB
Plaintext

DHT messages
these messages can be either wrapped in a LIDM message or sent anonymously over a path
This document is currently out of date (probably)
find introduction message (FIM)
variant 1: recursively find an IS by SA
{
A: "F",
I: 0 or 1 if iterative request,
S: "<32 bytes SA>",
T: transaction_id_uint64,
V: 0
}
variant 2: recursively find many IS in a tag
{
A: "F",
E: "<N*32 bytes optional exclude SA list>",
I: 0 or 1 if iterative request,
N: "<16 bytes topic tag>",
T: transaction_id_uint64,
V: 0
}
exclude adding service addresses in E if present
got introduction message (GIM)
sent in reply to FIM and PIM
{
A: "G",
I: [IS, IS, IS, ...],
T: transaction_id_uint64,
V: 0,
}
The I value MUST NOT contain more than 8 IS.
The I value is either 1 or 0 IS long for PIM and FIM variant 1.
publish introduction message (PIM)
publish one IS to the DHT.
version 0 uses the SA of the IS as the keyspace location.
in the future the location will be determined by the dht kdf
which uses a shared random source to obfuscate keyspace location.
R is currently set to 0 by the sender.
{
A: "I",
I: IS,
R: r_counter,
S: optional member 0 for immediate store otherwise non zero,
T: transaction_id_uint64,
V: 0
}
if R is greater than 0, do a random walk, otherwise if we are
closer to the SA of the IS than anyone else we know in the DHT
store the IS for later lookup.
As of protocol version 0, R is always 0.
If S is provided store the IS for later lookup unconditionally,
decrement S by 1 and forward to dht peer who is next closest to
the SA of the IS. If S is greater than 3, don't store and discard
this message.
find router contact message (FRCM)
find a router by long term RC.k public key
{
A: "R",
E: 0 or 1 if exploritory lookup,
I: 0 or 1 if iterative lookup,
K: "<32 byte public key of router>",
T: transaction_id_uint64,
V: 0
}
TODO: document me
got router contact message (GRCM)
R is a list containing a single RC if found or is an empty list if not found
sent in reply to FRCM only
{
A: "S",
R: [RC],
T: transaction_id_uint64,
V: 0
}
in response to an exploritory FRCM if the target router is not found the form
{
A: "S",
N: [list, of, router, publickeys, near, target],
R: [],
T: transaction_id_uint64,
V: 0
}