@push.rocks/smartproxy 22.6.0 → 23.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/changelog.md +18 -0
- package/dist_rust/{rustproxy → rustproxy_linux_amd64} +0 -0
- package/dist_rust/rustproxy_linux_arm64 +0 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/index.d.ts +0 -1
- package/dist_ts/index.js +1 -3
- package/dist_ts/plugins.d.ts +2 -1
- package/dist_ts/plugins.js +3 -2
- package/dist_ts/proxies/index.d.ts +0 -1
- package/dist_ts/proxies/index.js +1 -3
- package/dist_ts/proxies/smart-proxy/models/route-types.js +1 -1
- package/dist_ts/proxies/smart-proxy/rust-proxy-bridge.d.ts +9 -21
- package/dist_ts/proxies/smart-proxy/rust-proxy-bridge.js +83 -212
- package/dist_ts/proxies/smart-proxy/smart-proxy.js +2 -3
- package/npmextra.json +3 -0
- package/package.json +13 -11
- package/readme.md +35 -31
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/index.ts +0 -3
- package/ts/plugins.ts +2 -0
- package/ts/proxies/index.ts +0 -3
- package/ts/proxies/smart-proxy/models/route-types.ts +0 -2
- package/ts/proxies/smart-proxy/rust-proxy-bridge.ts +102 -233
- package/ts/proxies/smart-proxy/smart-proxy.ts +1 -2
- package/dist_ts/common/eventUtils.d.ts +0 -14
- package/dist_ts/common/eventUtils.js +0 -20
- package/dist_ts/common/types.d.ts +0 -82
- package/dist_ts/common/types.js +0 -15
- package/dist_ts/core/utils/event-system.d.ts +0 -200
- package/dist_ts/core/utils/event-system.js +0 -224
- package/dist_ts/core/utils/event-utils.d.ts +0 -15
- package/dist_ts/core/utils/event-utils.js +0 -11
- package/dist_ts/core/utils/route-manager.d.ts +0 -88
- package/dist_ts/core/utils/route-manager.js +0 -342
- package/dist_ts/core/utils/route-utils.d.ts +0 -28
- package/dist_ts/core/utils/route-utils.js +0 -67
- package/dist_ts/detection/detectors/http-detector-v2.d.ts +0 -33
- package/dist_ts/detection/detectors/http-detector-v2.js +0 -87
- package/dist_ts/detection/detectors/tls-detector-v2.d.ts +0 -33
- package/dist_ts/detection/detectors/tls-detector-v2.js +0 -80
- package/dist_ts/detection/protocol-detector-v2.d.ts +0 -46
- package/dist_ts/detection/protocol-detector-v2.js +0 -116
- package/dist_ts/forwarding/config/forwarding-types.d.ts +0 -42
- package/dist_ts/forwarding/config/forwarding-types.js +0 -18
- package/dist_ts/forwarding/config/index.d.ts +0 -9
- package/dist_ts/forwarding/config/index.js +0 -10
- package/dist_ts/forwarding/factory/forwarding-factory.d.ts +0 -25
- package/dist_ts/forwarding/factory/forwarding-factory.js +0 -172
- package/dist_ts/forwarding/factory/index.d.ts +0 -4
- package/dist_ts/forwarding/factory/index.js +0 -5
- package/dist_ts/forwarding/handlers/base-handler.d.ts +0 -62
- package/dist_ts/forwarding/handlers/base-handler.js +0 -121
- package/dist_ts/forwarding/handlers/http-handler.d.ts +0 -30
- package/dist_ts/forwarding/handlers/http-handler.js +0 -143
- package/dist_ts/forwarding/handlers/https-passthrough-handler.d.ts +0 -29
- package/dist_ts/forwarding/handlers/https-passthrough-handler.js +0 -156
- package/dist_ts/forwarding/handlers/https-terminate-to-http-handler.d.ts +0 -36
- package/dist_ts/forwarding/handlers/https-terminate-to-http-handler.js +0 -276
- package/dist_ts/forwarding/handlers/https-terminate-to-https-handler.d.ts +0 -35
- package/dist_ts/forwarding/handlers/https-terminate-to-https-handler.js +0 -261
- package/dist_ts/forwarding/handlers/index.d.ts +0 -8
- package/dist_ts/forwarding/handlers/index.js +0 -9
- package/dist_ts/forwarding/index.d.ts +0 -13
- package/dist_ts/forwarding/index.js +0 -16
- package/dist_ts/http/index.d.ts +0 -5
- package/dist_ts/http/index.js +0 -8
- package/dist_ts/http/models/http-types.d.ts +0 -6
- package/dist_ts/http/models/http-types.js +0 -7
- package/dist_ts/http/router/index.d.ts +0 -8
- package/dist_ts/http/router/index.js +0 -7
- package/dist_ts/http/router/proxy-router.d.ts +0 -115
- package/dist_ts/http/router/proxy-router.js +0 -325
- package/dist_ts/http/router/route-router.d.ts +0 -108
- package/dist_ts/http/router/route-router.js +0 -393
- package/dist_ts/protocols/tls/constants.d.ts +0 -122
- package/dist_ts/protocols/tls/constants.js +0 -135
- package/dist_ts/protocols/tls/parser.d.ts +0 -53
- package/dist_ts/protocols/tls/parser.js +0 -294
- package/dist_ts/protocols/tls/types.d.ts +0 -65
- package/dist_ts/protocols/tls/types.js +0 -5
- package/dist_ts/proxies/http-proxy/certificate-manager.d.ts +0 -95
- package/dist_ts/proxies/http-proxy/certificate-manager.js +0 -214
- package/dist_ts/proxies/http-proxy/connection-pool.d.ts +0 -47
- package/dist_ts/proxies/http-proxy/connection-pool.js +0 -195
- package/dist_ts/proxies/http-proxy/context-creator.d.ts +0 -34
- package/dist_ts/proxies/http-proxy/context-creator.js +0 -108
- package/dist_ts/proxies/http-proxy/default-certificates.d.ts +0 -54
- package/dist_ts/proxies/http-proxy/default-certificates.js +0 -127
- package/dist_ts/proxies/http-proxy/function-cache.d.ts +0 -95
- package/dist_ts/proxies/http-proxy/function-cache.js +0 -215
- package/dist_ts/proxies/http-proxy/handlers/index.d.ts +0 -4
- package/dist_ts/proxies/http-proxy/handlers/index.js +0 -6
- package/dist_ts/proxies/http-proxy/handlers/redirect-handler.d.ts +0 -18
- package/dist_ts/proxies/http-proxy/handlers/redirect-handler.js +0 -78
- package/dist_ts/proxies/http-proxy/handlers/static-handler.d.ts +0 -19
- package/dist_ts/proxies/http-proxy/handlers/static-handler.js +0 -211
- package/dist_ts/proxies/http-proxy/http-proxy.d.ts +0 -117
- package/dist_ts/proxies/http-proxy/http-proxy.js +0 -521
- package/dist_ts/proxies/http-proxy/http-request-handler.d.ts +0 -40
- package/dist_ts/proxies/http-proxy/http-request-handler.js +0 -257
- package/dist_ts/proxies/http-proxy/http2-request-handler.d.ts +0 -24
- package/dist_ts/proxies/http-proxy/http2-request-handler.js +0 -201
- package/dist_ts/proxies/http-proxy/index.d.ts +0 -14
- package/dist_ts/proxies/http-proxy/index.js +0 -16
- package/dist_ts/proxies/http-proxy/models/http-types.d.ts +0 -117
- package/dist_ts/proxies/http-proxy/models/http-types.js +0 -92
- package/dist_ts/proxies/http-proxy/models/index.d.ts +0 -5
- package/dist_ts/proxies/http-proxy/models/index.js +0 -6
- package/dist_ts/proxies/http-proxy/models/types.d.ts +0 -75
- package/dist_ts/proxies/http-proxy/models/types.js +0 -35
- package/dist_ts/proxies/http-proxy/request-handler.d.ts +0 -97
- package/dist_ts/proxies/http-proxy/request-handler.js +0 -737
- package/dist_ts/proxies/http-proxy/security-manager.d.ts +0 -98
- package/dist_ts/proxies/http-proxy/security-manager.js +0 -341
- package/dist_ts/proxies/http-proxy/websocket-handler.d.ts +0 -50
- package/dist_ts/proxies/http-proxy/websocket-handler.js +0 -505
- package/dist_ts/proxies/nftables-proxy/index.d.ts +0 -6
- package/dist_ts/proxies/nftables-proxy/index.js +0 -7
- package/dist_ts/proxies/nftables-proxy/models/errors.d.ts +0 -15
- package/dist_ts/proxies/nftables-proxy/models/errors.js +0 -28
- package/dist_ts/proxies/nftables-proxy/models/index.d.ts +0 -5
- package/dist_ts/proxies/nftables-proxy/models/index.js +0 -6
- package/dist_ts/proxies/nftables-proxy/models/interfaces.d.ts +0 -75
- package/dist_ts/proxies/nftables-proxy/models/interfaces.js +0 -5
- package/dist_ts/proxies/nftables-proxy/nftables-proxy.d.ts +0 -124
- package/dist_ts/proxies/nftables-proxy/nftables-proxy.js +0 -1374
- package/dist_ts/proxies/nftables-proxy/utils/index.d.ts +0 -9
- package/dist_ts/proxies/nftables-proxy/utils/index.js +0 -12
- package/dist_ts/proxies/nftables-proxy/utils/nft-command-executor.d.ts +0 -66
- package/dist_ts/proxies/nftables-proxy/utils/nft-command-executor.js +0 -131
- package/dist_ts/proxies/nftables-proxy/utils/nft-port-spec-normalizer.d.ts +0 -39
- package/dist_ts/proxies/nftables-proxy/utils/nft-port-spec-normalizer.js +0 -112
- package/dist_ts/proxies/nftables-proxy/utils/nft-rule-validator.d.ts +0 -59
- package/dist_ts/proxies/nftables-proxy/utils/nft-rule-validator.js +0 -130
- package/dist_ts/proxies/smart-proxy/acme-state-manager.d.ts +0 -42
- package/dist_ts/proxies/smart-proxy/acme-state-manager.js +0 -101
- package/dist_ts/proxies/smart-proxy/cert-store.d.ts +0 -10
- package/dist_ts/proxies/smart-proxy/cert-store.js +0 -72
- package/dist_ts/proxies/smart-proxy/certificate-manager.d.ts +0 -164
- package/dist_ts/proxies/smart-proxy/certificate-manager.js +0 -745
- package/dist_ts/proxies/smart-proxy/connection-manager.d.ts +0 -128
- package/dist_ts/proxies/smart-proxy/connection-manager.js +0 -689
- package/dist_ts/proxies/smart-proxy/http-proxy-bridge.d.ts +0 -43
- package/dist_ts/proxies/smart-proxy/http-proxy-bridge.js +0 -180
- package/dist_ts/proxies/smart-proxy/metrics-collector.d.ts +0 -98
- package/dist_ts/proxies/smart-proxy/metrics-collector.js +0 -355
- package/dist_ts/proxies/smart-proxy/nftables-manager.d.ts +0 -82
- package/dist_ts/proxies/smart-proxy/nftables-manager.js +0 -237
- package/dist_ts/proxies/smart-proxy/port-manager.d.ts +0 -117
- package/dist_ts/proxies/smart-proxy/port-manager.js +0 -318
- package/dist_ts/proxies/smart-proxy/route-connection-handler.d.ts +0 -60
- package/dist_ts/proxies/smart-proxy/route-connection-handler.js +0 -1407
- package/dist_ts/proxies/smart-proxy/route-manager.d.ts +0 -112
- package/dist_ts/proxies/smart-proxy/route-manager.js +0 -453
- package/dist_ts/proxies/smart-proxy/route-orchestrator.d.ts +0 -56
- package/dist_ts/proxies/smart-proxy/route-orchestrator.js +0 -204
- package/dist_ts/proxies/smart-proxy/rust-binary-locator.d.ts +0 -23
- package/dist_ts/proxies/smart-proxy/rust-binary-locator.js +0 -104
- package/dist_ts/proxies/smart-proxy/security-manager.d.ts +0 -74
- package/dist_ts/proxies/smart-proxy/security-manager.js +0 -227
- package/dist_ts/proxies/smart-proxy/throughput-tracker.d.ts +0 -36
- package/dist_ts/proxies/smart-proxy/throughput-tracker.js +0 -115
- package/dist_ts/proxies/smart-proxy/timeout-manager.d.ts +0 -48
- package/dist_ts/proxies/smart-proxy/timeout-manager.js +0 -158
- package/dist_ts/proxies/smart-proxy/tls-manager.d.ts +0 -50
- package/dist_ts/proxies/smart-proxy/tls-manager.js +0 -110
- package/dist_ts/proxies/smart-proxy/utils/route-patterns.d.ts +0 -161
- package/dist_ts/proxies/smart-proxy/utils/route-patterns.js +0 -282
- package/dist_ts/proxies/smart-proxy/utils/route-validators.d.ts +0 -73
- package/dist_ts/proxies/smart-proxy/utils/route-validators.js +0 -259
- package/dist_ts/routing/router/proxy-router.d.ts +0 -115
- package/dist_ts/routing/router/proxy-router.js +0 -325
- package/dist_ts/routing/router/route-router.d.ts +0 -108
- package/dist_ts/routing/router/route-router.js +0 -393
- package/dist_ts/tls/alerts/index.d.ts +0 -4
- package/dist_ts/tls/alerts/index.js +0 -5
- package/dist_ts/tls/alerts/tls-alert.d.ts +0 -150
- package/dist_ts/tls/alerts/tls-alert.js +0 -226
- package/dist_ts/tls/sni/client-hello-parser.d.ts +0 -100
- package/dist_ts/tls/sni/client-hello-parser.js +0 -464
- package/dist_ts/tls/sni/sni-extraction.d.ts +0 -58
- package/dist_ts/tls/sni/sni-extraction.js +0 -275
- package/dist_ts/tls/utils/index.d.ts +0 -4
- package/dist_ts/tls/utils/index.js +0 -5
- package/dist_ts/tls/utils/tls-utils.d.ts +0 -49
- package/dist_ts/tls/utils/tls-utils.js +0 -75
- package/ts/proxies/nftables-proxy/index.ts +0 -6
- package/ts/proxies/nftables-proxy/models/errors.ts +0 -30
- package/ts/proxies/nftables-proxy/models/index.ts +0 -5
- package/ts/proxies/nftables-proxy/models/interfaces.ts +0 -94
- package/ts/proxies/nftables-proxy/nftables-proxy.ts +0 -1754
- package/ts/proxies/nftables-proxy/utils/index.ts +0 -38
- package/ts/proxies/nftables-proxy/utils/nft-command-executor.ts +0 -162
- package/ts/proxies/nftables-proxy/utils/nft-port-spec-normalizer.ts +0 -125
- package/ts/proxies/nftables-proxy/utils/nft-rule-validator.ts +0 -156
- 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
|
-
}
|