0.1.6 • Published 6 years ago

gobgp v0.1.6

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

gobgp-node

Code Climate

gobgp library - NodeJS client for gobgpd

This is a young project which allows you to manage gobgpd remotely.

  • Features
    • RIB management which is equivalent to gobgp global rib in gobgp CLI

Requirements

gobgp-node is tested on Debian Linux and OSX.

  • Go
    • Requires an environment variable $GOPATH to be configured
  • grpc
  • gobgp
    • v1.15 or later

Installation

npm install gobgp

This installation process builds the C-shared library from already installed gobgp in your system and links gobgp-node binary with it.

Usage

Originate a route with gobgpd:

var Gobgp = require('gobgp');
var gobgp = new Gobgp('<gobgpd address>:50051');

gobgp.addPath({family: 'ipv4-unicast'}, '10.0.0.0/24');

Withdraw a route from gobgpd:

var Gobgp = require('gobgp');
var gobgp = new Gobgp('<gobgpd address>:50051');

gobgp.deletePath({family: 'ipv4-unicast'}, '10.0.0.0/24');

Show routes in gobgpd:

var Gobgp = require('gobgp');
var gobgp = new Gobgp('<gobgpd address>:50051');

gobgp.getRib({family: 'ipv4-unicast'}).then(function(table) {
  console.log(table);
});

Originate a flowspec route with gobgpd:

var Gobgp = require('gobgp');
var gobgp = new Gobgp('<gobgpd address>:50051');

gobgp.addPath({family: 'ipv4-flowspec'}, 'match source 10.0.0.0/24 then rate-limit 10000');

Show flowspec routes in gobgpd:

var Gobgp = require('gobgp');
var gobgp = new Gobgp('<gobgpd address>:50051');

gobgp.getRib({family: 'ipv4-flowspec'}).then(function(table) {
  console.log(table);
});

Originate a BGP community added route:

var Gobgp = require('gobgp');
var gobgp = new Gobgp('<gobgpd address>:50051');
var path = gobgp.serializePath('ipv4-unicast', '10.0.0.0/24');

path.pattrs.push(new Buffer([
  0xc0,                      // Optional, Transitive
  0x08,                      // Type Code: Communities
  0x04,                      // Length
  0xff, 0xff, 0xff, 0x02]))  // NO_ADVERTISE

gobgp.addPath({family: 'ipv4-unicast'}, path);

Or extremely easy on the latest version of gobgp,

var Gobgp = require('gobgp');
var gobgp = new Gobgp('<gobgpd address>:50051');

gobgp.addPath({family: 'ipv4-unicast'}, '10.0.0.0/24 community no-advertise');

Copyright and License

Copyright (c) 2018 Shintaro Kojima. Code released under the MIT license.

0.1.6

6 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago