@push.rocks/smartproxy 3.26.0 → 3.28.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.26.0',
6
+ version: '3.28.1',
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=
@@ -1,37 +1,119 @@
1
- export declare class Port80Handler {
1
+ import * as plugins from './plugins.js';
2
+ /**
3
+ * Configuration options for the ACME Certificate Manager
4
+ */
5
+ interface IAcmeCertManagerOptions {
6
+ port?: number;
7
+ contactEmail?: string;
8
+ useProduction?: boolean;
9
+ renewThresholdDays?: number;
10
+ httpsRedirectPort?: number;
11
+ renewCheckIntervalHours?: number;
12
+ }
13
+ /**
14
+ * Certificate data that can be emitted via events or set from outside
15
+ */
16
+ interface ICertificateData {
17
+ domain: string;
18
+ certificate: string;
19
+ privateKey: string;
20
+ expiryDate: Date;
21
+ }
22
+ /**
23
+ * Events emitted by the ACME Certificate Manager
24
+ */
25
+ export declare enum CertManagerEvents {
26
+ CERTIFICATE_ISSUED = "certificate-issued",
27
+ CERTIFICATE_RENEWED = "certificate-renewed",
28
+ CERTIFICATE_FAILED = "certificate-failed",
29
+ CERTIFICATE_EXPIRING = "certificate-expiring",
30
+ MANAGER_STARTED = "manager-started",
31
+ MANAGER_STOPPED = "manager-stopped"
32
+ }
33
+ /**
34
+ * Improved ACME Certificate Manager with event emission and external certificate management
35
+ */
36
+ export declare class AcmeCertManager extends plugins.EventEmitter {
2
37
  private domainCertificates;
3
38
  private server;
4
39
  private acmeClient;
5
40
  private accountKey;
6
- constructor();
41
+ private renewalTimer;
42
+ private isShuttingDown;
43
+ private options;
44
+ /**
45
+ * Creates a new ACME Certificate Manager
46
+ * @param options Configuration options
47
+ */
48
+ constructor(options?: IAcmeCertManagerOptions);
7
49
  /**
8
- * Adds a domain to be managed.
9
- * @param domain The domain to add.
50
+ * Starts the HTTP server for ACME challenges
51
+ */
52
+ start(): Promise<void>;
53
+ /**
54
+ * Stops the HTTP server and renewal timer
55
+ */
56
+ stop(): Promise<void>;
57
+ /**
58
+ * Adds a domain to be managed for certificates
59
+ * @param domain The domain to add
10
60
  */
11
61
  addDomain(domain: string): void;
12
62
  /**
13
- * Removes a domain from management.
14
- * @param domain The domain to remove.
63
+ * Removes a domain from management
64
+ * @param domain The domain to remove
15
65
  */
16
66
  removeDomain(domain: string): void;
17
67
  /**
18
- * Lazy initialization of the ACME client.
19
- * Uses Let’s Encrypt’s production directory (for testing you might switch to staging).
68
+ * Sets a certificate for a domain directly (for externally obtained certificates)
69
+ * @param domain The domain for the certificate
70
+ * @param certificate The certificate (PEM format)
71
+ * @param privateKey The private key (PEM format)
72
+ * @param expiryDate Optional expiry date
73
+ */
74
+ setCertificate(domain: string, certificate: string, privateKey: string, expiryDate?: Date): void;
75
+ /**
76
+ * Gets the certificate for a domain if it exists
77
+ * @param domain The domain to get the certificate for
78
+ */
79
+ getCertificate(domain: string): ICertificateData | null;
80
+ /**
81
+ * Lazy initialization of the ACME client
82
+ * @returns An ACME client instance
20
83
  */
21
84
  private getAcmeClient;
22
85
  /**
23
- * Handles incoming HTTP requests on port 80.
24
- * If the request is for an ACME challenge, it responds with the key authorization.
25
- * If the domain has a certificate, it redirects to HTTPS; otherwise, it initiates certificate issuance.
86
+ * Handles incoming HTTP requests
87
+ * @param req The HTTP request
88
+ * @param res The HTTP response
26
89
  */
27
90
  private handleRequest;
28
91
  /**
29
- * Serves the ACME HTTP-01 challenge response.
92
+ * Serves the ACME HTTP-01 challenge response
93
+ * @param req The HTTP request
94
+ * @param res The HTTP response
95
+ * @param domain The domain for the challenge
30
96
  */
31
97
  private handleAcmeChallenge;
32
98
  /**
33
- * Uses acme-client to perform a full ACME HTTP-01 challenge to obtain a certificate.
34
- * On success, it stores the certificate and key in memory and clears challenge data.
99
+ * Obtains a certificate for a domain using ACME HTTP-01 challenge
100
+ * @param domain The domain to obtain a certificate for
101
+ * @param isRenewal Whether this is a renewal attempt
35
102
  */
36
103
  private obtainCertificate;
104
+ /**
105
+ * Starts the certificate renewal timer
106
+ */
107
+ private startRenewalTimer;
108
+ /**
109
+ * Checks for certificates that need renewal
110
+ */
111
+ private checkForRenewals;
112
+ /**
113
+ * Emits a certificate event with the certificate data
114
+ * @param eventType The event type to emit
115
+ * @param data The certificate data
116
+ */
117
+ private emitCertificateEvent;
37
118
  }
119
+ export {};