appium-ios-tuntap 0.1.3 → 0.1.4
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/CHANGELOG.md +6 -0
- package/build/Makefile +2 -2
- package/build/Release/.deps/Release/obj.target/nothing/node_modules/node-addon-api/nothing.o.d +1 -1
- package/build/Release/.deps/Release/obj.target/tuntap/src/tuntap.o.d +21 -21
- package/build/Release/obj.target/tuntap/src/tuntap.o +0 -0
- package/build/Release/tuntap.node +0 -0
- package/build/config.gypi +148 -141
- package/build/node_modules/node-addon-api/nothing.target.mk +14 -14
- package/build/tuntap.target.mk +14 -14
- package/lib/TunTap.js +46 -35
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [0.1.4](https://github.com/appium/appium-ios-tuntap/compare/v0.1.3...v0.1.4) (2026-04-08)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* replace exec with execFile to prevent shell injection ([9614041](https://github.com/appium/appium-ios-tuntap/commit/9614041375fb5f9edfcd14d6cf4c65b002f19e4a))
|
|
6
|
+
|
|
1
7
|
## [0.1.3](https://github.com/appium/appium-ios-tuntap/compare/v0.1.2...v0.1.3) (2026-01-28)
|
|
2
8
|
|
|
3
9
|
### Miscellaneous Chores
|
package/build/Makefile
CHANGED
|
@@ -336,8 +336,8 @@ ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
|
|
|
336
336
|
endif
|
|
337
337
|
|
|
338
338
|
quiet_cmd_regen_makefile = ACTION Regenerating $@
|
|
339
|
-
cmd_regen_makefile = cd $(srcdir); /Users/runner/work/appium-ios-tuntap/appium-ios-tuntap/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/runner/Library/Caches/node-gyp/24.
|
|
340
|
-
Makefile: $(srcdir)/../../../Library/Caches/node-gyp/24.
|
|
339
|
+
cmd_regen_makefile = cd $(srcdir); /Users/runner/work/appium-ios-tuntap/appium-ios-tuntap/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/runner/Library/Caches/node-gyp/24.14.1" "-Dnode_gyp_dir=/Users/runner/work/appium-ios-tuntap/appium-ios-tuntap/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=/Users/runner/Library/Caches/node-gyp/24.14.1/<(target_arch)/node.lib" "-Dmodule_root_dir=/Users/runner/work/appium-ios-tuntap/appium-ios-tuntap" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/Users/runner/work/appium-ios-tuntap/appium-ios-tuntap/build/config.gypi -I/Users/runner/work/appium-ios-tuntap/appium-ios-tuntap/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/common.gypi "--toplevel-dir=." binding.gyp
|
|
340
|
+
Makefile: $(srcdir)/../../../Library/Caches/node-gyp/24.14.1/include/node/common.gypi $(srcdir)/binding.gyp $(srcdir)/build/config.gypi $(srcdir)/node_modules/node-addon-api/node_api.gyp $(srcdir)/node_modules/npm/node_modules/node-gyp/addon.gypi
|
|
341
341
|
$(call do_cmd,regen_makefile)
|
|
342
342
|
|
|
343
343
|
# "all" is a concatenation of the "all" targets from all the included
|
package/build/Release/.deps/Release/obj.target/nothing/node_modules/node-addon-api/nothing.o.d
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
cmd_Release/obj.target/nothing/node_modules/node-addon-api/nothing.o := cc -o Release/obj.target/nothing/node_modules/node-addon-api/nothing.o ../node_modules/node-addon-api/nothing.c '-DNODE_GYP_MODULE_NAME=nothing' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_FILE_OFFSET_BITS=64' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' -I/Users/runner/Library/Caches/node-gyp/24.
|
|
1
|
+
cmd_Release/obj.target/nothing/node_modules/node-addon-api/nothing.o := cc -o Release/obj.target/nothing/node_modules/node-addon-api/nothing.o ../node_modules/node-addon-api/nothing.c '-DNODE_GYP_MODULE_NAME=nothing' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_FILE_OFFSET_BITS=64' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' -I/Users/runner/Library/Caches/node-gyp/24.14.1/include/node -I/Users/runner/Library/Caches/node-gyp/24.14.1/src -I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/openssl/config -I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/openssl/openssl/include -I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/uv/include -I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/zlib -I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/v8/include -O3 -gdwarf-2 -fno-strict-aliasing -mmacosx-version-min=13.5 -arch arm64 -Wall -Wendif-labels -W -Wno-unused-parameter -MMD -MF ./Release/.deps/Release/obj.target/nothing/node_modules/node-addon-api/nothing.o.d.raw -c
|
|
2
2
|
Release/obj.target/nothing/node_modules/node-addon-api/nothing.o: \
|
|
3
3
|
../node_modules/node-addon-api/nothing.c
|
|
4
4
|
../node_modules/node-addon-api/nothing.c:
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
cmd_Release/obj.target/tuntap/src/tuntap.o := c++ -o Release/obj.target/tuntap/src/tuntap.o ../src/tuntap.cc '-DNODE_GYP_MODULE_NAME=tuntap' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_FILE_OFFSET_BITS=64' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNAPI_CPP_EXCEPTIONS' '-DNAPI_VERSION=8' '-DBUILDING_NODE_EXTENSION' -I/Users/runner/Library/Caches/node-gyp/24.
|
|
1
|
+
cmd_Release/obj.target/tuntap/src/tuntap.o := c++ -o Release/obj.target/tuntap/src/tuntap.o ../src/tuntap.cc '-DNODE_GYP_MODULE_NAME=tuntap' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_FILE_OFFSET_BITS=64' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNAPI_CPP_EXCEPTIONS' '-DNAPI_VERSION=8' '-DBUILDING_NODE_EXTENSION' -I/Users/runner/Library/Caches/node-gyp/24.14.1/include/node -I/Users/runner/Library/Caches/node-gyp/24.14.1/src -I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/openssl/config -I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/openssl/openssl/include -I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/uv/include -I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/zlib -I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/v8/include -I/Users/runner/work/appium-ios-tuntap/appium-ios-tuntap/node_modules/node-addon-api -O3 -gdwarf-2 -fno-strict-aliasing -mmacosx-version-min=10.15 -arch arm64 -Wall -Wendif-labels -W -Wno-unused-parameter -Wall -Wextra -Wno-unused-parameter -Wno-vla-extension -Wno-error -std=c++17 -stdlib=libc++ -fno-rtti -O3 -fPIC -MMD -MF ./Release/.deps/Release/obj.target/tuntap/src/tuntap.o.d.raw -c
|
|
2
2
|
Release/obj.target/tuntap/src/tuntap.o: ../src/tuntap.cc \
|
|
3
3
|
/Users/runner/work/appium-ios-tuntap/appium-ios-tuntap/node_modules/node-addon-api/napi.h \
|
|
4
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
5
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
6
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
7
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
4
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/node_api.h \
|
|
5
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/js_native_api.h \
|
|
6
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/js_native_api_types.h \
|
|
7
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/node_api_types.h \
|
|
8
8
|
/Users/runner/work/appium-ios-tuntap/appium-ios-tuntap/node_modules/node-addon-api/napi-inl.h \
|
|
9
9
|
/Users/runner/work/appium-ios-tuntap/appium-ios-tuntap/node_modules/node-addon-api/napi-inl.deprecated.h \
|
|
10
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
11
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
12
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
13
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
14
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
15
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
10
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/uv.h \
|
|
11
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/uv/errno.h \
|
|
12
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/uv/version.h \
|
|
13
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/uv/unix.h \
|
|
14
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/uv/threadpool.h \
|
|
15
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/uv/darwin.h
|
|
16
16
|
../src/tuntap.cc:
|
|
17
17
|
/Users/runner/work/appium-ios-tuntap/appium-ios-tuntap/node_modules/node-addon-api/napi.h:
|
|
18
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
19
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
20
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
21
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
18
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/node_api.h:
|
|
19
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/js_native_api.h:
|
|
20
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/js_native_api_types.h:
|
|
21
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/node_api_types.h:
|
|
22
22
|
/Users/runner/work/appium-ios-tuntap/appium-ios-tuntap/node_modules/node-addon-api/napi-inl.h:
|
|
23
23
|
/Users/runner/work/appium-ios-tuntap/appium-ios-tuntap/node_modules/node-addon-api/napi-inl.deprecated.h:
|
|
24
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
25
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
26
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
27
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
28
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
29
|
-
/Users/runner/Library/Caches/node-gyp/24.
|
|
24
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/uv.h:
|
|
25
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/uv/errno.h:
|
|
26
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/uv/version.h:
|
|
27
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/uv/unix.h:
|
|
28
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/uv/threadpool.h:
|
|
29
|
+
/Users/runner/Library/Caches/node-gyp/24.14.1/include/node/uv/darwin.h:
|
|
Binary file
|
|
Binary file
|
package/build/config.gypi
CHANGED
|
@@ -1,97 +1,46 @@
|
|
|
1
1
|
# Do not edit. File was generated by node-gyp's "configure" step
|
|
2
2
|
{
|
|
3
|
-
"target_defaults": {
|
|
4
|
-
"cflags": [],
|
|
5
|
-
"configurations": {
|
|
6
|
-
"Debug": {
|
|
7
|
-
"v8_enable_v8_checks": 0,
|
|
8
|
-
"variables": {}
|
|
9
|
-
},
|
|
10
|
-
"Release": {
|
|
11
|
-
"v8_enable_v8_checks": 1,
|
|
12
|
-
"variables": {}
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"default_configuration": "Release",
|
|
16
|
-
"defines": [],
|
|
17
|
-
"include_dirs": [],
|
|
18
|
-
"libraries": [],
|
|
19
|
-
"msvs_configuration_platform": "ARM64",
|
|
20
|
-
"xcode_configuration_platform": "arm64"
|
|
21
|
-
},
|
|
22
3
|
"variables": {
|
|
23
|
-
"
|
|
24
|
-
"asan": 0,
|
|
4
|
+
"use_ccache_win": 0,
|
|
25
5
|
"clang": 1,
|
|
6
|
+
"llvm_version": "16.0",
|
|
7
|
+
"xcode_version": "16.0",
|
|
8
|
+
"node_prefix": "/",
|
|
9
|
+
"node_install_npm": "true",
|
|
10
|
+
"node_install_corepack": "true",
|
|
26
11
|
"control_flow_guard": "false",
|
|
27
|
-
"
|
|
28
|
-
"dcheck_always_on": 0,
|
|
29
|
-
"debug_nghttp2": "false",
|
|
12
|
+
"node_use_amaro": "true",
|
|
30
13
|
"debug_node": "false",
|
|
31
|
-
"enable_lto": "false",
|
|
32
|
-
"enable_pgo_generate": "false",
|
|
33
|
-
"enable_pgo_use": "false",
|
|
34
14
|
"error_on_warn": "false",
|
|
35
|
-
"
|
|
15
|
+
"suppress_all_error_on_warn": "false",
|
|
16
|
+
"use_prefix_to_find_headers": "false",
|
|
36
17
|
"host_arch": "arm64",
|
|
37
|
-
"
|
|
38
|
-
"icu_endianness": "l",
|
|
39
|
-
"icu_gyp_path": "tools/icu/icu-generic.gyp",
|
|
40
|
-
"icu_path": "deps/icu-small",
|
|
41
|
-
"icu_small": "false",
|
|
42
|
-
"icu_ver_major": "77",
|
|
43
|
-
"libdir": "lib",
|
|
44
|
-
"llvm_version": "16.0",
|
|
45
|
-
"napi_build_version": "10",
|
|
46
|
-
"node_builtin_shareable_builtins": [
|
|
47
|
-
"deps/cjs-module-lexer/lexer.js",
|
|
48
|
-
"deps/cjs-module-lexer/dist/lexer.js",
|
|
49
|
-
"deps/undici/undici.js",
|
|
50
|
-
"deps/amaro/dist/index.js"
|
|
51
|
-
],
|
|
18
|
+
"target_arch": "arm64",
|
|
52
19
|
"node_byteorder": "little",
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"test/cctest/test_aliased_buffer.cc",
|
|
59
|
-
"test/cctest/test_base64.cc",
|
|
60
|
-
"test/cctest/test_base_object_ptr.cc",
|
|
61
|
-
"test/cctest/test_cppgc.cc",
|
|
62
|
-
"test/cctest/test_crypto_clienthello.cc",
|
|
63
|
-
"test/cctest/test_dataqueue.cc",
|
|
64
|
-
"test/cctest/test_environment.cc",
|
|
65
|
-
"test/cctest/test_inspector_socket.cc",
|
|
66
|
-
"test/cctest/test_inspector_socket_server.cc",
|
|
67
|
-
"test/cctest/test_json_utils.cc",
|
|
68
|
-
"test/cctest/test_linked_binding.cc",
|
|
69
|
-
"test/cctest/test_lru_cache.cc",
|
|
70
|
-
"test/cctest/test_node_api.cc",
|
|
71
|
-
"test/cctest/test_node_crypto.cc",
|
|
72
|
-
"test/cctest/test_node_crypto_env.cc",
|
|
73
|
-
"test/cctest/test_node_postmortem_metadata.cc",
|
|
74
|
-
"test/cctest/test_node_task_runner.cc",
|
|
75
|
-
"test/cctest/test_path.cc",
|
|
76
|
-
"test/cctest/test_per_process.cc",
|
|
77
|
-
"test/cctest/test_platform.cc",
|
|
78
|
-
"test/cctest/test_quic_cid.cc",
|
|
79
|
-
"test/cctest/test_quic_error.cc",
|
|
80
|
-
"test/cctest/test_quic_tokens.cc",
|
|
81
|
-
"test/cctest/test_report.cc",
|
|
82
|
-
"test/cctest/test_sockaddr.cc",
|
|
83
|
-
"test/cctest/test_string_bytes.cc",
|
|
84
|
-
"test/cctest/test_traced_value.cc",
|
|
85
|
-
"test/cctest/test_util.cc",
|
|
86
|
-
"test/cctest/node_test_fixture.h"
|
|
87
|
-
],
|
|
88
|
-
"node_debug_lib": "false",
|
|
89
|
-
"node_enable_d8": "false",
|
|
20
|
+
"want_separate_host_toolset": 0,
|
|
21
|
+
"arm_fpu": "neon",
|
|
22
|
+
"node_use_node_snapshot": "true",
|
|
23
|
+
"node_use_node_code_cache": "true",
|
|
24
|
+
"node_write_snapshot_as_array_literals": "false",
|
|
90
25
|
"node_enable_v8_vtunejit": "false",
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
26
|
+
"enable_pgo_generate": "false",
|
|
27
|
+
"enable_pgo_use": "false",
|
|
28
|
+
"enable_lto": "false",
|
|
29
|
+
"single_executable_application": "true",
|
|
30
|
+
"node_with_ltcg": "false",
|
|
31
|
+
"node_tag": "",
|
|
32
|
+
"node_release_urlbase": "https://nodejs.org/download/release/",
|
|
33
|
+
"node_debug_lib": "false",
|
|
34
|
+
"debug_nghttp2": "false",
|
|
35
|
+
"node_no_browser_globals": "false",
|
|
36
|
+
"node_shared": "false",
|
|
37
|
+
"libdir": "lib",
|
|
38
|
+
"node_module_version": 137,
|
|
39
|
+
"shlib_suffix": "137.dylib",
|
|
40
|
+
"asan": 0,
|
|
41
|
+
"ubsan": 0,
|
|
42
|
+
"coverage": "false",
|
|
43
|
+
"node_target_type": "executable",
|
|
95
44
|
"node_library_files": [
|
|
96
45
|
"lib/_http_agent.js",
|
|
97
46
|
"lib/_http_client.js",
|
|
@@ -198,6 +147,8 @@
|
|
|
198
147
|
"lib/internal/dns/promises.js",
|
|
199
148
|
"lib/internal/dns/utils.js",
|
|
200
149
|
"lib/internal/encoding.js",
|
|
150
|
+
"lib/internal/encoding/single-byte.js",
|
|
151
|
+
"lib/internal/encoding/util.js",
|
|
201
152
|
"lib/internal/error_serdes.js",
|
|
202
153
|
"lib/internal/errors.js",
|
|
203
154
|
"lib/internal/errors/error_source.js",
|
|
@@ -313,6 +264,7 @@
|
|
|
313
264
|
"lib/internal/readline/utils.js",
|
|
314
265
|
"lib/internal/repl.js",
|
|
315
266
|
"lib/internal/repl/await.js",
|
|
267
|
+
"lib/internal/repl/completion.js",
|
|
316
268
|
"lib/internal/repl/history.js",
|
|
317
269
|
"lib/internal/repl/utils.js",
|
|
318
270
|
"lib/internal/socket_list.js",
|
|
@@ -363,7 +315,9 @@
|
|
|
363
315
|
"lib/internal/test_runner/tests_stream.js",
|
|
364
316
|
"lib/internal/test_runner/utils.js",
|
|
365
317
|
"lib/internal/timers.js",
|
|
318
|
+
"lib/internal/tls/common.js",
|
|
366
319
|
"lib/internal/tls/secure-context.js",
|
|
320
|
+
"lib/internal/tls/wrap.js",
|
|
367
321
|
"lib/internal/trace_events_async_hooks.js",
|
|
368
322
|
"lib/internal/tty.js",
|
|
369
323
|
"lib/internal/url.js",
|
|
@@ -441,83 +395,136 @@
|
|
|
441
395
|
"lib/worker_threads.js",
|
|
442
396
|
"lib/zlib.js"
|
|
443
397
|
],
|
|
444
|
-
"
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
398
|
+
"node_cctest_sources": [
|
|
399
|
+
"src/node_snapshot_stub.cc",
|
|
400
|
+
"test/cctest/inspector/test_network_requests_buffer.cc",
|
|
401
|
+
"test/cctest/inspector/test_node_protocol.cc",
|
|
402
|
+
"test/cctest/node_test_fixture.cc",
|
|
403
|
+
"test/cctest/test_aliased_buffer.cc",
|
|
404
|
+
"test/cctest/test_base64.cc",
|
|
405
|
+
"test/cctest/test_base_object_ptr.cc",
|
|
406
|
+
"test/cctest/test_cppgc.cc",
|
|
407
|
+
"test/cctest/test_crypto_clienthello.cc",
|
|
408
|
+
"test/cctest/test_dataqueue.cc",
|
|
409
|
+
"test/cctest/test_environment.cc",
|
|
410
|
+
"test/cctest/test_inspector_socket.cc",
|
|
411
|
+
"test/cctest/test_inspector_socket_server.cc",
|
|
412
|
+
"test/cctest/test_json_utils.cc",
|
|
413
|
+
"test/cctest/test_linked_binding.cc",
|
|
414
|
+
"test/cctest/test_lru_cache.cc",
|
|
415
|
+
"test/cctest/test_node_api.cc",
|
|
416
|
+
"test/cctest/test_node_crypto.cc",
|
|
417
|
+
"test/cctest/test_node_crypto_env.cc",
|
|
418
|
+
"test/cctest/test_node_postmortem_metadata.cc",
|
|
419
|
+
"test/cctest/test_node_task_runner.cc",
|
|
420
|
+
"test/cctest/test_path.cc",
|
|
421
|
+
"test/cctest/test_per_process.cc",
|
|
422
|
+
"test/cctest/test_platform.cc",
|
|
423
|
+
"test/cctest/test_quic_cid.cc",
|
|
424
|
+
"test/cctest/test_quic_error.cc",
|
|
425
|
+
"test/cctest/test_quic_tokens.cc",
|
|
426
|
+
"test/cctest/test_report.cc",
|
|
427
|
+
"test/cctest/test_sockaddr.cc",
|
|
428
|
+
"test/cctest/test_string_bytes.cc",
|
|
429
|
+
"test/cctest/test_traced_value.cc",
|
|
430
|
+
"test/cctest/test_util.cc",
|
|
431
|
+
"test/cctest/node_test_fixture.h"
|
|
432
|
+
],
|
|
433
|
+
"napi_build_version": "10",
|
|
434
|
+
"node_shared_zlib": "false",
|
|
435
|
+
"node_shared_http_parser": "false",
|
|
436
|
+
"node_shared_libuv": "false",
|
|
450
437
|
"node_shared_ada": "false",
|
|
438
|
+
"node_shared_simdjson": "false",
|
|
439
|
+
"node_shared_simdutf": "false",
|
|
451
440
|
"node_shared_brotli": "false",
|
|
452
441
|
"node_shared_cares": "false",
|
|
453
|
-
"
|
|
454
|
-
"
|
|
442
|
+
"node_shared_gtest": "false",
|
|
443
|
+
"node_shared_hdr_histogram": "false",
|
|
444
|
+
"node_shared_merve": "false",
|
|
445
|
+
"node_shared_nbytes": "false",
|
|
455
446
|
"node_shared_nghttp2": "false",
|
|
456
447
|
"node_shared_nghttp3": "false",
|
|
457
448
|
"node_shared_ngtcp2": "false",
|
|
458
|
-
"
|
|
459
|
-
"node_shared_simdjson": "false",
|
|
460
|
-
"node_shared_simdutf": "false",
|
|
449
|
+
"node_use_sqlite": "true",
|
|
461
450
|
"node_shared_sqlite": "false",
|
|
462
451
|
"node_shared_uvwasi": "false",
|
|
463
|
-
"node_shared_zlib": "false",
|
|
464
452
|
"node_shared_zstd": "false",
|
|
465
|
-
"
|
|
466
|
-
"node_target_type": "executable",
|
|
467
|
-
"node_use_amaro": "true",
|
|
468
|
-
"node_use_bundled_v8": "true",
|
|
469
|
-
"node_use_node_code_cache": "true",
|
|
470
|
-
"node_use_node_snapshot": "true",
|
|
471
|
-
"node_use_openssl": "true",
|
|
472
|
-
"node_use_sqlite": "true",
|
|
473
|
-
"node_use_v8_platform": "true",
|
|
474
|
-
"node_with_ltcg": "false",
|
|
475
|
-
"node_without_node_options": "false",
|
|
476
|
-
"node_write_snapshot_as_array_literals": "false",
|
|
477
|
-
"openssl_is_fips": "false",
|
|
478
|
-
"openssl_quic": "false",
|
|
479
|
-
"ossfuzz": "false",
|
|
480
|
-
"shlib_suffix": "137.dylib",
|
|
481
|
-
"single_executable_application": "true",
|
|
482
|
-
"suppress_all_error_on_warn": "false",
|
|
483
|
-
"target_arch": "arm64",
|
|
484
|
-
"ubsan": 0,
|
|
485
|
-
"use_ccache_win": 0,
|
|
486
|
-
"use_prefix_to_find_headers": "false",
|
|
487
|
-
"v8_enable_31bit_smis_on_64bit_arch": 0,
|
|
488
|
-
"v8_enable_extensible_ro_snapshot": 0,
|
|
489
|
-
"v8_enable_external_code_space": 0,
|
|
490
|
-
"v8_enable_gdbjit": 0,
|
|
491
|
-
"v8_enable_hugepage": 0,
|
|
492
|
-
"v8_enable_i18n_support": 1,
|
|
493
|
-
"v8_enable_inspector": 1,
|
|
453
|
+
"v8_enable_webassembly": 1,
|
|
494
454
|
"v8_enable_javascript_promise_hooks": 1,
|
|
495
455
|
"v8_enable_lite_mode": 0,
|
|
496
|
-
"
|
|
456
|
+
"v8_enable_gdbjit": 0,
|
|
457
|
+
"v8_optimized_debug": 1,
|
|
458
|
+
"dcheck_always_on": 0,
|
|
497
459
|
"v8_enable_object_print": 1,
|
|
460
|
+
"v8_random_seed": 0,
|
|
461
|
+
"v8_promise_internal_field_count": 1,
|
|
462
|
+
"v8_use_siphash": 1,
|
|
463
|
+
"v8_enable_maglev": 1,
|
|
498
464
|
"v8_enable_pointer_compression": 0,
|
|
499
|
-
"v8_enable_pointer_compression_shared_cage": 0,
|
|
500
465
|
"v8_enable_sandbox": 0,
|
|
501
|
-
"
|
|
502
|
-
"
|
|
503
|
-
"
|
|
504
|
-
"
|
|
466
|
+
"v8_enable_pointer_compression_shared_cage": 0,
|
|
467
|
+
"v8_enable_external_code_space": 0,
|
|
468
|
+
"v8_enable_31bit_smis_on_64bit_arch": 0,
|
|
469
|
+
"v8_enable_extensible_ro_snapshot": 0,
|
|
505
470
|
"v8_trace_maps": 0,
|
|
506
|
-
"
|
|
507
|
-
"
|
|
508
|
-
"
|
|
509
|
-
"
|
|
471
|
+
"node_use_v8_platform": "true",
|
|
472
|
+
"node_use_bundled_v8": "true",
|
|
473
|
+
"force_dynamic_crt": 0,
|
|
474
|
+
"node_enable_d8": "false",
|
|
475
|
+
"node_enable_v8windbg": "false",
|
|
476
|
+
"v8_enable_hugepage": 0,
|
|
477
|
+
"node_use_openssl": "true",
|
|
478
|
+
"node_shared_openssl": "false",
|
|
479
|
+
"openssl_is_fips": "false",
|
|
480
|
+
"node_quic": "false",
|
|
481
|
+
"node_fipsinstall": "false",
|
|
482
|
+
"node_without_node_options": "false",
|
|
483
|
+
"openssl_quic": "false",
|
|
484
|
+
"icu_small": "false",
|
|
485
|
+
"v8_enable_i18n_support": 1,
|
|
486
|
+
"icu_gyp_path": "tools/icu/icu-generic.gyp",
|
|
487
|
+
"icu_path": "deps/icu-small",
|
|
488
|
+
"icu_ver_major": "78",
|
|
489
|
+
"icu_endianness": "l",
|
|
490
|
+
"icu_data_in": "../../deps/icu-tmp/icudt78l.dat",
|
|
491
|
+
"v8_enable_inspector": 1,
|
|
492
|
+
"node_builtin_shareable_builtins": [
|
|
493
|
+
"deps/undici/undici.js",
|
|
494
|
+
"deps/amaro/dist/index.js"
|
|
495
|
+
],
|
|
496
|
+
"ossfuzz": "false",
|
|
497
|
+
"nodedir": "/Users/runner/Library/Caches/node-gyp/24.14.1",
|
|
510
498
|
"python": "/opt/homebrew/opt/python@3.14/bin/python3.14",
|
|
511
499
|
"standalone_static_library": 1,
|
|
512
|
-
"prefix": "/Users/runner/hostedtoolcache/node/24.
|
|
513
|
-
"user_agent": "npm/11.
|
|
500
|
+
"prefix": "/Users/runner/hostedtoolcache/node/24.14.1/arm64",
|
|
501
|
+
"user_agent": "npm/11.11.0 node/v24.14.1 darwin arm64 workspaces/false ci/github-actions",
|
|
514
502
|
"cache": "/Users/runner/.npm",
|
|
515
503
|
"node_gyp": "/Users/runner/work/appium-ios-tuntap/appium-ios-tuntap/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",
|
|
516
|
-
"npm_version": "11.
|
|
517
|
-
"userconfig": "/private/var/folders/
|
|
504
|
+
"npm_version": "11.11.0",
|
|
505
|
+
"userconfig": "/private/var/folders/tb/y368xp_x10s3ty1b_mtl5mxr0000gn/T/2da411b2b99c0b3a7cfaf49f9d25047d/.npmrc",
|
|
518
506
|
"init_module": "/Users/runner/.npm-init.js",
|
|
519
|
-
"globalconfig": "/Users/runner/hostedtoolcache/node/24.
|
|
507
|
+
"globalconfig": "/Users/runner/hostedtoolcache/node/24.14.1/arm64/etc/npmrc",
|
|
520
508
|
"local_prefix": "/Users/runner/work/appium-ios-tuntap/appium-ios-tuntap",
|
|
521
|
-
"global_prefix": "/Users/runner/hostedtoolcache/node/24.
|
|
509
|
+
"global_prefix": "/Users/runner/hostedtoolcache/node/24.14.1/arm64"
|
|
510
|
+
},
|
|
511
|
+
"target_defaults": {
|
|
512
|
+
"include_dirs": [],
|
|
513
|
+
"libraries": [],
|
|
514
|
+
"defines": [],
|
|
515
|
+
"cflags": [],
|
|
516
|
+
"default_configuration": "Release",
|
|
517
|
+
"configurations": {
|
|
518
|
+
"Release": {
|
|
519
|
+
"variables": {},
|
|
520
|
+
"v8_enable_v8_checks": 1
|
|
521
|
+
},
|
|
522
|
+
"Debug": {
|
|
523
|
+
"variables": {},
|
|
524
|
+
"v8_enable_v8_checks": 0
|
|
525
|
+
}
|
|
526
|
+
},
|
|
527
|
+
"msvs_configuration_platform": "ARM64",
|
|
528
|
+
"xcode_configuration_platform": "arm64"
|
|
522
529
|
}
|
|
523
530
|
}
|
|
@@ -46,13 +46,13 @@ CFLAGS_OBJC_Debug :=
|
|
|
46
46
|
CFLAGS_OBJCC_Debug :=
|
|
47
47
|
|
|
48
48
|
INCS_Debug := \
|
|
49
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
50
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
51
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
52
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
53
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
54
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
55
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
49
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/include/node \
|
|
50
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/src \
|
|
51
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/openssl/config \
|
|
52
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/openssl/openssl/include \
|
|
53
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/uv/include \
|
|
54
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/zlib \
|
|
55
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/v8/include
|
|
56
56
|
|
|
57
57
|
DEFS_Release := \
|
|
58
58
|
'-DNODE_GYP_MODULE_NAME=nothing' \
|
|
@@ -96,13 +96,13 @@ CFLAGS_OBJC_Release :=
|
|
|
96
96
|
CFLAGS_OBJCC_Release :=
|
|
97
97
|
|
|
98
98
|
INCS_Release := \
|
|
99
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
100
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
101
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
102
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
103
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
104
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
105
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
99
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/include/node \
|
|
100
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/src \
|
|
101
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/openssl/config \
|
|
102
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/openssl/openssl/include \
|
|
103
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/uv/include \
|
|
104
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/zlib \
|
|
105
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/v8/include
|
|
106
106
|
|
|
107
107
|
OBJS := \
|
|
108
108
|
$(obj).target/$(TARGET)/node_modules/node-addon-api/nothing.o
|
package/build/tuntap.target.mk
CHANGED
|
@@ -55,13 +55,13 @@ CFLAGS_OBJC_Debug :=
|
|
|
55
55
|
CFLAGS_OBJCC_Debug :=
|
|
56
56
|
|
|
57
57
|
INCS_Debug := \
|
|
58
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
59
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
60
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
61
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
62
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
63
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
64
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
58
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/include/node \
|
|
59
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/src \
|
|
60
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/openssl/config \
|
|
61
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/openssl/openssl/include \
|
|
62
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/uv/include \
|
|
63
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/zlib \
|
|
64
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/v8/include \
|
|
65
65
|
-I/Users/runner/work/appium-ios-tuntap/appium-ios-tuntap/node_modules/node-addon-api
|
|
66
66
|
|
|
67
67
|
DEFS_Release := \
|
|
@@ -115,13 +115,13 @@ CFLAGS_OBJC_Release :=
|
|
|
115
115
|
CFLAGS_OBJCC_Release :=
|
|
116
116
|
|
|
117
117
|
INCS_Release := \
|
|
118
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
119
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
120
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
121
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
122
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
123
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
124
|
-
-I/Users/runner/Library/Caches/node-gyp/24.
|
|
118
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/include/node \
|
|
119
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/src \
|
|
120
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/openssl/config \
|
|
121
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/openssl/openssl/include \
|
|
122
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/uv/include \
|
|
123
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/zlib \
|
|
124
|
+
-I/Users/runner/Library/Caches/node-gyp/24.14.1/deps/v8/include \
|
|
125
125
|
-I/Users/runner/work/appium-ios-tuntap/appium-ios-tuntap/node_modules/node-addon-api
|
|
126
126
|
|
|
127
127
|
OBJS := \
|
package/lib/TunTap.js
CHANGED
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
import {
|
|
2
|
+
import { execFile } from 'node:child_process';
|
|
3
|
+
import { isIPv6 } from 'node:net';
|
|
3
4
|
import { promisify } from 'node:util';
|
|
4
5
|
import { log } from './logger.js';
|
|
5
6
|
const require = createRequire(import.meta.url);
|
|
6
7
|
const nativeTuntap = require('../build/Release/tuntap.node');
|
|
7
|
-
const
|
|
8
|
+
const execFileAsync = promisify(execFile);
|
|
9
|
+
/**
|
|
10
|
+
* Validates that a string is a safe IPv6 route destination (address or prefix).
|
|
11
|
+
* Rejects shell metacharacters to prevent injection even though execFile is safe.
|
|
12
|
+
*/
|
|
13
|
+
function isValidIPv6Route(destination) {
|
|
14
|
+
if (!destination || typeof destination !== 'string') {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const parts = destination.split('/');
|
|
18
|
+
if (parts.length > 2) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
const [addr, prefixLen] = parts;
|
|
22
|
+
if (!isIPv6(addr)) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
if (prefixLen !== undefined) {
|
|
26
|
+
const len = Number(prefixLen);
|
|
27
|
+
if (!Number.isInteger(len) || len < 0 || len > 128) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
8
33
|
// Custom error types
|
|
9
34
|
export class TunTapError extends Error {
|
|
10
35
|
code;
|
|
@@ -157,9 +182,7 @@ export class TunTap {
|
|
|
157
182
|
if (this.isClosed) {
|
|
158
183
|
throw new TunTapError('Device has been closed');
|
|
159
184
|
}
|
|
160
|
-
|
|
161
|
-
const ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
|
|
162
|
-
if (!ipv6Regex.test(address)) {
|
|
185
|
+
if (!isIPv6(address)) {
|
|
163
186
|
throw new TypeError('Invalid IPv6 address format');
|
|
164
187
|
}
|
|
165
188
|
// Validate MTU
|
|
@@ -169,29 +192,25 @@ export class TunTap {
|
|
|
169
192
|
const platform = process.platform;
|
|
170
193
|
try {
|
|
171
194
|
if (platform === 'darwin') {
|
|
172
|
-
|
|
173
|
-
await
|
|
174
|
-
await execPromise(`sudo ifconfig ${this.name} mtu ${mtu}`);
|
|
195
|
+
await execFileAsync('sudo', ['ifconfig', this.name, 'inet6', address, 'prefixlen', '64', 'up']);
|
|
196
|
+
await execFileAsync('sudo', ['ifconfig', this.name, 'mtu', String(mtu)]);
|
|
175
197
|
}
|
|
176
198
|
else if (platform === 'linux') {
|
|
177
|
-
// Linux configuration
|
|
178
199
|
try {
|
|
179
|
-
|
|
180
|
-
await execPromise('which ip');
|
|
200
|
+
await execFileAsync('which', ['ip']);
|
|
181
201
|
}
|
|
182
202
|
catch {
|
|
183
203
|
throw new TunTapError('The "ip" command is not available. Please install the iproute2 package (e.g., sudo apt install iproute2)');
|
|
184
204
|
}
|
|
185
205
|
try {
|
|
186
|
-
await
|
|
187
|
-
await
|
|
206
|
+
await execFileAsync('sudo', ['ip', '-6', 'addr', 'add', `${address}/64`, 'dev', this.name]);
|
|
207
|
+
await execFileAsync('sudo', ['ip', 'link', 'set', 'dev', this.name, 'up', 'mtu', String(mtu)]);
|
|
188
208
|
}
|
|
189
209
|
catch (err) {
|
|
190
210
|
if (err.message.includes('Permission denied')) {
|
|
191
211
|
throw new TunTapPermissionError(`Permission denied when configuring network interface. Make sure you have sudo privileges or run the application with sudo.`);
|
|
192
212
|
}
|
|
193
213
|
else if (err.message.includes('File exists')) {
|
|
194
|
-
// Address already configured, which might be okay
|
|
195
214
|
log.warn(`Address ${address} may already be configured on ${this.name}`);
|
|
196
215
|
}
|
|
197
216
|
else {
|
|
@@ -217,27 +236,23 @@ export class TunTap {
|
|
|
217
236
|
if (this.isClosed) {
|
|
218
237
|
throw new TunTapError('Device has been closed');
|
|
219
238
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
throw new TypeError('Destination must be a non-empty string');
|
|
239
|
+
if (!isValidIPv6Route(destination)) {
|
|
240
|
+
throw new TypeError('Destination must be a valid IPv6 address or prefix (e.g. fd00::1/64)');
|
|
223
241
|
}
|
|
224
242
|
const platform = process.platform;
|
|
225
243
|
try {
|
|
226
244
|
if (platform === 'darwin') {
|
|
227
|
-
|
|
228
|
-
await execPromise(`sudo route -n add -inet6 ${destination} -interface ${this.name}`);
|
|
245
|
+
await execFileAsync('sudo', ['route', '-n', 'add', '-inet6', destination, '-interface', this.name]);
|
|
229
246
|
}
|
|
230
247
|
else if (platform === 'linux') {
|
|
231
|
-
// Linux route
|
|
232
248
|
try {
|
|
233
|
-
await
|
|
249
|
+
await execFileAsync('sudo', ['ip', '-6', 'route', 'add', destination, 'dev', this.name]);
|
|
234
250
|
}
|
|
235
251
|
catch (err) {
|
|
236
252
|
if (err.message.includes('Permission denied')) {
|
|
237
253
|
throw new TunTapPermissionError(`Permission denied when adding route. Make sure you have sudo privileges or run the application with sudo.`);
|
|
238
254
|
}
|
|
239
255
|
else if (err.message.includes('File exists')) {
|
|
240
|
-
// Route already exists, which is fine
|
|
241
256
|
log.info(`Route to ${destination} already exists`);
|
|
242
257
|
}
|
|
243
258
|
else {
|
|
@@ -250,7 +265,6 @@ export class TunTap {
|
|
|
250
265
|
}
|
|
251
266
|
}
|
|
252
267
|
catch (err) {
|
|
253
|
-
// Only throw if it's not the "route already exists" case we handled above
|
|
254
268
|
if (err instanceof TunTapError) {
|
|
255
269
|
throw err;
|
|
256
270
|
}
|
|
@@ -263,22 +277,22 @@ export class TunTap {
|
|
|
263
277
|
if (!this.isOpen) {
|
|
264
278
|
throw new TunTapError('Device not open');
|
|
265
279
|
}
|
|
280
|
+
if (!isValidIPv6Route(destination)) {
|
|
281
|
+
throw new TypeError('Destination must be a valid IPv6 address or prefix (e.g. fd00::1/64)');
|
|
282
|
+
}
|
|
266
283
|
const platform = process.platform;
|
|
267
284
|
try {
|
|
268
285
|
if (platform === 'darwin') {
|
|
269
|
-
|
|
270
|
-
await execPromise(`sudo route -n delete -inet6 ${destination}`);
|
|
286
|
+
await execFileAsync('sudo', ['route', '-n', 'delete', '-inet6', destination]);
|
|
271
287
|
}
|
|
272
288
|
else if (platform === 'linux') {
|
|
273
|
-
|
|
274
|
-
await execPromise(`sudo ip -6 route del ${destination} dev ${this.name}`);
|
|
289
|
+
await execFileAsync('sudo', ['ip', '-6', 'route', 'del', destination, 'dev', this.name]);
|
|
275
290
|
}
|
|
276
291
|
else {
|
|
277
292
|
throw new TunTapError(`Unsupported platform: ${platform}`);
|
|
278
293
|
}
|
|
279
294
|
}
|
|
280
295
|
catch (err) {
|
|
281
|
-
// Ignore errors if route doesn't exist
|
|
282
296
|
if (!err.message.includes('not in table') && !err.message.includes('No such process')) {
|
|
283
297
|
throw new TunTapError(`Failed to remove route: ${err.message}`);
|
|
284
298
|
}
|
|
@@ -294,8 +308,7 @@ export class TunTap {
|
|
|
294
308
|
const platform = process.platform;
|
|
295
309
|
try {
|
|
296
310
|
if (platform === 'darwin') {
|
|
297
|
-
const { stdout } = await
|
|
298
|
-
// Parse macOS netstat output
|
|
311
|
+
const { stdout } = await execFileAsync('netstat', ['-I', this.name, '-b']);
|
|
299
312
|
const lines = stdout.trim().split('\n');
|
|
300
313
|
if (lines.length < 2) {
|
|
301
314
|
throw new Error('Unexpected netstat output');
|
|
@@ -307,14 +320,12 @@ export class TunTap {
|
|
|
307
320
|
rxBytes: parseInt(stats[6], 10) || 0,
|
|
308
321
|
txPackets: parseInt(stats[7], 10) || 0,
|
|
309
322
|
txErrors: parseInt(stats[8], 10) || 0,
|
|
310
|
-
txBytes: parseInt(stats[9], 10) || 0
|
|
323
|
+
txBytes: parseInt(stats[9], 10) || 0,
|
|
311
324
|
};
|
|
312
325
|
}
|
|
313
326
|
else if (platform === 'linux') {
|
|
314
|
-
const { stdout } = await
|
|
315
|
-
// Parse Linux ip command output
|
|
327
|
+
const { stdout } = await execFileAsync('ip', ['-s', 'link', 'show', this.name]);
|
|
316
328
|
const lines = stdout.trim().split('\n');
|
|
317
|
-
// Find RX and TX statistics
|
|
318
329
|
let rxIndex = -1;
|
|
319
330
|
let txIndex = -1;
|
|
320
331
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -336,7 +347,7 @@ export class TunTap {
|
|
|
336
347
|
rxErrors: parseInt(rxStats[2], 10) || 0,
|
|
337
348
|
txBytes: parseInt(txStats[0], 10) || 0,
|
|
338
349
|
txPackets: parseInt(txStats[1], 10) || 0,
|
|
339
|
-
txErrors: parseInt(txStats[2], 10) || 0
|
|
350
|
+
txErrors: parseInt(txStats[2], 10) || 0,
|
|
340
351
|
};
|
|
341
352
|
}
|
|
342
353
|
else {
|