1
0
Fork 0
This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Geno e4aba8d37d to npmjs 2015-07-08 07:36:12 +02:00
LICENSE Initial commit 2015-07-08 02:13:47 +02:00
README.md Update README.md 2015-07-08 07:30:51 +02:00
example.js Create example.js 2015-07-08 02:21:44 +02:00
index.js Create index.js 2015-07-08 02:14:53 +02:00
package.json to npmjs 2015-07-08 07:36:12 +02:00

README.md

nodejs-ipv6calc

Install

npm install ipv6calc

Example

var ipv6calc = require('./index');


var mac = "00-11-22-33-44-55";
var ip = "2001:db8::211:22ff:fe33:4455";
console.log(ip);
//2001:db8::211:22ff:fe33:4455

console.log(ipv6calc.toMAC(ip));
/*
00:11:22:33:44:55

Default: ipv6calc.toMAC(ip,':')
*/

console.log(mac);
//00-11-22-33-44-55

console.log(ipv6calc.toIPv6(mac));
/*
::211:22ff:fe33:4455

Default:ipv6calc.toIPv6('2001:bf7:540:0:',mac,64)
*/
console.log(ipv6calc.toIPv6('2001:bf7:540:0:',mac));
/*
2001:bf7:540:0:211:22ff:fe33:4455

Default:ipv6calc.toIPv6('2001:bf7:540:0:',mac,64)
*/
console.log(ipv6calc.fromIPv6(ip));
/*
{ net: '2001:db8::',
  host: '::211:22ff:fe33:4455',
  mac: '00:11:22:33:44:55' }
  
  Default:ipv6calc.fromIPv6(ip,64)
  */