Skip to content

Commit

Permalink
Update README and vscode configs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirherobrine23 committed Feb 20, 2024
1 parent b8b39f4 commit 1c9d30a
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 20 deletions.
17 changes: 16 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
{
"name": "rebory linux devcontainer",
"name": "wg.js devcontainer",
"updateRemoteUserUID": false,
"containerUser": "develop",
"remoteUser": "develop",
"runArgs": [
"--init"
],
"privileged": true,
"customizations": {
"vscode": {
"extensions": [
"github.vscode-github-actions",
"ms-vscode.cpptools",
"eamodio.gitlens",
"euskadi31.json-pretty-printer",
"redhat.vscode-yaml"
]
}
},
"build": {
"dockerfile": "Dockerfile",
"args": {
Expand Down
3 changes: 0 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ src/**/*.ts
.github/
.git*

# node-gyp
build/**/*

# Project
.vscode-ctags*
*.addrs.json
6 changes: 5 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"recommendations": [
"ms-vscode.cpptools"
"github.vscode-github-actions",
"ms-vscode.cpptools",
"eamodio.gitlens",
"euskadi31.json-pretty-printer",
"redhat.vscode-yaml"
]
}
3 changes: 0 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"files.eol": "\n",
"files.encoding": "utf8",
"files.defaultLanguage": "javascript",
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"editor.tabSize": 2,
Expand All @@ -24,8 +23,6 @@
"PATH": "${workspaceFolder}/node_modules/.bin:${env:PATH}"
},
"files.associations": {
"*.dsc": "ini",
"*.gyp": "python",
"random": "cpp",
"limits": "cpp",
"xstring": "cpp"
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Efficiently manage your Wireguard interface right from nodejs, no `wg` required.

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`.

## CommonJS droping support

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.

## Support to:

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

> **Note**
> [!NOTE]
>
> we have pre-copiled files for:
> - `Windows`: x64, arm64
> - `MacOS`: x64/intel, arm64/Apple silicon
> - `Linux`: x64/amd64, arm64/aarch64
>
> else arch and system require copiler supported by `node-gyp` installed to compile Node addon.
> - `Windows`: x64, arm64
>
> 1. To manage the Wireguard interfaces in linux, root access is required.
> 1. Windows user are `wireguard-nt` dll files includes in module
> 1. Another system's require `wireguard-go` [(check this page)](https://github.com/WireGuard/wireguard-go)
> 1. Another system's require `wireguard-go` [(check this page)](https://github.com/WireGuard/wireguard-go)
2 changes: 1 addition & 1 deletion addons/tools/wginterface-win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <map>
#include <iostream>
#include <wireguard-nt/include/wireguard.h>
#include <win/shared.cpp>
#include <windows.h>
#include <tlhelp32.h>
#include <accctrl.h>
Expand All @@ -25,6 +24,7 @@
#include <cfgmgr32.h>
#include <devguid.h>
#include "wginterface.hh"
#include "win/shared.cpp"
#include <wgkeys.hh>

const DEVPROPKEY devpkey_name = { { 0x65726957, 0x7547, 0x7261, { 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x4b, 0x65, 0x79 } }, DEVPROPID_FIRST_USABLE + 1 };
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wireguard-tools.js",
"version": "1.8.3",
"version": "2.0.0",
"description": "Control your wireguard interface from node.js, not a wireguard-tools/wg wrapper!",
"private": false,
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions src/quick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function parse(configString: string) {
if (Array.isArray(interfaceConfig.postdown)) config.PostDown = interfaceConfig.postdown;
if (Array.isArray(interfaceConfig.preup)) config.PreUp = interfaceConfig.preup;
if (Array.isArray(interfaceConfig.predown)) config.PreDown = interfaceConfig.predown;
if (Array.isArray(interfaceConfig.address)) config.Address = interfaceConfig.address;
if (Array.isArray(interfaceConfig.address)) config.address = interfaceConfig.address;

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

if (wgConfig.portListen >= 0) configStr.push(format("ListenPort = %s", wgConfig.portListen));
if (wgConfig.Address) configStr.push(format("Address = %s", wgConfig.Address.join(", ")));
if (wgConfig.address) configStr.push(format("Address = %s", wgConfig.address.join(", ")));
if (wgConfig.privateKey) configStr.push(format("PrivateKey = %s", wgConfig.privateKey));
if (wgConfig.publicKey) configStr.push(format("PublicKey = %s", wgConfig.publicKey));
if (wgConfig.Table > 0) configStr.push(format("Table = %s", wgConfig.Table));
Expand Down
2 changes: 1 addition & 1 deletion src/quick_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const StaticConfigJson: QuickConfig = {
PreDown: [
"iptables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT"
],
Address: [
address: [
"10.144.0.1/32", "192.160.0.1/32",
"10.80.0.1/32", "10.48.0.1/32",
"10.0.0.1/32", "10.208.0.1/32",
Expand Down

0 comments on commit 1c9d30a

Please sign in to comment.