🚀 Launch Week Day 5:Introducing Immutable Scans.Learn More →
Socket
Book a DemoInstallSign in
Socket

hypercore-protocol-proxy

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hypercore-protocol-proxy

A module that allows you to proxy a single hypercore replication stream to multiple peers

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

hypercore-protocol-proxy

A module that allows you to proxy a single hypercore replication stream to multiple peers.

npm install hypercore-protocol-proxy

Useful if you want to implement a hypercore proxy gateway that replicates with many peers behind the scene, for privacy or connectivity reasons.

Usage

const createProxyStream = require('hypercore-protocol-proxy')
const net = require('net')
const pump = require('pump')

net.createServer(function (socket) {
  const { stream, proxy } = createProxyStream(aFeedKey)

  pump(socket, stream, socket)

  // find some peers something
  findSomePeers(aFeedKey, function (stream) {
    proxy(stream) // proxy to this peer, can be called multiple times
  })
}).listen(3282)

API

{ stream, proxy } = createProxyStream(feedKey, [options])

Create a proxy stream and forwarded. All options are forwarded to hypercore's replication method.

Call proxy(stream) with a stream to another peer to start proxying to them. It is safe to call this as many times as you want.

License

MIT

FAQs

Package last updated on 05 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts