@push.rocks/smartproxy 23.0.0 → 23.1.1

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 (161) hide show
  1. package/changelog.md +17 -0
  2. package/dist_rust/{rustproxy → rustproxy_linux_amd64} +0 -0
  3. package/dist_rust/rustproxy_linux_arm64 +0 -0
  4. package/dist_ts/00_commitinfo_data.js +1 -1
  5. package/dist_ts/plugins.d.ts +2 -1
  6. package/dist_ts/plugins.js +3 -2
  7. package/dist_ts/proxies/smart-proxy/rust-proxy-bridge.d.ts +9 -21
  8. package/dist_ts/proxies/smart-proxy/rust-proxy-bridge.js +84 -212
  9. package/dist_ts/proxies/smart-proxy/smart-proxy.js +2 -3
  10. package/npmextra.json +3 -0
  11. package/package.json +13 -11
  12. package/readme.md +41 -11
  13. package/ts/00_commitinfo_data.ts +1 -1
  14. package/ts/plugins.ts +2 -0
  15. package/ts/proxies/smart-proxy/rust-proxy-bridge.ts +103 -233
  16. package/ts/proxies/smart-proxy/smart-proxy.ts +1 -2
  17. package/dist_ts/common/eventUtils.d.ts +0 -14
  18. package/dist_ts/common/eventUtils.js +0 -20
  19. package/dist_ts/common/types.d.ts +0 -82
  20. package/dist_ts/common/types.js +0 -15
  21. package/dist_ts/core/utils/event-system.d.ts +0 -200
  22. package/dist_ts/core/utils/event-system.js +0 -224
  23. package/dist_ts/core/utils/event-utils.d.ts +0 -15
  24. package/dist_ts/core/utils/event-utils.js +0 -11
  25. package/dist_ts/core/utils/route-manager.d.ts +0 -88
  26. package/dist_ts/core/utils/route-manager.js +0 -342
  27. package/dist_ts/core/utils/route-utils.d.ts +0 -28
  28. package/dist_ts/core/utils/route-utils.js +0 -67
  29. package/dist_ts/detection/detectors/http-detector-v2.d.ts +0 -33
  30. package/dist_ts/detection/detectors/http-detector-v2.js +0 -87
  31. package/dist_ts/detection/detectors/tls-detector-v2.d.ts +0 -33
  32. package/dist_ts/detection/detectors/tls-detector-v2.js +0 -80
  33. package/dist_ts/detection/protocol-detector-v2.d.ts +0 -46
  34. package/dist_ts/detection/protocol-detector-v2.js +0 -116
  35. package/dist_ts/forwarding/config/forwarding-types.d.ts +0 -42
  36. package/dist_ts/forwarding/config/forwarding-types.js +0 -18
  37. package/dist_ts/forwarding/config/index.d.ts +0 -9
  38. package/dist_ts/forwarding/config/index.js +0 -10
  39. package/dist_ts/forwarding/factory/forwarding-factory.d.ts +0 -25
  40. package/dist_ts/forwarding/factory/forwarding-factory.js +0 -172
  41. package/dist_ts/forwarding/factory/index.d.ts +0 -4
  42. package/dist_ts/forwarding/factory/index.js +0 -5
  43. package/dist_ts/forwarding/handlers/base-handler.d.ts +0 -62
  44. package/dist_ts/forwarding/handlers/base-handler.js +0 -121
  45. package/dist_ts/forwarding/handlers/http-handler.d.ts +0 -30
  46. package/dist_ts/forwarding/handlers/http-handler.js +0 -143
  47. package/dist_ts/forwarding/handlers/https-passthrough-handler.d.ts +0 -29
  48. package/dist_ts/forwarding/handlers/https-passthrough-handler.js +0 -156
  49. package/dist_ts/forwarding/handlers/https-terminate-to-http-handler.d.ts +0 -36
  50. package/dist_ts/forwarding/handlers/https-terminate-to-http-handler.js +0 -276
  51. package/dist_ts/forwarding/handlers/https-terminate-to-https-handler.d.ts +0 -35
  52. package/dist_ts/forwarding/handlers/https-terminate-to-https-handler.js +0 -261
  53. package/dist_ts/forwarding/handlers/index.d.ts +0 -8
  54. package/dist_ts/forwarding/handlers/index.js +0 -9
  55. package/dist_ts/forwarding/index.d.ts +0 -13
  56. package/dist_ts/forwarding/index.js +0 -16
  57. package/dist_ts/http/index.d.ts +0 -5
  58. package/dist_ts/http/index.js +0 -8
  59. package/dist_ts/http/models/http-types.d.ts +0 -6
  60. package/dist_ts/http/models/http-types.js +0 -7
  61. package/dist_ts/http/router/index.d.ts +0 -8
  62. package/dist_ts/http/router/index.js +0 -7
  63. package/dist_ts/http/router/proxy-router.d.ts +0 -115
  64. package/dist_ts/http/router/proxy-router.js +0 -325
  65. package/dist_ts/http/router/route-router.d.ts +0 -108
  66. package/dist_ts/http/router/route-router.js +0 -393
  67. package/dist_ts/protocols/tls/constants.d.ts +0 -122
  68. package/dist_ts/protocols/tls/constants.js +0 -135
  69. package/dist_ts/protocols/tls/parser.d.ts +0 -53
  70. package/dist_ts/protocols/tls/parser.js +0 -294
  71. package/dist_ts/protocols/tls/types.d.ts +0 -65
  72. package/dist_ts/protocols/tls/types.js +0 -5
  73. package/dist_ts/proxies/http-proxy/certificate-manager.d.ts +0 -95
  74. package/dist_ts/proxies/http-proxy/certificate-manager.js +0 -214
  75. package/dist_ts/proxies/http-proxy/connection-pool.d.ts +0 -47
  76. package/dist_ts/proxies/http-proxy/connection-pool.js +0 -195
  77. package/dist_ts/proxies/http-proxy/context-creator.d.ts +0 -34
  78. package/dist_ts/proxies/http-proxy/context-creator.js +0 -108
  79. package/dist_ts/proxies/http-proxy/default-certificates.d.ts +0 -54
  80. package/dist_ts/proxies/http-proxy/default-certificates.js +0 -127
  81. package/dist_ts/proxies/http-proxy/function-cache.d.ts +0 -95
  82. package/dist_ts/proxies/http-proxy/function-cache.js +0 -215
  83. package/dist_ts/proxies/http-proxy/handlers/index.d.ts +0 -4
  84. package/dist_ts/proxies/http-proxy/handlers/index.js +0 -6
  85. package/dist_ts/proxies/http-proxy/handlers/redirect-handler.d.ts +0 -18
  86. package/dist_ts/proxies/http-proxy/handlers/redirect-handler.js +0 -78
  87. package/dist_ts/proxies/http-proxy/handlers/static-handler.d.ts +0 -19
  88. package/dist_ts/proxies/http-proxy/handlers/static-handler.js +0 -211
  89. package/dist_ts/proxies/http-proxy/http-proxy.d.ts +0 -117
  90. package/dist_ts/proxies/http-proxy/http-proxy.js +0 -521
  91. package/dist_ts/proxies/http-proxy/http-request-handler.d.ts +0 -40
  92. package/dist_ts/proxies/http-proxy/http-request-handler.js +0 -257
  93. package/dist_ts/proxies/http-proxy/http2-request-handler.d.ts +0 -24
  94. package/dist_ts/proxies/http-proxy/http2-request-handler.js +0 -201
  95. package/dist_ts/proxies/http-proxy/index.d.ts +0 -14
  96. package/dist_ts/proxies/http-proxy/index.js +0 -16
  97. package/dist_ts/proxies/http-proxy/models/http-types.d.ts +0 -117
  98. package/dist_ts/proxies/http-proxy/models/http-types.js +0 -92
  99. package/dist_ts/proxies/http-proxy/models/index.d.ts +0 -5
  100. package/dist_ts/proxies/http-proxy/models/index.js +0 -6
  101. package/dist_ts/proxies/http-proxy/models/types.d.ts +0 -75
  102. package/dist_ts/proxies/http-proxy/models/types.js +0 -35
  103. package/dist_ts/proxies/http-proxy/request-handler.d.ts +0 -97
  104. package/dist_ts/proxies/http-proxy/request-handler.js +0 -737
  105. package/dist_ts/proxies/http-proxy/security-manager.d.ts +0 -98
  106. package/dist_ts/proxies/http-proxy/security-manager.js +0 -341
  107. package/dist_ts/proxies/http-proxy/websocket-handler.d.ts +0 -50
  108. package/dist_ts/proxies/http-proxy/websocket-handler.js +0 -505
  109. package/dist_ts/proxies/smart-proxy/acme-state-manager.d.ts +0 -42
  110. package/dist_ts/proxies/smart-proxy/acme-state-manager.js +0 -101
  111. package/dist_ts/proxies/smart-proxy/cert-store.d.ts +0 -10
  112. package/dist_ts/proxies/smart-proxy/cert-store.js +0 -72
  113. package/dist_ts/proxies/smart-proxy/certificate-manager.d.ts +0 -164
  114. package/dist_ts/proxies/smart-proxy/certificate-manager.js +0 -745
  115. package/dist_ts/proxies/smart-proxy/connection-manager.d.ts +0 -128
  116. package/dist_ts/proxies/smart-proxy/connection-manager.js +0 -689
  117. package/dist_ts/proxies/smart-proxy/http-proxy-bridge.d.ts +0 -43
  118. package/dist_ts/proxies/smart-proxy/http-proxy-bridge.js +0 -180
  119. package/dist_ts/proxies/smart-proxy/metrics-collector.d.ts +0 -98
  120. package/dist_ts/proxies/smart-proxy/metrics-collector.js +0 -355
  121. package/dist_ts/proxies/smart-proxy/nftables-manager.d.ts +0 -82
  122. package/dist_ts/proxies/smart-proxy/nftables-manager.js +0 -237
  123. package/dist_ts/proxies/smart-proxy/port-manager.d.ts +0 -117
  124. package/dist_ts/proxies/smart-proxy/port-manager.js +0 -318
  125. package/dist_ts/proxies/smart-proxy/route-connection-handler.d.ts +0 -60
  126. package/dist_ts/proxies/smart-proxy/route-connection-handler.js +0 -1407
  127. package/dist_ts/proxies/smart-proxy/route-manager.d.ts +0 -112
  128. package/dist_ts/proxies/smart-proxy/route-manager.js +0 -453
  129. package/dist_ts/proxies/smart-proxy/route-orchestrator.d.ts +0 -56
  130. package/dist_ts/proxies/smart-proxy/route-orchestrator.js +0 -204
  131. package/dist_ts/proxies/smart-proxy/rust-binary-locator.d.ts +0 -23
  132. package/dist_ts/proxies/smart-proxy/rust-binary-locator.js +0 -104
  133. package/dist_ts/proxies/smart-proxy/security-manager.d.ts +0 -74
  134. package/dist_ts/proxies/smart-proxy/security-manager.js +0 -227
  135. package/dist_ts/proxies/smart-proxy/throughput-tracker.d.ts +0 -36
  136. package/dist_ts/proxies/smart-proxy/throughput-tracker.js +0 -115
  137. package/dist_ts/proxies/smart-proxy/timeout-manager.d.ts +0 -48
  138. package/dist_ts/proxies/smart-proxy/timeout-manager.js +0 -158
  139. package/dist_ts/proxies/smart-proxy/tls-manager.d.ts +0 -50
  140. package/dist_ts/proxies/smart-proxy/tls-manager.js +0 -110
  141. package/dist_ts/proxies/smart-proxy/utils/route-patterns.d.ts +0 -161
  142. package/dist_ts/proxies/smart-proxy/utils/route-patterns.js +0 -282
  143. package/dist_ts/proxies/smart-proxy/utils/route-validators.d.ts +0 -73
  144. package/dist_ts/proxies/smart-proxy/utils/route-validators.js +0 -259
  145. package/dist_ts/routing/router/proxy-router.d.ts +0 -115
  146. package/dist_ts/routing/router/proxy-router.js +0 -325
  147. package/dist_ts/routing/router/route-router.d.ts +0 -108
  148. package/dist_ts/routing/router/route-router.js +0 -393
  149. package/dist_ts/tls/alerts/index.d.ts +0 -4
  150. package/dist_ts/tls/alerts/index.js +0 -5
  151. package/dist_ts/tls/alerts/tls-alert.d.ts +0 -150
  152. package/dist_ts/tls/alerts/tls-alert.js +0 -226
  153. package/dist_ts/tls/sni/client-hello-parser.d.ts +0 -100
  154. package/dist_ts/tls/sni/client-hello-parser.js +0 -464
  155. package/dist_ts/tls/sni/sni-extraction.d.ts +0 -58
  156. package/dist_ts/tls/sni/sni-extraction.js +0 -275
  157. package/dist_ts/tls/utils/index.d.ts +0 -4
  158. package/dist_ts/tls/utils/index.js +0 -5
  159. package/dist_ts/tls/utils/tls-utils.d.ts +0 -49
  160. package/dist_ts/tls/utils/tls-utils.js +0 -75
  161. package/ts/proxies/smart-proxy/rust-binary-locator.ts +0 -112
