Commit Graph

58 Commits

Author SHA1 Message Date
Gouryella
88e4525bf6 perf(core): Optimizes performance configuration and resource management
- Removed the manual performance optimization configuration in main.go and replaced it with a new tuning module.
- Add patterned GC tuning in server.go and tunnel_runner.go
- Updated yamux configuration to a unified optimized configuration to improve throughput.
- Implement connection pool preheating function to eliminate cold start delay.
- Optimize session selection using a min-heap, reducing the time complexity from O(n) to O(log n).
- Add a bufio.Reader pool and a buffer pool to reduce memory allocation.
- Implement a fragmented lock manager to improve performance under high concurrency.
- Adjust heartbeat and timeout configurations to suit high-throughput scenarios
BREAKING CHANGE: Manual GC tuning configuration has been removed; automatic tuning mode is now used.
v0.6.0-beta
2025-12-23 11:16:12 +08:00
Gouryella
0cff316334 feat(client): Optimized connection pool scaling logic and enhanced session statistics functionality.
- Reduce inspection intervals and cooling times to improve response speed
- Added burst load handling mechanism to support batch expansion.
- Introduced the GetSessionStats method to retrieve detailed statistics for each session.
- Create data sessions concurrently to accelerate scaling.
- Added a ping loop keep-alive mechanism for each session.
feat(server): Enhance tunnel management and security restrictions
- Implement IP-based tunnel number and registration frequency limits
- Add a rate limiter to prevent malicious registration behavior.
- Improved shutdown process to ensure proper exit of cleanup coroutines.
- Introduce atomic operations to tunnel connections to improve concurrency performance
- Track client IP addresses for access control
perf(server): Improves HTTP request processing performance and resource reuse.
- Use sync.Pool to reuse bufio.Writer to reduce GC pressure.
- Enable TCP_NODELAY to improve response speed
- Adjust HTTP server timeout configuration to balance performance and security
refactor(proxy): Optimizes the stream open timeout control logic
- Use context to control timeouts and avoid goroutine leaks.
- Ensure that established connections are properly closed upon timeout.
docs(test): Upgrade one-click test scripts to Go test service
- Replace Python's built-in server with a high-performance Go implementation
- Update dependency checks: Use Go instead of Python 3
- Enhanced startup log output for easier debugging
chore(shared): Enhances the security and consistency of the ID generator.
- Remove the timestamp fallback scheme and uniformly adopt crypto/rand.
- Added TryGenerateID to provide a non-panic error handling method.
- Define the maximum frame size explicitly and add comments to explain it.
style(frame): Reduce memory allocation and optimize read performance
- Use an array on the stack instead of heap allocation to read the frame header.
- Reduced maximum frame size from 10MB to 1MB to decrease DoS risk.
v0.6.0-alpha
2025-12-22 16:08:24 +08:00
Gouryella
9e2bcafa98 docs (nginx): Add proxy header configuration to support WebSocket upgrades 2025-12-22 14:24:46 +08:00
Gouryella
2ea604a55e Merge pull request #11 from Gouryella/fix/reconnect-sticky-endpoint
feat(tcp): Fix reconnect behavior to keep stable subdomain and TCP port
v0.5.3
2025-12-20 10:47:05 +08:00
Gouryella
b75a098f99 feat(tcp): Fix reconnect behavior to keep stable subdomain and TCP port
Persist the assigned subdomain after first connect so reconnects reuse it.
Allow reserving a specific TCP port when the subdomain is tcp-<port> to prevent port drift.
2025-12-20 10:25:13 +08:00
Gouryella
ddefbbdbd9 Merge pull request #10 from Gouryella/fix/websocket-error
fix(tcp): Fixed a connection reading issue during WebSocket upgrade
v0.5.2
2025-12-19 17:56:39 +08:00
Gouryella
bad099d0f3 fix(tcp): Fixed a connection reading issue during WebSocket upgrade processing.
When processing HTTP streams, support for buffered readers has been added for WebSocket upgrade requests.
This ensures that data not fully read before connection switching is not lost. The forwarding logic for the Host header has also been optimized.
Add the X-Forwarded-Host header to preserve the original host information.
2025-12-19 17:48:15 +08:00
Gouryella
b1393e5e0f Merge pull request #9 from Gouryella/fix/http-proxy
Fix/http proxy
v0.5.1
2025-12-19 10:34:34 +08:00
Gouryella
e5aaf150e3 feat(proxy): Removes support for the HTTP CONNECT method.
In the ServeHTTP processing logic, CONNECT requests are no longer processed, and a 405 status code is returned when such a request is received.
The method was flagged as not allowed. The original handleConnect implementation code was also removed.
2025-12-19 10:26:38 +08:00
Gouryella
1c733de303 feat(server): Supports HTTP CONNECT proxy and connection pooling.
- Added handling for the HTTP CONNECT method, supporting HTTPS tunneling proxies.
- Introducing connQueueListener to hand over HTTP connections to standard http.Server handling.
- Optimized Connection struct fields and lifecycle management logic
- Remove redundant comments and streamline some response writing logic
- Upgrade the golang.org/x/net dependency version to support new features.
- Enhanced HTTP request parsing stability and improved error logging methods.
- Adjusted the TCP listener startup process to integrate HTTP/2 configuration support.
- Improve the connection closing mechanism to avoid resource leakage issues.
v0.5.1-beta
2025-12-16 02:24:20 +08:00
Gouryella
7431d821d8 refactor(tcp): Optimizes the TCP tunnel data connection processing logic.
The data connection processing logic was refactored, and a successful response was sent in advance before upgrading to a yamux session.
Redundant DataConnection structures and related management methods were removed. Adjustments were also made.
In ConnectionGroup, the session selection logic prioritizes using non-primary sessions for data transmission.
Only fall back to the main session when no data session is available, in order to improve forwarding efficiency and stability.
v0.5.1-alpha
2025-12-15 16:49:42 +08:00
Gouryella
be4fe2059c Merge pull request #8 from Gouryella/refactor/protocol-v2
refactor(protocol): switch to yamux multiplexing with connection pooling
v0.5.0
2025-12-14 11:13:57 +08:00
Gouryella
f1a65ac965 feat(daemon): Enhances the display of daemon startup information and the reading of configuration data.
- Added support for parsing the --address/-a and --server/-s parameters.
- At startup, attempt to load the server address from the configuration file.
- Wait and retrieve runtime information for the daemon (such as the URL).
- Optimized UI display: Shows forwarding address, server address, and access link.
- Supports centering the generated tunnel URL information in the terminal.
- Added the utility functions parseFlagValue and waitForDaemonInfo for parameter parsing and status waiting.
v0.5.0-beta
2025-12-13 21:54:43 +08:00
Gouryella
b92015aace docs (readme): Updated version feature descriptions to v0.5.0 2025-12-13 18:10:37 +08:00
Gouryella
0c19c3300c feat(tunnel): switch to yamux stream proxying and connection pooling
- Introduce pooled tunnel sessions (TunnelID/DataConnect) on client/server
- Proxy HTTP/HTTPS via raw HTTP over yamux streams; pipe TCP streams directly
- Move UI/stats into internal/shared; refactor CLI tunnel helpers; drop msgpack/hpack legacy
v0.5.0-alpha
2025-12-13 18:03:44 +08:00
Gouryella
3c93789266 Merge pull request #7 from Gouryella/perf/fix-something
perf: Add flow control, panic recovery and performance tuning
v0.4.1
2025-12-10 20:42:16 +08:00
Gouryella
d192c28acc fix(internal/server/tcp): Adjusts the initialization order of connection handlers.
Move the initialization of the mutex lock after the structure is created to ensure that the condition variable can correctly reference the mutex lock instance.
This can avoid potential race conditions and improve code readability.
2025-12-10 20:27:25 +08:00
Gouryella
5940fff204 feat(protocol): Added flow control frame type and support for automatic release mechanism of security frames.
A new FlowControl frame type has been added for backpressure control between the client and server, and SafeFrame has been introduced.
Frame resource management has been encapsulated to ensure that frame data is correctly returned to the memory pool after use. The frame processing logic has also been optimized.
The way frame.Release() is called improves code security and maintainability.
feat(client): Implements queue pressure monitoring and flow control signal sending functions.
Add the `monitorQueuePressure` method to periodically check the length of the `dataFrameQueue`, and trigger an alarm when the queue usage exceeds a threshold.
Automatically send flow control commands to the server to pause or resume writing, preventing data backlog and connection interruptions caused by slow consumption speed.
feat(server): Supports receiving and responding to flow control requests from clients.
The `handleFlowControl` and `sendWithBackpressure` methods have been added to enable backpressure control of received data frames on the server side.
By blocking the sending process using a condition variable until the client releases the pause state, connection stability is ensured under high load.
refactor(client): Reduces redundant resource release operations during frame processing.
Use SafeFrame to manage frame lifecycles uniformly, replacing manual frame.Release() with defer sf.Close() in multiple frame handlers.
This avoids the risk of memory leaks caused by unreleased abnormal paths.
perf(client): Shorten the shutdown timeout to speed up resource reclamation.
The forced shutdown wait time in the tunnel runner and connector has been adjusted from 5 seconds and 3 seconds to 2 seconds to improve the program exit response speed.
v0.4.1-beta
2025-12-10 17:41:07 +08:00
Gouryella
b3c8fc3f41 fix(tunnel): Fixes the delayed display logic to correctly handle microsecond-level delays.
- Adjust the delayed formatting function to prioritize checking if the delay is 0 to avoid displaying errors.
- When the delay is less than 1 millisecond, it is displayed in microseconds to improve the precision of the expression.
feat (constants): Shorten heart rate intervals and timeouts to improve response speed.
- Adjust HeartbeatInterval from 5 seconds to 2 seconds
- Adjust HeartbeatTimeout from 15 seconds to 6 seconds
- Improve the sensitivity of heartbeat detection between the client and the server
v0.4.1-alpha
2025-12-10 16:25:45 +08:00
Gouryella
f6f2c6fd5b feat (recovery): Introduced panic recovery and monitoring mechanisms.
A new recovery package has been added, containing Recoverer and PanicMetrics, for capturing panics in goroutines.
It records stack trace information and provides statistical metrics. This mechanism is also integrated into the TCP connector and listener.
Enhance service stability and observability.
2025-12-10 16:10:26 +08:00
Gouryella
8e6f9c553a feat(proxy): Optimizes homepage response processing
Convert the HTML content into byte slices and set the Content-Length header.
To improve response performance and accuracy.
2025-12-10 15:26:24 +08:00
Gouryella
600e6141d5 Merge pull request #6 from Gouryella/perf/improve-performance
perf: Improve performance and stability with buffer pooling, context   management, and security enhancements
v0.4.0
2025-12-08 20:33:54 +08:00
Gouryella
d21bb4897f feat(cli): Supports stopping HTTPS tunnels and optimizes configuration display logic.
- Added support for HTTPS tunnel types to the `drip stop` command and updated the example documentation.
- Optimized token display logic to adapt to token formats of different lengths.
- Adjust the alignment of FrameHandler buffer read/write and timeout configuration formats.
- Move the error handling logic location to ensure data read integrity.
- Introducing context to control request lifecycle and supporting cancel transfer in proxy handlers
- The hop-by-hop header judgment format in the unified response header filtering rules
- Add a context-aware streaming request cancellation mechanism and extend the channel cleanup timeout.
- Add a context control field to the TCP connection structure to support connection lifecycle management.
- Format the httpResponseWriter field comments
v0.4.0-beta
2025-12-08 16:57:10 +08:00
Gouryella
3bc7978999 fix(proxy): Improves response handling for health check and statistics interfaces.
Replace json.NewEncoder.Encode with json.Marshal and w.Write.
Add a Content-Length header to ensure the integrity and correctness of the response data.
At the same time, error handling is enhanced to avoid potential coding failures.
2025-12-08 15:51:02 +08:00
Gouryella
aa5b0bfde3 feat(proxy): Adjusts the processing logic of the health check and statistics interfaces. 2025-12-08 15:22:25 +08:00
Gouryella
3d1479900c fix(tcp): Prevent slow handshake attacks and optimize TLS configuration
- Set a read timeout before the TLS handshake to prevent slow handshake attacks

