INFRASTRUCTURE-FREE · PEER-TO-PEER · ENCRYPTED

Emergency comms
without the network

MeshLink enables resilient communication when centralized infrastructure fails — using WebRTC data channels, distributed hash tables, and self-healing mesh routing.

🌐

WebRTC Data Channels

Direct browser-to-browser communication with encrypted data channels. No servers in the message path.

P2P · DTLS · SCTP
🔗

Kademlia DHT

Decentralized peer discovery using XOR-metric routing. Nodes self-organize without a central registry.

k=20 · 160-bit IDs
🛡️

Mesh Routing

TTL-based flood routing with packet deduplication and store-and-forward delivery for offline nodes.

TTL=5 · Dedupe · SAF
🚨

SOS Broadcast

Priority emergency broadcasts propagate through the full mesh with highest-priority routing guarantees.

HIGH · Broadcast · E2E
🔒

End-to-End Encryption

Web Crypto API with ECDH key exchange and AES-GCM encryption. Keys never leave the device.

ECDH · AES-256-GCM
📦

Offline Caching

IndexedDB-backed message store enables offline-first operation and store-and-forward packet delivery.

IndexedDB · Offline-first
PACKET STRUCTURE
🔐 E2E ENCRYPTED
// Example MeshLink packet
{
  "id": "pkt-a3f9b2",        // UUIDv4 for deduplication
  "from": "peer-7c4d1a",     // Sender peer ID
  "to": "broadcast",       // Target: peerID or "broadcast"
  "ttl": 5,               // Hops remaining (decrements)
  "priority": "HIGH",      // LOW | MEDIUM | HIGH | SOS
  "message": "Need assistance at Grid B7",
  "timestamp": 1704067200000,
  "sig": "ECDSA:3045...",     // Packet signature
  "enc": "AES-GCM:iv+ciphertext" // Encrypted payload
}
Peers 0
ME
Node Alpha
This device
BROADCAST
📡
Mesh Broadcast
All connected peers
DIRECT PEERS
No peers connected
📡 Mesh Broadcast
Broadcasting to all 0 peers · TTL=5 · E2E Encrypted
🔐 AES-256-GCM
TTL 5
SYSTEM Node initialized
MeshLink node online. Peer discovery active via DHT. Waiting for connections...
Kademlia Routing Table
Node ID (XOR prefix) IP / Transport Distance (XOR) RTT Bucket Status
DHT Lookup Workflow
// Kademlia lookup: find k closest nodes to target
async function kademliaLookup(targetId) {
  // Step 1: Find α closest nodes from local table
  const closest = routingTable.findClosest(targetId, α=3);
  const queried = new Set();

  // Step 2: Iterative lookup — query closest unqueried
  while (closest.some(n => !queried.has(n.id))) {
    const next = closest.filter(n => !queried.has(n.id)).slice(0,α);
    const results = await Promise.all(next.map(n => n.findNode(targetId)));
    next.forEach(n => queried.add(n.id));

    // XOR metric: distance = myId XOR targetId
    results.flat().forEach(node => {
      const dist = xorDistance(node.id, targetId);
      routingTable.insert(node, dist);
    });
    closest.sort((a,b) => xorCmp(a.id,b.id,targetId));
  }
  return closest.slice(0,k=20);
}
Mesh Routing Algorithm
// TTL-based flood routing with deduplication
function routePacket(packet) {
  // 1. Deduplicate: reject already-seen packet IDs
  if (seenPackets.has(packet.id)) return;
  seenPackets.add(packet.id);

  // 2. Decrement TTL — drop if expired
  packet.ttl -= 1;
  if (packet.ttl <= 0) return;

  // 3. Check if we're the destination
  if (packet.to === myPeerId || packet.to === "broadcast") {
    deliver(packet);
    if (packet.to !== "broadcast") return;
  }

  // 4. Rebroadcast to all known peers
  peers.forEach(peer => {
    if (peer.id !== packet.from) peer.send(packet);
  });
}
Store-and-Forward Cache
No cached packets. Messages for offline peers will appear here.
Node Identity
Peer ID
Node Name
Bucket count160
k-factor20
α (alpha)3
Table size0 nodes
XOR Distance Map
Activity Log
00:00
DHT initialized
View:
Network Health
1
1 online · 0 offline
0
WebRTC data channels
Round-trip time
0
Since session start
Selected Node
Click a node to inspect
Packet Log
IDRoutePRI