UNPKG

ndn-js-contrib

Version:

Reusable 'Classes' for Named Data Networking: NameTree, PIT, FIB, ContentStore, Interfaces, and Transports

59 lines (44 loc) 3.28 kB
NDN-Contrib - Expanded Class Library on top of NDN-js ================= [NDN-js](https://github.com/named-data/ndn-js) offers the common client Named Data Networking library in pure javascript. This is an expansion upon that work, offering a modular set of javascript 'classes' for building NDN enabled apps in Node.js, the browser, and even exciting runtimes like breach and atom-shell. * DataStructures * [NameTree](http://rynomad.github.io/ndn-js-contrib/doc/NameTree.html) - NDN nametree with lookups. * [ContentStore](http://rynomad.github.io/ndn-js-contrib/doc/ContentStore.html) ContentStore accepting cache or repository entries (ephemeral and persistent) * [csEntry](http://rynomad.github.io/ndn-js-contrib/doc/csEntry.html) - in-Memory packet cache * [Repository](http://rynomad.github.io/ndn-js-contrib/doc/Repository.html) - persistent packet storage (based on levelUp, so suitable for browser and node.js) * [PIT](http://rynomad.github.io/ndn-js-contrib/doc/PIT.html) - Pending Interest Table with modular entry options (callbacks or integer IDs) * [FIB](http://rynomad.github.io/ndn-js-contrib/doc/FIB.html) - Forwarding Interest Base * [Interfaces](http://rynomad.github.io/ndn-js-contrib/doc/Interfaces.html) - Interface manager accepting any combination of transports * Transports - * Node * [TCP Server](http://rynomad.github.io/ndn-js-contrib/doc/TCPServerTransport.html) * [WebSocket Server](http://rynomad.github.io/ndn-js-contrib/doc/WebSocketServerTransport.html) * Browser * [HTML5 MessageChannel](http://rynomad.github.io/ndn-js-contrib/doc/MessageChannelTransport.html) * [WebRTC DataChannel](http://rynomad.github.io/ndn-js-contrib/doc/DataChannelTransport.html) * Other * Telehash, atom-shell IPC, and more coming soon... Usage ----- simply require("ndn-js-contrib") in your project (use browserify for browser projects) var ndn = require("ndn-js-contrib"); all the classes are now attached to the ndn object (including ndn-js @ ndn.ndn), and are ready to go... var myInterfaces = new ndn.Interfaces(/*Subject*/) ndn.WebSocketServer.defineListener(); myInterface.installProtocol(ndn.WebSocketServer); now you have a websocket server accepting incoming connections and handing interest and data packets to your subject! For more, detail see the full [documentation](http://rynomad.github.io/ndn-js-contrib/doc/index.html). You can also include just part of the library by doing something like var ndn = require("ndn-js"); var Interfaces = require("ndn-contrib/src/DataStructures/Interfaces.js"); Interfaces.installNDN(ndn); /** This is done for you if you require("ndn-contrib"), * it's a safety measure to avoid 'instanceof' bugs. */ Contributing ----------- Bug reports and pull requests welcome! lint, doc, and test are all registered tasks in Gruntfile.js, and will run automatically for you when you use grunt watch. Browser tests are also assembled via grunt in the test/browser directory, and have a livereload script that will re-compile and run them when watch is running. Happy hacking! License ------- LGPL (vTBD) Contact ------- Ryan Bennett, Colorado State University. nomad.ry@gmail.com