Files
modules/routing-paths/hyper-p2p-relay-tunnel/docs/api.md
T
Raven ScottandCursor 17876e6284 Expand category docs and module APIs across the library.
Manual pass adds helpers (listChannels, taskCounts, openProposals), richer getStats with protocol fields, category README hubs, and tightened api.md for core, messaging, network, routing, supercomputer, and consensus modules.

Co-authored-by: Cursor <[email protected]>
2026-05-21 00:54:19 -04:00

1.5 KiB

API: hyper-p2p-relay-tunnel

Protocol: relay-tunnel/v1 · Export: HyperP2PRelayTunnel

Overview

HyperP2PRelayTunnel — P2P module. See README.md and architecture.md.

Constructor

const mod = new HyperP2PRelayTunnel(opts)
Option Type Default Description
topic Buffer | string | null null Hyperswarm topic; omit for local-only
keyPair KeyPair random Discovery identity

Methods

advertise(...)

Public API on HyperP2PRelayTunnel. See index.js for parameters and return types.

findRelay(...)

Public API on HyperP2PRelayTunnel. See index.js for parameters and return types.

connect(...)

Public API on HyperP2PRelayTunnel. See index.js for parameters and return types.

relay(...)

Public API on HyperP2PRelayTunnel. See index.js for parameters and return types.

closeTunnel(...)

Public API on HyperP2PRelayTunnel. See index.js for parameters and return types.

getStats() → object

Metrics plus protocol: 'relay-tunnel/v1'.

async ready()

Joins Hyperswarm when topic is set; opens Protomux channel.

async close()

Tears down swarm and clears local state; emits closed where applicable.

P2P

Gossip / sync over Protomux relay-tunnel/v1 when topic is configured.

Testing

npm install && npm test