simple-hyperproxy
v0.0.7
Published
P2P proxy built on top of [Hyperswarm DHT.](https://github.com/hyperswarm/dht)
Downloads
5
Readme
Simple-Hyperproxy
P2P proxy built on top of Hyperswarm DHT.
npm install -g simple-hyperproxy
Requires Node version >= v14.17.0
Usage
simple-hyperproxy expose [port]
# Exposed port on key [key]
simple-hyperproxy bind key
# Binded key on port [port]
Example
const axios = require('axios');
const SimpleHyperProxy = require('simple-hyperproxy')
const proxy = new SimpleHyperProxy()
const server = http.createServer((req, res) => {
// Define server
})
server.listen(8081, '127.0.0.1', () => {
})
const key = await proxy.expose(8081)
const bindPort = await proxy.bind(key)
console.log(await axios.get('http://localhost:' + bindPort))