nns
v1.1.1
Published
Linux network namespaces with node.
Downloads
223
Maintainers
Readme
nns
Creates network namespaces with a fully working internet connection.
Usage
Simply create a network namespace, don't care about settings
let nns = require('nns'); // 1. require
nns() // 2. invoke
.then(() => {
// 3. ???
})
.then(() => {
console.log('Profit!'); // 4.
})
Create a network namespace with specific config.
let nns = require('nns'); // 1. require
nns({ // 2. invoke
name: 'asd12',
vethDefault: 'veth_asd12',
vethNNS: 'veth0',
netmask: 30,
network: '169.254.1.252',
ipDefault: '169.254.1.253',
ipNNS: '169.254.1.254',
broadcast: '169.254.1.255'
})
.then(() => {
// 3. ???
})
.then(() => {
console.log('Profit!'); // 4.
})
Create a network namespace using custom defaults
let nns = require('nns'); // 1. require
nns({ // 2. invoke
prefix: 'custom',
ipStart: '169.254.123.0',
ipMask: 30
})
.then(() => {
// 3. ???
})
.then(() => {
console.log('Profit!'); // 4.
})
Tests
npm test