ddat interop with dat js cable interop with cabal js ddat's frontend = dat-thang cable fe = cable-thang dillo support based on cel's dillo-dat bootstrap node xplatform support Signed-off-by: divo <418@cryspace.space>
42 lines
2.3 KiB
Markdown
42 lines
2.3 KiB
Markdown
# Network protocol identity
|
|
|
|
`NETWORK_PROTOCOL` in the repository root is the single editable protocol
|
|
token. `cesspool_discovery_key` uses it as the Cesspool topic namespace.
|
|
Hypercore V6 has no fixed protocol-name field: `userData` is optional
|
|
application data, and the handshake `id` is protocol-local.
|
|
|
|
The default file contains `cesspool`. Production uses the Cesspool discovery
|
|
and transport path. `hypercore` is reserved for compatibility experiments
|
|
against the historical Dat/Dillo implementation; it is not the production
|
|
network stack and does not refer to Cabal's newer Hypercore stack. The V6
|
|
session opens channel 0 with a clear 24-byte nonce, then encrypts subsequent
|
|
stream bytes with XSalsa20; channel 1 carries the content feed.
|
|
|
|
Dat-thang keeps one client network key in `~/.dat/dat-thang.network-key`.
|
|
Loading or switching a local or remote archive must not replace that key: the
|
|
same peer identity announces every archive the client shares. Cable keeps its
|
|
Cabal-compatible room identity separately. Archive feed keys still determine
|
|
the archive topic; they are not the client's network identity.
|
|
The discovery UDP socket tries 3282 first, then 3000, 3002, 3004, 2001, 2003,
|
|
and 2005, matching Dillo's `hyperdiscovery` port list. Callers can request a
|
|
specific port.
|
|
|
|
The compatibility builds use the packed channel/type header and protobuf payload schema
|
|
from `extra/schema.proto`. The `cesspool` token selects V7 channel numbering;
|
|
`hypercore` selects V6 channel numbering. This message codec is independent
|
|
of the transport and Cesspool's UDP discovery packets.
|
|
|
|
The Cesspool V7 handshake includes the selected token in `userData`. The V6
|
|
Hypercore handshake omits `userData`, because the legacy implementation treats
|
|
it as application-owned data rather than network identity.
|
|
|
|
## Scheme application view
|
|
|
|
When S7 is enabled, protocol frames can be viewed as a tagged Scheme record
|
|
with named fields: `(dat:wire-message (channel . N) (type . N) (payload .
|
|
#u8(...)))`. `dat-wire->sexp` and `dat-sexp->wire` call the existing C frame
|
|
codec. The record is an application representation only; the frame header,
|
|
payload bytes, channel numbering, encryption, and protocol identity continue
|
|
to come from the selected C network implementation. Scheme code is installed
|
|
under `share/datgpt/scheme` as part of the default install.
|