{"id":19647566,"url":"https://github.com/vaguue/net-runner-engine","last_synced_at":"2025-04-28T15:32:08.116Z","repository":{"id":59777280,"uuid":"529359819","full_name":"vaguue/net-runner-engine","owner":"vaguue","description":"This is the NS3 based module used for the Net-runner website ","archived":false,"fork":false,"pushed_at":"2022-12-10T08:39:30.000Z","size":185,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-15T18:52:17.802Z","etag":null,"topics":["cpp","emulator-frontend","network","network-analysis","network-simulator","networking","node-addon-api","nodejs","nodejs-modules","ns-3","ns3","ns3-simulator"],"latest_commit_sha":null,"homepage":"https://net-runner.xyz","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vaguue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-26T18:06:12.000Z","updated_at":"2025-01-13T09:30:07.000Z","dependencies_parsed_at":"2023-01-26T00:16:46.280Z","dependency_job_id":null,"html_url":"https://github.com/vaguue/net-runner-engine","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaguue%2Fnet-runner-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaguue%2Fnet-runner-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaguue%2Fnet-runner-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaguue%2Fnet-runner-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vaguue","download_url":"https://codeload.github.com/vaguue/net-runner-engine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251338741,"owners_count":21573603,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","emulator-frontend","network","network-analysis","network-simulator","networking","node-addon-api","nodejs","nodejs-modules","ns-3","ns3","ns3-simulator"],"created_at":"2024-11-11T14:44:29.782Z","updated_at":"2025-04-28T15:32:03.076Z","avatar_url":"https://github.com/vaguue.png","language":"C++","readme":"# Net-runner-engine [![GitHub license](https://img.shields.io/github/license/vaguue/net-runner-engine?style=flat)](https://github.com/vaguue/net-runner-engine/blob/main/LICENSE) [![npm](https://img.shields.io/npm/v/net-runner-engine)](https://www.npmjs.com/package/net-runner-engine) [![Downloads](https://img.shields.io/npm/dm/net-runner-engine.svg)](http://npm-stat.com/charts.html?package=net-runner-engine) [![Coverage Status](https://coveralls.io/repos/github/vaguue/net-runner-engine/badge.svg)](https://coveralls.io/github/vaguue/net-runner-engine)\n\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Net-runner\" src=\"https://raw.githubusercontent.com/vaguue/net-runner-engine/main/logo.svg\" height=\"420\" width=\"620\"/\u003e\n\u003c/p\u003e\n\n\n## About\nThis is the [NS-3](https://www.nsnam.org/) based [node-addon-api](https://github.com/nodejs/node-addon-api) module used for the [Net-runner](https://net-runner.xyz) website. \nIt's core functionality is to launch the NS-3 functions according to Javascript object specified as an argument and dump the results. Example config and usage from Node.js can be found at the [examples](https://github.com/vaguue/net-runner-engine/blob/main/test/examples) folder.\n## Goal\nThe 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!\nIf 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.\n## Installation\nThere is a dedicated Docker [image](https://hub.docker.com/r/netrunnerxyz/ns3-node) for installing and using this module. It you want to install this module in your system, just run \n```\nnpm install net-runner-engine\n```\nHowever, not all systems are supported. Current supported systems:\n* Linux x64\n## Standalone usage\nExample usage script:\n```js\nconst Simulator = require('net-runner-engine');\nconst path = require('path');\nconst fs = require('fs');\n\nconst { fromConfig, Network, Hub, Switch, Host, TCPClient, TCPServer, UDPClient, UDPServer } = Simulator;\n\nconst dstDir = path.resolve(__dirname, 'files');\n\nconst net = new Network({ \n  animeLen: 1, // seconds, default is 3\n});\n\nconst host1 = new Host(net, { \n  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)\n});\nconst host2 = new Host(net, { name: 'Bob' });\n\nhost1.setupApplication(new TCPClient({ \n  addr: '192.168.1.3',\n  port: 3000,\n  onTick: ({ time, sendPacket, tick }) =\u003e { // you can implement you custom logic here\n    if (time \u003e 1000) {\n      const buf = Buffer.from('hello');\n      sendPacket(buf); //accepts Buffer only\n    }\n    return '0.01s'; //call onTick after 0.1s\n  },\n}));\n\nhost2.setupApplication(new TCPServer({ \n  port: 3000,\n  onReceive: ({ address, packet, reply }) =\u003e { // custom recieve callback\n    console.log('[*] recieve', address, packet);\n    const buf = Buffer.from('world?');\n    reply(buf);\n  },\n}));\n\n// connecting two hosts\nhost1.connect(host2, { \n  sourceIP: '192.168.1.2', //IP of host1's device, required for Host node\n  targetIP: '192.168.1.3', //IP of host2's device, required for Host node\n  dataRate: '1Mbps', //optional, default is 5Mbps\n  delay: '1ms', //optional, default is 5ms\n});\n\nnet.run(dstDir, { upload: true }).then(url =\u003e console.log('[*] uploaded', url)); //simulate network and upload results to https://net-runner.xyz/\n```\nAfter running this script you'll see appropriate PCAP files for each interface of each network's node in 'files' directory.\n## Documentation\nDocumentation for this module can be found [here](https://www.net-runner.xyz/blog/M2w2RJCxrg)\n## Architecture\nThe structure of internal config is shown below:\n```\n{\n  nodes: [{ id, title, x, y, type, applications }],\n  edges: [{ source, target, type, sourceIP, targetIP }],\n  options: { animeLen: 10, popuplateIP: false }\n}\n```\nA network is represented as a graph that contains information about nodes and connections in a network. The module's work is to:\n1. Convert node-addon-api arguments to C++ STL structures.\n2. Instantiate network nodes.\n3. Set up connections between nodes.\n4. Set up NS-3 helpers.\n5. Run the simulator.\nSteps 2-5 are done using the respective NS-3 functions.\n## TODO's\nSome 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.\n- [x] Host node\n- [x] Switch node\n- [x] Hub node\n- [x] ICMP client\n- [x] TCP client/server\n- [x] UDP client/server\n- [x] PCAP dumps (each interface)\n- [x] ARP table dumps(each host)\n- [x] Connection configuration (channel attributes)\n- [x] Documentation\n- [x] Routing table dumps \n- [ ] Setting up IP/MAC addresses manually\n- [ ] DHCP server functionality\n- [ ] WIFI\n- [ ] TCP configuration (window, different stacks)\n- [ ] IPIP, PPPoE, VPN (GRE)\n## Contacts\nEmail: sabrinarempel7@gmail.com\nFeel free to ask any questions!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaguue%2Fnet-runner-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvaguue%2Fnet-runner-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaguue%2Fnet-runner-engine/lists"}