@@ -1,128 +0,0 @@
1
- import * as plugins from '../../plugins.js';
2
- import type { IConnectionRecord } from './models/interfaces.js';
3
- import { LifecycleComponent } from '../../core/utils/lifecycle-component.js';
4
- import { WrappedSocket } from '../../core/models/wrapped-socket.js';
5
- import type { SmartProxy } from './smart-proxy.js';
6
- /**
7
- * Manages connection lifecycle, tracking, and cleanup with performance optimizations
8
- */
9
- export declare class ConnectionManager extends LifecycleComponent {
10
- private smartProxy;
11
- private connectionRecords;
12
- private terminationStats;
13
- private nextInactivityCheck;
14
- private readonly maxConnections;
15
- private readonly cleanupBatchSize;
16
- private cleanupQueue;
17
- private cleanupTimer;
18
- private isProcessingCleanup;
19
- private connectionsByRoute;
20
- constructor(smartProxy: SmartProxy);
21
- /**
22
- * Generate a unique connection ID
23
- */
24
- generateConnectionId(): string;
25
- /**
26
- * Create and track a new connection
27
- * Accepts either a regular net.Socket or a WrappedSocket for transparent PROXY protocol support
28
- *
29
- * @param socket - The socket for the connection
30
- * @param options - Optional configuration
31
- * @param options.connectionId - Pre-generated connection ID (for atomic IP tracking)
32
- * @param options.skipIpTracking - Skip IP tracking (if already done atomically)
33
- */
34
- createConnection(socket: plugins.net.Socket | WrappedSocket, options?: {
35
- connectionId?: string;
36
- skipIpTracking?: boolean;
37
- }): IConnectionRecord | null;
38
- /**
39
- * Track an existing connection
40
- * @param connectionId - The connection ID
41
- * @param record - The connection record
42
- * @param skipIpTracking - Skip IP tracking if already done atomically
43
- */
44
- trackConnection(connectionId: string, record: IConnectionRecord, skipIpTracking?: boolean): void;
45
- /**
46
- * Schedule next inactivity check for a connection
47
- */
48
- private scheduleInactivityCheck;
49
- /**
50
- * Start the inactivity check timer
51
- */
52
- private startInactivityCheckTimer;
53
- /**
54
- * Get a connection by ID
55
- */
56
- getConnection(connectionId: string): IConnectionRecord | undefined;
57
- /**
58
- * Get all active connections
59
- */
60
- getConnections(): Map<string, IConnectionRecord>;
61
- /**
62
- * Get count of active connections
63
- */
64
- getConnectionCount(): number;
65
- /**
66
- * Track connection by route
67
- */
68
- trackConnectionByRoute(routeId: string, connectionId: string): void;
69
- /**
70
- * Remove connection tracking for a route
71
- */
72
- removeConnectionByRoute(routeId: string, connectionId: string): void;
73
- /**
74
- * Get connection count by route
75
- */
76
- getConnectionCountByRoute(routeId: string): number;
77
- /**
78
- * Initiates cleanup once for a connection
79
- */
80
- initiateCleanupOnce(record: IConnectionRecord, reason?: string): void;
81
- /**
82
- * Queue a connection for cleanup
83
- */
84
- private queueCleanup;
85
- /**
86
- * Process the cleanup queue in batches
87
- */
88
- private processCleanupQueue;
89
- /**
90
- * Clean up a connection record
91
- */
92
- cleanupConnection(record: IConnectionRecord, reason?: string): void;
93
- /**
94
- * Creates a generic error handler for incoming or outgoing sockets
95
- */
96
- handleError(side: 'incoming' | 'outgoing', record: IConnectionRecord): (err: Error) => void;
97
- /**
98
- * Creates a generic close handler for incoming or outgoing sockets
99
- */
100
- handleClose(side: 'incoming' | 'outgoing', record: IConnectionRecord): () => void;
101
- /**
102
- * Increment termination statistics
103
- */
104
- incrementTerminationStat(side: 'incoming' | 'outgoing', reason: string): void;
105
- /**
106
- * Get termination statistics
107
- */
108
- getTerminationStats(): {
109
- incoming: Record<string, number>;
110
- outgoing: Record<string, number>;
111
- };
112
- /**
113
- * Optimized inactivity check - only checks connections that are due
114
- */
115
- private performOptimizedInactivityCheck;
116
- /**
117
- * Legacy method for backward compatibility
118
- */
119
- performInactivityCheck(): void;
120
- /**
121
- * Clear all connections (for shutdown)
122
- */
123
- clearConnections(): Promise<void>;
124
- /**
125
- * Override LifecycleComponent's onCleanup method
126
- */
127
- protected onCleanup(): Promise<void>;
128
- }