# Changelog ## 2025-02-27 - 3.16.4 - fix(PortProxy) Fix and enhance port proxy handling - Ensure that all created proxy servers are correctly checked for listening state. - Corrected the handling of ports and domain configurations within port proxy setups. - Expanded test coverage for handling multiple concurrent and chained proxy connections. ## 2025-02-27 - 3.16.3 - fix(PortProxy) Refactored PortProxy to support multiple listening ports and improved modularity. - Updated PortProxy to allow multiple listening ports with flexible configuration. - Moved helper functions for IP and port range checks outside the class for cleaner code structure. ## 2025-02-27 - 3.16.2 - fix(PortProxy) Fix port-based routing logic in PortProxy - Optimized the handling and checking of local ports in the global port range. - Fixed the logic for rejecting or accepting connections based on predefined port ranges. - Improved handling of the default and specific domain configurations during port-based connections. ## 2025-02-27 - 3.16.1 - fix(core) Updated minor version numbers in dependencies for patch release. - No specific file changes detected. - Dependencies versioning adjusted for stability. ## 2025-02-27 - 3.16.0 - feat(PortProxy) Enhancements made to PortProxy settings and capabilities - Added 'forwardAllGlobalRanges' and 'targetIP' to IPortProxySettings. - Improved PortProxy to forward connections based on domain-specific configurations. - Added comprehensive handling for global port-range based connection forwarding. - Enabled forwarding of all connections on global port ranges directly to global target IP. ## 2025-02-27 - 3.15.0 - feat(classes.portproxy) Add support for port range-based routing with enhanced IP and port validation. - Introduced globalPortRanges in IPortProxySettings for routing based on port ranges. - Improved connection handling with port range and domain configuration validations. - Updated connection logging to include the local port information. ## 2025-02-26 - 3.14.2 - fix(PortProxy) Fix cleanup timer reset for PortProxy - Resolved an issue where the cleanup timer in the PortProxy class did not reset correctly if both incoming and outgoing data events were triggered without clearing flags. ## 2025-02-26 - 3.14.1 - fix(PortProxy) Increased default maxConnectionLifetime for PortProxy to 600000 ms - Updated PortProxy settings to extend default maxConnectionLifetime to 10 minutes. ## 2025-02-26 - 3.14.0 - feat(PortProxy) Introduce max connection lifetime feature - Added an optional maxConnectionLifetime setting for PortProxy. - Forces cleanup of long-lived connections based on inactivity or lifetime limit. ## 2025-02-25 - 3.13.0 - feat(core) Add support for tagging iptables rules with comments and cleaning them up on process exit - Extended IPTablesProxy class to include tagging rules with unique comments. - Added feature to clean up iptables rules via comments during process exit. ## 2025-02-24 - 3.12.0 - feat(IPTablesProxy) Introduce IPTablesProxy class for managing iptables NAT rules - Added IPTablesProxy class to facilitate basic port forwarding using iptables. - Introduced IIpTableProxySettings interface for configuring IPTablesProxy. - Implemented start and stop methods for managing iptables rules dynamically. ## 2025-02-24 - 3.11.0 - feat(Port80Handler) Add automatic certificate issuance with ACME client - Implemented automatic certificate issuance using 'acme-client' for Port80Handler. - Converts account key and CSR from Buffers to strings for processing. - Implemented HTTP-01 challenge handling for certificate acquisition. - New certificates are fetched and added dynamically. ## 2025-02-24 - 3.10.5 - fix(portproxy) Fix incorrect import path in test file - Change import path from '../ts/smartproxy.portproxy.js' to '../ts/classes.portproxy.js' in test/test.portproxy.ts ## 2025-02-23 - 3.10.4 - fix(PortProxy) Refactor connection tracking to utilize unified records in PortProxy - Implemented a unified record system for tracking incoming and outgoing connections. - Replaced individual connection tracking sets with a Set of IConnectionRecord. - Improved logging of connection activities and statistics. ## 2025-02-23 - 3.10.3 - fix(PortProxy) Refactor and optimize PortProxy for improved readability and maintainability - Simplified and clarified inline comments. - Optimized the extractSNI function for better readability. - Streamlined the cleanup process for connections in PortProxy. - Improved handling and logging of incoming and outgoing connections. ## 2025-02-23 - 3.10.2 - fix(PortProxy) Fix connection handling to include timeouts for SNI-enabled connections. - Added initial data timeout for SNI-enabled connections to improve connection handling. - Cleared timeout once data is received to prevent premature socket closure. ## 2025-02-22 - 3.10.1 - fix(PortProxy) Improve socket cleanup logic to prevent potential resource leaks - Updated socket cleanup in PortProxy to ensure sockets are forcefully destroyed if not already destroyed. ## 2025-02-22 - 3.10.0 - feat(smartproxy.portproxy) Enhance PortProxy with detailed connection statistics and termination tracking - Added tracking of termination statistics for incoming and outgoing connections - Enhanced logging to include detailed termination statistics - Introduced helpers to update and log termination stats - Retained detailed connection duration and active connection logging ## 2025-02-22 - 3.9.4 - fix(PortProxy) Ensure proper cleanup on connection rejection in PortProxy - Added cleanup calls after socket end in connection rejection scenarios within PortProxy ## 2025-02-21 - 3.9.3 - fix(PortProxy) Fix handling of optional outgoing socket in PortProxy - Refactored the cleanUpSockets function to correctly handle cases where the outgoing socket may be undefined. - Ensured correct handling of socket events with non-null assertions where applicable. - Improved robustness in connection establishment and cleanup processes. ## 2025-02-21 - 3.9.2 - fix(PortProxy) Improve timeout handling for port proxy connections - Added console logging for both incoming and outgoing side timeouts in the PortProxy class. - Updated the timeout event handlers to ensure proper cleanup of connections. ## 2025-02-21 - 3.9.1 - fix(dependencies) Ensure correct ordering of dependencies and improve logging format. - Reorder dependencies in package.json for better readability. - Use pretty-ms for displaying time durations in logs. ## 2025-02-21 - 3.9.0 - feat(smartproxy.portproxy) Add logging of connection durations to PortProxy - Track start times for incoming and outgoing connections. - Log duration of longest running incoming and outgoing connections every 10 seconds. ## 2025-02-21 - 3.8.1 - fix(plugins) Simplified plugin import structure across codebase - Consolidated plugin imports under a single 'plugins.ts' file. - Replaced individual plugin imports in smartproxy files with the consolidated plugin imports. - Fixed error handling for early socket errors in PortProxy setup. ## 2025-02-21 - 3.8.0 - feat(PortProxy) Add active connection tracking and logging in PortProxy - Implemented a feature to track active incoming connections in PortProxy. - Active connections are now logged every 10 seconds for monitoring purposes. - Refactored connection handling to ensure proper cleanup and logging. ## 2025-02-21 - 3.7.3 - fix(portproxy) Fix handling of connections in PortProxy to improve stability and performance. - Improved IP normalization and matching - Better SNI extraction and handling for TLS - Streamlined connection handling with robust error management ## 2025-02-21 - 3.7.2 - fix(PortProxy) Improve SNICallback and connection handling in PortProxy - Fixed SNICallback to create minimal TLS context for SNI. - Changed connection setup to use net.connect for raw passthrough. ## 2025-02-21 - 3.7.1 - fix(smartproxy.portproxy) Optimize SNI handling by simplifying context creation - Removed unnecessary SecureContext creation for SNI requests in PortProxy - Improved handling of SNI passthrough by acknowledging requests without context creation ## 2025-02-21 - 3.7.0 - feat(PortProxy) Add optional source IP preservation support in PortProxy - Added a feature to optionally preserve the client's source IP when proxying connections. - Enhanced test cases to include scenarios for source IP preservation. ## 2025-02-21 - 3.6.0 - feat(PortProxy) Add feature to preserve original client IP through chained proxies - Added support to bind local address in PortProxy to preserve original client IP. - Implemented test for chained proxies to ensure client IP is preserved. ## 2025-02-21 - 3.5.0 - feat(PortProxy) Enhance PortProxy to support domain-specific target IPs - Introduced support for domain-specific target IP configurations in PortProxy. - Updated connection handling to prioritize domain-specific target IPs if provided. - Added tests to verify forwarding based on domain-specific target IPs. ## 2025-02-21 - 3.4.4 - fix(PortProxy) Fixed handling of SNI domain connections and IP allowance checks - Improved logic for handling SNI domain checks, ensuring IPs are correctly verified. - Fixed issue where default allowed IPs were not being checked correctly for non-SNI connections. - Revised the SNICallback behavior to handle connections more gracefully when domain configurations are unavailable. ## 2025-02-21 - 3.4.3 - fix(PortProxy) Fixed indentation issue and ensured proper cleanup of sockets in PortProxy - Fixed inconsistent indentation in IP allowance check. - Ensured proper cleanup of sockets on connection end in PortProxy. ## 2025-02-21 - 3.4.2 - fix(smartproxy) Enhance SSL/TLS handling with SNI and error logging - Improved handling for SNI-enabled and non-SNI connections - Added detailed logging for connection establishment and rejections - Introduced error logging for TLS client errors and server errors ## 2025-02-21 - 3.4.1 - fix(PortProxy) Normalize IP addresses for port proxy to handle IPv4-mapped IPv6 addresses. - Improved IP normalization logic in PortProxy to support IPv4-mapped IPv6 addresses. - Updated isAllowed function to expand patterns for better matching accuracy. ## 2025-02-21 - 3.4.0 - feat(PortProxy) Enhanced PortProxy with custom target host and improved testing - PortProxy constructor now accepts 'fromPort', 'toPort', and optional 'toHost' directly from settings - Refactored test cases to cover forwarding to the custom host - Added support to handle multiple concurrent connections - Refactored internal connection handling logic to utilize default configurations ## 2025-02-21 - 3.3.1 - fix(PortProxy) fixed import usage of net and tls libraries for PortProxy - Corrected the use of plugins for importing 'tls' and 'net' libraries in the PortProxy module. - Updated the constructor of PortProxy to accept combined tls options with ProxySettings. ## 2025-02-21 - 3.3.0 - feat(PortProxy) Enhanced PortProxy with domain and IP filtering, SNI support, and minimatch integration - Added new ProxySettings interface to configure domain patterns, SNI, and default allowed IPs. - Integrated minimatch to filter allowed IPs and domains. - Enabled SNI support for PortProxy connections. - Updated port proxy test to accommodate new settings. ## 2025-02-04 - 3.2.0 - feat(testing) Added a comprehensive test suite for the PortProxy class - Set up a test environment for PortProxy using net.Server. - Test coverage includes starting and stopping the proxy, handling TCP connections, concurrent connections, and timeouts. - Ensures proper resource cleanup after tests. ## 2025-02-04 - 3.1.4 - fix(core) No uncommitted changes. Preparing for potential minor improvements or bug fixes. ## 2025-02-04 - 3.1.3 - fix(networkproxy) Refactor and improve WebSocket handling and request processing - Improved error handling in WebSocket connection and request processing. - Refactored the WebSocket handling in NetworkProxy to use a unified error logging mechanism. ## 2025-02-04 - 3.1.2 - fix(core) Refactor certificate handling across the project - Moved certificate keys and certs to the assets/certs directory. - Updated test utilities to load certificates from the central location. - Cleaned up redundant code and improved error logging regarding certificates. - Ensured correct handling of host header in ProxyRouter class. ## 2025-02-03 - 3.1.1 - fix(workflow) Update Gitea workflow paths and dependencies - Updated registry paths for npmci image and repositories in Gitea workflow files. - Fixed dependency paths in package.json. - Completed adding typescript to the list of devDependencies. ## 2024-10-07 - 3.1.0 - feat(NetworkProxy) Introduce WebSocket heartbeat to maintain active connections in NetworkProxy - Added heartbeat mechanism to WebSocket connections to ensure they remain active. - Terminating WebSocket if no pong is received for 5 minutes. - Set up heartbeat interval to run every 1 minute for connection checks. ## 2024-10-07 - 3.0.61 - fix(networkproxy) Improve error handling for proxy requests - Wrapped proxy request logic in a try-catch block to handle errors gracefully. - Improved error handling for WebSocket communication by checking errors before attempting to send messages. - Added logging for error cases to aid in debugging. ## 2024-05-29 - 3.0.60 - various updates Maintenance updates and adjustments. - Updated project description - Updated tsconfig settings - Updated npmextra.json with new githost info ## 2023-07-27 - 3.0.58 to 3.0.59 - core improvements Improvements and internal restructuring. - Switch to a new organizational scheme - Core updates and adjustments ## 2022-07-29 - 2.0.16 to 3.0.0 - major transition This release marks a major transition with several breaking changes. - BREAKING CHANGE: switched core to ESM (EcmaScript Module) - Major core updates