Skip to content

Documentation / @super-line/adapter-libp2p / Libp2pAdapterOptions

Interface: Libp2pAdapterOptions

Defined in: packages/adapter-libp2p/src/index.ts:54

Options for createLibp2pAdapter.

Properties

discovery?

optional discovery?: Discovery | Discovery[]

Defined in: packages/adapter-libp2p/src/index.ts:69

How the built-in node discovers peers — see Discovery. Omit for no discovery: a valid single-node setup, or a seed that others point at via { bootstrap }. Discovered peers are dialed automatically, so the gossipsub mesh forms without extra wiring.


identity?

optional identity?: PrivateKey | { path: string; }

Defined in: packages/adapter-libp2p/src/index.ts:84

Peer identity for the built-in node: a raw PrivateKey, or { path } to load-or-create a persistent Ed25519 key on disk (stable peer ID across restarts). Omit for an ephemeral key — with purely dynamic discovery (mdns/dns/relay) that's fine, since nothing references your peer ID; otherwise a startup warning fires because bootstrap lists break on restart.


listen?

optional listen?: string[]

Defined in: packages/adapter-libp2p/src/index.ts:75

Listen multiaddrs for the built-in node. Defaults to ['/ip4/0.0.0.0/tcp/0'] (or /ws for the WebSocket transport). Seed nodes should use a FIXED port so their multiaddr stays valid in others' bootstrap lists.


node?

optional node?: PubSubLibp2p

Defined in: packages/adapter-libp2p/src/index.ts:62

Bring your own (started) libp2p node. It must expose a gossipsub pubsub service (the adapter does its own loopback, so emitSelf can be left off). When provided, the adapter does NOT manage the node's lifecycle — close() leaves it running — and node-building options (discovery, listen, …) don't apply: you own the node's topology.


presence?

optional presence?: false | { livenessTtlMs?: number; snapshotIntervalMs?: number; }

Defined in: packages/adapter-libp2p/src/index.ts:91

Cluster presence directory (powers srv.cluster.* / srv.isOnline). On by default; set false to disable (cluster queries then throw). Pass an object to tune timings.


topic?

optional topic?: string

Defined in: packages/adapter-libp2p/src/index.ts:86

The single shared gossipsub topic every node joins. Defaults to 'super-line/v1'.


transport?

optional transport?: "tcp" | "ws"

Defined in: packages/adapter-libp2p/src/index.ts:77

Transport for the built-in node. Defaults to 'tcp'.

Released under the MIT License.