iosignal 5.2.0 → 5.3.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.
Files changed (40) hide show
  1. package/README.md +163 -0
  2. package/dist/browser/esm/io.d.ts +8 -9
  3. package/dist/browser/esm/io.js +5 -5
  4. package/dist/browser/esm/io.js.map +1 -1
  5. package/dist/browser/iife/io.js +5 -5
  6. package/dist/browser/iife/io.js.map +1 -1
  7. package/dist/node/iosignal.cjs +124 -119
  8. package/dist/node/iosignal.js +123 -118
  9. package/dist/types/client/IOCore.d.ts +2 -2
  10. package/dist/types/client/browser/IOWebSocket.d.ts +4 -4
  11. package/dist/types/common/payload.d.ts +2 -2
  12. package/package.json +21 -3
  13. package/.vscode/settings.json +0 -3
  14. package/index.js +0 -26
  15. package/rollup.config.js +0 -59
  16. package/src/auth/BohoAuth.js +0 -196
  17. package/src/auth/key_providers/FileKeyProvider.js +0 -59
  18. package/src/auth/key_providers/RedisKeyProvider.js +0 -46
  19. package/src/auth/key_providers/StringKeyProvider.js +0 -54
  20. package/src/client/CongPacket.js +0 -143
  21. package/src/client/IOCongSocket.js +0 -92
  22. package/src/client/IOCore.js +0 -1202
  23. package/src/client/IOWS.js +0 -78
  24. package/src/client/browser/IOWebSocket.js +0 -202
  25. package/src/common/constants.js +0 -210
  26. package/src/common/payload.js +0 -82
  27. package/src/common/quotaTable.js +0 -68
  28. package/src/common/util.js +0 -64
  29. package/src/server/FileLogger.js +0 -30
  30. package/src/server/Manager.js +0 -450
  31. package/src/server/Metrics.js +0 -155
  32. package/src/server/Remote.js +0 -216
  33. package/src/server/RemoteCore.js +0 -427
  34. package/src/server/Server.js +0 -236
  35. package/src/server/serverOption.js +0 -56
  36. package/src/services/RedisService.js +0 -53
  37. package/src/services/constant.js +0 -7
  38. package/src/services/replyService.js +0 -39
  39. package/src/services/sudoService.js +0 -85
  40. package/tsconfig.json +0 -25
@@ -1,92 +0,0 @@
1
- import { IOCore } from "./IOCore.js"
2
- import { SIZE_LIMIT } from "../common/constants.js";
3
- import { pack, CongRx } from './CongPacket.js'
4
- import net from 'net'
5
-
6
-
7
- export class IOCongSocket extends IOCore {
8
- constructor(url) {
9
- super(url);
10
- if (url) this.open();
11
- }
12
-
13
- /**
14
- * Closes TCP socket and cleans resources.
15
- */
16
- close() {
17
- if (this.socket) {
18
- if (this.congRx) {
19
- this.socket.unpipe(this.congRx);
20
- this.congRx.destroy(); // Use destroy() for complete stream cleanup
21
- this.congRx = null;
22
- }
23
- this.socket.removeAllListeners();
24
- if (!this.socket.destroyed) {
25
- this.socket.destroy(); // destroy() is sufficient for forceful closing
26
- }
27
- }
28
- super.close();
29
- }
30
-
31
-
32
-
33
- keepConnection() {
34
- if (!this.autoReconnect) return;
35
- // Reconnect only if the socket is fully destroyed and the state is closed.
36
- if ((!this.socket || this.socket.destroyed)) {
37
- this.open();
38
- }
39
- }
40
-
41
-
42
- createConnection(url) {
43
- // TCP Socket
44
- let urlObj = new URL(url)
45
- if (urlObj.protocol != "cong:") {
46
- urlObj = new URL('cong://' + url)
47
- }
48
- this.socket = net.createConnection(urlObj.port, urlObj.hostname)
49
- this.stateChange('connecting','connecting')
50
-
51
- this.socket.on('connect', () => {
52
- this.congRx = new CongRx();
53
- this.socket.pipe(this.congRx)
54
- this.congRx.on("data", this.onTCPSocketMessage.bind(this));
55
- this.emit('open')
56
- })
57
-
58
- this.socket.on('error', e => {
59
- this.emit('error', e)
60
- })
61
-
62
- this.socket.on('close', () => {
63
- this.emit('close');
64
- })
65
-
66
- }
67
-
68
- onTCPSocketMessage(data) {
69
- this.rxCounter++;
70
- this.rxBytes += data.byteLength
71
- this.lastTxRxTime = Date.now();
72
- this.emit('socket_data', data);
73
-
74
- }
75
-
76
- socket_send(data) {
77
- if (this.socket?.readyState === 'open') {
78
- let packData = pack(data);
79
- this.socket.write(packData)
80
- this.txCounter++;
81
- this.txBytes += packData.byteLength;
82
- this.lastTxRxTime = Date.now();
83
- } else {
84
- console.log('.')
85
- }
86
- }
87
-
88
- }
89
-
90
-
91
-
92
-