appium-ios-tuntap 0.0.1

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 ADDED
@@ -0,0 +1,83 @@
1
+ ## 1.0.0 (2025-07-22)
2
+
3
+ ### Features
4
+
5
+ * add packet streaming api instead of eventEmitter ([8c4df4b](https://github.com/appium/appium-ios-tuntap/commit/8c4df4bace59c2b29a567e2f9c81b1737500c42b))
6
+
7
+ ### Bug Fixes
8
+
9
+ * add proper headers for linux ([967ea00](https://github.com/appium/appium-ios-tuntap/commit/967ea007b198f77f7e3aaaa1489dc5a0977bc5e6))
10
+ * add test to ci ([8753e01](https://github.com/appium/appium-ios-tuntap/commit/8753e0109f0ad4120ac4db1318c103fc2be0f7c7))
11
+
12
+ ### Miscellaneous Chores
13
+
14
+ * add semantics release ([#7](https://github.com/appium/appium-ios-tuntap/issues/7)) ([a52b2e6](https://github.com/appium/appium-ios-tuntap/commit/a52b2e6010e99f1e5518726a93b313efab6475fb))
15
+ * **release:** bump version to 0.0.2 ([ed690cf](https://github.com/appium/appium-ios-tuntap/commit/ed690cfcc56c22a33cfc303960b46091619fe7e1))
16
+ * **release:** initial release of tuntap-bridge npm package v0.0.1 ([0b68aea](https://github.com/appium/appium-ios-tuntap/commit/0b68aeaae2af9d0a7af386055f3667b6826c6d22))
17
+ * turn release ([#8](https://github.com/appium/appium-ios-tuntap/issues/8)) ([3efc5a4](https://github.com/appium/appium-ios-tuntap/commit/3efc5a4eb7cb4e4f59daffb2623ead811292fa69))
18
+
19
+ # Changelog
20
+
21
+ All notable changes to this project will be documented in this file.
22
+
23
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
24
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
25
+
26
+ ## [0.0.3] - 2025-01-07
27
+
28
+ ### Added
29
+ - Signal handling for graceful shutdown (SIGINT/SIGTERM)
30
+ - Thread safety with mutex protection in C++ code
31
+ - Custom error types for better error handling:
32
+ - `TunTapError` - Base error class
33
+ - `TunTapPermissionError` - Permission-related errors
34
+ - `TunTapDeviceError` - Device availability errors
35
+ - Input validation for all methods:
36
+ - IPv6 address format validation
37
+ - MTU range checking (1280-65535)
38
+ - Buffer size validation
39
+ - Type checking for all parameters
40
+ - New methods:
41
+ - `removeRoute()` - Remove routes from the interface
42
+ - `getStats()` - Get network interface statistics
43
+ - Resource cleanup handlers for automatic cleanup on process exit
44
+ - Timeout handling for network operations
45
+ - Memory leak prevention with RAII pattern
46
+ - Debug logging support with `--debug` flag
47
+ - Comprehensive test suite
48
+
49
+ ### Changed
50
+ - Updated to C++17 standard for better performance and modern features
51
+ - Improved error messages with more context and suggestions
52
+ - Enhanced buffer management to reduce memory allocations
53
+ - Better handling of concurrent operations
54
+ - Optimized compilation with `-O3` flag
55
+ - Improved TypeScript type definitions
56
+
57
+ ### Fixed
58
+ - File descriptor leaks on error conditions
59
+ - Resource cleanup on unexpected process termination
60
+ - Race conditions in multi-threaded environments
61
+ - Memory leaks in error paths
62
+ - Proper cleanup of network interfaces on shutdown
63
+ - Better error handling for permission issues
64
+
65
+ ### Security
66
+ - Added proper bounds checking for all buffer operations
67
+ - Validated all user inputs to prevent invalid operations
68
+ - Thread-safe operations to prevent race conditions
69
+
70
+ ## [0.0.2] - Previous Release
71
+
72
+ ### Added
73
+ - Basic TUN/TAP device support for macOS and Linux
74
+ - TypeScript support
75
+ - Basic read/write operations
76
+ - IPv6 configuration support
77
+
78
+ ## [0.0.1] - Initial Release
79
+
80
+ ### Added
81
+ - Initial implementation of TUN/TAP bridge
82
+ - Support for creating virtual network interfaces
83
+ - Basic documentation
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright JS Foundation and other contributors, https://js.foundation
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,256 @@
1
+ # TunTap Bridge
2
+
3
+ A native TUN/TAP interface module for Node.js that works on both macOS and Linux, with enhanced error handling, signal management, and thread safety.
4
+
5
+ ## Description
6
+
7
+ This module provides a Node.js interface to TUN/TAP virtual network devices, allowing you to create and manage network tunnels from JavaScript/TypeScript. It's useful for VPNs, network tunneling, and other network-related applications.
8
+
9
+ ## Features
10
+
11
+ - **Cross-platform**: Works on macOS (utun) and Linux (TUN/TAP)
12
+ - **TypeScript support**: Full TypeScript definitions included
13
+ - **Signal handling**: Graceful shutdown on SIGINT/SIGTERM
14
+ - **Thread safety**: Safe to use from multiple Node.js worker threads
15
+ - **Resource management**: Automatic cleanup of file descriptors and network interfaces
16
+ - **Enhanced error handling**: Custom error types for better debugging
17
+ - **Input validation**: Validates IPv6 addresses, MTU ranges, and buffer sizes
18
+ - **Performance optimized**: Built with C++17 and compiler optimizations
19
+ - **Network statistics**: Get interface statistics (RX/TX bytes, packets, errors)
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ npm install appium-ios-tuntap
25
+ ```
26
+
27
+ ## Prerequisites
28
+
29
+ ### macOS
30
+
31
+ On macOS, the module uses the built-in utun interfaces. No additional setup is required, but you'll need administrator privileges to create and configure the interfaces.
32
+
33
+ ### Linux
34
+
35
+ On Linux, the module requires:
36
+
37
+ 1. **TUN/TAP Kernel Module**: The TUN/TAP kernel module must be loaded.
38
+
39
+ ```bash
40
+ # Check if the module is loaded
41
+ lsmod | grep tun
42
+
43
+ # If not loaded, load it
44
+ sudo modprobe tun
45
+
46
+ # To load it automatically at boot
47
+ echo "tun" | sudo tee -a /etc/modules
48
+ ```
49
+
50
+ 2. **Permissions**: The user running the application needs access to `/dev/net/tun`.
51
+
52
+ ```bash
53
+ # Option 1: Run your application with sudo
54
+ sudo node your-app.js
55
+
56
+ # Option 2: Add your user to the 'tun' group (if it exists)
57
+ sudo usermod -a -G tun your-username
58
+
59
+ # Option 3: Create a udev rule to set permissions
60
+ echo 'KERNEL=="tun", GROUP="your-username", MODE="0660"' | sudo tee /etc/udev/rules.d/99-tuntap.rules
61
+ sudo udevadm control --reload-rules
62
+ sudo udevadm trigger
63
+ ```
64
+
65
+ 3. **iproute2 Package**: The `ip` command is required for configuring interfaces.
66
+
67
+ ```bash
68
+ # Debian/Ubuntu
69
+ sudo apt install iproute2
70
+
71
+ # CentOS/RHEL
72
+ sudo yum install iproute
73
+
74
+ # Arch Linux
75
+ sudo pacman -S iproute2
76
+ ```
77
+
78
+ 4. **Development Headers**: If you're building from source, you'll need the Linux kernel headers.
79
+
80
+ ```bash
81
+ # Debian/Ubuntu
82
+ sudo apt install linux-headers-$(uname -r)
83
+
84
+ # CentOS/RHEL
85
+ sudo yum install kernel-devel
86
+
87
+ # Arch Linux
88
+ sudo pacman -S linux-headers
89
+ ```
90
+
91
+ ## Usage
92
+
93
+ ### Basic Usage
94
+
95
+ ```javascript
96
+ import { TunTap } from 'appium-ios-tuntap';
97
+
98
+ // Create a TUN device
99
+ const tun = new TunTap();
100
+
101
+ // Open the device
102
+ if (tun.open()) {
103
+ console.log(`Opened TUN device: ${tun.name}`);
104
+
105
+ // Configure the device with an IPv6 address and MTU
106
+ await tun.configure('fd00::1', 1500);
107
+
108
+ // Add a route
109
+ await tun.addRoute('fd00::/64');
110
+
111
+ // Read from the device
112
+ const data = tun.read(4096);
113
+ if (data.length > 0) {
114
+ console.log(`Read ${data.length} bytes`);
115
+ }
116
+
117
+ // Write to the device
118
+ const buffer = Buffer.from([/* your packet data */]);
119
+ const bytesWritten = tun.write(buffer);
120
+ console.log(`Wrote ${bytesWritten} bytes`);
121
+
122
+ // Get interface statistics
123
+ const stats = await tun.getStats();
124
+ console.log('RX bytes:', stats.rxBytes);
125
+ console.log('TX bytes:', stats.txBytes);
126
+
127
+ // Close the device when done
128
+ tun.close();
129
+ }
130
+ ```
131
+
132
+ ### Error Handling
133
+
134
+ ```javascript
135
+ import { TunTap, TunTapError, TunTapPermissionError, TunTapDeviceError } from 'appium-ios-tuntap';
136
+
137
+ try {
138
+ const tun = new TunTap();
139
+ tun.open();
140
+ await tun.configure('fe80::1', 1500);
141
+ // ... use the device ...
142
+ tun.close();
143
+ } catch (err) {
144
+ if (err instanceof TunTapPermissionError) {
145
+ console.error('Permission denied. Please run with sudo.');
146
+ } else if (err instanceof TunTapDeviceError) {
147
+ console.error('Device error:', err.message);
148
+ } else if (err instanceof TunTapError) {
149
+ console.error('TUN/TAP error:', err.message);
150
+ } else {
151
+ console.error('Unexpected error:', err);
152
+ }
153
+ }
154
+ ```
155
+
156
+ ### Tunnel Manager
157
+
158
+ ```javascript
159
+ import { connectToTunnelLockdown } from 'appium-ios-tuntap';
160
+ import { Socket } from 'net';
161
+
162
+ // Create a socket connection to your tunnel endpoint
163
+ const socket = new Socket();
164
+ socket.connect(port, host, async () => {
165
+ try {
166
+ // Establish tunnel connection
167
+ const tunnel = await connectToTunnelLockdown(socket);
168
+
169
+ console.log('Tunnel established:', tunnel.Address);
170
+
171
+ // Add packet consumer
172
+ tunnel.addPacketConsumer({
173
+ onPacket: (packet) => {
174
+ console.log(`${packet.protocol} packet: ${packet.src}:${packet.sourcePort} → ${packet.dst}:${packet.destPort}`);
175
+ }
176
+ });
177
+
178
+ // Or use async iteration
179
+ for await (const packet of tunnel.getPacketStream()) {
180
+ console.log('Received packet:', packet);
181
+ }
182
+
183
+ // Close tunnel when done
184
+ await tunnel.closer();
185
+ } catch (err) {
186
+ console.error('Tunnel error:', err);
187
+ }
188
+ });
189
+ ```
190
+
191
+ ## API Reference
192
+
193
+ ### TunTap Class
194
+
195
+ #### Constructor
196
+ - `new TunTap(name?: string)` - Create a new TUN/TAP device instance
197
+
198
+ #### Methods
199
+ - `open(): boolean` - Open the TUN device
200
+ - `close(): boolean` - Close the TUN device
201
+ - `read(maxSize?: number): Buffer` - Read data from the device (default: 4096 bytes)
202
+ - `write(data: Buffer): number` - Write data to the device
203
+ - `configure(address: string, mtu?: number): Promise<void>` - Configure IPv6 address and MTU
204
+ - `addRoute(destination: string): Promise<void>` - Add a route to the device
205
+ - `removeRoute(destination: string): Promise<void>` - Remove a route from the device
206
+ - `getStats(): Promise<Stats>` - Get interface statistics
207
+
208
+ #### Properties
209
+ - `name: string` - The device name (e.g., 'utun0', 'tun0')
210
+ - `fd: number` - The file descriptor of the device
211
+
212
+ ### Error Types
213
+
214
+ - `TunTapError` - Base error class for all TUN/TAP errors
215
+ - `TunTapPermissionError` - Thrown when there are permission issues
216
+ - `TunTapDeviceError` - Thrown when the device is not available or cannot be opened
217
+
218
+ ### Signal Handling
219
+
220
+ The module automatically handles SIGINT and SIGTERM signals for graceful shutdown. All open devices will be closed and network interfaces cleaned up when the process exits.
221
+
222
+ ## Troubleshooting
223
+
224
+ ### Linux Issues
225
+
226
+ 1. **"TUN/TAP device not available"**: The TUN/TAP kernel module is not loaded.
227
+ - Solution: `sudo modprobe tun`
228
+
229
+ 2. **"Permission denied" when opening /dev/net/tun**: The user doesn't have sufficient permissions.
230
+ - Solution: Run with sudo or add your user to the 'tun' group.
231
+
232
+ 3. **"Permission denied" when configuring the interface**: The user doesn't have sudo privileges.
233
+ - Solution: Run the application with sudo or configure sudo to allow the specific commands without a password.
234
+
235
+ 4. **"Command not found" when configuring the interface**: The `ip` command is not available.
236
+ - Solution: Install the iproute2 package.
237
+
238
+ ### macOS Issues
239
+
240
+ 1. **"Failed to create control socket"**: The application doesn't have sufficient permissions.
241
+ - Solution: Run with sudo.
242
+
243
+ 2. **"Could not find an available utun device"**: All utun devices are in use.
244
+ - Solution: Close other applications that might be using utun devices.
245
+
246
+ ## Debug Mode
247
+
248
+ Enable debug logging by running your application with the `--debug` flag:
249
+
250
+ ```bash
251
+ node your-app.js --debug
252
+ ```
253
+
254
+ ## License
255
+
256
+ Apache-2.0
package/binding.gyp ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "targets": [
3
+ {
4
+ "target_name": "tuntap",
5
+ "sources": [ "src/tuntap.cc" ],
6
+ "include_dirs": [
7
+ "<!@(node -p \"require('node-addon-api').include\")"
8
+ ],
9
+ "dependencies": [
10
+ "<!(node -p \"require('node-addon-api').gyp\")"
11
+ ],
12
+ "cflags!": [ "-fno-exceptions" ],
13
+ "cflags_cc!": [ "-fno-exceptions" ],
14
+ "cflags": [
15
+ "-O3",
16
+ "-Wall",
17
+ "-Wextra",
18
+ "-Wno-unused-parameter",
19
+ "-fPIC"
20
+ ],
21
+ "cflags_cc": [
22
+ "-std=c++17",
23
+ "-Wno-vla-extension",
24
+ "-O3",
25
+ "-Wall",
26
+ "-Wextra",
27
+ "-Wno-unused-parameter",
28
+ "-fPIC"
29
+ ],
30
+ "xcode_settings": {
31
+ "GCC_ENABLE_CPP_EXCEPTIONS": "YES",
32
+ "CLANG_CXX_LIBRARY": "libc++",
33
+ "CLANG_CXX_LANGUAGE_STANDARD": "c++17",
34
+ "MACOSX_DEPLOYMENT_TARGET": "10.15",
35
+ "GCC_OPTIMIZATION_LEVEL": "3",
36
+ "WARNING_CFLAGS": [
37
+ "-Wall",
38
+ "-Wextra",
39
+ "-Wno-unused-parameter",
40
+ "-Wno-vla-extension",
41
+ "-Wno-error"
42
+ ],
43
+ "OTHER_CPLUSPLUSFLAGS": [
44
+ "-O3",
45
+ "-fPIC"
46
+ ]
47
+ },
48
+ "msvs_settings": {
49
+ "VCCLCompilerTool": {
50
+ "ExceptionHandling": 1,
51
+ "AdditionalOptions": [
52
+ "/std:c++17",
53
+ "/O2"
54
+ ]
55
+ }
56
+ },
57
+ "defines": [
58
+ "NAPI_CPP_EXCEPTIONS",
59
+ "NAPI_VERSION=8"
60
+ ],
61
+ "conditions": [
62
+ ["OS=='linux'", {
63
+ "cflags": [
64
+ "-pthread"
65
+ ],
66
+ "cflags_cc": [
67
+ "-pthread"
68
+ ],
69
+ "ldflags": [
70
+ "-pthread"
71
+ ]
72
+ }],
73
+ ["OS=='mac'", {
74
+ "xcode_settings": {
75
+ "OTHER_LDFLAGS": [
76
+ "-framework", "SystemConfiguration",
77
+ "-framework", "CoreFoundation"
78
+ ]
79
+ }
80
+ }]
81
+ ]
82
+ }
83
+ ]
84
+ }