- Clear the read timeout setting after a successful handshake

- Enable session resumption for server and client TLS configurations

- Explicitly prioritize the use of server-side cipher suites (ignored in TLS 1.3 but retained to ensure consistency)
2025-12-08 13:29:57 +08:00
Gouryella
1a5ffce15c refactor(buffer): Optimizes TCP and HTTP streaming request processing using a buffer pool.
Replaces the fixed-size buffers in `FrameHandler` and `Handler` with dynamic buffers obtained from the buffer pool,

to reduce memory allocation and improve performance. Also updates the logo path in the README to match the new resource directory structure.
2025-12-08 12:53:56 +08:00
Gouryella
7283180e6a perf(client): Optimize client performance and introduce a data frame processing worker pool
- Add runtime performance optimization configurations to main.go, including setting GOMAXPROCS, adjusting GC frequency, and memory limits.

- Implement a worker pool-based data frame processing mechanism in connector.go to improve processing capabilities under high concurrency.

- Adjust frame writer configuration to improve batch write efficiency and enable adaptive refresh strategy.

- Add callback handling support for write errors to enhance connection stability.

refactor(server): Introduce an adaptive buffer pool to optimize memory usage

- Add adaptive_buffer_pool.go to implement large and small buffer reuse, reducing memory allocation overhead.

