Giter VIP home page Giter VIP logo

dreamtime's Introduction

Peer-to-peer networking for shell scripts & OS pipes.

npm install chr15m/dreamtime

Screencast of dreamtime connecting to two servers and local

Run

./node_modules/.bin/dreamtime unique-room-identifier

Example: aggregate the output from ping from different servers:

ping -n wikipedia.org | stdbuf -oL cut -b15- | dreamtime ping-party

Screencast of dreamtime aggregating script output

For more options & help run dreamtime with no arguments.

Node module

You can require dreamtime as a node module:

// connect to a room with a callback for received messages
room = require('dreamtime')("my-room-id", console.log);

// our unique fingerprint
console.log(c.client.fingerprint);

// wait 5 seconds & send a message to the room
// and then disconnect
setTimeout(function() {
  room.send("my first test message");
  room.disconnect();
}, 5000);

You can also re-use an existing webtorrent client:

var dreamtime = require("dreamtime");
room = dreamtime("my-room-id", {"torrent_client": wt}, console.log);

Implementation

Dreamtime is built on top of WebTorrent and uses the Bittorrent extension protocol for messaging.

Discovery is achieved by seeding a torrent with the following info field.

Contents are bencoded and SHA1'ed to make the infoHash as is standard.

{"length": 1,
 "name: YOUR-ROOM-NAME,
 "piece length": 16384,
 "pieces": 0x5b a9 3c 9d b0 cf f9 3f 52 b5 21 d7 42 0e 43 f6 ed a2 78 4f }

The content of the torrent is a single character \0 and so the pieces field contains sha1("\0").

Security note

Channels are completely public. Anybody can join or eavesdrop. Don't share secrets over them.

dreamtime's People

Contributors

chr15m avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

vdt pablo-merino

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.