Client for interacting with blind peers, sending RPC requests to keep hypercores and autobases available.
npm install blind-peering
const blindPeering = new BlindPeering(swarm, store, opts)Create a new Blind Peering instance. swarm is a hyperswarm instance and store is a Corestore instance.
opts include:
mirrors: a list of blind peer keys (mirrors) to use. You should always set this, otherwise there are no mirrors to contact.suspended: whether to start in suspended state (default false)wakeup: a Wakeup objectawait blindPeering.addCore(core, target = core.key, opts)Add a Hypercore to a blind peer.
target is an optional key. It looks for blind peers 'close' (using XOR distance) to that key. It defaults to the key of the hypercore, thereby load balancing among the available blind peers. To use a specific blind peer, set target to its key.
opts include:
announce: whether the hypercore should be announced to the swarm (default false)mirrors: how many blind peers to contact. Defaults to 1.referrer: key of a referrer hypercore to pass to the blind peerpriority: integer indicating the priority to request. See Blind Peer for the possibilitiesblindPeering.addCoreBackground(core, target = core.key, opts)Same as addCore, but is sync (it runs in the background).
await blindPeering.addAutobase(base, target)Add an autobase to a blind peer.
base is an Autobase instance.
target is an optional key. It looks for blind peers 'close' (using XOR distance) to that key. It defaults to the autobase's wakeupCapability.key.
blindPeering.addAutobaseBackground(base, target)Add an autobase to a blind peer (runs in the background).
base is an Autobase instance.
target is an optional key. It looks for blind peers 'close' (using XOR distance) to that key. It defaults to the autobase's wakeupCapability.key.
await blindPeering.suspend()Suspend all activity.
await blindPeering.resume()Resume activity after having been suspended.
await blindPeering.close()Close the blind peering instance.