- Apply buffer pool management for large/medium temporary buffers in proxy handlers and TCP connections.

- Change the HTTP response writer to a cached bufio.Writer to improve I/O performance.

- Optimize HTTP request reading logic and response sending process.

build(docker): Update mount paths and remove unused named volumes

- Modify the data directory mount method in docker-compose.release.yml. ./data:/app/data

- Remove the unnecessary drip-data named volume definition

test(script): Add performance testing and profiling scripts

- Add profile-test.sh script for automating stress testing and performance data collection

- Supports collecting pprof data such as CPU, stack traces, and coroutines and generating analysis reports
v0.4.0-alpha
2025-12-08 12:24:42 +08:00
Gouryella
9e8b3b001d build(github): update sigstore version v0.3.2 2025-12-07 13:54:23 +08:00
Gouryella
492ed3da9c Merge pull request #5 from Gouryella/fix/stop-laggy-stream
feat(client): Implements a response cancellation mechanism to improve…
2025-12-07 13:51:26 +08:00
Gouryella
faa53400f5 feat(docker): Refactored the Docker build and release process and added support for image signing. 2025-12-07 11:21:21 +08:00
Gouryella
0fee9569d2 ci(docker): Removes Docker Hub login and image push configuration
The Docker Hub login step and image push configuration have been removed from the GitHub Actions workflow,

