Class: Linky

Linky

new Linky()

Link Layer proxy with APIs to enable loss
Parameters:
Name Type Description
opts.host string hostname of the machine to proxy from, defaults to localhost
opts.to string port of the running Server, defaults to 9995
opts.from string port that the client will connect to, defaults to 9998
Source:
Example
var networkLink = new Linky({from: '9995', to: '9998'});

Methods

createLinkLayer()

Initialize the link layer by spawning the link task and listening for any command requests.
Source:
Example
networkLink.createLinkLayer();

destroyLinkLayer()

Destroy the link layer process
Source:
Example
networkLink.destroyLinkLayer();

lossyLinkLayer(loss)

Set a loss to the link, the loss value will determine how many packets will be dropped
Parameters:
Name Type Description
loss int Integer value from 0 to 100 that informs the link of how much loss to set
Source:
Example
networkLink.lossyLinkLayer();

resetLinkLayer()

Resets the link, all packets will be allowed to flow through
Source:
Example
networkLink.resetLinkLayer();

sendCommand(cmd)

Helper function that sends a command to a running
Parameters:
Name Type Description
cmd object Command attributes to pass to the Link process
Source:
Example
networkLink.sendCommand({
  op: 'shimmy',
  amount: 1234
});

stallLinkLayer()

Stalls the link, all packets will be dropped
Source:
Example
networkLink.stallLinkLayer();