@push.rocks/smartproxy 3.28.6 → 3.29.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.
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.iptablesproxy.d.ts +79 -7
- package/dist_ts/classes.iptablesproxy.js +662 -67
- package/dist_ts/classes.networkproxy.d.ts +46 -1
- package/dist_ts/classes.networkproxy.js +347 -8
- package/dist_ts/classes.portproxy.d.ts +36 -0
- package/dist_ts/classes.portproxy.js +464 -365
- package/package.json +2 -2
- package/readme.md +80 -10
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.iptablesproxy.ts +786 -68
- package/ts/classes.networkproxy.ts +417 -7
- package/ts/classes.portproxy.ts +652 -485
|
@@ -12,6 +12,8 @@ export interface INetworkProxyOptions {
|
|
|
12
12
|
allowHeaders?: string;
|
|
13
13
|
maxAge?: number;
|
|
14
14
|
};
|
|
15
|
+
connectionPoolSize?: number;
|
|
16
|
+
portProxyIntegration?: boolean;
|
|
15
17
|
}
|
|
16
18
|
export declare class NetworkProxy {
|
|
17
19
|
options: INetworkProxyOptions;
|
|
@@ -28,10 +30,14 @@ export declare class NetworkProxy {
|
|
|
28
30
|
startTime: number;
|
|
29
31
|
requestsServed: number;
|
|
30
32
|
failedRequests: number;
|
|
33
|
+
private portProxyConnections;
|
|
34
|
+
private tlsTerminatedConnections;
|
|
31
35
|
private heartbeatInterval;
|
|
32
36
|
private metricsInterval;
|
|
37
|
+
private connectionPoolCleanupInterval;
|
|
33
38
|
private defaultCertificates;
|
|
34
39
|
private certificateCache;
|
|
40
|
+
private connectionPool;
|
|
35
41
|
/**
|
|
36
42
|
* Creates a new NetworkProxy instance
|
|
37
43
|
*/
|
|
@@ -40,6 +46,36 @@ export declare class NetworkProxy {
|
|
|
40
46
|
* Loads default certificates from the filesystem
|
|
41
47
|
*/
|
|
42
48
|
private loadDefaultCertificates;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the port number this NetworkProxy is listening on
|
|
51
|
+
* Useful for PortProxy to determine where to forward connections
|
|
52
|
+
*/
|
|
53
|
+
getListeningPort(): number;
|
|
54
|
+
/**
|
|
55
|
+
* Updates the server capacity settings
|
|
56
|
+
* @param maxConnections Maximum number of simultaneous connections
|
|
57
|
+
* @param keepAliveTimeout Keep-alive timeout in milliseconds
|
|
58
|
+
* @param connectionPoolSize Size of the connection pool per backend
|
|
59
|
+
*/
|
|
60
|
+
updateCapacity(maxConnections?: number, keepAliveTimeout?: number, connectionPoolSize?: number): void;
|
|
61
|
+
/**
|
|
62
|
+
* Returns current server metrics
|
|
63
|
+
* Useful for PortProxy to determine which NetworkProxy to use for load balancing
|
|
64
|
+
*/
|
|
65
|
+
getMetrics(): any;
|
|
66
|
+
/**
|
|
67
|
+
* Cleanup the connection pool by removing idle connections
|
|
68
|
+
* or reducing pool size if it exceeds the configured maximum
|
|
69
|
+
*/
|
|
70
|
+
private cleanupConnectionPool;
|
|
71
|
+
/**
|
|
72
|
+
* Get a connection from the pool or create a new one
|
|
73
|
+
*/
|
|
74
|
+
private getConnectionFromPool;
|
|
75
|
+
/**
|
|
76
|
+
* Return a connection to the pool for reuse
|
|
77
|
+
*/
|
|
78
|
+
private returnConnectionToPool;
|
|
43
79
|
/**
|
|
44
80
|
* Starts the proxy server
|
|
45
81
|
*/
|
|
@@ -56,6 +92,10 @@ export declare class NetworkProxy {
|
|
|
56
92
|
* Sets up metrics collection
|
|
57
93
|
*/
|
|
58
94
|
private setupMetricsCollection;
|
|
95
|
+
/**
|
|
96
|
+
* Sets up connection pool cleanup
|
|
97
|
+
*/
|
|
98
|
+
private setupConnectionPoolCleanup;
|
|
59
99
|
/**
|
|
60
100
|
* Handles an incoming WebSocket connection
|
|
61
101
|
*/
|
|
@@ -73,7 +113,12 @@ export declare class NetworkProxy {
|
|
|
73
113
|
*/
|
|
74
114
|
private authenticateRequest;
|
|
75
115
|
/**
|
|
76
|
-
* Forwards a request to the destination
|
|
116
|
+
* Forwards a request to the destination using connection pool
|
|
117
|
+
* for optimized connection reuse from PortProxy
|
|
118
|
+
*/
|
|
119
|
+
private forwardRequestUsingConnectionPool;
|
|
120
|
+
/**
|
|
121
|
+
* Forwards a request to the destination (standard method)
|
|
77
122
|
*/
|
|
78
123
|
private forwardRequest;
|
|
79
124
|
/**
|