@push.rocks/smartproxy 3.28.5 → 3.29.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.
@@ -1,4 +1,5 @@
1
1
  import * as plugins from './plugins.js';
2
+ import { NetworkProxy } from './classes.networkproxy.js';
2
3
  /** Domain configuration with per-domain allowed port ranges */
3
4
  export interface IDomainConfig {
4
5
  domains: string[];
@@ -10,6 +11,8 @@ export interface IDomainConfig {
10
11
  to: number;
11
12
  }>;
12
13
  connectionTimeout?: number;
14
+ useNetworkProxy?: boolean;
15
+ networkProxyIndex?: number;
13
16
  }
14
17
  /** Port proxy settings including global allowed port ranges */
15
18
  export interface IPortProxySettings extends plugins.tls.TlsOptions {
@@ -43,6 +46,10 @@ export interface IPortProxySettings extends plugins.tls.TlsOptions {
43
46
  enableRandomizedTimeouts?: boolean;
44
47
  maxConnectionsPerIP?: number;
45
48
  connectionRateLimitPerMinute?: number;
49
+ keepAliveTreatment?: 'standard' | 'extended' | 'immortal';
50
+ keepAliveInactivityMultiplier?: number;
51
+ extendedKeepAliveLifetime?: number;
52
+ networkProxies?: NetworkProxy[];
46
53
  }
47
54
  export declare class PortProxy {
48
55
  private netServers;
@@ -54,7 +61,23 @@ export declare class PortProxy {
54
61
  private terminationStats;
55
62
  private connectionsByIP;
56
63
  private connectionRateByIP;
64
+ private networkProxies;
57
65
  constructor(settingsArg: IPortProxySettings);
66
+ /**
67
+ * Forwards a TLS connection to a NetworkProxy for handling
68
+ * @param connectionId - Unique connection identifier
69
+ * @param socket - The incoming client socket
70
+ * @param record - The connection record
71
+ * @param domainConfig - The domain configuration
72
+ * @param initialData - Initial data chunk (TLS ClientHello)
73
+ * @param serverName - SNI hostname (if available)
74
+ */
75
+ private forwardToNetworkProxy;
76
+ /**
77
+ * Sets up a direct connection to the target (original behavior)
78
+ * This is used when NetworkProxy isn't configured or as a fallback
79
+ */
80
+ private setupDirectConnection;
58
81
  /**
59
82
  * Get connections count by IP
60
83
  */
@@ -75,10 +98,6 @@ export declare class PortProxy {
75
98
  * Track connection termination statistic
76
99
  */
77
100
  private incrementTerminationStat;
78
- /**
79
- * Get connection timeout based on domain config or default settings
80
- */
81
- private getConnectionTimeout;
82
101
  /**
83
102
  * Cleans up a connection record.
84
103
  * Destroys both incoming and outgoing sockets, clears timers, and removes the record.
@@ -94,10 +113,30 @@ export declare class PortProxy {
94
113
  * Get target IP with round-robin support
95
114
  */
96
115
  private getTargetIP;
116
+ /**
117
+ * Initiates cleanup once for a connection
118
+ */
119
+ private initiateCleanupOnce;
120
+ /**
121
+ * Creates a generic error handler for incoming or outgoing sockets
122
+ */
123
+ private handleError;
124
+ /**
125
+ * Creates a generic close handler for incoming or outgoing sockets
126
+ */
127
+ private handleClose;
97
128
  /**
98
129
  * Main method to start the proxy
99
130
  */
100
131
  start(): Promise<void>;
132
+ /**
133
+ * Add or replace NetworkProxy instances
134
+ */
135
+ setNetworkProxies(networkProxies: NetworkProxy[]): void;
136
+ /**
137
+ * Get a list of configured NetworkProxy instances
138
+ */
139
+ getNetworkProxies(): NetworkProxy[];
101
140
  /**
102
141
  * Gracefully shut down the proxy
103
142
  */