appium-ios-tuntap 0.1.8 → 0.1.10
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 +12 -0
- package/build/Release/tuntap.node +0 -0
- package/build/config.gypi +1 -1
- package/lib/TunTap.js +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/platform/darwin.js +2 -16
- package/lib/platform/linux.js +2 -1
- package/lib/tunnel.js +9 -8
- package/package.json +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [0.1.10](https://github.com/appium/appium-ios-tuntap/compare/v0.1.9...v0.1.10) (2026-04-13)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* Use native `which` helper ([#32](https://github.com/appium/appium-ios-tuntap/issues/32)) ([37cb5c3](https://github.com/appium/appium-ios-tuntap/commit/37cb5c3ed68d7c46fdacec00b94d2c3319bc440c))
|
|
6
|
+
|
|
7
|
+
## [0.1.9](https://github.com/appium/appium-ios-tuntap/compare/v0.1.8...v0.1.9) (2026-04-13)
|
|
8
|
+
|
|
9
|
+
### Miscellaneous Chores
|
|
10
|
+
|
|
11
|
+
* Introduce automated formatting using prettier tool ([#28](https://github.com/appium/appium-ios-tuntap/issues/28)) ([4b74da1](https://github.com/appium/appium-ios-tuntap/commit/4b74da15932ffb630c3c6e368de73b1e933afbba))
|
|
12
|
+
|
|
1
13
|
## [0.1.8](https://github.com/appium/appium-ios-tuntap/compare/v0.1.7...v0.1.8) (2026-04-12)
|
|
2
14
|
|
|
3
15
|
### Code Refactoring
|
|
Binary file
|
package/build/config.gypi
CHANGED
|
@@ -502,7 +502,7 @@
|
|
|
502
502
|
"cache": "/Users/runner/.npm",
|
|
503
503
|
"node_gyp": "/Users/runner/work/appium-ios-tuntap/appium-ios-tuntap/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",
|
|
504
504
|
"npm_version": "11.11.0",
|
|
505
|
-
"userconfig": "/private/var/folders/tb/y368xp_x10s3ty1b_mtl5mxr0000gn/T/
|
|
505
|
+
"userconfig": "/private/var/folders/tb/y368xp_x10s3ty1b_mtl5mxr0000gn/T/03d2eb2fce8568cbe5922560e6a16a15/.npmrc",
|
|
506
506
|
"init_module": "/Users/runner/.npm-init.js",
|
|
507
507
|
"globalconfig": "/Users/runner/hostedtoolcache/node/24.14.1/arm64/etc/npmrc",
|
|
508
508
|
"local_prefix": "/Users/runner/work/appium-ios-tuntap/appium-ios-tuntap",
|
package/lib/TunTap.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
2
|
import { isIPv6 } from 'node:net';
|
|
3
|
-
import { TunTapDeviceError, TunTapError, TunTapPermissionError
|
|
3
|
+
import { TunTapDeviceError, TunTapError, TunTapPermissionError } from './errors.js';
|
|
4
4
|
import { log } from './logger.js';
|
|
5
5
|
import { createTunTapPlatform } from './platform/create-platform.js';
|
|
6
6
|
const require = createRequire(import.meta.url);
|
|
7
7
|
const DEFAULT_READ_BUFFER_SIZE = 4096;
|
|
8
|
-
const MAX_BUFFER_SIZE =
|
|
8
|
+
const MAX_BUFFER_SIZE = 0xffff; // 65535
|
|
9
9
|
const DEFAULT_MTU = 1500;
|
|
10
10
|
const MIN_MTU = 1280;
|
|
11
11
|
const nativeTuntap = require('../build/Release/tuntap.node');
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/platform/darwin.js
CHANGED
|
@@ -6,27 +6,13 @@ export class DarwinTunTapPlatform {
|
|
|
6
6
|
/** @inheritdoc */
|
|
7
7
|
async configure(interfaceName, address, mtu) {
|
|
8
8
|
assertEffectiveRoot();
|
|
9
|
-
await execFileAsync('ifconfig', [
|
|
10
|
-
interfaceName,
|
|
11
|
-
'inet6',
|
|
12
|
-
address,
|
|
13
|
-
'prefixlen',
|
|
14
|
-
'64',
|
|
15
|
-
'up',
|
|
16
|
-
]);
|
|
9
|
+
await execFileAsync('ifconfig', [interfaceName, 'inet6', address, 'prefixlen', '64', 'up']);
|
|
17
10
|
await execFileAsync('ifconfig', [interfaceName, 'mtu', String(mtu)]);
|
|
18
11
|
}
|
|
19
12
|
/** @inheritdoc */
|
|
20
13
|
async addRoute(interfaceName, destination) {
|
|
21
14
|
assertEffectiveRoot();
|
|
22
|
-
await execFileAsync('route', [
|
|
23
|
-
'-n',
|
|
24
|
-
'add',
|
|
25
|
-
'-inet6',
|
|
26
|
-
destination,
|
|
27
|
-
'-interface',
|
|
28
|
-
interfaceName,
|
|
29
|
-
]);
|
|
15
|
+
await execFileAsync('route', ['-n', 'add', '-inet6', destination, '-interface', interfaceName]);
|
|
30
16
|
}
|
|
31
17
|
/** @inheritdoc */
|
|
32
18
|
async removeRoute(_interfaceName, destination) {
|
package/lib/platform/linux.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fs } from '@appium/support';
|
|
1
2
|
import { log } from '../logger.js';
|
|
2
3
|
import { TunTapError } from '../errors.js';
|
|
3
4
|
import { execFileAsync } from './exec.js';
|
|
@@ -8,7 +9,7 @@ export class LinuxTunTapPlatform {
|
|
|
8
9
|
async configure(interfaceName, address, mtu) {
|
|
9
10
|
assertEffectiveRoot();
|
|
10
11
|
try {
|
|
11
|
-
await
|
|
12
|
+
await fs.which('ip');
|
|
12
13
|
}
|
|
13
14
|
catch {
|
|
14
15
|
throw new TunTapError('The "ip" command is not available. Please install iproute2 (e.g., sudo apt install iproute2)');
|
package/lib/tunnel.js
CHANGED
|
@@ -60,7 +60,7 @@ export class TunnelManager extends EventEmitter {
|
|
|
60
60
|
else {
|
|
61
61
|
queue.push(packet);
|
|
62
62
|
}
|
|
63
|
-
}
|
|
63
|
+
},
|
|
64
64
|
};
|
|
65
65
|
this.addPacketConsumer(consumer);
|
|
66
66
|
try {
|
|
@@ -107,7 +107,7 @@ export class TunnelManager extends EventEmitter {
|
|
|
107
107
|
return {
|
|
108
108
|
name: this.tun.name,
|
|
109
109
|
mtu: tunnelInfo.clientParameters.mtu,
|
|
110
|
-
interface: this.tun
|
|
110
|
+
interface: this.tun,
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
113
|
catch (err) {
|
|
@@ -189,7 +189,7 @@ export class TunnelManager extends EventEmitter {
|
|
|
189
189
|
// Extract IPv6 header (fixed 40 bytes)
|
|
190
190
|
const header = this.buffer.slice(offset, offset + 40);
|
|
191
191
|
// Ensure this is an IPv6 packet (version 6)
|
|
192
|
-
const version = (header[0] >> 4) &
|
|
192
|
+
const version = (header[0] >> 4) & 0x0f;
|
|
193
193
|
if (version !== 6) {
|
|
194
194
|
offset++;
|
|
195
195
|
continue;
|
|
@@ -232,7 +232,7 @@ export class TunnelManager extends EventEmitter {
|
|
|
232
232
|
dst,
|
|
233
233
|
sourcePort,
|
|
234
234
|
destPort,
|
|
235
|
-
payload: udpPayload
|
|
235
|
+
payload: udpPayload,
|
|
236
236
|
};
|
|
237
237
|
this.emit('data', packetData);
|
|
238
238
|
this.packetConsumers.forEach((consumer) => {
|
|
@@ -269,7 +269,7 @@ export class TunnelManager extends EventEmitter {
|
|
|
269
269
|
dst,
|
|
270
270
|
sourcePort,
|
|
271
271
|
destPort,
|
|
272
|
-
payload: tcpPayload
|
|
272
|
+
payload: tcpPayload,
|
|
273
273
|
};
|
|
274
274
|
this.emit('data', packetData);
|
|
275
275
|
this.packetConsumers.forEach((consumer) => {
|
|
@@ -309,7 +309,8 @@ export class TunnelManager extends EventEmitter {
|
|
|
309
309
|
const data = this.tun.read(16384); // A large buffer for MTU
|
|
310
310
|
// If we got data, send it to the device
|
|
311
311
|
if (data && data.length > 0) {
|
|
312
|
-
if (data.length >= 40) {
|
|
312
|
+
if (data.length >= 40) {
|
|
313
|
+
// Minimum IPv6 header size
|
|
313
314
|
log.debug(`TUN → Device: ${data.length} bytes, IPv6 src=${formatIPv6Address(data.slice(8, 24))}, dst=${formatIPv6Address(data.slice(24, 40))}`);
|
|
314
315
|
}
|
|
315
316
|
else {
|
|
@@ -381,7 +382,7 @@ export async function exchangeCoreTunnelParameters(socket) {
|
|
|
381
382
|
return new Promise((resolve, reject) => {
|
|
382
383
|
const request = {
|
|
383
384
|
type: 'clientHandshakeRequest',
|
|
384
|
-
mtu: 16000
|
|
385
|
+
mtu: 16000,
|
|
385
386
|
};
|
|
386
387
|
const requestJSON = JSON.stringify(request);
|
|
387
388
|
const jsonBuffer = Buffer.from(requestJSON);
|
|
@@ -486,7 +487,7 @@ export async function connectToTunnelLockdown(secureServiceSocket) {
|
|
|
486
487
|
closer: closeFunc,
|
|
487
488
|
addPacketConsumer: (consumer) => tunnelManager.addPacketConsumer(consumer),
|
|
488
489
|
removePacketConsumer: (consumer) => tunnelManager.removePacketConsumer(consumer),
|
|
489
|
-
getPacketStream: () => tunnelManager.getPacketStream()
|
|
490
|
+
getPacketStream: () => tunnelManager.getPacketStream(),
|
|
490
491
|
};
|
|
491
492
|
}
|
|
492
493
|
catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-ios-tuntap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Native TUN/TAP interface module for Node.js",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
"build:addon": "node-gyp rebuild",
|
|
12
12
|
"lint": "eslint .",
|
|
13
13
|
"lint:fix": "npm run lint -- --fix",
|
|
14
|
+
"format": "prettier -w ./src ./test",
|
|
15
|
+
"format:check": "prettier --check ./src ./test",
|
|
14
16
|
"prepare": "npm run build:addon && npm run build",
|
|
15
17
|
"test": "sudo npm run test:integration && npm run test:unit",
|
|
16
18
|
"test:unit": "sudo npx mocha 'test/tuntap-unit.spec.mjs' --exit --timeout 2m",
|
|
@@ -51,7 +53,13 @@
|
|
|
51
53
|
"@semantic-release/git": "^10.0.1",
|
|
52
54
|
"@types/node": "^25.0.1",
|
|
53
55
|
"conventional-changelog-conventionalcommits": "^9.0.0",
|
|
54
|
-
"semantic-release": "^25.0.2"
|
|
56
|
+
"semantic-release": "^25.0.2",
|
|
57
|
+
"prettier": "^3.0.0"
|
|
58
|
+
},
|
|
59
|
+
"prettier": {
|
|
60
|
+
"bracketSpacing": false,
|
|
61
|
+
"printWidth": 100,
|
|
62
|
+
"singleQuote": true
|
|
55
63
|
},
|
|
56
64
|
"engines": {
|
|
57
65
|
"node": "^20.19.0 || ^22.12.0 || >=24.0.0",
|