Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tccli

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tccli

NodeJS cli for tc-wrapper (a library for traffic control on linux)

  • 1.0.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

tc-wrapper-cli

Simple command line interpreter (cli) for tc-wrapper library.

Installation

This module is installed via npm:

npm install -g tccli

Usage

The cli has three major commands del, get and set, for deleting, fetching and setting tc rules.

There is also an add command to make easier add more rules to existing ones, this command will running get, del and set under the hood as tc-wrapper lib dont support add.

Allowed targeting

Currently tc-wrapper only supports ip traffic, and can match by network, src and dst ports.

Allowed modificators

  • rate: Bandwith limitation, htb algorith will be used, tbf is not supported (yet).
  • delay: Round trip time of packets, will be added as additional time.
  • jitter: Delay variation normal-distributed.
  • loss: Packet loss, in percentage.
  • corrupt: Packet corruption, in percentage.

Clean all rules for eth0

tccli del eth0

Get all rules for eth0

tccli get eth0

Output will be a JSON output similar to this:

{
  "outgoing": {
    "network=0.0.0.0/0,protocol=ip": {
      "delay": "1.0ms",
      "jitter": "0.5%",
      "loss": "3%",
      "corrupt": "2%",
      "rate": "10Mbit"
    }
  },
  "incoming": {
    "network=192.168.1.1/32,protocol=ip": {
      "loss": "9%",
     },
     "network=10.10.10.0/28,srcPort=80,protocol=ip": {
       "rate": "100Mbit",
     }
  }
}

Increase packet time by 20 ms

tccli set eth0 --delay 20ms

By default all rules will be aplied to outgoing packets, so last command is the same as:

tccli set eth0 --delay 20ms --direction outgoing

Limit incoming bandwith of eth0 to 20 Mbit

tccli set eth0 --rate 20Mbit --direction incoming

Limit output bandwith of eth0 to 100 Mbit and loss 20% of packets

tccli set eth0 --rate 100Mbit --loss 20%

set operation will overwrite any rule of eth0, if you want to keep other rules you have to use add command.

Apply several rules with add

tccli set eth0 --rate 100Mbit --loss 20%
tccli add eth0 --network 192.168.1.1/32 --corrupt 2%
tccli add eth0 --network 10.10.10.0/28 --srcPort 80 --corrupt 2% --direction incoming

Enable debug of module

This module uses debug for debugging, you can enable debug messages of all modules with:

DEBUG=tc-wrapper-cli*

Keep in mind that tc-wrapper library also uses debug module, so you can enable both cli and lib debug messages using:

DEBUG=tc-wrapper*

Run tests

npm test

License (MIT)

In case you never heard about the MIT license.

See the LICENSE file for details.

Keywords

FAQs

Package last updated on 05 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc