782 Commits

Author SHA1 Message Date
47508eb1eb Refactor socket handling in forwarding handlers to use centralized utilities and remove deprecated functions 2025-06-01 15:35:45 +00:00
fb147148ef 19.5.18
Some checks failed
Default (tags) / security (push) Failing after 14m49s
Default (tags) / test (push) Has been cancelled
Default (tags) / release (push) Has been cancelled
Default (tags) / metadata (push) Has been cancelled
v19.5.18
2025-06-01 15:10:42 +00:00
07f5ceddc4 Implement proxy chain connection accumulation fix and add comprehensive tests
- Updated socket handling to prevent connection accumulation in chained proxies.
- Introduced centralized bidirectional forwarding for consistent socket management.
- Enhanced cleanup logic to ensure immediate closure of sockets when one closes.
- Added tests to verify connection behavior under various scenarios, including backend failures and rapid reconnections.
2025-06-01 15:10:36 +00:00
3ac3345be8 19.5.17
Some checks failed
Default (tags) / security (push) Failing after 14m51s
Default (tags) / test (push) Has been cancelled
Default (tags) / release (push) Has been cancelled
Default (tags) / metadata (push) Has been cancelled
v19.5.17
2025-06-01 14:41:23 +00:00
5b40e82c41 Add tests for connect-disconnect and error handling in SmartProxy 2025-06-01 14:41:19 +00:00
2a75a86d73 19.5.16
Some checks failed
Default (tags) / security (push) Failing after 14m53s
Default (tags) / test (push) Has been cancelled
Default (tags) / release (push) Has been cancelled
Default (tags) / metadata (push) Has been cancelled
v19.5.16
2025-06-01 14:22:23 +00:00
250eafd36c Enhance connection cleanup and error handling in RouteConnectionHandler
- Implement immediate cleanup for connection failures to prevent leaks
- Add NFTables cleanup on socket close to manage memory usage
- Fix connection limit bypass by checking record after creation
- Introduce tests for rapid connection retries and routing failures
2025-06-01 14:22:06 +00:00
facb68a9d0 19.5.15
Some checks failed
Default (tags) / security (push) Failing after 14m55s
Default (tags) / test (push) Has been cancelled
Default (tags) / release (push) Has been cancelled
Default (tags) / metadata (push) Has been cancelled
v19.5.15
2025-06-01 14:00:05 +00:00
23898c1577 19.5.14
Some checks failed
Default (tags) / security (push) Failing after 14m57s
Default (tags) / test (push) Has been cancelled
Default (tags) / release (push) Has been cancelled
Default (tags) / metadata (push) Has been cancelled
v19.5.14
2025-06-01 13:58:30 +00:00
2d240671ab Improve error handling and logging for outgoing connections in RouteConnectionHandler 2025-06-01 13:58:20 +00:00
705a59413d 19.5.13
Some checks failed
Default (tags) / security (push) Failing after 16m13s
Default (tags) / test (push) Has been cancelled
Default (tags) / release (push) Has been cancelled
Default (tags) / metadata (push) Has been cancelled
v19.5.13
2025-06-01 13:43:46 +00:00
e9723a8af9 19.5.12
Some checks failed
Default (tags) / security (push) Failing after 16m15s
Default (tags) / test (push) Has been cancelled
Default (tags) / release (push) Has been cancelled
Default (tags) / metadata (push) Has been cancelled
v19.5.12
2025-06-01 13:43:05 +00:00
300ab1a077 Fix connection leak in route-connection-handler by using safe socket creation
The previous fix only addressed ForwardingHandler classes but missed the critical setupDirectConnection() method in route-connection-handler.ts where SmartProxy actually handles connections. This caused active connections to rise indefinitely on ECONNREFUSED errors.

Changes:
- Import createSocketWithErrorHandler in route-connection-handler.ts
- Replace net.connect() with createSocketWithErrorHandler() in setupDirectConnection()
- Properly clean up connection records when server connection fails
- Add connectionFailed flag to prevent setup of failed connections

This ensures connection records are cleaned up immediately when backend connections fail, preventing memory leaks.
2025-06-01 13:42:46 +00:00
900942a263 19.5.11
Some checks failed
Default (tags) / security (push) Successful in 38s
Default (tags) / test (push) Failing after 32m5s
Default (tags) / release (push) Has been cancelled
Default (tags) / metadata (push) Has been cancelled
v19.5.11
2025-06-01 13:32:16 +00:00
d45485985a Fix socket error handling to prevent server crashes on ECONNREFUSED
This commit addresses critical issues where unhandled socket connection errors (ECONNREFUSED) would crash the server and cause memory leaks with rising connection counts.

