Skip to content

Transport Reference

Technical specifications for Kunuleco transport layers.


Transport Priority

There is no single priority list. The node uses one order to make first contact and another to send over connections that already exist. Paths are under src/kunuleco/. The first-contact order was checked against the source at 0.2.241 (node 2c6fc87a). The sending table below was checked on 2026-09-30 and its line numbers have moved since.

First contact (join)

Each arm counts only when the peer proves the identity the join is for and the host answers the join. A connection that proves another identity, or a host that stays silent, moves the walk on. transport disable <t> skips an arm, and transport force <t> skips every other arm and the race. Every arm runs inside the encrypted channel described under Connections.

join form Order Source (verbs/invite_system.py unless named)
join <host> <presence> <AID> [tor=… vdht=…] (an invite line) 0. the same node, when the presence is here · 1. a live LAN (mDNS) session under the host's name · 2. at t=0 the hint phase: LAN sightings already proven to be the AID, one at a time, then one race of the tor= and vdht= hints, each pinned to the AID and decided on proof, then up to 4 unproven LAN sightings · 3. the directory walk, from t=5 s if nothing has proved the AID yet, or at once if the hint phase ends first: look up the host, then Veilid, Tor and a race of the endpoints in its record :4030, :2004, :2445-2538, :2062-2094, :2205, :2257, :2308, :2356
join <name#TAG> [presence] (no AID) 0 and 1 as above, then the directory walk at once. No hint phase :2092-2094
join <short-code> the code's signed record is checked and its host shown, then the code's own Veilid record key as a hint (with the LAN sightings), then a live LAN session, Veilid and Tor in turn. No stagger and no race :2732-2998
join <kunul1… seed> a race of the seed's LAN addresses and its Tor and Veilid hints. Only a LAN win counts as meeting in person verbs/unified_verbs.py:14243-14266

One join wins. Every arm proves the host on its own connection and offers it, the first admitted or refused verdict decides, and the other arms are closed (:278-365). A transport family whose join went unanswered is not joined again in the same walk, so one join sends at most one join per family (:252-267). Before 0.2.241 one join was measured sending three.

The timings since 0.2.241:

Constant Value What it bounds
DIRECTORY_STAGGER 5 s how long the hint phase runs alone before the directory walk starts beside it (:243)
HINT_PHASE_TIMEOUT 25 s the race of the invite's hints (:216)
HINT_CONFIRM_TIMEOUT 10 s each hint's proof of the host (:217)
LAN_UNPROVEN_BUDGET 10 s all the unproven LAN sightings together (:227)

A stale hint now costs 5 seconds before the directory is asked. In 0.2.240 it cost 25, or 35 for a hint that connected and never proved, or 45 with the unproven LAN sightings, and in 0.2.236 to 0.2.239 it cost 10. A Tor hint still has its 25 seconds, because a freshly published onion's first connection was measured at 21.1 seconds (TPT-131). No bound on a whole join is stated or measured.

The cost of the stagger is privacy. When a valid hint is slow to prove, as on a cold onion, the directory is asked at 5 seconds, so the directory's operator learns that this node looked the host up, and each listed address the walk dials learns which AID was asked for (:238-242).

The race starts every endpoint in the same pass (transport/connection_racer.py:200). The endpoint priorities (private LAN address 1, Veilid 2, Tor 3, public address 5) set the order the attempts start in, not a wait between them, so the first endpoint to connect wins whatever its priority. The race of an invite's hints is decided on proof of the host, not on the first connection.

Sending over an existing connection

No send path opens a new connection.

What is sent Order Source
tell, and the outbox flush 1. the LAN (mDNS) session · 2. any other live CapTP session to that peer · 3. Tor · 4. Veilid · 5. the invite system's lookup, which checks LAN, Tor, then Veilid. If the peer has no connected session, the message is queued in the outbox first verbs/unified_verbs.py:3936, :3949, :3963, :3975, :3988; verbs/invite_system.py:1170; queueing at verbs/unified_verbs.py:229
Speech in a presence, to remote members 1. the LAN session · 2. the member's stored connection · 3. Tor · 4. Veilid. Tor leads Veilid because a Veilid route can accept a message and lose it captp/message_router.py:2180, :2191, :2204, :2217; the reason at :2124
Other presence traffic (send_to_peer) 1. any live CapTP session · 2. Tor · 3. Veilid captp/message_router.py:2531, :2567, :2578

P2PCapTPBridge.send_via_best_transport (transport/veilid/bridge.py:4637, TCP, then Veilid) is attached to the bridge but nothing calls it.


mDNS Transport

Service Definition

Property Value
Service Type _kunuleco._tcp.local.
Port 4243 (the CapTP port, set by KUNULECO_CAPTP_PORT)
Protocol TCP

Service TXT Records

All four keys are unsigned hints. The signed CapTP hello decides who the peer is.

Key Value
identity Name#Discriminator
version 0.5.0
captp_port The CapTP port to dial (4243 by default)
verify_key Hex-encoded Ed25519 verify key (omitted when the identity has none)

Simultaneous Dials

Two peers that discover each other may both dial at once. The CapTP layer merges the two connections into one session.

Reconnection

  • At most 8 LAN dials in flight
  • Backoff after a failed dial: 10 s, doubling to 300 s

Veilid Transport

API Connection

Property Value
Host localhost
Port 15959 on an installed node, 5959 without a config file (see Configuration)
Protocol JSON over HTTP

Route Configuration

Setting Value
Refresh interval 120 seconds (transport/veilid/__init__.py:27)
Stability Reliable
Sequencing EnsureOrdered
Hop count Default

Route Blob Format

Opaque binary blob (base64-encoded for transmission).

Message Operations

Operation Latency
app_message (fire-and-forget) 5-10ms
app_call (round-trip) ~183ms through CGNAT
Route import 4-10ms

Status Response

{
  "available": true,
  "running": true,
  "route_id": "...",
  "peer_count": 5
}

Tor Transport

Configuration

Property Value
SOCKS Port 19050 (isolated) or 9050 (system)
Control Port 19051 (isolated) or 9051 (system)
CapTP Port 4243

Onion Service

Property Value
Version 3 (v3 onion addresses)
Port 80 (mapped to local 4243)
Persistence Persistent (key stored)

Key Storage

<data_dir>/tor_data/
└── onion_private_key

Authentication

Methods (in order of preference):

  1. Cookie authentication
  2. Password (via TOR_CONTROL_PASSWORD)
  3. No authentication (if enabled in torrc)

Status Response

{
  "available": true,
  "running": true,
  "onion_address": "abc123...xyz.onion",
  "peer_count": 2
}

IPFS Transport

Removed in 0.3.129. 0.3.111 stopped storing media in IPFS, 0.3.127 stopped using it for connections, and 0.3.129 removed the kubo daemon. ipfs is refused as an unknown transport.


Port Summary

Default Configuration

Service Standard Kunuleco Isolated
Veilid API 5959 5959
Tor SOCKS 9050 19050
Tor Control 9051 19051
Kunuleco CapTP 4243 4243

Wire Protocol

All transports ultimately carry CapTP messages.

Framing

Messages are length-prefixed:

┌──────────────┬────────────────────────────┐
│ 4-byte len   │ JSON payload               │
│ (big-endian) │                            │
└──────────────┴────────────────────────────┘

Health Check Endpoints

mDNS

No endpoint — health determined by service registration.

Veilid

GET http://localhost:5959/

Tor

Control port connection with AUTHENTICATE command.