Skip to content

devsnek/wgctrl-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wgctrl-js

$ npm i wgctrl
import { getDevices, getDevice, setDevice } from 'wgctrl';

// Get the current WireGuard device names.
console.log(getDevices()); // [ 'device 1', 'device 2' ]

// Get the configuration of a specific device.
const d = getDevice('device 1');


// Add a peer and set the configuration:
d.peers.push({
  publicKey: 'abc',
  presharedKey: 'def',
  endpoint: '192.51.100.127:1234',
  presistentKeepaliveInterval: 25,
  allowedIPs: [
    '10.137.137.0/24',
  ],
});

// Set the configuration of a specific device.
setDevice(d);

About

Wireguard Control API for Node.js

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published