@push.rocks/smartproxy 18.1.0 → 18.2.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.
Files changed (52) hide show
  1. package/dist_ts/00_commitinfo_data.js +1 -1
  2. package/dist_ts/certificate/certificate-manager.d.ts +150 -0
  3. package/dist_ts/certificate/certificate-manager.js +505 -0
  4. package/dist_ts/certificate/events/simplified-events.d.ts +56 -0
  5. package/dist_ts/certificate/events/simplified-events.js +13 -0
  6. package/dist_ts/certificate/models/certificate-errors.d.ts +69 -0
  7. package/dist_ts/certificate/models/certificate-errors.js +141 -0
  8. package/dist_ts/certificate/models/certificate-strategy.d.ts +60 -0
  9. package/dist_ts/certificate/models/certificate-strategy.js +73 -0
  10. package/dist_ts/certificate/simplified-certificate-manager.d.ts +150 -0
  11. package/dist_ts/certificate/simplified-certificate-manager.js +501 -0
  12. package/dist_ts/http/index.d.ts +1 -9
  13. package/dist_ts/http/index.js +5 -11
  14. package/dist_ts/plugins.d.ts +3 -1
  15. package/dist_ts/plugins.js +4 -2
  16. package/dist_ts/proxies/network-proxy/network-proxy.js +3 -1
  17. package/dist_ts/proxies/network-proxy/simplified-certificate-bridge.d.ts +48 -0
  18. package/dist_ts/proxies/network-proxy/simplified-certificate-bridge.js +76 -0
  19. package/dist_ts/proxies/network-proxy/websocket-handler.js +21 -7
  20. package/dist_ts/proxies/smart-proxy/cert-store.d.ts +10 -0
  21. package/dist_ts/proxies/smart-proxy/cert-store.js +70 -0
  22. package/dist_ts/proxies/smart-proxy/certificate-manager.d.ts +116 -0
  23. package/dist_ts/proxies/smart-proxy/certificate-manager.js +401 -0
  24. package/dist_ts/proxies/smart-proxy/legacy-smart-proxy.d.ts +168 -0
  25. package/dist_ts/proxies/smart-proxy/legacy-smart-proxy.js +642 -0
  26. package/dist_ts/proxies/smart-proxy/models/route-types.d.ts +26 -0
  27. package/dist_ts/proxies/smart-proxy/models/route-types.js +1 -1
  28. package/dist_ts/proxies/smart-proxy/models/simplified-smartproxy-config.d.ts +65 -0
  29. package/dist_ts/proxies/smart-proxy/models/simplified-smartproxy-config.js +31 -0
  30. package/dist_ts/proxies/smart-proxy/models/smartproxy-options.d.ts +102 -0
  31. package/dist_ts/proxies/smart-proxy/models/smartproxy-options.js +73 -0
  32. package/dist_ts/proxies/smart-proxy/network-proxy-bridge.d.ts +10 -44
  33. package/dist_ts/proxies/smart-proxy/network-proxy-bridge.js +66 -202
  34. package/dist_ts/proxies/smart-proxy/route-connection-handler.d.ts +4 -0
  35. package/dist_ts/proxies/smart-proxy/route-connection-handler.js +62 -2
  36. package/dist_ts/proxies/smart-proxy/simplified-smart-proxy.d.ts +41 -0
  37. package/dist_ts/proxies/smart-proxy/simplified-smart-proxy.js +132 -0
  38. package/dist_ts/proxies/smart-proxy/smart-proxy.d.ts +18 -13
  39. package/dist_ts/proxies/smart-proxy/smart-proxy.js +79 -196
  40. package/package.json +5 -3
  41. package/readme.plan.md +1405 -617
  42. package/ts/00_commitinfo_data.ts +1 -1
  43. package/ts/http/index.ts +5 -12
  44. package/ts/plugins.ts +4 -1
  45. package/ts/proxies/network-proxy/network-proxy.ts +3 -0
  46. package/ts/proxies/network-proxy/websocket-handler.ts +18 -6
  47. package/ts/proxies/smart-proxy/cert-store.ts +86 -0
  48. package/ts/proxies/smart-proxy/certificate-manager.ts +506 -0
  49. package/ts/proxies/smart-proxy/models/route-types.ts +33 -3
  50. package/ts/proxies/smart-proxy/network-proxy-bridge.ts +86 -239
  51. package/ts/proxies/smart-proxy/route-connection-handler.ts +74 -1
  52. package/ts/proxies/smart-proxy/smart-proxy.ts +105 -222
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartproxy',
6
- version: '18.1.0',
6
+ version: '18.2.0',
7
7
  description: 'A powerful proxy package with unified route-based configuration for high traffic management. Features include SSL/TLS support, flexible routing patterns, WebSocket handling, advanced security options, and automatic ACME certificate management.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx3QkFBd0I7SUFDOUIsT0FBTyxFQUFFLFFBQVE7SUFDakIsV0FBVyxFQUFFLHFQQUFxUDtDQUNuUSxDQUFBIn0=
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Unified certificate manager for SmartProxy
3
+ */
4
+ import * as plugins from '../plugins.js';
5
+ import type { CertProvider } from './models/certificate-strategy.js';
6
+ import type { CertificateEventMap, ICertificateEventEmitter } from './events/certificate-events.js';
7
+ import type { IRouteConfig } from '../proxies/smart-proxy/models/route-types.js';
8
+ /**
9
+ * Certificate storage format
10
+ */
11
+ interface StoredCertificate {
12
+ domain: string;
13
+ certificate: string;
14
+ privateKey: string;
15
+ expiresAt: Date;
16
+ source: 'acme-http' | 'acme-dns' | 'static';
17
+ }
18
+ /**
19
+ * Certificate manager configuration
20
+ */
21
+ export interface CertificateManagerConfig {
22
+ certProvider: CertProvider;
23
+ acmeEmail: string;
24
+ acmeServer: 'production' | 'staging';
25
+ storageDir?: string;
26
+ renewBeforeDays?: number;
27
+ defaultCertPath?: string;
28
+ defaultKeyPath?: string;
29
+ }
30
+ /**
31
+ * Unified certificate manager
32
+ */
33
+ export declare class CertificateManager extends plugins.EventEmitter implements ICertificateEventEmitter {
34
+ private config;
35
+ private certificateCache;
36
+ private acmeClient;
37
+ private renewalTimer?;
38
+ private pendingRequests;
39
+ constructor(config: CertificateManagerConfig);
40
+ /**
41
+ * Initialize the certificate manager
42
+ */
43
+ start(): Promise<void>;
44
+ /**
45
+ * Stop the certificate manager
46
+ */
47
+ stop(): Promise<void>;
48
+ /**
49
+ * Get a certificate for a domain (main entry point)
50
+ */
51
+ getCertificate(domain: string): Promise<StoredCertificate>;
52
+ /**
53
+ * Request a new certificate
54
+ */
55
+ private requestCertificate;
56
+ /**
57
+ * Request certificate via ACME HTTP-01
58
+ */
59
+ private requestAcmeHttpCertificate;
60
+ /**
61
+ * Request certificate via ACME DNS-01
62
+ */
63
+ private requestAcmeDnsCertificate;
64
+ /**
65
+ * Renew a certificate
66
+ */
67
+ renewCertificate(domain: string): Promise<StoredCertificate>;
68
+ /**
69
+ * Check certificates for renewal
70
+ */
71
+ private checkForRenewals;
72
+ /**
73
+ * Initialize ACME client
74
+ */
75
+ private initializeAcmeClient;
76
+ /**
77
+ * Load stored certificates from disk
78
+ */
79
+ private loadStoredCertificates;
80
+ /**
81
+ * Store certificate to disk
82
+ */
83
+ private storeCertificate;
84
+ /**
85
+ * Ensure storage directory exists
86
+ */
87
+ private ensureStorageDir;
88
+ /**
89
+ * Get or create ACME account key
90
+ */
91
+ private getOrCreateAccountKey;
92
+ /**
93
+ * Generate keypair for certificate
94
+ */
95
+ private generateKeypair;
96
+ /**
97
+ * Generate CSR for domain
98
+ */
99
+ private generateCsr;
100
+ /**
101
+ * Extract expiry date from certificate
102
+ */
103
+ private extractExpiryDate;
104
+ /**
105
+ * Check if certificate is valid
106
+ */
107
+ private isCertificateValid;
108
+ /**
109
+ * Check if certificate should be renewed
110
+ */
111
+ private shouldRenew;
112
+ /**
113
+ * Check if certificate is expiring soon
114
+ */
115
+ private isExpiringSoon;
116
+ /**
117
+ * Get days remaining until expiry
118
+ */
119
+ private getDaysRemaining;
120
+ /**
121
+ * Start renewal timer
122
+ */
123
+ private startRenewalTimer;
124
+ /**
125
+ * Get default certificate for SNI fallback
126
+ */
127
+ getDefaultCertificate(): Promise<{
128
+ cert: string;
129
+ key: string;
130
+ }>;
131
+ /**
132
+ * Set up HTTP challenge responder
133
+ */
134
+ private setupHttpChallenge;
135
+ /**
136
+ * Clean up HTTP challenge
137
+ */
138
+ private cleanupHttpChallenge;
139
+ /**
140
+ * Type assertion for event emitter
141
+ */
142
+ on<K extends keyof CertificateEventMap>(event: K, listener: (data: CertificateEventMap[K]) => void): this;
143
+ off<K extends keyof CertificateEventMap>(event: K, listener: (data: CertificateEventMap[K]) => void): this;
144
+ emit<K extends keyof CertificateEventMap>(event: K, data: CertificateEventMap[K]): boolean;
145
+ /**
146
+ * Update routes (placeholder for future implementation)
147
+ */
148
+ updateRoutes(routes: IRouteConfig[]): Promise<void>;
149
+ }
150
+ export {};