@push.rocks/smartproxy 3.34.0 → 3.37.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.
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartproxy',
6
- version: '3.34.0',
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.'
6
+ version: '3.37.1',
7
+ description: 'A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, dynamic routing with authentication options, and automatic ACME certificate management.'
8
8
  };
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx3QkFBd0I7SUFDOUIsT0FBTyxFQUFFLFFBQVE7SUFDakIsV0FBVyxFQUFFLDRMQUE0TDtDQUMxTSxDQUFBIn0=
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx3QkFBd0I7SUFDOUIsT0FBTyxFQUFFLFFBQVE7SUFDakIsV0FBVyxFQUFFLG1PQUFtTztDQUNqUCxDQUFBIn0=
@@ -14,6 +14,16 @@ export interface INetworkProxyOptions {
14
14
  };
15
15
  connectionPoolSize?: number;
16
16
  portProxyIntegration?: boolean;
17
+ acme?: {
18
+ enabled?: boolean;
19
+ port?: number;
20
+ contactEmail?: string;
21
+ useProduction?: boolean;
22
+ renewThresholdDays?: number;
23
+ autoRenew?: boolean;
24
+ certificateStore?: string;
25
+ skipConfiguredCerts?: boolean;
26
+ };
17
27
  }
18
28
  export declare class NetworkProxy {
19
29
  options: INetworkProxyOptions;
@@ -37,7 +47,10 @@ export declare class NetworkProxy {
37
47
  private connectionPoolCleanupInterval;
38
48
  private defaultCertificates;
39
49
  private certificateCache;
50
+ private certManager;
51
+ private certificateStoreDir;
40
52
  private connectionPool;
53
+ private roundRobinPositions;
41
54
  /**
42
55
  * Creates a new NetworkProxy instance
43
56
  */
@@ -76,6 +89,37 @@ export declare class NetworkProxy {
76
89
  * Return a connection to the pool for reuse
77
90
  */
78
91
  private returnConnectionToPool;
92
+ /**
93
+ * Initializes the ACME certificate manager for automatic certificate issuance
94
+ * @private
95
+ */
96
+ private initializeAcmeManager;
97
+ /**
98
+ * Registers domains from proxy configs with the ACME manager
99
+ * @private
100
+ */
101
+ private registerDomainsWithAcmeManager;
102
+ /**
103
+ * Handles newly issued or renewed certificates from ACME manager
104
+ * @private
105
+ */
106
+ private handleCertificateIssued;
107
+ /**
108
+ * Handles certificate issuance failures
109
+ * @private
110
+ */
111
+ private handleCertificateFailed;
112
+ /**
113
+ * Saves certificate and private key to the filesystem
114
+ * @private
115
+ */
116
+ private saveCertificateToStore;
117
+ /**
118
+ * Handles SNI (Server Name Indication) for TLS connections
119
+ * Used by the HTTPS server to select the correct certificate for each domain
120
+ * @private
121
+ */
122
+ private handleSNI;
79
123
  /**
80
124
  * Starts the proxy server
81
125
  */
@@ -137,10 +181,36 @@ export declare class NetworkProxy {
137
181
  * Sends an error response to the client
138
182
  */
139
183
  private sendErrorResponse;
184
+ /**
185
+ * Selects a destination IP from the array using round-robin
186
+ * @param config The proxy configuration
187
+ * @returns A destination IP address
188
+ */
189
+ private selectDestinationIp;
190
+ /**
191
+ * Selects a destination port from the array using round-robin
192
+ * @param config The proxy configuration
193
+ * @returns A destination port number
194
+ */
195
+ private selectDestinationPort;
140
196
  /**
141
197
  * Updates proxy configurations
142
198
  */
143
199
  updateProxyConfigs(proxyConfigsArg: plugins.tsclass.network.IReverseProxyConfig[]): Promise<void>;
200
+ /**
201
+ * Converts PortProxy domain configurations to NetworkProxy configs
202
+ * @param domainConfigs PortProxy domain configs
203
+ * @param sslKeyPair Default SSL key pair to use if not specified
204
+ * @returns Array of NetworkProxy configs
205
+ */
206
+ convertPortProxyConfigs(domainConfigs: Array<{
207
+ domains: string[];
208
+ targetIPs?: string[];
209
+ allowedIPs?: string[];
210
+ }>, sslKeyPair?: {
211
+ key: string;
212
+ cert: string;
213
+ }): plugins.tsclass.network.IReverseProxyConfig[];
144
214
  /**
145
215
  * Adds default headers to be included in all responses
146
216
  */
@@ -151,6 +221,21 @@ export declare class NetworkProxy {
151
221
  * Stops the proxy server
152
222
  */
153
223
  stop(): Promise<void>;
224
+ /**
225
+ * Requests a new certificate for a domain
226
+ * This can be used to manually trigger certificate issuance
227
+ * @param domain The domain to request a certificate for
228
+ * @returns A promise that resolves when the request is submitted (not when the certificate is issued)
229
+ */
230
+ requestCertificate(domain: string): Promise<boolean>;
231
+ /**
232
+ * Updates the certificate cache for a domain
233
+ * @param domain The domain name
234
+ * @param certificate The certificate (PEM format)
235
+ * @param privateKey The private key (PEM format)
236
+ * @param expiryDate Optional expiry date
237
+ */
238
+ private updateCertificateCache;
154
239
  /**
155
240
  * Logs a message according to the configured log level
156
241
  */