Comparing version 0.4.0 to 0.5.0
@@ -20,3 +20,2 @@ #!/usr/bin/env node | ||
console.log(' --remove Remove tc current rules'); | ||
console.log(' --sudo Use sudo for commands'); | ||
} else { | ||
@@ -23,0 +22,0 @@ if (!hasbin.all.sync(['tc'])) { |
@@ -15,24 +15,24 @@ 'use strict'; | ||
const setupScripts = [ | ||
'sudo tc qdisc add dev %s handle 1: root htb', | ||
'sudo tc filter add dev %s protocol ip prio 1 u32 match ip dport 80 0xffff flowid 1:11', | ||
]; | ||
const rateScripts = [ | ||
'sudo tc class add dev %s parent 1: classid 1:11 htb rate %s', | ||
]; | ||
const delayLossScripts = [ | ||
'sudo tc qdisc add dev %s parent 1:11 handle 10: netem delay %s loss %s', | ||
]; | ||
const deleteScripts = [ | ||
'sudo tc qdisc del dev %s root', | ||
]; | ||
module.exports = { | ||
sltc: config => { | ||
const options = merge({}, defaultConfig, config); | ||
const sudo = options.sudo ? 'sudo ' : ''; | ||
const setupScripts = [ | ||
sudo + 'tc qdisc add dev %s handle 1: root htb', | ||
sudo + 'tc filter add dev %s protocol ip prio 1 u32 match ip dport 80 0xffff flowid 1:11', | ||
]; | ||
const rateScripts = [ | ||
sudo + 'tc class add dev %s parent 1: classid 1:11 htb rate %s', | ||
]; | ||
const delayLossScripts = [ | ||
sudo + 'tc qdisc add dev %s parent 1:11 handle 10: netem delay %s loss %s', | ||
]; | ||
const deleteScripts = [ | ||
sudo + 'tc qdisc del dev %s root', | ||
]; | ||
if (options.remove) { | ||
@@ -39,0 +39,0 @@ deleteScripts.forEach((script) => { |
{ | ||
"description": "Simple Linux Traffic Control", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"bin": "./bin/sltc.js", | ||
@@ -5,0 +5,0 @@ "main": "./lib/sltc.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3954
70