@push.rocks/smartproxy 23.0.0 → 23.1.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.
Files changed (161) hide show
  1. package/changelog.md +17 -0
  2. package/dist_rust/{rustproxy → rustproxy_linux_amd64} +0 -0
  3. package/dist_rust/rustproxy_linux_arm64 +0 -0
  4. package/dist_ts/00_commitinfo_data.js +1 -1
  5. package/dist_ts/plugins.d.ts +2 -1
  6. package/dist_ts/plugins.js +3 -2
  7. package/dist_ts/proxies/smart-proxy/rust-proxy-bridge.d.ts +9 -21
  8. package/dist_ts/proxies/smart-proxy/rust-proxy-bridge.js +84 -212
  9. package/dist_ts/proxies/smart-proxy/smart-proxy.js +2 -3
  10. package/npmextra.json +3 -0
  11. package/package.json +13 -11
  12. package/readme.md +41 -11
  13. package/ts/00_commitinfo_data.ts +1 -1
  14. package/ts/plugins.ts +2 -0
  15. package/ts/proxies/smart-proxy/rust-proxy-bridge.ts +103 -233
  16. package/ts/proxies/smart-proxy/smart-proxy.ts +1 -2
  17. package/dist_ts/common/eventUtils.d.ts +0 -14
  18. package/dist_ts/common/eventUtils.js +0 -20
  19. package/dist_ts/common/types.d.ts +0 -82
  20. package/dist_ts/common/types.js +0 -15
  21. package/dist_ts/core/utils/event-system.d.ts +0 -200
  22. package/dist_ts/core/utils/event-system.js +0 -224
  23. package/dist_ts/core/utils/event-utils.d.ts +0 -15
  24. package/dist_ts/core/utils/event-utils.js +0 -11
  25. package/dist_ts/core/utils/route-manager.d.ts +0 -88
  26. package/dist_ts/core/utils/route-manager.js +0 -342
  27. package/dist_ts/core/utils/route-utils.d.ts +0 -28
  28. package/dist_ts/core/utils/route-utils.js +0 -67
  29. package/dist_ts/detection/detectors/http-detector-v2.d.ts +0 -33
  30. package/dist_ts/detection/detectors/http-detector-v2.js +0 -87
  31. package/dist_ts/detection/detectors/tls-detector-v2.d.ts +0 -33
  32. package/dist_ts/detection/detectors/tls-detector-v2.js +0 -80
  33. package/dist_ts/detection/protocol-detector-v2.d.ts +0 -46
  34. package/dist_ts/detection/protocol-detector-v2.js +0 -116
  35. package/dist_ts/forwarding/config/forwarding-types.d.ts +0 -42
  36. package/dist_ts/forwarding/config/forwarding-types.js +0 -18
  37. package/dist_ts/forwarding/config/index.d.ts +0 -9
  38. package/dist_ts/forwarding/config/index.js +0 -10
  39. package/dist_ts/forwarding/factory/forwarding-factory.d.ts +0 -25
  40. package/dist_ts/forwarding/factory/forwarding-factory.js +0 -172
  41. package/dist_ts/forwarding/factory/index.d.ts +0 -4
  42. package/dist_ts/forwarding/factory/index.js +0 -5
  43. package/dist_ts/forwarding/handlers/base-handler.d.ts +0 -62
  44. package/dist_ts/forwarding/handlers/base-handler.js +0 -121
  45. package/dist_ts/forwarding/handlers/http-handler.d.ts +0 -30
  46. package/dist_ts/forwarding/handlers/http-handler.js +0 -143
  47. package/dist_ts/forwarding/handlers/https-passthrough-handler.d.ts +0 -29
  48. package/dist_ts/forwarding/handlers/https-passthrough-handler.js +0 -156
  49. package/dist_ts/forwarding/handlers/https-terminate-to-http-handler.d.ts +0 -36
  50. package/dist_ts/forwarding/handlers/https-terminate-to-http-handler.js +0 -276
  51. package/dist_ts/forwarding/handlers/https-terminate-to-https-handler.d.ts +0 -35
  52. package/dist_ts/forwarding/handlers/https-terminate-to-https-handler.js +0 -261
  53. package/dist_ts/forwarding/handlers/index.d.ts +0 -8
  54. package/dist_ts/forwarding/handlers/index.js +0 -9
  55. package/dist_ts/forwarding/index.d.ts +0 -13
  56. package/dist_ts/forwarding/index.js +0 -16
  57. package/dist_ts/http/index.d.ts +0 -5
  58. package/dist_ts/http/index.js +0 -8
  59. package/dist_ts/http/models/http-types.d.ts +0 -6
  60. package/dist_ts/http/models/http-types.js +0 -7
  61. package/dist_ts/http/router/index.d.ts +0 -8
  62. package/dist_ts/http/router/index.js +0 -7
  63. package/dist_ts/http/router/proxy-router.d.ts +0 -115
  64. package/dist_ts/http/router/proxy-router.js +0 -325
  65. package/dist_ts/http/router/route-router.d.ts +0 -108
  66. package/dist_ts/http/router/route-router.js +0 -393
  67. package/dist_ts/protocols/tls/constants.d.ts +0 -122
  68. package/dist_ts/protocols/tls/constants.js +0 -135
  69. package/dist_ts/protocols/tls/parser.d.ts +0 -53
  70. package/dist_ts/protocols/tls/parser.js +0 -294
  71. package/dist_ts/protocols/tls/types.d.ts +0 -65
  72. package/dist_ts/protocols/tls/types.js +0 -5
  73. package/dist_ts/proxies/http-proxy/certificate-manager.d.ts +0 -95
  74. package/dist_ts/proxies/http-proxy/certificate-manager.js +0 -214
  75. package/dist_ts/proxies/http-proxy/connection-pool.d.ts +0 -47
  76. package/dist_ts/proxies/http-proxy/connection-pool.js +0 -195
  77. package/dist_ts/proxies/http-proxy/context-creator.d.ts +0 -34
  78. package/dist_ts/proxies/http-proxy/context-creator.js +0 -108
  79. package/dist_ts/proxies/http-proxy/default-certificates.d.ts +0 -54
  80. package/dist_ts/proxies/http-proxy/default-certificates.js +0 -127
  81. package/dist_ts/proxies/http-proxy/function-cache.d.ts +0 -95
  82. package/dist_ts/proxies/http-proxy/function-cache.js +0 -215
  83. package/dist_ts/proxies/http-proxy/handlers/index.d.ts +0 -4
  84. package/dist_ts/proxies/http-proxy/handlers/index.js +0 -6
  85. package/dist_ts/proxies/http-proxy/handlers/redirect-handler.d.ts +0 -18
  86. package/dist_ts/proxies/http-proxy/handlers/redirect-handler.js +0 -78
  87. package/dist_ts/proxies/http-proxy/handlers/static-handler.d.ts +0 -19
  88. package/dist_ts/proxies/http-proxy/handlers/static-handler.js +0 -211
  89. package/dist_ts/proxies/http-proxy/http-proxy.d.ts +0 -117
  90. package/dist_ts/proxies/http-proxy/http-proxy.js +0 -521
  91. package/dist_ts/proxies/http-proxy/http-request-handler.d.ts +0 -40
  92. package/dist_ts/proxies/http-proxy/http-request-handler.js +0 -257
  93. package/dist_ts/proxies/http-proxy/http2-request-handler.d.ts +0 -24
  94. package/dist_ts/proxies/http-proxy/http2-request-handler.js +0 -201
  95. package/dist_ts/proxies/http-proxy/index.d.ts +0 -14
  96. package/dist_ts/proxies/http-proxy/index.js +0 -16
  97. package/dist_ts/proxies/http-proxy/models/http-types.d.ts +0 -117
  98. package/dist_ts/proxies/http-proxy/models/http-types.js +0 -92
  99. package/dist_ts/proxies/http-proxy/models/index.d.ts +0 -5
  100. package/dist_ts/proxies/http-proxy/models/index.js +0 -6
  101. package/dist_ts/proxies/http-proxy/models/types.d.ts +0 -75
  102. package/dist_ts/proxies/http-proxy/models/types.js +0 -35
  103. package/dist_ts/proxies/http-proxy/request-handler.d.ts +0 -97
  104. package/dist_ts/proxies/http-proxy/request-handler.js +0 -737
  105. package/dist_ts/proxies/http-proxy/security-manager.d.ts +0 -98
  106. package/dist_ts/proxies/http-proxy/security-manager.js +0 -341
  107. package/dist_ts/proxies/http-proxy/websocket-handler.d.ts +0 -50
  108. package/dist_ts/proxies/http-proxy/websocket-handler.js +0 -505
  109. package/dist_ts/proxies/smart-proxy/acme-state-manager.d.ts +0 -42
  110. package/dist_ts/proxies/smart-proxy/acme-state-manager.js +0 -101
  111. package/dist_ts/proxies/smart-proxy/cert-store.d.ts +0 -10
  112. package/dist_ts/proxies/smart-proxy/cert-store.js +0 -72
  113. package/dist_ts/proxies/smart-proxy/certificate-manager.d.ts +0 -164
  114. package/dist_ts/proxies/smart-proxy/certificate-manager.js +0 -745
  115. package/dist_ts/proxies/smart-proxy/connection-manager.d.ts +0 -128
  116. package/dist_ts/proxies/smart-proxy/connection-manager.js +0 -689
  117. package/dist_ts/proxies/smart-proxy/http-proxy-bridge.d.ts +0 -43
  118. package/dist_ts/proxies/smart-proxy/http-proxy-bridge.js +0 -180
  119. package/dist_ts/proxies/smart-proxy/metrics-collector.d.ts +0 -98
  120. package/dist_ts/proxies/smart-proxy/metrics-collector.js +0 -355
  121. package/dist_ts/proxies/smart-proxy/nftables-manager.d.ts +0 -82
  122. package/dist_ts/proxies/smart-proxy/nftables-manager.js +0 -237
  123. package/dist_ts/proxies/smart-proxy/port-manager.d.ts +0 -117
  124. package/dist_ts/proxies/smart-proxy/port-manager.js +0 -318
  125. package/dist_ts/proxies/smart-proxy/route-connection-handler.d.ts +0 -60
  126. package/dist_ts/proxies/smart-proxy/route-connection-handler.js +0 -1407
  127. package/dist_ts/proxies/smart-proxy/route-manager.d.ts +0 -112
  128. package/dist_ts/proxies/smart-proxy/route-manager.js +0 -453
  129. package/dist_ts/proxies/smart-proxy/route-orchestrator.d.ts +0 -56
  130. package/dist_ts/proxies/smart-proxy/route-orchestrator.js +0 -204
  131. package/dist_ts/proxies/smart-proxy/rust-binary-locator.d.ts +0 -23
  132. package/dist_ts/proxies/smart-proxy/rust-binary-locator.js +0 -104
  133. package/dist_ts/proxies/smart-proxy/security-manager.d.ts +0 -74
  134. package/dist_ts/proxies/smart-proxy/security-manager.js +0 -227
  135. package/dist_ts/proxies/smart-proxy/throughput-tracker.d.ts +0 -36
  136. package/dist_ts/proxies/smart-proxy/throughput-tracker.js +0 -115
  137. package/dist_ts/proxies/smart-proxy/timeout-manager.d.ts +0 -48
  138. package/dist_ts/proxies/smart-proxy/timeout-manager.js +0 -158
  139. package/dist_ts/proxies/smart-proxy/tls-manager.d.ts +0 -50
  140. package/dist_ts/proxies/smart-proxy/tls-manager.js +0 -110
  141. package/dist_ts/proxies/smart-proxy/utils/route-patterns.d.ts +0 -161
  142. package/dist_ts/proxies/smart-proxy/utils/route-patterns.js +0 -282
  143. package/dist_ts/proxies/smart-proxy/utils/route-validators.d.ts +0 -73
  144. package/dist_ts/proxies/smart-proxy/utils/route-validators.js +0 -259
  145. package/dist_ts/routing/router/proxy-router.d.ts +0 -115
  146. package/dist_ts/routing/router/proxy-router.js +0 -325
  147. package/dist_ts/routing/router/route-router.d.ts +0 -108
  148. package/dist_ts/routing/router/route-router.js +0 -393
  149. package/dist_ts/tls/alerts/index.d.ts +0 -4
  150. package/dist_ts/tls/alerts/index.js +0 -5
  151. package/dist_ts/tls/alerts/tls-alert.d.ts +0 -150
  152. package/dist_ts/tls/alerts/tls-alert.js +0 -226
  153. package/dist_ts/tls/sni/client-hello-parser.d.ts +0 -100
  154. package/dist_ts/tls/sni/client-hello-parser.js +0 -464
  155. package/dist_ts/tls/sni/sni-extraction.d.ts +0 -58
  156. package/dist_ts/tls/sni/sni-extraction.js +0 -275
  157. package/dist_ts/tls/utils/index.d.ts +0 -4
  158. package/dist_ts/tls/utils/index.js +0 -5
  159. package/dist_ts/tls/utils/tls-utils.d.ts +0 -49
  160. package/dist_ts/tls/utils/tls-utils.js +0 -75
  161. package/ts/proxies/smart-proxy/rust-binary-locator.ts +0 -112
