@bytecodealliance/preview2-shim 0.14.1 → 0.14.2
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/README.md +2 -2
- package/lib/browser/filesystem.js +6 -5
- package/lib/browser/random.js +1 -1
- package/lib/io/calls.js +128 -1
- package/lib/io/worker-http.js +159 -65
- package/lib/io/worker-io.js +40 -43
- package/lib/io/worker-socket-tcp.js +131 -0
- package/lib/io/worker-socket-udp.js +219 -0
- package/lib/io/worker-thread.js +288 -82
- package/lib/nodejs/cli.js +27 -11
- package/lib/nodejs/filesystem.js +89 -38
- package/lib/nodejs/http.js +643 -522
- package/lib/nodejs/index.js +0 -1
- package/lib/nodejs/sockets/socket-common.js +15 -2
- package/lib/nodejs/sockets/tcp-socket-impl.js +279 -188
- package/lib/nodejs/sockets/udp-socket-impl.js +305 -165
- package/lib/nodejs/sockets/wasi-sockets.js +54 -33
- package/lib/nodejs/sockets.js +25 -11
- package/lib/synckit/index.js +22 -39
- package/package.json +1 -1
- package/types/interfaces/wasi-http-types.d.ts +53 -41
- package/types/interfaces/wasi-sockets-tcp.d.ts +5 -0
package/lib/nodejs/index.js
CHANGED
|
@@ -73,10 +73,17 @@ export function deserializeIpAddress(addr, family) {
|
|
|
73
73
|
return address;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
export function
|
|
76
|
+
export function findUnusedLocalAddress(
|
|
77
|
+
family,
|
|
78
|
+
{ iPv4MappedAddress = false } = {}
|
|
79
|
+
) {
|
|
77
80
|
let address = [127, 0, 0, 1];
|
|
78
81
|
if (family.toLocaleLowerCase() === "ipv6") {
|
|
79
|
-
|
|
82
|
+
if (iPv4MappedAddress) {
|
|
83
|
+
address = [0, 0, 0, 0, 0, 0xffff, 0x7f00, 0x0001];
|
|
84
|
+
} else {
|
|
85
|
+
address = [0, 0, 0, 0, 0, 0, 0, 1];
|
|
86
|
+
}
|
|
80
87
|
}
|
|
81
88
|
return {
|
|
82
89
|
tag: family,
|
|
@@ -114,3 +121,9 @@ export function isIPv4MappedAddress(ipSocketAddress) {
|
|
|
114
121
|
}
|
|
115
122
|
return ipSocketAddress.val.address[5] === 0xffff;
|
|
116
123
|
}
|
|
124
|
+
|
|
125
|
+
export function isWildcardAddress(ipSocketAddress) {
|
|
126
|
+
// ipv6: [0, 0, 0, 0, 0, 0, 0, 0]
|
|
127
|
+
// ipv4: [0, 0, 0, 0]
|
|
128
|
+
return ipSocketAddress.val.address.every((segment) => segment === 0);
|
|
129
|
+
}
|