Skip to content

Commit 1c9d30a

Browse files
Update README and vscode configs
1 parent b8b39f4 commit 1c9d30a

File tree

9 files changed

+33
-20
lines changed

9 files changed

+33
-20
lines changed

.devcontainer/devcontainer.json

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
{
2-
"name": "rebory linux devcontainer",
2+
"name": "wg.js devcontainer",
33
"updateRemoteUserUID": false,
44
"containerUser": "develop",
55
"remoteUser": "develop",
6+
"runArgs": [
7+
"--init"
8+
],
9+
"privileged": true,
10+
"customizations": {
11+
"vscode": {
12+
"extensions": [
13+
"github.vscode-github-actions",
14+
"ms-vscode.cpptools",
15+
"eamodio.gitlens",
16+
"euskadi31.json-pretty-printer",
17+
"redhat.vscode-yaml"
18+
]
19+
}
20+
},
621
"build": {
722
"dockerfile": "Dockerfile",
823
"args": {

.npmignore

-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ src/**/*.ts
1616
.github/
1717
.git*
1818

19-
# node-gyp
20-
build/**/*
21-
2219
# Project
2320
.vscode-ctags*
2421
*.addrs.json

.vscode/extensions.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
22
"recommendations": [
3-
"ms-vscode.cpptools"
3+
"github.vscode-github-actions",
4+
"ms-vscode.cpptools",
5+
"eamodio.gitlens",
6+
"euskadi31.json-pretty-printer",
7+
"redhat.vscode-yaml"
48
]
59
}

.vscode/settings.json

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"files.eol": "\n",
33
"files.encoding": "utf8",
4-
"files.defaultLanguage": "javascript",
54
"files.trimFinalNewlines": true,
65
"files.trimTrailingWhitespace": true,
76
"editor.tabSize": 2,
@@ -24,8 +23,6 @@
2423
"PATH": "${workspaceFolder}/node_modules/.bin:${env:PATH}"
2524
},
2625
"files.associations": {
27-
"*.dsc": "ini",
28-
"*.gyp": "python",
2926
"random": "cpp",
3027
"limits": "cpp",
3128
"xstring": "cpp"

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Efficiently manage your Wireguard interface right from nodejs, no `wg` required.
44

55
other tools are wrappers over `wg`, `wireguard-tools.js` is not like that, it is a `C/C++` addon in which you don't need to have `wg` installed, as this module has full compatibility of its own `wg`.
66

7+
## CommonJS droping support
8+
9+
With a small disappointment I come to inform you that CommonJS will be ignored in the next updates and will be completely an ESM module, if you don't want to migrate to ESM I recommend staying on version `1.8.1` or even `1.8.3`, which will be the last versions but recent in CommonJS.
10+
711
## Support to:
812

913
- Userspace [(wireguard-go)](https://git.zx2c4.com/wireguard-go/about/) support.
@@ -12,15 +16,11 @@ other tools are wrappers over `wg`, `wireguard-tools.js` is not like that, it is
1216
- [wg-quick](https://man7.org/linux/man-pages/man8/wg-quick.8.html) file support.
1317
- More info and example check [`wiki`](https://sirherobrine23.org/Wireguard/Wireguard-tools.js/wiki).
1418

15-
> **Note**
19+
> [!NOTE]
1620
>
1721
> we have pre-copiled files for:
18-
> - `Windows`: x64, arm64
19-
> - `MacOS`: x64/intel, arm64/Apple silicon
2022
> - `Linux`: x64/amd64, arm64/aarch64
21-
>
22-
> else arch and system require copiler supported by `node-gyp` installed to compile Node addon.
23+
> - `Windows`: x64, arm64
2324
>
2425
> 1. To manage the Wireguard interfaces in linux, root access is required.
25-
> 1. Windows user are `wireguard-nt` dll files includes in module
26-
> 1. Another system's require `wireguard-go` [(check this page)](https://github.com/WireGuard/wireguard-go)
26+
> 1. Another system's require `wireguard-go` [(check this page)](https://github.com/WireGuard/wireguard-go)

addons/tools/wginterface-win.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <map>
55
#include <iostream>
66
#include <wireguard-nt/include/wireguard.h>
7-
#include <win/shared.cpp>
87
#include <windows.h>
98
#include <tlhelp32.h>
109
#include <accctrl.h>
@@ -25,6 +24,7 @@
2524
#include <cfgmgr32.h>
2625
#include <devguid.h>
2726
#include "wginterface.hh"
27+
#include "win/shared.cpp"
2828
#include <wgkeys.hh>
2929

3030
const DEVPROPKEY devpkey_name = { { 0x65726957, 0x7547, 0x7261, { 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x4b, 0x65, 0x79 } }, DEVPROPID_FIRST_USABLE + 1 };

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wireguard-tools.js",
3-
"version": "1.8.3",
3+
"version": "2.0.0",
44
"description": "Control your wireguard interface from node.js, not a wireguard-tools/wg wrapper!",
55
"private": false,
66
"type": "module",

src/quick.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export function parse(configString: string) {
5353
if (Array.isArray(interfaceConfig.postdown)) config.PostDown = interfaceConfig.postdown;
5454
if (Array.isArray(interfaceConfig.preup)) config.PreUp = interfaceConfig.preup;
5555
if (Array.isArray(interfaceConfig.predown)) config.PreDown = interfaceConfig.predown;
56-
if (Array.isArray(interfaceConfig.address)) config.Address = interfaceConfig.address;
56+
if (Array.isArray(interfaceConfig.address)) config.address = interfaceConfig.address;
5757

5858
config.peers = {};
5959
peers.forEach(({ publickey, presharedkey, endpoint, keepinterval, allowedips }) => {
@@ -76,7 +76,7 @@ export function stringify(wgConfig: QuickConfig): string {
7676
let configStr: string[] = ["[Interface]"];
7777

7878
if (wgConfig.portListen >= 0) configStr.push(format("ListenPort = %s", wgConfig.portListen));
79-
if (wgConfig.Address) configStr.push(format("Address = %s", wgConfig.Address.join(", ")));
79+
if (wgConfig.address) configStr.push(format("Address = %s", wgConfig.address.join(", ")));
8080
if (wgConfig.privateKey) configStr.push(format("PrivateKey = %s", wgConfig.privateKey));
8181
if (wgConfig.publicKey) configStr.push(format("PublicKey = %s", wgConfig.publicKey));
8282
if (wgConfig.Table > 0) configStr.push(format("Table = %s", wgConfig.Table));

src/quick_test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const StaticConfigJson: QuickConfig = {
3232
PreDown: [
3333
"iptables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT"
3434
],
35-
Address: [
35+
address: [
3636
"10.144.0.1/32", "192.160.0.1/32",
3737
"10.80.0.1/32", "10.48.0.1/32",
3838
"10.0.0.1/32", "10.208.0.1/32",

0 commit comments

Comments
 (0)