appium-ios-tuntap 0.2.1 → 0.2.3

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 CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.2.3](https://github.com/appium/appium-ios-tuntap/compare/v0.2.2...v0.2.3) (2026-05-13)
2
+
3
+ ## [0.2.2](https://github.com/appium/appium-ios-tuntap/compare/v0.2.1...v0.2.2) (2026-04-30)
4
+
5
+ ### Bug Fixes
6
+
7
+ * linter ([#38](https://github.com/appium/appium-ios-tuntap/issues/38)) ([8dfed52](https://github.com/appium/appium-ios-tuntap/commit/8dfed527cc557856025bba6070b2686414d582a2))
8
+
1
9
  ## [0.2.1](https://github.com/appium/appium-ios-tuntap/compare/v0.2.0...v0.2.1) (2026-04-13)
2
10
 
3
11
  ### Miscellaneous Chores
package/README.md CHANGED
@@ -291,11 +291,6 @@ To manually verify the fix for signal handling (introduced in v0.0.4):
291
291
 
292
292
  This ensures the signal handler works as intended.
293
293
 
294
- Apache-2.0
295
- >>>>>>> upstream/main
296
294
  ## License
297
295
 
298
296
  Apache-2.0
299
- =======
300
- Apache-2.0
301
- >>>>>>> upstream/main
package/lib/TunTap.d.ts CHANGED
@@ -25,6 +25,10 @@ export declare class TunTap {
25
25
  get isOpen(): boolean;
26
26
  /** Whether {@link TunTap.close} has been called (device cannot be reopened). */
27
27
  get isClosed(): boolean;
28
+ /** OS-assigned interface name (e.g. `utun4` on macOS). */
29
+ get name(): string;
30
+ /** File descriptor for the open TUN device (for advanced use). */
31
+ get fd(): number;
28
32
  /**
29
33
  * Open the TUN device via the native addon.
30
34
  *
@@ -70,10 +74,6 @@ export declare class TunTap {
70
74
  * @throws {RangeError} if `bufferSize` is out of range
71
75
  */
72
76
  startPolling(callback: PacketCallback, bufferSize?: number): void;
73
- /** OS-assigned interface name (e.g. `utun4` on macOS). */
74
- get name(): string;
75
- /** File descriptor for the open TUN device (for advanced use). */
76
- get fd(): number;
77
77
  /**
78
78
  * Configure IPv6 address and MTU on this interface using the platform backend (must run as root on Darwin/Linux).
79
79
  *
package/lib/TunTap.js CHANGED
@@ -13,22 +13,6 @@ const MAX_BUFFER_SIZE = 0xffff; // 65535
13
13
  const DEFAULT_MTU = 1500;
14
14
  const MIN_MTU = 1280;
15
15
  const nativeTuntap = require('node-gyp-build')(pkgRoot);
16
- /**
17
- * Validates an IPv6 route destination (address with optional CIDR prefix).
18
- */
19
- function isValidIPv6Route(destination) {
20
- const parts = destination.split('/');
21
- if (parts.length > 2) {
22
- return false;
23
- }
24
- if (parts.length === 2) {
25
- const prefix = parseInt(parts[1], 10);
26
- if (isNaN(prefix) || prefix < 0 || prefix > 128 || parts[1] !== String(prefix)) {
27
- return false;
28
- }
29
- }
30
- return isIPv6(parts[0]);
31
- }
32
16
  /**
33
17
  * High-level wrapper around the native TUN device with IPv6-only configuration helpers.
34
18
  *
@@ -75,6 +59,14 @@ export class TunTap {
75
59
  get isClosed() {
76
60
  return this._isClosed;
77
61
  }
62
+ /** OS-assigned interface name (e.g. `utun4` on macOS). */
63
+ get name() {
64
+ return this.device.getName();
65
+ }
66
+ /** File descriptor for the open TUN device (for advanced use). */
67
+ get fd() {
68
+ return this.device.getFd();
69
+ }
78
70
  /**
79
71
  * Open the TUN device via the native addon.
80
72
  *
@@ -202,14 +194,6 @@ export class TunTap {
202
194
  }
203
195
  this.device.startPolling(callback, bufferSize);
204
196
  }
205
- /** OS-assigned interface name (e.g. `utun4` on macOS). */
206
- get name() {
207
- return this.device.getName();
208
- }
209
- /** File descriptor for the open TUN device (for advanced use). */
210
- get fd() {
211
- return this.device.getFd();
212
- }
213
197
  /**
214
198
  * Configure IPv6 address and MTU on this interface using the platform backend (must run as root on Darwin/Linux).
215
199
  *
@@ -318,3 +302,19 @@ export class TunTap {
318
302
  }
319
303
  }
320
304
  }
305
+ /**
306
+ * Validates an IPv6 route destination (address with optional CIDR prefix).
307
+ */
308
+ function isValidIPv6Route(destination) {
309
+ const parts = destination.split('/');
310
+ if (parts.length > 2) {
311
+ return false;
312
+ }
313
+ if (parts.length === 2) {
314
+ const prefix = parseInt(parts[1], 10);
315
+ if (isNaN(prefix) || prefix < 0 || prefix > 128 || parts[1] !== String(prefix)) {
316
+ return false;
317
+ }
318
+ }
319
+ return isIPv6(parts[0]);
320
+ }
package/lib/tunnel.d.ts CHANGED
@@ -2,15 +2,6 @@ import { TunTap } from './TunTap.js';
2
2
  import { EventEmitter } from 'node:events';
3
3
  import { Socket } from 'node:net';
4
4
  import { Buffer } from 'node:buffer';
5
- interface TunnelClientParameters {
6
- address: string;
7
- mtu: number;
8
- }
9
- interface TunnelInfo {
10
- clientParameters: TunnelClientParameters;
11
- serverAddress: string;
12
- serverRSDPort?: number;
13
- }
14
5
  export interface PacketData {
15
6
  protocol: 'TCP' | 'UDP';
16
7
  src: string;
@@ -28,9 +19,6 @@ export interface PacketData {
28
19
  * // `packet` is PacketData
29
20
  * });
30
21
  */
31
- export interface TunnelManagerEvents {
32
- data: [packet: PacketData];
33
- }
34
22
  export interface PacketConsumer {
35
23
  /**
36
24
  * Invoked for each parsed TCP/UDP payload extracted from the tunnel stream.
@@ -39,6 +27,9 @@ export interface PacketConsumer {
39
27
  */
40
28
  onPacket(packet: PacketData): void;
41
29
  }
30
+ export interface TunnelManagerEvents {
31
+ data: [packet: PacketData];
32
+ }
42
33
  export interface TunnelConnection {
43
34
  Address: string;
44
35
  RsdPort?: number;
@@ -52,6 +43,15 @@ export interface TunnelConnection {
52
43
  /** @returns async iterator of packets until the tunnel is stopped */
53
44
  getPacketStream(): AsyncIterable<PacketData>;
54
45
  }
46
+ interface TunnelClientParameters {
47
+ address: string;
48
+ mtu: number;
49
+ }
50
+ interface TunnelInfo {
51
+ clientParameters: TunnelClientParameters;
52
+ serverAddress: string;
53
+ serverRSDPort?: number;
54
+ }
55
55
  /**
56
56
  * Bridges a CoreDevice tunnel `Socket` and a {@link TunTap} interface: IPv6 framing, TUN I/O, and packet fan-out.
57
57
  * Emits {@link TunnelManagerEvents} (currently `data` with {@link PacketData}) for TCP/UDP packets, same as registered consumers.
package/lib/tunnel.js CHANGED
@@ -362,16 +362,6 @@ export class TunnelManager extends EventEmitter {
362
362
  log.debug(`Tunnel for ${tunName} closed successfully`);
363
363
  }
364
364
  }
365
- function formatIPv6Address(buffer) {
366
- if (!buffer || buffer.length !== 16) {
367
- return 'invalid-address';
368
- }
369
- const parts = [];
370
- for (let i = 0; i < 16; i += 2) {
371
- parts.push(buffer.readUInt16BE(i).toString(16));
372
- }
373
- return parts.join(':');
374
- }
375
365
  /**
376
366
  * Perform the CDTunnel JSON handshake (8-byte magic + length-prefixed JSON) over `socket`.
377
367
  *
@@ -499,3 +489,13 @@ export async function connectToTunnelLockdown(secureServiceSocket) {
499
489
  throw err;
500
490
  }
501
491
  }
492
+ function formatIPv6Address(buffer) {
493
+ if (!buffer || buffer.length !== 16) {
494
+ return 'invalid-address';
495
+ }
496
+ const parts = [];
497
+ for (let i = 0; i < 16; i += 2) {
498
+ parts.push(buffer.readUInt16BE(i).toString(16));
499
+ }
500
+ return parts.join(':');
501
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-ios-tuntap",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Native TUN/TAP interface module for Node.js",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -16,9 +16,9 @@
16
16
  "format:check": "prettier --check ./src ./test",
17
17
  "install": "node-gyp-build",
18
18
  "prepare": "npm run build",
19
- "test": "sudo npm run test:integration && npm run test:unit",
20
- "test:unit": "sudo npx mocha 'test/tuntap-unit.spec.mjs' --exit --timeout 2m",
21
- "test:integration": "sudo npx mocha 'test/tuntap-integration.spec.mjs' --exit --timeout 2m"
19
+ "test": "npm run test:integration && npm run test:unit",
20
+ "test:unit": "mocha 'test/unit/**/*.spec.mjs' --exit --timeout 2m",
21
+ "test:integration": "mocha 'test/integration/**/*.spec.mjs' --exit --timeout 2m"
22
22
  },
23
23
  "files": [
24
24
  "src/tuntap.cc",
@@ -57,9 +57,10 @@
57
57
  "@semantic-release/git": "^10.0.1",
58
58
  "@types/node": "^25.0.1",
59
59
  "conventional-changelog-conventionalcommits": "^9.0.0",
60
- "semantic-release": "^25.0.2",
60
+ "mocha": "^11.7.5",
61
+ "prebuildify": "^6.0.1",
61
62
  "prettier": "^3.0.0",
62
- "prebuildify": "^6.0.1"
63
+ "semantic-release": "^25.0.2"
63
64
  },
64
65
  "prettier": {
65
66
  "bracketSpacing": false,