retaining only the push logic for the GitHub Container Registry. This simplifies the CI process and avoids

unnecessary Docker Hub-related operations.
2025-12-07 00:14:33 +08:00
Gouryella
b5629a1cf7 docs(readme): Updated badge display to use div tags
Replaced the original `<p>` tags with `<div>` tags for better alignment and layout control,

while maintaining content centering. This change applies to the README.md and README_CN.md files.
2025-12-06 23:59:58 +08:00
Gouryella
bbef7efb5e feat(client): Implements a response cancellation mechanism to improve resource management
Added support for HTTP response context cancellation, including logic for registering, triggering, and cleaning up cancellation functions.

Introduced a responseCancels mapping and corresponding synchronization lock in FrameHandler to track and control the request lifecycle.

When the data frame type is closed, actively called cancelResponse to release related resources.

Simultaneously, during the response body reading process, identified context cancellation or timeout errors and prematurely terminated the processing flow to avoid invalid operations.
v0.3.2-alpha
2025-12-06 23:58:31 +08:00
Gouryella
47ac5c7c22 Merge pull request #4 from Gouryella/fix/windows-daemon
Fix/windows daemon
v0.3.1
2025-12-06 23:23:11 +08:00
Gouryella
133a3892af fix: smooth table layout for Windows CLI 2025-12-06 23:04:49 +08:00
Gouryella
dface89e78 Documents (Readme): Updated installation instructions and merged client and server installation scripts
- Changed the previous separate client and server installation method to a unified entry point, distinguished by the `--client` or `--server` parameters.
- Provided examples of non-interactive installation commands.

- Synchronized the installation guidance in the English and Chinese README documents.

- Removed the separate `install-server.sh` script content display, as it has been integrated into the new `install.sh` script.
2025-12-06 22:18:35 +08:00
Gouryella
522c092d8d feat(install-scripts): Enhanced installation script functionality and added uninstallation support
- Added panel printing functions (print_panel, print_subheader) to install-server.sh and install.sh,

for improved interface display.

- Introduced the ensure_command_access function to automatically link the drip command to system paths (e.g., /usr/local/bin),

improving command availability.

- Added complete uninstallation logic: Added uninstall.sh script, supporting client-side, server-side, or both uninstallation.

- install.sh supports triggering the uninstallation process with the --uninstall parameter and enhanced PATH cleanup mechanism.

- Unified multilingual prompts and optimized user experience.
2025-12-06 13:27:34 +08:00
Gouryella
bec13a9e51 feat(install.sh): Refactored message handling functions for compatibility with bash 3.2 and zsh
The original method of storing multilingual messages using associative arrays was replaced with the functions `msg_en` and `msg_zh`,

to provide better shell compatibility. The `prompt_input` function was also introduced to unify user input logic,

improving stability and maintainability across different shell environments.
2025-12-06 12:34:01 +08:00
Gouryella
eb0b36164b Translate comments in nginx configuration file 2025-12-06 03:26:25 +08:00
Gouryella
eee2d570f1 Add TLSv1.3 support to proxy configuration 2025-12-06 03:25:16 +08:00
Gouryella
c67cba6625 feat (client): Added system dependencies and optimized Windows process check logic
- Explicitly included golang.org/x/sys v0.38.0 in go.mod and removed indirect references

- Optimized process liveness detection logic on Windows platforms using the golang.org/x/sys/windows package