@@ -1,117 +0,0 @@
1
- import * as plugins from '../../../plugins.js';
2
- import { HttpStatus as ProtocolHttpStatus } from '../../../protocols/http/index.js';
3
- /**
4
- * HTTP-specific event types
5
- */
6
- export declare enum HttpEvents {
7
- REQUEST_RECEIVED = "request-received",
8
- REQUEST_FORWARDED = "request-forwarded",
9
- REQUEST_HANDLED = "request-handled",
10
- REQUEST_ERROR = "request-error"
11
- }
12
- export declare const HttpStatus: {
13
- readonly OK: ProtocolHttpStatus.OK;
14
- readonly MOVED_PERMANENTLY: ProtocolHttpStatus.MOVED_PERMANENTLY;
15
- readonly FOUND: ProtocolHttpStatus.FOUND;
16
- readonly TEMPORARY_REDIRECT: ProtocolHttpStatus.TEMPORARY_REDIRECT;
17
- readonly PERMANENT_REDIRECT: ProtocolHttpStatus.PERMANENT_REDIRECT;
18
- readonly BAD_REQUEST: ProtocolHttpStatus.BAD_REQUEST;
19
- readonly UNAUTHORIZED: ProtocolHttpStatus.UNAUTHORIZED;
20
- readonly FORBIDDEN: ProtocolHttpStatus.FORBIDDEN;
21
- readonly NOT_FOUND: ProtocolHttpStatus.NOT_FOUND;
22
- readonly METHOD_NOT_ALLOWED: ProtocolHttpStatus.METHOD_NOT_ALLOWED;
23
- readonly REQUEST_TIMEOUT: ProtocolHttpStatus.REQUEST_TIMEOUT;
24
- readonly TOO_MANY_REQUESTS: ProtocolHttpStatus.TOO_MANY_REQUESTS;
25
- readonly INTERNAL_SERVER_ERROR: ProtocolHttpStatus.INTERNAL_SERVER_ERROR;
26
- readonly NOT_IMPLEMENTED: ProtocolHttpStatus.NOT_IMPLEMENTED;
27
- readonly BAD_GATEWAY: ProtocolHttpStatus.BAD_GATEWAY;
28
- readonly SERVICE_UNAVAILABLE: ProtocolHttpStatus.SERVICE_UNAVAILABLE;
29
- readonly GATEWAY_TIMEOUT: ProtocolHttpStatus.GATEWAY_TIMEOUT;
30
- };
31
- /**
32
- * Base error class for HTTP-related errors
33
- */
34
- export declare class HttpError extends Error {
35
- readonly statusCode: number;
36
- constructor(message: string, statusCode?: number);
37
- }
38
- /**
39
- * Error related to certificate operations
40
- */
41
- export declare class CertificateError extends HttpError {
42
- readonly domain: string;
43
- readonly isRenewal: boolean;
44
- constructor(message: string, domain: string, isRenewal?: boolean);
45
- }
46
- /**
47
- * Error related to server operations
48
- */
49
- export declare class ServerError extends HttpError {
50
- readonly code?: string;
51
- constructor(message: string, code?: string, statusCode?: number);
52
- }
53
- /**
54
- * Error for bad requests
55
- */
56
- export declare class BadRequestError extends HttpError {
57
- constructor(message: string);
58
- }
59
- /**
60
- * Error for not found resources
61
- */
62
- export declare class NotFoundError extends HttpError {
63
- constructor(message?: string);
64
- }
65
- /**
66
- * Redirect configuration for HTTP requests
67
- */
68
- export interface IRedirectConfig {
69
- source: string;
70
- destination: string;
71
- type: number;
72
- preserveQuery?: boolean;
73
- }
74
- /**
75
- * HTTP router configuration
76
- */
77
- export interface IRouterConfig {
78
- routes: Array<{
79
- path: string;
80
- method?: string;
81
- handler: (req: plugins.http.IncomingMessage, res: plugins.http.ServerResponse) => void | Promise<void>;
82
- }>;
83
- notFoundHandler?: (req: plugins.http.IncomingMessage, res: plugins.http.ServerResponse) => void;
84
- errorHandler?: (error: Error, req: plugins.http.IncomingMessage, res: plugins.http.ServerResponse) => void;
85
- }
86
- /**
87
- * HTTP request method types
88
- */
89
- export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE';
90
- /**
91
- * Helper function to get HTTP status text
92
- */
93
- export declare function getStatusText(status: number): string;
94
- export interface IDomainOptions {
95
- domainName: string;
96
- sslRedirect: boolean;
97
- acmeMaintenance: boolean;
98
- forward?: {
99
- ip: string;
100
- port: number;
101
- };
102
- acmeForward?: {
103
- ip: string;
104
- port: number;
105
- };
106
- }
107
- export interface IDomainCertificate {
108
- options: IDomainOptions;
109
- certObtained: boolean;
110
- obtainingInProgress: boolean;
111
- certificate?: string;
112
- privateKey?: string;
113
- expiryDate?: Date;
114
- lastRenewalAttempt?: Date;
115
- }
116
- export { HttpError as Port80HandlerError };
117
- export { CertificateError as CertError };
@@ -1,92 +0,0 @@
1
- import * as plugins from '../../../plugins.js';
2
- // Import from protocols for consistent status codes
3
- import { HttpStatus as ProtocolHttpStatus, getStatusText as getProtocolStatusText } from '../../../protocols/http/index.js';
4
- /**
5
- * HTTP-specific event types
6
- */
7
- export var HttpEvents;
8
- (function (HttpEvents) {
9
- HttpEvents["REQUEST_RECEIVED"] = "request-received";
10
- HttpEvents["REQUEST_FORWARDED"] = "request-forwarded";
11
- HttpEvents["REQUEST_HANDLED"] = "request-handled";
12
- HttpEvents["REQUEST_ERROR"] = "request-error";
13
- })(HttpEvents || (HttpEvents = {}));
14
- // Re-export for backward compatibility with subset of commonly used codes
15
- export const HttpStatus = {
16
- OK: ProtocolHttpStatus.OK,
17
- MOVED_PERMANENTLY: ProtocolHttpStatus.MOVED_PERMANENTLY,
18
- FOUND: ProtocolHttpStatus.FOUND,
19
- TEMPORARY_REDIRECT: ProtocolHttpStatus.TEMPORARY_REDIRECT,
20
- PERMANENT_REDIRECT: ProtocolHttpStatus.PERMANENT_REDIRECT,
21
- BAD_REQUEST: ProtocolHttpStatus.BAD_REQUEST,
22
- UNAUTHORIZED: ProtocolHttpStatus.UNAUTHORIZED,
23
- FORBIDDEN: ProtocolHttpStatus.FORBIDDEN,
24
- NOT_FOUND: ProtocolHttpStatus.NOT_FOUND,
25
- METHOD_NOT_ALLOWED: ProtocolHttpStatus.METHOD_NOT_ALLOWED,
26
- REQUEST_TIMEOUT: ProtocolHttpStatus.REQUEST_TIMEOUT,
27
- TOO_MANY_REQUESTS: ProtocolHttpStatus.TOO_MANY_REQUESTS,
28
- INTERNAL_SERVER_ERROR: ProtocolHttpStatus.INTERNAL_SERVER_ERROR,
29
- NOT_IMPLEMENTED: ProtocolHttpStatus.NOT_IMPLEMENTED,
30
- BAD_GATEWAY: ProtocolHttpStatus.BAD_GATEWAY,
31
- SERVICE_UNAVAILABLE: ProtocolHttpStatus.SERVICE_UNAVAILABLE,
32
- GATEWAY_TIMEOUT: ProtocolHttpStatus.GATEWAY_TIMEOUT,
33
- };
34
- /**
35
- * Base error class for HTTP-related errors
36
- */
37
- export class HttpError extends Error {
38
- constructor(message, statusCode = HttpStatus.INTERNAL_SERVER_ERROR) {
39
- super(message);
40
- this.statusCode = statusCode;
41
- this.name = 'HttpError';
42
- }
43
- }
44
- /**
45
- * Error related to certificate operations
46
- */
47
- export class CertificateError extends HttpError {
48
- constructor(message, domain, isRenewal = false) {
49
- super(`${message} for domain ${domain}${isRenewal ? ' (renewal)' : ''}`, HttpStatus.INTERNAL_SERVER_ERROR);
50
- this.domain = domain;
51
- this.isRenewal = isRenewal;
52
- this.name = 'CertificateError';
53
- }
54
- }
55
- /**
56
- * Error related to server operations
57
- */
58
- export class ServerError extends HttpError {
59
- constructor(message, code, statusCode = HttpStatus.INTERNAL_SERVER_ERROR) {
60
- super(message, statusCode);
61
- this.code = code;
62
- this.name = 'ServerError';
63
- }
64
- }
65
- /**
66
- * Error for bad requests
67
- */
68
- export class BadRequestError extends HttpError {
69
- constructor(message) {
70
- super(message, HttpStatus.BAD_REQUEST);
71
- this.name = 'BadRequestError';
72
- }
73
- }
74
- /**
75
- * Error for not found resources
76
- */
77
- export class NotFoundError extends HttpError {
78
- constructor(message = 'Resource not found') {
79
- super(message, HttpStatus.NOT_FOUND);
80
- this.name = 'NotFoundError';
81
- }
82
- }
83
- /**
84
- * Helper function to get HTTP status text
85
- */
86
- export function getStatusText(status) {
87
- return getProtocolStatusText(status);
88
- }
89
- // Backward compatibility exports
90
- export { HttpError as Port80HandlerError };
91
- export { CertificateError as CertError };
92
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaHR0cC10eXBlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3RzL3Byb3hpZXMvaHR0cC1wcm94eS9tb2RlbHMvaHR0cC10eXBlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLHFCQUFxQixDQUFDO0FBQy9DLG9EQUFvRDtBQUNwRCxPQUFPLEVBQUUsVUFBVSxJQUFJLGtCQUFrQixFQUFFLGFBQWEsSUFBSSxxQkFBcUIsRUFBRSxNQUFNLGtDQUFrQyxDQUFDO0FBRTVIOztHQUVHO0FBQ0gsTUFBTSxDQUFOLElBQVksVUFLWDtBQUxELFdBQVksVUFBVTtJQUNwQixtREFBcUMsQ0FBQTtJQUNyQyxxREFBdUMsQ0FBQTtJQUN2QyxpREFBbUMsQ0FBQTtJQUNuQyw2Q0FBK0IsQ0FBQTtBQUNqQyxDQUFDLEVBTFcsVUFBVSxLQUFWLFVBQVUsUUFLckI7QUFHRCwwRUFBMEU7QUFDMUUsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLEVBQUUsRUFBRSxrQkFBa0IsQ0FBQyxFQUFFO0lBQ3pCLGlCQUFpQixFQUFFLGtCQUFrQixDQUFDLGlCQUFpQjtJQUN2RCxLQUFLLEVBQUUsa0JBQWtCLENBQUMsS0FBSztJQUMvQixrQkFBa0IsRUFBRSxrQkFBa0IsQ0FBQyxrQkFBa0I7SUFDekQsa0JBQWtCLEVBQ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BQU8scUJBQXFCLENBQUMsTUFBNEIsQ0FBQyxDQUFDO0FBQzdELENBQUM7QUFxQkQsaUNBQWlDO0FBQ2pDLE9BQU8sRUFBRSxTQUFTLElBQUksa0JBQWtCLEVBQUUsQ0FBQztBQUMzQyxPQUFPLEVBQUUsZ0JBQWdCLElBQUksU0FBUyxFQUFFLENBQUMifQ==
@@ -1,5 +0,0 @@
1
- /**
2
- * HttpProxy models
3
- */
4
- export * from './types.js';
5
- export * from './http-types.js';
@@ -1,6 +0,0 @@
1
- /**
2
- * HttpProxy models
3
- */
4
- export * from './types.js';
5
- export * from './http-types.js';
6
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi90cy9wcm94aWVzL2h0dHAtcHJveHkvbW9kZWxzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsY0FBYyxZQUFZLENBQUM7QUFDM0IsY0FBYyxpQkFBaUIsQ0FBQyJ9
@@ -1,75 +0,0 @@
1
- import * as plugins from '../../../plugins.js';
2
- export interface IAcmeOptions {
3
- enabled: boolean;
4
- email?: string;
5
- accountEmail?: string;
6
- port?: number;
7
- certificateStore?: string;
8
- environment?: 'production' | 'staging';
9
- useProduction?: boolean;
10
- renewThresholdDays?: number;
11
- autoRenew?: boolean;
12
- skipConfiguredCerts?: boolean;
13
- }
14
- import type { IRouteConfig } from '../../smart-proxy/models/route-types.js';
15
- /**
16
- * Configuration options for HttpProxy
17
- */
18
- export interface IHttpProxyOptions {
19
- port: number;
20
- maxConnections?: number;
21
- keepAliveTimeout?: number;
22
- headersTimeout?: number;
23
- logLevel?: 'error' | 'warn' | 'info' | 'debug';
24
- cors?: {
25
- allowOrigin?: string;
26
- allowMethods?: string;
27
- allowHeaders?: string;
28
- maxAge?: number;
29
- };
30
- connectionPoolSize?: number;
31
- portProxyIntegration?: boolean;
32
- backendProtocol?: 'http1' | 'http2';
33
- functionCacheSize?: number;
34
- functionCacheTtl?: number;
35
- acme?: IAcmeOptions;
36
- routes?: IRouteConfig[];
37
- maxConnectionsPerIP?: number;
38
- connectionRateLimitPerMinute?: number;
39
- }
40
- /**
41
- * Interface for a certificate entry in the cache
42
- */
43
- export interface ICertificateEntry {
44
- key: string;
45
- cert: string;
46
- expires?: Date;
47
- }
48
- /**
49
- * Interface for connection tracking in the pool
50
- */
51
- export interface IConnectionEntry {
52
- socket: plugins.net.Socket;
53
- lastUsed: number;
54
- isIdle: boolean;
55
- }
56
- /**
57
- * WebSocket with heartbeat interface
58
- */
59
- export interface IWebSocketWithHeartbeat extends plugins.wsDefault {
60
- lastPong: number;
61
- isAlive: boolean;
62
- }
63
- /**
64
- * Logger interface for consistent logging across components
65
- */
66
- export interface ILogger {
67
- debug(message: string, data?: any): void;
68
- info(message: string, data?: any): void;
69
- warn(message: string, data?: any): void;
70
- error(message: string, data?: any): void;
71
- }
72
- /**
73
- * Creates a logger based on the specified log level
74
- */
75
- export declare function createLogger(logLevel?: string): ILogger;
@@ -1,35 +0,0 @@
1
- import * as plugins from '../../../plugins.js';
2
- /**
3
- * Creates a logger based on the specified log level
4
- */
5
- export function createLogger(logLevel = 'info') {
6
- const logLevels = {
7
- error: 0,
8
- warn: 1,
9
- info: 2,
10
- debug: 3
11
- };
12
- return {
13
- debug: (message, data) => {
14
- if (logLevels[logLevel] >= logLevels.debug) {
15
- console.log(`[DEBUG] ${message}`, data || '');
16
- }
17
- },
18
- info: (message, data) => {
19
- if (logLevels[logLevel] >= logLevels.info) {
20
- console.log(`[INFO] ${message}`, data || '');
21
- }
22
- },
23
- warn: (message, data) => {
24
- if (logLevels[logLevel] >= logLevels.warn) {
25
- console.warn(`[WARN] ${message}`, data || '');
26
- }
27
- },
28
- error: (message, data) => {
29
- if (logLevels[logLevel] >= logLevels.error) {
30
- console.error(`[ERROR] ${message}`, data || '');
31
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xDQUFDLE9BQWUsRUFBRSxJQUFVLEVBQUUsRUFBRTtZQUNwQyxJQUFJLFNBQVMsQ0FBQyxRQUFRLENBQUMsSUFBSSxTQUFTLENBQUMsSUFBSSxFQUFFLENBQUM7Z0JBQzFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsVUFBVSxPQUFPLEVBQUUsRUFBRSxJQUFJLElBQUksRUFBRSxDQUFDLENBQUM7WUFDaEQsQ0FBQztRQUNILENBQUM7UUFDRCxLQUFLLEVBQUUsQ0FBQyxPQUFlLEVBQUUsSUFBVSxFQUFFLEVBQUU7WUFDckMsSUFBSSxTQUFTLENBQUMsUUFBUSxDQUFDLElBQUksU0FBUyxDQUFDLEtBQUssRUFBRSxDQUFDO2dCQUMzQyxPQUFPLENBQUMsS0FBSyxDQUFDLFdBQVcsT0FBTyxFQUFFLEVBQUUsSUFBSSxJQUFJLEVBQUUsQ0FBQyxDQUFDO1lBQ2xELENBQUM7UUFDSCxDQUFDO0tBQ0YsQ0FBQztBQUNKLENBQUMifQ==
@@ -1,97 +0,0 @@
1
- import * as plugins from '../../plugins.js';
2
- import '../../core/models/socket-augmentation.js';
3
- import { type IHttpProxyOptions } from './models/types.js';
4
- import { SharedRouteManager as RouteManager } from '../../core/routing/route-manager.js';
5
- import { ConnectionPool } from './connection-pool.js';
6
- import { SecurityManager } from './security-manager.js';
7
- /**
8
- * Interface for tracking metrics
9
- */
10
- export interface IMetricsTracker {
11
- incrementRequestsServed(): void;
12
- incrementFailedRequests(): void;
13
- }
14
- export type MetricsTracker = IMetricsTracker;
15
- /**
16
- * Handles HTTP request processing and proxying
17
- */
18
- export declare class RequestHandler {
19
- private options;
20
- private connectionPool;
21
- private routeManager?;
22
- private functionCache?;
23
- private router?;
24
- private defaultHeaders;
25
- private logger;
26
- private metricsTracker;
27
- private h2Sessions;
28
- private contextCreator;
29
- securityManager: SecurityManager;
30
- private rateLimitCleanupInterval;
31
- constructor(options: IHttpProxyOptions, connectionPool: ConnectionPool, routeManager?: RouteManager, functionCache?: any, // FunctionCache - using any to avoid circular dependency
32
- router?: any);
33
- /**
34
- * Set the route manager instance
35
- */
36
- setRouteManager(routeManager: RouteManager): void;
37
- /**
38
- * Set the metrics tracker instance
39
- */
40
- setMetricsTracker(tracker: IMetricsTracker): void;
41
- /**
42
- * Set default headers to be included in all responses
43
- */
44
- setDefaultHeaders(headers: {
45
- [key: string]: string;
46
- }): void;
47
- /**
48
- * Get all default headers
49
- */
50
- getDefaultHeaders(): {
51
- [key: string]: string;
52
- };
53
- /**
54
- * Select the appropriate target from the targets array based on sub-matching criteria
55
- */
56
- private selectTarget;
57
- /**
58
- * Apply CORS headers to response if configured
59
- * Implements Phase 5.5: Context-aware CORS handling
60
- *
61
- * @param res The server response to apply headers to
62
- * @param req The incoming request
63
- * @param route Optional route config with CORS settings
64
- */
65
- private applyCorsHeaders;
66
- /**
67
- * Apply default headers to response
68
- */
69
- private applyDefaultHeaders;
70
- /**
71
- * Apply URL rewriting based on route configuration
72
- * Implements Phase 5.2: URL rewriting using route context
73
- *
74
- * @param req The request with the URL to rewrite
75
- * @param route The route configuration containing rewrite rules
76
- * @param routeContext Context for template variable resolution
77
- * @returns True if URL was rewritten, false otherwise
78
- */
79
- private applyUrlRewriting;
80
- /**
81
- * Apply header modifications from route configuration
82
- * Implements Phase 5.1: Route-based header manipulation
83
- */
84
- private applyRouteHeaderModifications;
85
- /**
86
- * Handle an HTTP request
87
- */
88
- handleRequest(req: plugins.http.IncomingMessage, res: plugins.http.ServerResponse): Promise<void>;
89
- /**
90
- * Handle HTTP/2 stream requests with function-based target support
91
- */
92
- handleHttp2(stream: plugins.http2.ServerHttp2Stream, headers: plugins.http2.IncomingHttpHeaders): Promise<void>;
93
- /**
94
- * Cleanup resources and stop intervals
95
- */
96
- destroy(): void;
97
- }