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

net-runner-engine

v2.0.5

Published

Node.js ns3 wrapper

Downloads

3

Readme

Net-runner-engine GitHub license npm Downloads Coverage Status

About

This is the NS-3 based node-addon-api module used for the Net-runner website. It's core functionality is to launch the NS-3 functions according to JSON config specified as an argument and dump the results. Example config and usage from Node.js can be found at examples folder.

Goal

The goal of this project is to provide the web-based platform who those who are learning the inner workings of computer networks. Although the project is up and running, this project is very young and has many work to do. So I decided to do this with the NS-3 community all together! If you are an NS-3 expert, or Node.js enthusiast, or just want to commit to this project, feel free to contact me (see contacts below) and ask any questions.

Installation

There is dedicated Docker image for installing and using this module. It you want to install this module in your system, just run

npm install net-runner-engine

However, not all systems are supported. Current supported systems:

  • Linux x64

Standalone usage

Example usage script:

const Simulator = require('net-runner-engine');
const path = require('path');
const fs = require('fs');

const { fromConfig, Network, Hub, Switch, Host, TCPClient, TCPServer, UDPClient, UDPServer } = Simulator;

const dstDir = path.resolve(__dirname, 'files');

const net = new Network({ 
  animeLen: 5, // seconds, default is 3
});

const host1 = new Host(net, { 
  name: 'Alice', // this name will be used in resulting PCAP files, optional (some numbers will be used if not specified, e.g. 0-1-hub-csma-0.pcap)
});
const host2 = new Host(net, { name: 'Bob' });

host1.setupApplication(new TCPClient({ 
  addr: '192.168.1.3',
  port: 3000,
  onTick: ({ time, sendPacket, tick }) => { // you can implement you custom logic here
    if (time > 1000) {
      const buf = Buffer.from("hello");
      sendPacket(buf); //accepts Buffer only
    }
    return '0.1s'; //call onTick after 0.1s
  },
}));

host2.setupApplication(new TCPServer({ 
  port: 3000,
  onReceive: ({ address, packet, reply }) => { // custom recieve callback
    console.log('[*] recieve', address, packet);
    const buf = Buffer.from("world?");
    reply(buf);
  },
}));

// connecting two hosts
host1.connect(host2, { 
  sourceIP: '192.168.1.2', //IP of host1's device, required for Host node
  targetIP: '192.168.1.3', //IP of host2's device, required for Host node
  dataRate: '1Mbps', //optional, default is 5Mbps
  delay: '1ms', //optional, default is 5ms
});

net.run(dstDir, { upload: true }).then(url => console.log('[*] uploaded', url)); //simulate network and upload results to https://net-runner.xyz/

After running this script you'll see appropriate PCAP files for each interface of each network's node in 'files' directory.

Documentation

Documentation for this module can be found here

Architecture

The structure of internal config is shown below:

{
  nodes: [{ id, title, x, y, type, applications }],
  edges: [{ source, target, type, sourceIP, targetIP }],
  options: { animeLen: 10, popuplateIP: false }
}

A network is represented as a graph that contains information about nodes and connections in a network. The module's work is to:

  1. Convert node-addon-api arguments to C++ STL structures.
  2. Instantiate network nodes.
  3. Set up connections between nodes.
  4. Set up NS-3 helpers.
  5. Run the simulator. Steps 2-5 are done using the respective NS-3 functions.

TODO's

Some tasks are marked done, which means you can use appropriate functionality on the website, though non of them are finished completely, every task is in active state.

  • [x] Host node
  • [x] Switch node
  • [x] Hub node
  • [x] ICMP client
  • [x] TCP client/server
  • [x] UDP client/server
  • [x] PCAP dumps (each interface)
  • [x] ARP table dumps(each host)
  • [x] Connection configuration (channel attributes)
  • [x] Documentation
  • [x] Routing table dumps
  • [ ] Setting up IP/MAC addresses manually
  • [ ] DHCP server functionality
  • [ ] WIFI
  • [ ] TCP configuration (window, different stacks)
  • [ ] IPIP, PPPoE, VPN (GRE)

Contacts

Email: [email protected] Feel free to ask any questions!