Changes:
- Add createSocketWithErrorHandler() utility that attaches error handlers immediately upon socket creation
- Update https-passthrough-handler to use safe socket creation and clean up client sockets on server connection failure
- Update https-terminate-to-http-handler to use safe socket creation
- Ensure proper connection cleanup when server connections fail
- Document the fix in readme.hints.md and create implementation plan in readme.plan.md

The fix prevents race conditions where sockets could emit errors before handlers were attached, and ensures failed connections are properly cleaned up to prevent memory leaks.
2025-06-01 13:30:06 +00:00
9fdc2d5069 Refactor socket handling plan to address server crashes, memory leaks, and race conditions 2025-06-01 13:01:24 +00:00
37c87e8450 19.5.10
Some checks failed
Default (tags) / security (push) Successful in 33s
Default (tags) / test (push) Failing after 20m32s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
v19.5.10
2025-06-01 12:33:48 +00:00
92b2f230ef 19.5.9
Some checks failed
Default (tags) / security (push) Successful in 36s
Default (tags) / test (push) Failing after 20m42s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
v19.5.9
2025-06-01 12:27:59 +00:00
e7ebf57ce1 19.5.8
Some checks failed
Default (tags) / security (push) Successful in 39s
Default (tags) / test (push) Failing after 20m46s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
v19.5.8
2025-06-01 12:27:25 +00:00
ad80798210 Enhance socket cleanup and management for improved connection handling
- Refactor cleanupSocket function to support options for immediate destruction, allowing drain, and grace periods.
- Introduce createIndependentSocketHandlers for better management of half-open connections between client and server sockets.
- Update various handlers (HTTP, HTTPS passthrough, HTTPS terminate) to utilize new cleanup and socket management functions.
- Implement custom timeout handling in socket setup to prevent immediate closure during keep-alive connections.
- Add tests for long-lived connections and half-open connection scenarios to ensure stability and reliability.
- Adjust connection manager to handle socket cleanup based on activity status, improving resource management.
2025-06-01 12:27:15 +00:00
265b80ee04 19.5.7
Some checks failed
Default (tags) / security (push) Successful in 32s
Default (tags) / test (push) Failing after 14m26s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
v19.5.7
2025-06-01 08:09:39 +00:00
726d40b9a5 feat(lifecycle-component): enhance lifecycle management with unref support for timers and event listeners
fix(lifecycle-component): store actual event handler for proper cleanup
chore(meta): update certificate dates in meta.json
2025-06-01 08:09:29 +00:00
cacc88797a 19.5.6
Some checks failed
Default (tags) / security (push) Successful in 38s
Default (tags) / test (push) Failing after 17m22s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
v19.5.6
2025-06-01 08:03:39 +00:00
bed1a76537 refactor(socket-utils): replace direct socket cleanup with centralized cleanupSocket utility across connection management 2025-06-01 08:02:32 +00:00
eb2e67fecc feat(socket-utils): implement socket cleanup utilities and enhance socket handling in forwarding handlers 2025-06-01 07:51:20 +00:00
c7c325a7d8 fix(tests): update AcmeStateManager tests to use socket-handler for challenge routes
fix(tests): enhance non-TLS connection detection with range support in HttpProxy tests
2025-06-01 07:06:11 +00:00
a2affcd93e 19.5.5
Some checks failed
Default (tags) / security (push) Successful in 40s
Default (tags) / test (push) Failing after 11m45s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
v19.5.5
2025-05-31 22:18:55 +00:00
e0f3e8a0ec fix(lifecycle-component): support 'once' option for event listeners 2025-05-31 22:18:34 +00:00
96c4de0f8a fix(connection-manager): set default maxConnections to 10000 if not specified 2025-05-31 18:12:19 +00:00
829ae0d6a3 fix(refactor): remove deprecated Port80Handler and related utilities
- Deleted event-utils.ts which contained deprecated Port80Handler and its subscribers.
- Updated index.ts to remove the export of event-utils.
- Refactored ConnectionManager to extend LifecycleComponent for better resource management.
- Added BinaryHeap implementation for efficient priority queue operations.
- Introduced EnhancedConnectionPool for managing pooled connections with lifecycle management.
- Implemented LifecycleComponent to manage timers and event listeners automatically.
- Added comprehensive tests for BinaryHeap and LifecycleComponent to ensure functionality.
2025-05-31 18:01:09 +00:00
7b81186bb3 feat(performance): Add async utility functions and filesystem utilities
- Implemented async utilities including delay, retryWithBackoff, withTimeout, parallelLimit, debounceAsync, AsyncMutex, and CircuitBreaker.
- Created tests for async utilities to ensure functionality and reliability.
- Developed AsyncFileSystem class with methods for file and directory operations, including ensureDir, readFile, writeFile, remove, and more.
- Added tests for filesystem utilities to validate file operations and error handling.
2025-05-31 17:45:40 +00:00
02603c3b07 fix(performance): start with planning performance optimizations 2025-05-31 17:14:15 +00:00
af753ba1a8 19.5.4
Some checks failed
Default (tags) / security (push) Successful in 37s
Default (tags) / test (push) Failing after 8m48s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
v19.5.4
2025-05-29 15:09:05 +00:00
d816fe4583 docs(readme): Update documentation to accurately reflect v19.5.3 API
- Correct action types to only 'forward' and 'socket-handler'
- Remove references to non-existent helper functions (createStaticFileRoute, createSecurityConfig, etc.)
- Add documentation for missing helper functions (createPortMappingRoute, createDynamicRoute, etc.)
- Update all code examples to use correct API (redirects/blocks via socket handlers)
- Fix interface definitions to match actual codebase
- Add comprehensive socket handler documentation and examples
- Clarify that security configuration is at route level, not action level
- Update architecture section to reflect current module structure
- Remove references to deprecated modules (Port80Handler, certificate module)
2025-05-29 15:07:44 +00:00
7e62864da6 19.5.3
Some checks failed
Default (tags) / security (push) Successful in 38s
Default (tags) / test (push) Failing after 8m51s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
v19.5.3
2025-05-29 14:34:00 +00:00
32583f784f fix(smartproxy): Fix route security configuration location and improve ACME timing tests and socket mock implementations 2025-05-29 14:34:00 +00:00
e6b3ae395c update 2025-05-29 14:06:47 +00:00
af13d3af10 update 2025-05-29 13:24:27 +00:00
30ff3b7d8a update 2025-05-29 12:54:31 +00:00
ab1ea95070 update 2025-05-29 12:15:53 +00:00
b0beeae19e update 2025-05-29 11:30:42 +00:00
f1c012ec30 19.5.2
Some checks failed
Default (tags) / security (push) Successful in 38s
Default (tags) / test (push) Failing after 1h11m1s
Default (tags) / release (push) Has been cancelled
Default (tags) / metadata (push) Has been cancelled
v19.5.2
2025-05-29 10:23:19 +00:00
fdb45cbb91 fix(test): Fix ACME challenge route creation and HTTP request parsing in tests 2025-05-29 10:23:19 +00:00
6a08bbc558 update 2025-05-29 10:13:41 +00:00
200a735876 update 2025-05-29 01:07:39 +00:00
d8d1bdcd41 update 2025-05-29 01:00:20 +00:00
2024ea5a69 19.5.1
Some checks failed
Default (tags) / security (push) Successful in 38s
Default (tags) / test (push) Failing after 1h14m25s
Default (tags) / release (push) Has been cancelled
Default (tags) / metadata (push) Has been cancelled
v19.5.1
2025-05-29 00:24:57 +00:00
e4aade4a9a fix(socket-handler): Fix socket handler race condition by differentiating between async and sync handlers. Now, async socket handlers complete their setup before initial data is emitted, ensuring that no data is lost. Documentation and tests have been updated to reflect this change. 2025-05-29 00:24:57 +00:00
d42fa8b1e9 19.5.0
Some checks failed
Default (tags) / security (push) Successful in 42s
Default (tags) / test (push) Failing after 1h11m17s
Default (tags) / release (push) Has been cancelled
Default (tags) / metadata (push) Has been cancelled
v19.5.0
2025-05-28 23:33:02 +00:00
f81baee1d2 feat(socket-handler): Add socket-handler support for custom socket handling in SmartProxy 2025-05-28 23:33:02 +00:00