Socket
Book a DemoInstallSign in
Socket

brctl-wrapper

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

brctl-wrapper

NodeJS wrapper for brctl command (virtual bridges on linux)

1.0.8
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

brctl-wrapper

Simple wrapper for brctl of Linux (virtual bridges).

Installation

This module is installed via npm:

npm install --save brctl-wrapper

Usage

Create bridge: Step by step

import brtcl from 'brtcl-wrapper';

brctl.createBridge('myBridge')
  .then(() => {
    Promise.all(['eth0', 'eth1'].map(i => brctl.addIfaceToBridge(i, 'miBridge')))
      .then(() => {
        brctl.enableBridge('miBridge')
          .then(() => {
            // ----- Bridge is up!
          })
          .catch(err => console.error('Impossible to enable bridge: ', err));
      })
      .catch(err => console.error('Error adding ifaces to bridge: ', err));
  })
  .catch(err => console.error('Error creating bridge: ', err));

Create bridge: Complete setup

import brtcl from 'brtcl-wrapper';

const bridgeOptions = {
  ifaces: ['eth0', 'eth1'],
  enable: true
};
brctl.createBridge('myBridge', bridgeOptions)
  .then(() => {
    // ----- Bridge is up!
  })
  .catch(err => console.error('Error creating bridge: ', err));

Set a custom ip to the bridge

import brtcl from 'brtcl-wrapper';

const bridgeOptions = {
  ifaces: ['eth0', 'eth1'],
  enable: true,
  ip: '10.255.1.22/24'
};
brctl.createBridge('myBridge', bridgeOptions)
  .then(() => {
    // ----- Bridge is up and with ip 10.255.1.22/24!
  })
  .catch(err => console.error('Error creating bridge: ', err));

Delete bridge

import brtcl from 'brtcl-wrapper';

brctl.deleteBridge('myBridge')
  .then(() => {
    // ----- Bridge is disabled and destroyed!
  })
  .catch(err => console.error('Error destroying bridge: ', err));

Enable debug of module

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

DEBUG=brctl-wrapper

Run tests

npm test

License (MIT)

In case you never heard about the MIT license.

See the LICENSE file for details.

FAQs

Package last updated on 22 May 2018

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.