appium-ios-tuntap 0.2.2 → 0.2.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 +8 -0
- package/README.md +0 -5
- package/binding.gyp +1 -2
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/appium-ios-tuntap.node +0 -0
- package/prebuilds/darwin-x64/appium-ios-tuntap.node +0 -0
- package/prebuilds/linux-arm64/appium-ios-tuntap.node +0 -0
- package/prebuilds/linux-x64/appium-ios-tuntap.node +0 -0
- package/src/native/tun_backend.h +0 -1
- package/src/native/tun_backend_darwin.cc +20 -1
- package/src/native/tun_backend_linux.cc +19 -1
- package/src/tuntap.cc +0 -5
- package/src/native/tun_backend_common.cc +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [0.2.4](https://github.com/appium/appium-ios-tuntap/compare/v0.2.3...v0.2.4) (2026-05-13)
|
|
2
|
+
|
|
3
|
+
### Code Refactoring
|
|
4
|
+
|
|
5
|
+
* eliminate tun_backend_common.cc indirection ([#41](https://github.com/appium/appium-ios-tuntap/issues/41)) ([5fd387e](https://github.com/appium/appium-ios-tuntap/commit/5fd387e230fb772dbf280472dbadb43d131a4a2e))
|
|
6
|
+
|
|
7
|
+
## [0.2.3](https://github.com/appium/appium-ios-tuntap/compare/v0.2.2...v0.2.3) (2026-05-13)
|
|
8
|
+
|
|
1
9
|
## [0.2.2](https://github.com/appium/appium-ios-tuntap/compare/v0.2.1...v0.2.2) (2026-04-30)
|
|
2
10
|
|
|
3
11
|
### Bug Fixes
|
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/binding.gyp
CHANGED
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/native/tun_backend.h
CHANGED
|
@@ -14,10 +14,25 @@
|
|
|
14
14
|
#include <netinet/in.h>
|
|
15
15
|
#include <netinet6/in6_var.h>
|
|
16
16
|
|
|
17
|
+
#include <fcntl.h>
|
|
18
|
+
|
|
17
19
|
#define UTUN_CONTROL_NAME "com.apple.net.utun_control"
|
|
18
20
|
|
|
19
21
|
namespace {
|
|
20
22
|
|
|
23
|
+
bool SetNonBlocking(int fd, std::string& error) {
|
|
24
|
+
int flags = fcntl(fd, F_GETFL, 0);
|
|
25
|
+
if (flags < 0) {
|
|
26
|
+
error = std::string("Failed to get file descriptor flags: ") + strerror(errno);
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
|
|
30
|
+
error = std::string("Failed to set non-blocking mode: ") + strerror(errno);
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
|
|
21
36
|
class DarwinTunBackend : public TunPlatformBackend {
|
|
22
37
|
public:
|
|
23
38
|
static constexpr size_t kUtunHeaderSize = 4;
|
|
@@ -65,6 +80,10 @@ public:
|
|
|
65
80
|
return false;
|
|
66
81
|
}
|
|
67
82
|
|
|
83
|
+
if (!SetNonBlocking(temp_fd.get(), error)) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
|
|
68
87
|
out.fd = std::move(temp_fd);
|
|
69
88
|
out.interface_name = std::string(interface_name);
|
|
70
89
|
return true;
|
|
@@ -144,7 +163,7 @@ private:
|
|
|
144
163
|
|
|
145
164
|
} // namespace
|
|
146
165
|
|
|
147
|
-
std::unique_ptr<TunPlatformBackend>
|
|
166
|
+
std::unique_ptr<TunPlatformBackend> CreatePlatformBackend() {
|
|
148
167
|
return std::make_unique<DarwinTunBackend>();
|
|
149
168
|
}
|
|
150
169
|
|
|
@@ -13,6 +13,20 @@
|
|
|
13
13
|
#include <linux/if_tun.h>
|
|
14
14
|
|
|
15
15
|
namespace {
|
|
16
|
+
|
|
17
|
+
bool SetNonBlocking(int fd, std::string& error) {
|
|
18
|
+
int flags = fcntl(fd, F_GETFL, 0);
|
|
19
|
+
if (flags < 0) {
|
|
20
|
+
error = std::string("Failed to get file descriptor flags: ") + strerror(errno);
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
|
|
24
|
+
error = std::string("Failed to set non-blocking mode: ") + strerror(errno);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
|
|
16
30
|
constexpr const char* kTunDevicePath = "/dev/net/tun";
|
|
17
31
|
|
|
18
32
|
class LinuxTunBackend : public TunPlatformBackend {
|
|
@@ -49,6 +63,10 @@ public:
|
|
|
49
63
|
return false;
|
|
50
64
|
}
|
|
51
65
|
|
|
66
|
+
if (!SetNonBlocking(temp_fd.get(), error)) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
|
|
52
70
|
out.fd = std::move(temp_fd);
|
|
53
71
|
out.interface_name = std::string(ifr.ifr_name);
|
|
54
72
|
return true;
|
|
@@ -86,7 +104,7 @@ public:
|
|
|
86
104
|
|
|
87
105
|
} // namespace
|
|
88
106
|
|
|
89
|
-
std::unique_ptr<TunPlatformBackend>
|
|
107
|
+
std::unique_ptr<TunPlatformBackend> CreatePlatformBackend() {
|
|
90
108
|
return std::make_unique<LinuxTunBackend>();
|
|
91
109
|
}
|
|
92
110
|
|
package/src/tuntap.cc
CHANGED
|
@@ -107,11 +107,6 @@ Napi::Value TunDevice::Open(const Napi::CallbackInfo& info) {
|
|
|
107
107
|
return Napi::Boolean::New(env, false);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
if (!SetNonBlocking(result.fd.get(), error)) {
|
|
111
|
-
Napi::Error::New(env, error).ThrowAsJavaScriptException();
|
|
112
|
-
return Napi::Boolean::New(env, false);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
110
|
fd_ = std::move(result.fd);
|
|
116
111
|
name_ = result.interface_name;
|
|
117
112
|
is_open_ = true;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#include "tun_backend.h"
|
|
2
|
-
|
|
3
|
-
#include <errno.h>
|
|
4
|
-
#include <fcntl.h>
|
|
5
|
-
#include <string.h>
|
|
6
|
-
|
|
7
|
-
std::unique_ptr<TunPlatformBackend> CreatePlatformTunBackend();
|
|
8
|
-
|
|
9
|
-
bool SetNonBlocking(int fd, std::string& error) {
|
|
10
|
-
int flags = fcntl(fd, F_GETFL, 0);
|
|
11
|
-
if (flags < 0) {
|
|
12
|
-
error = std::string("Failed to get file descriptor flags: ") + strerror(errno);
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
|
|
17
|
-
error = std::string("Failed to set non-blocking mode: ") + strerror(errno);
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
std::unique_ptr<TunPlatformBackend> CreatePlatformBackend() {
|
|
25
|
-
return CreatePlatformTunBackend();
|
|
26
|
-
}
|
|
27
|
-
|