- Used OpenProcess and GetExitCodeProcess instead of Signal detection methods to improve accuracy

- Updated command-line output and added an ASCII banner to improve user experience

- Added blank lines to the github.com/spf13/cobra package to standardize import format
2025-12-05 23:43:15 +08:00
Gouryella
531c5fcbec Merge pull request #3 from Gouryella/feat/major-performance-improvements
feat: Add HTTP streaming, compression support, and Docker deployment
v0.3.0
2025-12-05 22:21:46 +08:00
Gouryella
1e477879c5 feat(proxy): Adds last activity time tracking for streaming responses
Adds a `lastActivityAt` field to the `streamingResponseEntry` structure to record the last active time of the streaming response.

Updates this timestamp when creating the streaming response, sending headers, and sending data blocks.

Modifies the logic for cleaning up timeout channels, using the last activity time instead of the creation time to determine if a timeout has occurred, improving accuracy in long-connection scenarios.
2025-12-05 22:20:04 +08:00
Gouryella
aead68bb62 feat: Add HTTP streaming, compression support, and Docker deployment
enhancements

  - Add adaptive HTTP response handling with automatic streaming for large
  responses (>1MB)
  - Implement zero-copy streaming using buffer pools for better performance
  - Add compression module for reduced bandwidth usage
  - Add GitHub Container Registry workflow for automated Docker builds
  - Add production-optimized Dockerfile and docker-compose configuration
  - Simplify background mode with -d flag and improved daemon management
  - Update documentation with new command syntax and deployment guides
  - Clean up unused code and improve error handling
  - Fix lipgloss style usage (remove unnecessary .Copy() calls)
2025-12-05 22:09:07 +08:00
Gouryella
b538397a00 Merge pull request #2 from Gouryella/perf/adaptive-pool-and-binary-protocol
perf: Implement adaptive buffer pool management and optimize binary protocol
v0.2.0
2025-12-03 18:33:05 +08:00
Gouryella
8086657b7a refactor(writer): Optimizes the FrameWriter write logic and cleans up irrelevant comments.
Redundant comments have been removed from the `WriteFrame` and heartbeat control methods, and logic for releasing unprocessed frames in the queue has been added to the `Close` method to ensure proper resource reclamation. Some unnecessary channel signal comments have also been removed, making the code more concise and clear.
2025-12-03 18:32:38 +08:00
Gouryella
35e6c86e1f feat(client): Added the --short option to the version command to support plain text output.
Added the `--short` flag to the `version` command for printing version information without styles.

In this mode, only the version, Git commit hash, and build time in plain text format will be output, facilitating script parsing.

Optimized Windows process detection logic to improve runtime accuracy.

Removed redundant comments and simplified signal checking methods, making the code clearer and easier to maintain.

refactor(protocol): Replaced string matching of data frame types with enumeration types.

Unified the representation of data frame types in the protocol, using the `DataType` enumeration to improve performance and readability.

Introduced a pooled buffer mechanism to improve memory efficiency in high-load scenarios.

refactor(ui): Adjusted style definitions, removing hard-coded color values.

Removed fixed color settings from some lipgloss styles, providing flexibility for future theme customization.

``` docs(install): Improved the version extraction function in the installation script.

Added the `get_version_from_binary` function to enhance version identification capabilities, prioritizing plain mode output, ensuring accurate version number acquisition for the drip client or server across different terminal environments.

perf(tcp): Improved TCP processing performance and connection management capabilities.

Adjusted HTTP client transmission parameter configuration, increasing the maximum number of idle connections to accommodate higher concurrent requests.

Improved error handling logic, adding special checks for common cases such as closing network connections to avoid log pollution.

chore(writer): Expanded the FrameWriter queue length to improve batch write stability.

Increased the FrameWriter queue size from 1024 to 2048, and released pooled resources after flushing, better handling sudden traffic spikes and reducing memory usage fluctuations.
2025-12-03 18:11:37 +08:00
Gouryella
bb5ed1739e docs(readme): Updated the structure and content of the English and Chinese README documents
- Unified logo size and optimized layout using HTML tags

- Replaced headings with semantic tags `<h1>` and `<h3>`

- Reorganized the document structure to enhance readability and visual appeal

- Optimized Chinese descriptions for a more natural and fluent style

- Adjusted the installation, usage instructions, and architecture diagram descriptions

- Standardized the display of command-line options and parameters
2025-12-03 11:09:06 +08:00
Gouryella
729911d2cf Merge pull request #1 from Gouryella/perf/improve-flow
perf (client): Refactored the command-line interface and enhanced use…
v0.1.1
2025-12-03 10:53:30 +08:00