Skip to content

mastinno/networkThrottler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NetworkThrottler

##Network Throttler

NetworkThrottler NodeJS application implements network traffic shaper/throttler functionality that allows to test applications' behavior in various network conditions.

NetworkThrottler provides web UI frontend to manage network conditions (also contains list of pre-configured network conditions profiles).

NetworkThrottler uses tc/netem on Linux and ipfw on MacOS.

##Contents Sources contents:

  • ./conf - folder contains configuration file
  • ./scripts - folder contains bash scripts to configure app as service (networkThrottler) and config for logrotate (forever)
  • ./throttler - core implementation for network shaper/throttler
  • ./web - frontend core implementation
  • ./app.js - main app

##Raspberry Pi

To run throttler on Raspberry Pi you need to have following:

  • Raspberry Pi board with installed OS. Application functionality were tested on Rasbian but should work out of the box on the most of Linux distributions.
  • WiFi adapter attached to board. As of now application supports traffic throttling only on WiFi adapter that will be changed soon to allow throttling on any network interface.
  • Connect to Raspberry Pi:
    • via ssh (if you know its IP).
    • via serial cable. You may need to check this to find out correct wire colors in serial cable. Its possible that you need to use this command: screen /dev/cu.usbserial 115200)
  • Configured WiFi access point. Follow guide here or here. NOTE: new version of hostapd can be found here. You may experience the issue with update-rc.d to solve it follow this suggestion. Also, to solve issue with WiFi authentication (device can't be authenticated with RPI WiFi access point and following log message ...IEEE 803.11: deauthenticated due to local deauth request will be found in /var/log/messages) you need to install haveged.

##Pre-installed software requirements

  • The latest stable version of NodeJS. Follow guide here or here.

  • Installed NodeJs forever and nodemon modules in case you want to have auto-update and running application continuously. To install do:

      $ sudo npm install forever -g
      $ sudo npm install nodemon -g
    

##Running

Install Node.js packages required by application - go inside the source's root directory and run:

$ node install 

To start Network Throtler just go inside the source's root directory and run:

$ node app.js

To configure Network Throttler as service/daemon use ./scripts/networkThrottler example script. For Debian (or Linux that supports init.d) put it inside init.d directory and run there:

$ sudo update-rc.d networkThrottler defaults 

To start throttler service application run:

$ /etc/init.d/networkThrottler start

To stop throttler service application run:

$ /etc/init.d/networkThrottler stop

##Logging

Network Throttler will log everything to ./logs/node.log file.

To rotate log files logrotate were used and configured with ./scripts/forever example config file (need to be placed in /etc/logrotate.d/). Install logrotate in case your OS doesn't have it.

##LICENSE

Copyright 2015 Twilio.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Releases

No releases published

Packages

No packages published