@gjsify/net 0.0.4 → 0.1.0
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 +29 -1
- package/lib/esm/index.js +34 -3
- package/lib/esm/server.js +133 -0
- package/lib/esm/socket.js +332 -0
- package/lib/types/index.d.ts +30 -0
- package/lib/types/server.d.ts +40 -0
- package/lib/types/socket.d.ts +78 -0
- package/package.json +23 -22
- package/src/error.spec.ts +169 -0
- package/src/extended.spec.ts +413 -0
- package/src/index.spec.ts +1072 -80
- package/src/index.ts +47 -12
- package/src/server.spec.ts +303 -0
- package/src/server.ts +186 -0
- package/src/socket.ts +404 -0
- package/src/test.mts +6 -2
- package/src/timeout.spec.ts +464 -0
- package/tsconfig.json +22 -9
- package/tsconfig.tsbuildinfo +1 -0
- package/lib/cjs/index.js +0 -26
- package/test.gjs.mjs +0 -34766
- package/test.node.mjs +0 -366
- package/tsconfig.types.json +0 -8
package/lib/cjs/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import Gio from "@girs/gio-2.0";
|
|
2
|
-
function isIP(input) {
|
|
3
|
-
const addr = Gio.InetAddress.new_from_string(input);
|
|
4
|
-
if (!addr)
|
|
5
|
-
return 0;
|
|
6
|
-
const family = addr.get_family();
|
|
7
|
-
switch (family) {
|
|
8
|
-
case Gio.SocketFamily.INVALID:
|
|
9
|
-
return 0;
|
|
10
|
-
case Gio.SocketFamily.IPV4:
|
|
11
|
-
return 4;
|
|
12
|
-
case Gio.SocketFamily.IPV6:
|
|
13
|
-
return 6;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function isIPv4(input) {
|
|
17
|
-
return isIP(input) === 4;
|
|
18
|
-
}
|
|
19
|
-
function isIPv6(input) {
|
|
20
|
-
return isIP(input) === 6;
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
isIP,
|
|
24
|
-
isIPv4,
|
|
25
|
-
isIPv6
|
|
26
|
-
};
|