From: Paul J R Date: Mon, 10 Feb 2014 00:07:53 +0000 (+1100) Subject: bgp daemon in nodejs X-Git-Url: http://git.pjr.cc/?p=random_node_code.git;a=commitdiff_plain;h=1ea948ff48a7a490c199e4402a7050acd892b1ad;hp=008863e49aed995e8b05ef846350b9dcf3187dd1 bgp daemon in nodejs --- diff --git a/README.md b/README.md index d322b37..f9160d1 100644 --- a/README.md +++ b/README.md @@ -23,4 +23,5 @@ The nodejs template currently doesnt work as it stands but in the long term what 3) setup the base structure for the container 4) install the node binary 5) setup the init nodejs script -6) ... magic! \ No newline at end of file +6) ... magic! + diff --git a/bgpfake/bf.js b/bgpfake/bf.js new file mode 100644 index 0000000..f90a42f --- /dev/null +++ b/bgpfake/bf.js @@ -0,0 +1,270 @@ +var myas=1234; +var myip="10.99.99.1"; + +var net = require('net'); + +var scon; + + +function createentry(i) { + // split into octets + var a = 16; + var b = 0; + + // c is easy... + var c = (i%255)+1; + //console.log("i is now: "+i); + + // if we're above 256.... + if(i>255) { + i = i >> 8; + //console.log("i is now: "+i); + b = i%255; + } + + // if we're still above 256.... + if(i>255) { + i = i >> 8; + //console.log("i is now: "+i); + a+=((i<<8)%255); + } + return a+"."+b+"."+c; +} + +function createaspath(i) { + var n=(i%5)+2; + var as = 1024; + var ret = new Array(); + + for(var t=0; t