@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.
@@ -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 {
@@ -46,6 +49,7 @@ export interface IPortProxySettings extends plugins.tls.TlsOptions {
46
49
  keepAliveTreatment?: 'standard' | 'extended' | 'immortal';
47
50
  keepAliveInactivityMultiplier?: number;
48
51
  extendedKeepAliveLifetime?: number;
52
+ networkProxies?: NetworkProxy[];
49
53
  }
50
54
  export declare class PortProxy {
51
55
  private netServers;
@@ -57,7 +61,23 @@ export declare class PortProxy {
57
61
  private terminationStats;
58
62
  private connectionsByIP;
59
63
  private connectionRateByIP;
64
+ private networkProxies;
60
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;
61
81
  /**
62
82
  * Get connections count by IP
63
83
  */
@@ -97,10 +117,26 @@ export declare class PortProxy {
97
117
  * Initiates cleanup once for a connection
98
118
  */
99
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;
100
128
  /**
101
129
  * Main method to start the proxy
102
130
  */
103
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[];
104
140
  /**
105
141
  * Gracefully shut down the proxy
106
142
  */