Comparing version 1.0.6 to 1.0.8
@@ -23,3 +23,3 @@ #!/usr/bin/env node | ||
_commander2.default.version('1.0.0').arguments('<operation> <iface>').action(function (inOperation, inIface) { | ||
_commander2.default.version('1.0.8').arguments('<operation> <iface>').action(function (inOperation, inIface) { | ||
operation = inOperation; | ||
@@ -34,5 +34,5 @@ if (['del', 'get', 'set', 'add'].indexOf(operation) < 0) { | ||
} | ||
}).usage('<operation> <iface> [options]').option('-d --direction [direction]', 'Rule traffic direction. Allowed outgoing or incoming.', 'outgoing', /(outgoing|incoming)/).option('-n --network [network]', 'Network including mask', '0.0.0.0/0', /(\d{1,3}\.){3}\d{1,3}\/\d{1,2}/).option('--srcPort [port]', 'Destination port.').option('--dstPort [port]', 'Source port.').option('-p --protocol [protocol]', 'Protocol of rules. Only supported IPv4 right now.', 'ip', /ip/).option('--delay [time]', 'Delay including unit. Ex: 10ms').option('--jitter [time]', 'Delay variation including unit. Ex: 10ms').option('--loss [percentage]', 'Packet loss including unit. Ex: 5%').option('--corrupt [percentage]', 'Packet corruption including unit. Ex: 1%').option('--rate [bandwidth]', 'Bandwith limit including unit. Ex: 10Mbit').parse(process.argv); | ||
}).usage('<operation> <iface> [options]').option('-d --direction [direction]', 'Rule traffic direction. Allowed outgoing or incoming.', 'outgoing', /(outgoing|incoming)/).option('--srcNetwork [srcNetwork]', 'Network source mask', '0.0.0.0/0', /(\d{1,3}\.){3}\d{1,3}\/\d{1,2}/).option('--dstNetwork [dstNetwork]', 'Network destination mask', '0.0.0.0/0', /(\d{1,3}\.){3}\d{1,3}\/\d{1,2}/).option('--srcPort [port]', 'Destination port.').option('--dstPort [port]', 'Source port.').option('-p --protocol [protocol]', 'Protocol of rules. Only supported IPv4 right now.', 'ip', /ip/).option('--delay [time]', 'Delay including unit. Ex: 10ms').option('--jitter [time]', 'Delay variation including unit. Ex: 10ms').option('--loss [percentage]', 'Packet loss including unit. Ex: 5%').option('--corrupt [percentage]', 'Packet corruption including unit. Ex: 1%').option('--rate [bandwidth]', 'Bandwith limit including unit. Ex: 10Mbit').parse(process.argv); | ||
var rule = ['network=' + _commander2.default.network]; | ||
var rule = ['srcNetwork=' + _commander2.default.srcNetwork, 'dstNetwork=' + _commander2.default.dstNetwork]; | ||
if (_commander2.default.srcPort) { | ||
@@ -39,0 +39,0 @@ rule.push('srcPort=' + _commander2.default.srcPort); |
{ | ||
"name": "tccli", | ||
"version": "1.0.6", | ||
"version": "1.0.8", | ||
"author": "J. Victor Soto", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -13,2 +13,6 @@ # tc-wrapper-cli | ||
## Changelog | ||
* 1.0.8: Removed network parameter and included srcNetwork & dstNetwork paramenters | ||
## Usage | ||
@@ -25,3 +29,4 @@ | ||
-d --direction [direction] Rule traffic direction. Allowed outgoing or incoming. | ||
-n --network [network] Network including mask | ||
--srcNetwork [network] Network source mask | ||
--dstNetwork [network] Network destination mask | ||
--srcPort [port] Destination port. | ||
@@ -71,3 +76,3 @@ --dstPort [port] Source port. | ||
"outgoing": { | ||
"network=0.0.0.0/0,protocol=ip": { | ||
"dstNetwork=0.0.0.0/0,protocol=ip": { | ||
"delay": "1.0ms", | ||
@@ -81,6 +86,6 @@ "jitter": "0.5%", | ||
"incoming": { | ||
"network=192.168.1.1/32,protocol=ip": { | ||
"srcNetwork=192.168.1.1/32,protocol=ip": { | ||
"loss": "9%", | ||
}, | ||
"network=10.10.10.0/28,srcPort=80,protocol=ip": { | ||
"srcNetwork=192.168.1.1/32,dstNetwork=10.10.10.0/28,srcPort=80,protocol=ip": { | ||
"rate": "100Mbit", | ||
@@ -127,7 +132,7 @@ } | ||
``` sh | ||
tccli add eth0 --network 192.168.1.1/32 --corrupt 2% | ||
tccli add eth0 --dstNetwork 192.168.1.1/32 --corrupt 2% | ||
``` | ||
``` sh | ||
tccli add eth0 --network 10.10.10.0/28 --srcPort 80 --corrupt 2% --direction incoming | ||
tccli add eth0 --dstNetwork 10.10.10.0/28 --srcPort 80 --corrupt 2% --direction incoming | ||
``` | ||
@@ -142,7 +147,7 @@ | ||
"outgoing": { | ||
"network=0.0.0.0/0,protocol=ip": { | ||
"dstNetwork=0.0.0.0/0,protocol=ip": { | ||
"loss": "20%", | ||
"rate": "100Mbit" | ||
}, | ||
"network=192.168.1.1/32,protocol=ip": { | ||
"dstNetwork=192.168.1.1/32,protocol=ip": { | ||
"corrupt": "2%", | ||
@@ -153,3 +158,3 @@ "rate": "32Gbit" | ||
"incoming": { | ||
"network=10.10.10.0/28,srcPort=80,dstPort=80,protocol=ip": { | ||
"dstNetwork=10.10.10.0/28,srcPort=80,dstPort=80,protocol=ip": { | ||
"corrupt": "2%", | ||
@@ -156,0 +161,0 @@ "rate": "32Gbit" |
11287
80
184