@push.rocks/smartproxy 7.1.2 → 10.0.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.
- package/dist_ts/00_commitinfo_data.js +2 -2
- package/dist_ts/classes.router.d.ts +9 -10
- package/dist_ts/classes.router.js +3 -5
- package/dist_ts/common/acmeFactory.d.ts +9 -0
- package/dist_ts/common/acmeFactory.js +20 -0
- package/dist_ts/common/eventUtils.d.ts +15 -0
- package/dist_ts/common/eventUtils.js +19 -0
- package/dist_ts/common/types.d.ts +82 -0
- package/dist_ts/common/types.js +17 -0
- package/dist_ts/networkproxy/classes.np.certificatemanager.js +23 -19
- package/dist_ts/networkproxy/classes.np.networkproxy.d.ts +1 -0
- package/dist_ts/networkproxy/classes.np.networkproxy.js +5 -1
- package/dist_ts/networkproxy/classes.np.types.d.ts +5 -10
- package/dist_ts/networkproxy/classes.np.types.js +1 -1
- package/dist_ts/plugins.d.ts +6 -3
- package/dist_ts/plugins.js +7 -4
- package/dist_ts/port80handler/classes.port80handler.d.ts +14 -111
- package/dist_ts/port80handler/classes.port80handler.js +94 -373
- package/dist_ts/smartproxy/classes.pp.certprovisioner.d.ts +54 -0
- package/dist_ts/smartproxy/classes.pp.certprovisioner.js +166 -0
- package/dist_ts/smartproxy/classes.pp.interfaces.d.ts +11 -33
- package/dist_ts/smartproxy/classes.pp.networkproxybridge.d.ts +5 -0
- package/dist_ts/smartproxy/classes.pp.networkproxybridge.js +21 -11
- package/dist_ts/smartproxy/classes.pp.portrangemanager.js +1 -11
- package/dist_ts/smartproxy/classes.smartproxy.d.ts +3 -5
- package/dist_ts/smartproxy/classes.smartproxy.js +94 -180
- package/package.json +12 -10
- package/readme.hints.md +64 -1
- package/readme.md +253 -408
- package/readme.plan.md +29 -0
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.router.ts +13 -15
- package/ts/common/acmeFactory.ts +23 -0
- package/ts/common/eventUtils.ts +34 -0
- package/ts/common/types.ts +89 -0
- package/ts/networkproxy/classes.np.certificatemanager.ts +23 -19
- package/ts/networkproxy/classes.np.networkproxy.ts +4 -0
- package/ts/networkproxy/classes.np.types.ts +6 -10
- package/ts/plugins.ts +17 -4
- package/ts/port80handler/classes.port80handler.ts +108 -509
- package/ts/smartproxy/classes.pp.certprovisioner.ts +188 -0
- package/ts/smartproxy/classes.pp.interfaces.ts +13 -36
- package/ts/smartproxy/classes.pp.networkproxybridge.ts +22 -10
- package/ts/smartproxy/classes.pp.portrangemanager.ts +0 -10
- package/ts/smartproxy/classes.smartproxy.ts +103 -195
package/dist_ts/plugins.d.ts
CHANGED
|
@@ -13,10 +13,13 @@ import * as smartdelay from '@push.rocks/smartdelay';
|
|
|
13
13
|
import * as smartpromise from '@push.rocks/smartpromise';
|
|
14
14
|
import * as smartrequest from '@push.rocks/smartrequest';
|
|
15
15
|
import * as smartstring from '@push.rocks/smartstring';
|
|
16
|
-
|
|
17
|
-
import * as
|
|
16
|
+
import * as smartacme from '@push.rocks/smartacme';
|
|
17
|
+
import * as smartacmePlugins from '@push.rocks/smartacme/dist_ts/smartacme.plugins.js';
|
|
18
|
+
import * as smartacmeHandlers from '@push.rocks/smartacme/dist_ts/handlers/index.js';
|
|
19
|
+
import * as taskbuffer from '@push.rocks/taskbuffer';
|
|
20
|
+
export { lik, smartdelay, smartrequest, smartpromise, smartstring, smartacme, smartacmePlugins, smartacmeHandlers, taskbuffer, };
|
|
18
21
|
import prettyMs from 'pretty-ms';
|
|
19
22
|
import * as ws from 'ws';
|
|
20
23
|
import wsDefault from 'ws';
|
|
21
24
|
import { minimatch } from 'minimatch';
|
|
22
|
-
export {
|
|
25
|
+
export { prettyMs, ws, wsDefault, minimatch };
|
package/dist_ts/plugins.js
CHANGED
|
@@ -16,12 +16,15 @@ import * as smartdelay from '@push.rocks/smartdelay';
|
|
|
16
16
|
import * as smartpromise from '@push.rocks/smartpromise';
|
|
17
17
|
import * as smartrequest from '@push.rocks/smartrequest';
|
|
18
18
|
import * as smartstring from '@push.rocks/smartstring';
|
|
19
|
-
|
|
19
|
+
import * as smartacme from '@push.rocks/smartacme';
|
|
20
|
+
import * as smartacmePlugins from '@push.rocks/smartacme/dist_ts/smartacme.plugins.js';
|
|
21
|
+
import * as smartacmeHandlers from '@push.rocks/smartacme/dist_ts/handlers/index.js';
|
|
22
|
+
import * as taskbuffer from '@push.rocks/taskbuffer';
|
|
23
|
+
export { lik, smartdelay, smartrequest, smartpromise, smartstring, smartacme, smartacmePlugins, smartacmeHandlers, taskbuffer, };
|
|
20
24
|
// third party scope
|
|
21
|
-
import * as acme from 'acme-client';
|
|
22
25
|
import prettyMs from 'pretty-ms';
|
|
23
26
|
import * as ws from 'ws';
|
|
24
27
|
import wsDefault from 'ws';
|
|
25
28
|
import { minimatch } from 'minimatch';
|
|
26
|
-
export {
|
|
27
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
29
|
+
export { prettyMs, ws, wsDefault, minimatch };
|
|
30
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3BsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsb0JBQW9CO0FBQ3BCLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxRQUFRLENBQUM7QUFDdEMsT0FBTyxLQUFLLElBQUksTUFBTSxNQUFNLENBQUM7QUFDN0IsT0FBTyxLQUFLLEtBQUssTUFBTSxPQUFPLENBQUM7QUFDL0IsT0FBTyxLQUFLLEdBQUcsTUFBTSxLQUFLLENBQUM7QUFDM0IsT0FBTyxLQUFLLEdBQUcsTUFBTSxLQUFLLENBQUM7QUFDM0IsT0FBTyxLQUFLLEdBQUcsTUFBTSxLQUFLLENBQUM7QUFDM0IsT0FBTyxLQUFLLEtBQUssTUFBTSxPQUFPLENBQUM7QUFFL0IsT0FBTyxFQUFFLFlB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0QyxPQUFPLEVBQUUsUUFBUSxFQUFFLEVBQUUsRUFBRSxTQUFTLEVBQUUsU0FBUyxFQUFFLENBQUMifQ==
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as plugins from '../plugins.js';
|
|
2
|
+
import type { IDomainOptions, ICertificateData, IAcmeOptions } from '../common/types.js';
|
|
2
3
|
/**
|
|
3
4
|
* Custom error classes for better error handling
|
|
4
5
|
*/
|
|
@@ -14,92 +15,25 @@ export declare class ServerError extends Port80HandlerError {
|
|
|
14
15
|
readonly code?: string;
|
|
15
16
|
constructor(message: string, code?: string);
|
|
16
17
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Domain forwarding configuration
|
|
19
|
-
*/
|
|
20
|
-
export interface IForwardConfig {
|
|
21
|
-
ip: string;
|
|
22
|
-
port: number;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Domain configuration options
|
|
26
|
-
*/
|
|
27
|
-
export interface IDomainOptions {
|
|
28
|
-
domainName: string;
|
|
29
|
-
sslRedirect: boolean;
|
|
30
|
-
acmeMaintenance: boolean;
|
|
31
|
-
forward?: IForwardConfig;
|
|
32
|
-
acmeForward?: IForwardConfig;
|
|
33
|
-
}
|
|
34
18
|
/**
|
|
35
19
|
* Configuration options for the Port80Handler
|
|
36
20
|
*/
|
|
37
|
-
interface IPort80HandlerOptions {
|
|
38
|
-
port?: number;
|
|
39
|
-
contactEmail?: string;
|
|
40
|
-
useProduction?: boolean;
|
|
41
|
-
renewThresholdDays?: number;
|
|
42
|
-
httpsRedirectPort?: number;
|
|
43
|
-
renewCheckIntervalHours?: number;
|
|
44
|
-
enabled?: boolean;
|
|
45
|
-
autoRenew?: boolean;
|
|
46
|
-
certificateStore?: string;
|
|
47
|
-
skipConfiguredCerts?: boolean;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Certificate data that can be emitted via events or set from outside
|
|
51
|
-
*/
|
|
52
|
-
export interface ICertificateData {
|
|
53
|
-
domain: string;
|
|
54
|
-
certificate: string;
|
|
55
|
-
privateKey: string;
|
|
56
|
-
expiryDate: Date;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Events emitted by the Port80Handler
|
|
60
|
-
*/
|
|
61
|
-
export declare enum Port80HandlerEvents {
|
|
62
|
-
CERTIFICATE_ISSUED = "certificate-issued",
|
|
63
|
-
CERTIFICATE_RENEWED = "certificate-renewed",
|
|
64
|
-
CERTIFICATE_FAILED = "certificate-failed",
|
|
65
|
-
CERTIFICATE_EXPIRING = "certificate-expiring",
|
|
66
|
-
MANAGER_STARTED = "manager-started",
|
|
67
|
-
MANAGER_STOPPED = "manager-stopped",
|
|
68
|
-
REQUEST_FORWARDED = "request-forwarded"
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Certificate failure payload type
|
|
72
|
-
*/
|
|
73
|
-
export interface ICertificateFailure {
|
|
74
|
-
domain: string;
|
|
75
|
-
error: string;
|
|
76
|
-
isRenewal: boolean;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Certificate expiry payload type
|
|
80
|
-
*/
|
|
81
|
-
export interface ICertificateExpiring {
|
|
82
|
-
domain: string;
|
|
83
|
-
expiryDate: Date;
|
|
84
|
-
daysRemaining: number;
|
|
85
|
-
}
|
|
86
21
|
/**
|
|
87
22
|
* Port80Handler with ACME certificate management and request forwarding capabilities
|
|
88
23
|
* Now with glob pattern support for domain matching
|
|
89
24
|
*/
|
|
90
25
|
export declare class Port80Handler extends plugins.EventEmitter {
|
|
91
26
|
private domainCertificates;
|
|
27
|
+
private acmeHttp01Storage;
|
|
28
|
+
private smartAcme;
|
|
92
29
|
private server;
|
|
93
|
-
private acmeClient;
|
|
94
|
-
private accountKey;
|
|
95
|
-
private renewalTimer;
|
|
96
30
|
private isShuttingDown;
|
|
97
31
|
private options;
|
|
98
32
|
/**
|
|
99
33
|
* Creates a new Port80Handler
|
|
100
34
|
* @param options Configuration options
|
|
101
35
|
*/
|
|
102
|
-
constructor(options?:
|
|
36
|
+
constructor(options?: IAcmeOptions);
|
|
103
37
|
/**
|
|
104
38
|
* Starts the HTTP server for ACME challenges
|
|
105
39
|
*/
|
|
@@ -131,19 +65,6 @@ export declare class Port80Handler extends plugins.EventEmitter {
|
|
|
131
65
|
* @param domain The domain to get the certificate for
|
|
132
66
|
*/
|
|
133
67
|
getCertificate(domain: string): ICertificateData | null;
|
|
134
|
-
/**
|
|
135
|
-
* Saves a certificate to the filesystem store
|
|
136
|
-
* @param domain The domain for the certificate
|
|
137
|
-
* @param certificate The certificate (PEM format)
|
|
138
|
-
* @param privateKey The private key (PEM format)
|
|
139
|
-
* @private
|
|
140
|
-
*/
|
|
141
|
-
private saveCertificateToStore;
|
|
142
|
-
/**
|
|
143
|
-
* Loads certificates from the certificate store
|
|
144
|
-
* @private
|
|
145
|
-
*/
|
|
146
|
-
private loadCertificatesFromStore;
|
|
147
68
|
/**
|
|
148
69
|
* Check if a domain is a glob pattern
|
|
149
70
|
* @param domain Domain to check
|
|
@@ -163,11 +84,6 @@ export declare class Port80Handler extends plugins.EventEmitter {
|
|
|
163
84
|
* @returns True if the domain matches the pattern
|
|
164
85
|
*/
|
|
165
86
|
private domainMatchesPattern;
|
|
166
|
-
/**
|
|
167
|
-
* Lazy initialization of the ACME client
|
|
168
|
-
* @returns An ACME client instance
|
|
169
|
-
*/
|
|
170
|
-
private getAcmeClient;
|
|
171
87
|
/**
|
|
172
88
|
* Handles incoming HTTP requests
|
|
173
89
|
* @param req The HTTP request
|
|
@@ -182,34 +98,17 @@ export declare class Port80Handler extends plugins.EventEmitter {
|
|
|
182
98
|
* @param requestType Type of request for logging
|
|
183
99
|
*/
|
|
184
100
|
private forwardRequest;
|
|
185
|
-
/**
|
|
186
|
-
* Serves the ACME HTTP-01 challenge response
|
|
187
|
-
* @param req The HTTP request
|
|
188
|
-
* @param res The HTTP response
|
|
189
|
-
* @param domain The domain for the challenge
|
|
190
|
-
*/
|
|
191
|
-
private handleAcmeChallenge;
|
|
192
101
|
/**
|
|
193
102
|
* Obtains a certificate for a domain using ACME HTTP-01 challenge
|
|
194
103
|
* @param domain The domain to obtain a certificate for
|
|
195
104
|
* @param isRenewal Whether this is a renewal attempt
|
|
196
105
|
*/
|
|
197
|
-
private obtainCertificate;
|
|
198
|
-
/**
|
|
199
|
-
* Process ACME authorizations by verifying and completing challenges
|
|
200
|
-
* @param client ACME client
|
|
201
|
-
* @param domain Domain name
|
|
202
|
-
* @param authorizations Authorizations to process
|
|
203
|
-
*/
|
|
204
|
-
private processAuthorizations;
|
|
205
|
-
/**
|
|
206
|
-
* Starts the certificate renewal timer
|
|
207
|
-
*/
|
|
208
|
-
private startRenewalTimer;
|
|
209
106
|
/**
|
|
210
|
-
*
|
|
107
|
+
* Obtains a certificate for a domain using SmartAcme HTTP-01 challenges
|
|
108
|
+
* @param domain The domain to obtain a certificate for
|
|
109
|
+
* @param isRenewal Whether this is a renewal attempt
|
|
211
110
|
*/
|
|
212
|
-
private
|
|
111
|
+
private obtainCertificate;
|
|
213
112
|
/**
|
|
214
113
|
* Extract expiry date from certificate using a more robust approach
|
|
215
114
|
* @param certificate Certificate PEM string
|
|
@@ -255,6 +154,10 @@ export declare class Port80Handler extends plugins.EventEmitter {
|
|
|
255
154
|
* Gets configuration details
|
|
256
155
|
* @returns Current configuration
|
|
257
156
|
*/
|
|
258
|
-
getConfig(): Required<
|
|
157
|
+
getConfig(): Required<IAcmeOptions>;
|
|
158
|
+
/**
|
|
159
|
+
* Request a certificate renewal for a specific domain.
|
|
160
|
+
* @param domain The domain to renew.
|
|
161
|
+
*/
|
|
162
|
+
renewCertificate(domain: string): Promise<void>;
|
|
259
163
|
}
|
|
260
|
-
export {};
|