0.0.2 • Published 1 year ago

@homelabsio/wgctrl v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

wgctrl-js

npm Version Node.js GitHub License CI Status

Wireguard control API for Node.js

Install

npm install @homelabsio/wgctrl

Runtime Requirements

@homelabsio/wgctrl performs various network configuration tasks which require that the node process either:

Usage

Modify existing Wireguard device

import { Peer, Device, getDevices, getDevice, setDevice } from '@homelabsio/wgctrl';

// Get array of current WireGuard devices
let devs: string[] = getDevices();
console.log (devs); // [ 'wg0', 'wg1', 'wg2' ]

const wg0: Device = getDevice('');
let newPeer: Peer = new Peer('BCBqOfgqPK2RQO+z1QPYHvlxcOG41m2385dvjJcj5mE=');
newPeer.endpoint = "203.0.113.0:51820";
newPeer.presharedKey = "QJa8/fxAxEZtbaWrQ1UOrkGc2Gzx+O/DbhYzYcICPew=";
newPeer.persistentKeepaliveInterval = 25;
newPeer.addAllowedIP("198.19.254.250/32");
newPeer.addAllowedIP("198.19.254.252");
wg.addPeer(newPeer);

setDevice(wg0);

Testing

npm run format
npm run lint
npm run test

See Also

  • TODO

Legal

@homelabsio/wgctrl is licensed under the terms of the MIT License. See the license file for details.

0.0.2

1 year ago

0.0.1

1 year ago

0.0.0

1 year ago