Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sirherobrine23/wireguard-tools.js
Maneger Wireguard interface directly from node (and create you APIs)
https://github.com/sirherobrine23/wireguard-tools.js
linux networking vpn wireguard wireguard-admin wireguard-configuration wireguard-vpn-setup
Last synced: 16 days ago
JSON representation
Maneger Wireguard interface directly from node (and create you APIs)
- Host: GitHub
- URL: https://github.com/sirherobrine23/wireguard-tools.js
- Owner: Sirherobrine23
- License: gpl-3.0
- Created: 2022-07-09T08:47:29.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-11T23:35:50.000Z (4 months ago)
- Last Synced: 2024-10-29T08:27:45.255Z (16 days ago)
- Topics: linux, networking, vpn, wireguard, wireguard-admin, wireguard-configuration, wireguard-vpn-setup
- Language: C++
- Homepage: https://sirherobrine23.com.br/Wireguard/wireguard-tools.js
- Size: 1.3 MB
- Stars: 11
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Wireguard-tools for Nodejs
Manage your Wireguard interfaces directly from Node.js without any wrappers over `wg` or `wg-quick`
> [!WARNING]
> Require cmake and tools (GCC/GCC++, clang or Visual Studio) to build this addon
>
> New versions does't include prebuilt binaries```js
import { setConfig, getConfig, key, Config } from "../index.js"const tunName = process.platform === "darwin" ? "utun10" : "wg3" // Tunnel name, in MacOS/Darwin require start with utun prefix
let currentConfig: Config
try {
currentConfig = await getConfig(tunName) // Check if exists tun
} catch {
// Create new wireguard tun
currentConfig = {
name: tunName,
privateKey: await key.privateKey(),
portListen: 5820,
address: [
"10.66.66.1/24"
],
peers: {}
}
}// Add new Peer
const peerPrivate = await key.privateKey()
currentConfig.peers[key.publicKey(peerPrivate)] = {
presharedKey: await key.presharedKey(),
allowedIPs: [
"10.66.66.2/24"
]
}// Deploy new Config
await setConfig(currentConfig)
```## Licences
- `Wireguard-tools.js`: GPL-3.0
### Wireguard
- `Embeddable-wg-library`: LGPL-2.1+.
- `Wireguard-nt`: GPL-2.0
- `Wireguard-go`: MIT