798 Commits

Author SHA1 Message Date
Juergen Kunz
9094b76b1b 19.5.23
Some checks failed
Default (tags) / security (push) Successful in 34s
Default (tags) / test (push) Failing after 24m25s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
v19.5.23
2025-06-06 23:36:19 +00:00
Juergen Kunz
9aebcd488d Implement connection timeout handling and improve connection cleanup in SmartProxy 2025-06-06 23:34:50 +00:00
Juergen Kunz
311691c2cc 19.5.22
Some checks failed
Default (tags) / security (push) Successful in 36s
Default (tags) / test (push) Failing after 19m29s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
v19.5.22
2025-06-06 15:54:40 +00:00
Juergen Kunz
578d1ba2f7 update 2025-06-06 15:00:46 +00:00
Juergen Kunz
233c98e5ff 19.5.21
Some checks failed
Default (tags) / security (push) Successful in 39s
Default (tags) / test (push) Failing after 19m32s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
v19.5.21
2025-06-06 14:30:39 +00:00
Juergen Kunz
b3714d583d Implement PROXY protocol v1 support in SmartProxy
- Added ProxyProtocolParser class for parsing and generating PROXY protocol v1 headers.
- Integrated PROXY protocol parsing into RouteConnectionHandler for handling incoming connections from trusted proxies.
- Implemented WrappedSocket class to encapsulate real client information.
- Configured SmartProxy to accept and send PROXY protocol headers in routing actions.
- Developed comprehensive unit tests for PROXY protocol parsing and generation.
- Documented usage patterns, configuration, and best practices for proxy chaining scenarios.
- Added security and performance considerations for PROXY protocol implementation.
2025-06-06 13:45:44 +00:00
Juergen Kunz
527cacb1a8 19.5.20
Some checks failed
Default (tags) / security (push) Successful in 40s
Default (tags) / test (push) Failing after 19m26s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
v19.5.20
2025-06-06 08:25:22 +00:00
Juergen Kunz
5f175b4ca8 fix tests 2025-06-06 08:23:37 +00:00
Juergen Kunz
b9be6533ae start fixing tests 2025-06-06 07:40:59 +00:00
Juergen Kunz
18d79ac7e1 feat(proxy): Implement WrappedSocket class for PROXY protocol support and update connection handling 2025-06-05 17:57:24 +00:00
Juergen Kunz
2a75e7c490 Refactor routing and proxy components for improved structure and compatibility
- Removed deprecated route utility functions in favor of direct matcher usage.
- Updated imports to reflect new module structure for routing utilities.
- Consolidated route manager functionality into SharedRouteManager for better consistency.
- Eliminated legacy routing methods and interfaces, streamlining the HttpProxy and associated components.
- Enhanced WebSocket and HTTP request handling to utilize the new unified HttpRouter.
- Updated route matching logic to leverage matcher classes for domain, path, and header checks.
- Cleaned up legacy compatibility code across various modules, ensuring a more maintainable codebase.
2025-06-03 16:21:09 +00:00
Juergen Kunz
cf70b6ace5 feat(routing): Add SharedRouteManager and route matching utilities for enhanced routing capabilities 2025-06-03 16:19:52 +00:00
54ffbadb86 feat(routing): Implement unified routing and matching system
- Introduced a centralized routing module with comprehensive matchers for domains, headers, IPs, and paths.
- Added DomainMatcher for domain pattern matching with support for wildcards and specificity calculation.
- Implemented HeaderMatcher for HTTP header matching, including exact matches and pattern support.
- Developed IpMatcher for IP address matching, supporting CIDR notation, ranges, and wildcards.
- Created PathMatcher for path matching with parameter extraction and wildcard support.
- Established RouteSpecificity class to calculate and compare route specificity scores.
- Enhanced HttpRouter to utilize the new matching system, supporting both modern and legacy route configurations.
- Added detailed logging and error handling for routing operations.
2025-06-02 03:57:52 +00:00
01e1153fb8 feat(proxy): Start implementing PROXY protocol support and WrappedSocket class for enhanced client IP handling 2025-06-01 21:30:37 +00:00
fa9166be4b 19.5.19
Some checks failed
Default (tags) / security (push) Failing after 14m47s
Default (tags) / test (push) Has been cancelled
Default (tags) / release (push) Has been cancelled
Default (tags) / metadata (push) Has been cancelled
v19.5.19
2025-06-01 15:45:03 +00:00
c5efee3bfe fix(smartproxy): Fix connection handling and improve route matching edge cases 2025-06-01 15:45:03 +00:00
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