@sourceregistry/node-wireguard 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +105 -0
- package/bin/x86_64-linux-gnu/node-wireguard.node +0 -0
- package/binding.gyp +53 -0
- package/lib/binding.d.ts +5 -0
- package/lib/binding.js +45 -0
- package/lib/index.d.ts +56 -0
- package/lib/index.js +115 -0
- package/lib/types/AllowedIP.d.ts +5 -0
- package/lib/types/AllowedIP.js +2 -0
- package/lib/types/Config.d.ts +17 -0
- package/lib/types/Config.js +2 -0
- package/lib/types/Device.d.ts +23 -0
- package/lib/types/Device.js +2 -0
- package/lib/types/Key.d.ts +5 -0
- package/lib/types/Key.js +2 -0
- package/lib/types/Peer.d.ts +22 -0
- package/lib/types/Peer.js +2 -0
- package/lib/types/PeerConfig.d.ts +24 -0
- package/lib/types/PeerConfig.js +2 -0
- package/lib/types/index.d.ts +6 -0
- package/lib/types/index.js +22 -0
- package/package.json +80 -0
- package/src/WireGuardClient.cpp +490 -0
- package/src/WireGuardClient.h +32 -0
- package/src/WireGuardTypes.h +68 -0
- package/src/crypto/Key.cpp +77 -0
- package/src/crypto/Key.h +30 -0
- package/src/helpers/Array.h +26 -0
- package/src/helpers/AsyncPromise.h +91 -0
- package/src/helpers/IfName.cpp +27 -0
- package/src/helpers/IfName.h +17 -0
- package/src/netlink/NlAttr.cpp +398 -0
- package/src/netlink/NlAttr.h +40 -0
- package/src/netlink/NlSocket.cpp +143 -0
- package/src/netlink/NlSocket.h +44 -0
- package/src/netlink/RtLink.cpp +217 -0
- package/src/netlink/RtLink.h +34 -0
- package/src/netlink/wireguard_uapi.h +68 -0
- package/src/node-wireguard.cpp +48 -0
- package/src/uapi/UapiCodec.cpp +185 -0
- package/src/uapi/UapiCodec.h +22 -0
- package/src/uapi/UapiSocket.cpp +116 -0
- package/src/uapi/UapiSocket.h +27 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <string>
|
|
4
|
+
#include <vector>
|
|
5
|
+
|
|
6
|
+
namespace uapi {
|
|
7
|
+
|
|
8
|
+
// Default search path for a userspace WireGuard implementation's (e.g.
|
|
9
|
+
// wireguard-go) control socket. wgctrl-go's wguser backend also checks
|
|
10
|
+
// $XDG_RUNTIME_DIR/wireguard first; not implemented here (v1 is Linux-only
|
|
11
|
+
// and most wireguard-go deployments use the /var/run path).
|
|
12
|
+
extern const char *const kSocketDir;
|
|
13
|
+
|
|
14
|
+
// True if a UAPI control socket exists for `name` - used to decide whether
|
|
15
|
+
// to dispatch a given interface to the kernel-netlink or UAPI backend.
|
|
16
|
+
bool HasSocket(const std::string &name);
|
|
17
|
+
|
|
18
|
+
// Lists interface names that have a UAPI control socket present.
|
|
19
|
+
std::vector<std::string> ListInterfaceNames();
|
|
20
|
+
|
|
21
|
+
// Connects to the UAPI socket for `name`, writes `request` in full, then reads
|
|
22
|
+
// the full response (the server closes the connection after one request/response
|
|
23
|
+
// - see wireguard-go's ipc_linux.go). Throws helpers::SystemError on any failure,
|
|
24
|
+
// with ENOENT if the socket doesn't exist.
|
|
25
|
+
std::string Transact(const std::string &name, const std::string &request);
|
|
26
|
+
|
|
27
|
+
} // namespace uapi
|