@push.rocks/smartproxy 3.24.0 → 3.25.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.
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartproxy',
6
- version: '3.24.0',
6
+ version: '3.25.0',
7
7
  description: 'A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, and dynamic routing with authentication options.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx3QkFBd0I7SUFDOUIsT0FBTyxFQUFFLFFBQVE7SUFDakIsV0FBVyxFQUFFLDRMQUE0TDtDQUMxTSxDQUFBIn0=
@@ -9,7 +9,11 @@ export interface IDomainConfig {
9
9
  from: number;
10
10
  to: number;
11
11
  }>;
12
+ httpTimeout?: number;
13
+ wsTimeout?: number;
12
14
  }
15
+ /** Connection protocol types for timeout management */
16
+ export type ProtocolType = 'http' | 'websocket' | 'https' | 'tls' | 'unknown';
13
17
  /** Port proxy settings including global allowed port ranges */
14
18
  export interface IPortProxySettings extends plugins.tls.TlsOptions {
15
19
  fromPort: number;
@@ -20,18 +24,29 @@ export interface IPortProxySettings extends plugins.tls.TlsOptions {
20
24
  defaultAllowedIPs?: string[];
21
25
  defaultBlockedIPs?: string[];
22
26
  preserveSourceIP?: boolean;
27
+ initialDataTimeout?: number;
28
+ socketTimeout?: number;
29
+ inactivityCheckInterval?: number;
23
30
  maxConnectionLifetime?: number;
31
+ httpConnectionTimeout?: number;
32
+ wsConnectionTimeout?: number;
33
+ httpKeepAliveTimeout?: number;
34
+ gracefulShutdownTimeout?: number;
24
35
  globalPortRanges: Array<{
25
36
  from: number;
26
37
  to: number;
27
38
  }>;
28
39
  forwardAllGlobalRanges?: boolean;
29
- gracefulShutdownTimeout?: number;
30
40
  noDelay?: boolean;
31
41
  keepAlive?: boolean;
32
42
  keepAliveInitialDelay?: number;
33
43
  maxPendingDataSize?: number;
34
- initialDataTimeout?: number;
44
+ disableInactivityCheck?: boolean;
45
+ enableKeepAliveProbes?: boolean;
46
+ enableProtocolDetection?: boolean;
47
+ enableDetailedLogging?: boolean;
48
+ maxConnectionsPerIP?: number;
49
+ connectionRateLimitPerMinute?: number;
35
50
  }
36
51
  export declare class PortProxy {
37
52
  private netServers;
@@ -41,8 +56,41 @@ export declare class PortProxy {
41
56
  private isShuttingDown;
42
57
  private domainTargetIndices;
43
58
  private terminationStats;
59
+ private connectionsByIP;
60
+ private connectionRateByIP;
44
61
  constructor(settingsArg: IPortProxySettings);
62
+ /**
63
+ * Get connections count by IP
64
+ */
65
+ private getConnectionCountByIP;
66
+ /**
67
+ * Check and update connection rate for an IP
68
+ */
69
+ private checkConnectionRate;
70
+ /**
71
+ * Track connection by IP
72
+ */
73
+ private trackConnectionByIP;
74
+ /**
75
+ * Remove connection tracking for an IP
76
+ */
77
+ private removeConnectionByIP;
78
+ /**
79
+ * Track connection termination statistic
80
+ */
45
81
  private incrementTerminationStat;
82
+ /**
83
+ * Get protocol-specific timeout based on connection type
84
+ */
85
+ private getProtocolTimeout;
86
+ /**
87
+ * Detect protocol and update connection record
88
+ */
89
+ private detectProtocol;
90
+ /**
91
+ * Parse HTTP headers for keep-alive and other connection info
92
+ */
93
+ private parseHttpHeaders;
46
94
  /**
47
95
  * Cleans up a connection record.
48
96
  * Destroys both incoming and outgoing sockets, clears timers, and removes the record.
@@ -50,8 +98,20 @@ export declare class PortProxy {
50
98
  * @param reason - Optional reason for cleanup (for logging)
51
99
  */
52
100
  private cleanupConnection;
101
+ /**
102
+ * Update connection activity timestamp
103
+ */
53
104
  private updateActivity;
105
+ /**
106
+ * Get target IP with round-robin support
107
+ */
54
108
  private getTargetIP;
109
+ /**
110
+ * Main method to start the proxy
111
+ */
55
112
  start(): Promise<void>;
113
+ /**
114
+ * Gracefully shut down the proxy
115
+ */
56
116
  stop(): Promise<void>;
57
117
  }