npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mplane

v0.7.9

Published

mPlane nodeJS implementation

Downloads

14

Readme

mPlane

#mPlane nodeJS reference library

This is the mPlane nodejs library. The architecture and software structure is freely inspired by mPlane reference implementation written in python by Brian Trammell [email protected].

#Installation

npm install mplane

#Usage example In this example we set a capability for a probe.

var mplane = require('mplane');

var MY_IP="192.168.0.1";

// Initialize available primitives from a registry
// Can be any valid URL or local file
mplane.Element.initialize_registry("ict-mplane.eu/registry/demo");

// Create a new Capability object
var probeCapability = new mplane.Capability();
// Set time constraints
probeCapability.set_when("now ... future / 1s");

// Add parameters with constraints
probeCapability.add_parameter({
    type:"destination.ip4",
    constraints: "192.168.0.0/16"
}).add_parameter({
        type:"source.ip4",
        constraints:MY_IP
});

// Results
probeCapability.add_result_column("delay.twoway");

// Some metadata
probeCapability.set_metadata_value("System_type","Just a TEST")
    .set_metadata_value("System_version","0.1a")
    .set_metadata_value("System_ID","Pinger").update_token();
// A label to identify the capability
probeCapability.set_label("This_is_a_pinger");

#Interaction with the RI The mPlane Reference Implementation, written in python, can be find here. In order to correctly interact with any component using the RI messages formats, two method have been exposed in the library, to decode messages generated by the RI and to send messages to a RI component.

##from_dict This is a global method exposed in the mplane library. It sould be used to import any raw message received from an mPlane RI component. It will generate an mplane object of the type contained in the message. In the following example the data received as a body of an HTTP communication is imported in an mPlane object.

var result = mplane.from_dict(body);

to_dict

This method, defined for any mPlane information element, should be used before sending data to a RI component. The following example, shows how the pinger capability defined in the above probe example be transformed in a standard mPlane message.

/* serialize the capability in an mPlane RI message*/
var RIprobeCapability = probeCapability.to_dict();

/* Shows the serialized capability*/
console.log(RIprobeCapability);

This is the output of the above example

{
    "capability": "measure",
    "label": "This_is_a_pinger",
    "metadata": {
        "System_type": "Just a TEST",
        "System_version": "0.1a",
        "System_ID": "Pinger"
    },
    "link": "",
    "token": "ead75d3d198ce8f45ae371246da15fd89d05de24",
    "when": "now ... future / 1s",
    "resultvalues": [],
    "results": [
        "delay.twoway"
    ],
    "parameters": {
        "destination.ip4": "192.168.0.0/16",
        "source.ip4": "192.168.0.1"
    }
}

#Transport

The base mPlane library implements the mPlane Information Model elements that can be used to build messages to be carried on top of any protocol of choice (SSH, HTTP,...). A nodejs HTTPS API has been implemented for basic usage (create and read elements) and can be find here.

#EXAMPLES

Supervisor

A complete supervisor implementation written in javascript is available here.

Reasoner

A reasoner written for DEMO purpouses is available here

Probe

A probe implementing ping, traceroute and HTTP download delay is available here

#Documentation Please refer to the API reference mPlane nodejs API

#Release Notes

You can find release notes here

#LICENSE This software is released under the BSD license.