136 Commits

Author SHA1 Message Date
d00ab0a6e1 feat(metrics): Improve latency tracking and error visualization
- Add atomic operations to track minimum and maximum request latency
- Update GetStats method to handle uninitialized latency values
- Modify dashboard error chart with improved color scheme and legend
- Adjust chart margins and axis width for better readability
2025-02-15 18:24:55 +08:00
35ea14a91f feat(cache): Add Content-Encoding support in cache management
- Update CacheItem struct to include ContentEncoding field
- Modify Put and Commit methods to store Content-Encoding header
- Enhance cache retrieval to set Content-Encoding header for cached responses
- Implement Content-Encoding preservation across proxy and mirror handlers
2025-02-15 18:16:04 +08:00
1c44fe1bf4 feat(metrics): Add status code tracking and improve path metrics handling
- Implement status code statistics tracking in Collector
- Update PathMetrics type to use pointer-based access
- Enhance atomic operations for request and error count tracking
- Modify type assertions to use pointer-based type conversion
2025-02-15 18:08:49 +08:00
2267a27b37 feat(cache): Implement streaming cache with TeeReader for efficient response handling
- Replace full response body reading with streaming cache mechanism
- Add CreateTemp and Commit methods to CacheManager for incremental caching
- Use io.TeeReader to simultaneously write response to client and cache file
- Remove buffer pool and full body reading in proxy and mirror handlers
- Improve memory efficiency and reduce latency for large responses
- Update error handling and logging for cache-related operations
2025-02-15 17:48:13 +08:00
ffc64bb73a feat(cache): Add fixed path cache support to admin dashboard and API
- Integrate fixed path cache into cache admin handler and API endpoints
- Update cache admin dashboard to display fixed path cache statistics
- Modify cache management functions to support fixed path cache operations
- Add new cache type to frontend cache management UI
2025-02-15 17:32:27 +08:00
9c3c48f4b6 feat(cache,middleware): Enhance caching mechanism for fixed path proxy
- Modify CacheKey to use a simplified string representation of Vary headers
- Update GenerateCacheKey to handle Vary headers more efficiently
- Implement caching in FixedPathProxyMiddleware with cache hit/miss tracking
- Improve response handling by reading entire response body before writing
- Add error handling for connection-related issues during response writing
2025-02-15 17:14:29 +08:00
88726d9d8f feat(cache): Add CacheKey methods for string representation, equality, and hashing
- Implement `String()` method to generate a unique string representation of CacheKey
- Add `Equal()` method to compare CacheKey instances
- Create `Hash()` method using FNV-64a hashing algorithm for efficient key comparison
2025-02-15 17:09:00 +08:00
c4cd99a827 feat(cache): Implement comprehensive caching system for proxy requests
- Add CacheManager to handle caching for proxy and mirror handlers
- Introduce cache-related API endpoints for stats, enabling, and clearing
- Modify proxy and mirror handlers to support caching GET requests
- Remove rate limiting and simplify request handling
- Update go.mod dependencies and remove unused imports
- Add cache hit/miss headers to responses
- Enhance metrics collection for cached requests
2025-02-15 17:00:16 +08:00
fc2e324d82 Merge branch 'main' of https://github.com/woodchen-ink/proxy-go 2025-02-15 16:23:23 +08:00
3e5950e3f6 feat(metrics,web): Enhance dashboard with advanced metrics visualization
- Integrate Recharts library for interactive data visualization
- Add detailed latency distribution charts and error type analysis
- Implement bandwidth and performance metrics graphs
- Update metrics collection to support more granular statistical tracking
- Modify frontend API routes to remove /admin prefix
- Improve metrics display with responsive and informative charts
2025-02-15 16:23:20 +08:00
wood chen
c21ba55041
Update readme.md 2025-02-15 12:10:41 +08:00
eabb1f1f9a refactor(models,web): Update JSON serialization and formatting utilities
- Modify RequestLog struct to use PascalCase JSON tags
- Enhance formatBytes function to handle undefined or NaN inputs
- Update formatDate to return full datetime and handle empty inputs
- Add null/NaN checks to formatLatency for more robust display
2025-02-15 12:01:28 +08:00
b5a6928a3a refactor(web): Update API routes to use /admin prefix
- Modify fetch API calls in dashboard, login, and config pages
- Update routes to consistently use /admin/api/ endpoint
- Ensure uniform API route handling across frontend components
2025-02-15 11:56:03 +08:00
f758db3531 refactor(metrics): Simplify metrics collection and improve performance
- Restructure Collector to use more efficient atomic operations
- Remove complex caching and monitoring dependencies
- Simplify path and status code tracking with sync.Map
- Optimize request logging with a dedicated request queue
- Remove unnecessary utility functions and pools
- Streamline stats generation and reduce complexity
2025-02-15 11:51:01 +08:00
33d6a51416 refactor(web): Migrate to modern web frontend and simplify admin routes
- Remove legacy static files, templates, and JavaScript
- Update main.go to serve SPA-style web application
- Modify admin route handling to support client-side routing
- Simplify configuration and metrics API endpoints
- Remove server-side template rendering in favor of static file serving
- Update Dockerfile and GitHub Actions to build web frontend
2025-02-15 11:44:09 +08:00
ecba8adbf1 refactor(templates): Update template definition names for admin pages
- Change template definition names from "Content" to specific page names
- Modify layout.html to conditionally render templates based on page name
- Ensure consistent template naming across admin page templates
2025-02-15 09:49:23 +08:00
ab8684d4c5 refactor(admin): Enhance template rendering and routing for admin pages
- Update template rendering to use a dynamic layout with configurable title
- Modify template parsing to use template.Must for simplified error handling
- Update static file serving path from /web/static to /admin/static
- Improve template execution with dynamic content mapping
- Simplify template loading and error management in main.go
2025-02-15 09:45:36 +08:00
8a2207bd29 feat(templates): Implement template rendering for admin routes
- Replace static file serving with Go template rendering
- Add template parsing for login, metrics, and config pages
- Set appropriate content type headers for HTML responses
- Improve error handling for template rendering
- Enhance logging for template-related errors
2025-02-15 09:40:52 +08:00
dca6a8a362 chore(ci): Include web directory in Docker build context
- Copy web directory to Docker context for image build
- Ensure web assets are available during Docker image creation
2025-02-15 09:32:48 +08:00
fa5cbff486 feat(web): Update file paths for static and template serving in Docker environment
- Modify Dockerfile to copy web directory into /app
- Update main.go to serve static and template files from absolute paths (/app/web)
- Add debug logging for static file and template route handling
- Ensure consistent file serving across admin and web routes
2025-02-15 09:29:55 +08:00
0446eb1c53 feat(proxy): Optimize HTTP transport and timeout configurations
- Increase connection pool and idle connection limits
- Extend timeout durations for more robust network handling
- Configure HTTP/2 transport with enhanced performance settings
- Add HTTP/2-specific optimizations and security constraints
2025-02-15 08:59:20 +08:00
ca79cc7dac feat(routing): Enhance main handler with admin route management and debug logging
- Refactor routing logic to use a more modular handler approach
- Add dedicated admin route handler with explicit path matching
- Implement comprehensive debug logging for request handling
- Simplify main handler by removing nested admin route logic
- Add fallback NotFound handler for unmatched routes
2025-02-15 08:51:16 +08:00
6c7bc2bfb8 refactor(proxy): Improve error handling and response writing in proxy handler
- Modify error response writing to use explicit WriteHeader and Write methods
- Remove redundant WriteHeader call in ServeHTTP method
- Add WriteHeader before writing response for both small and large responses
- Enhance code readability and error handling consistency
2025-02-15 08:34:14 +08:00
53b16f44fb feat(admin): Implement admin layout and login page template
- Add responsive admin layout with navigation menu
- Convert login page to use layout template system
- Integrate Tailwind CSS and DaisyUI for styling
- Add authentication check script in layout
2025-02-15 08:31:07 +08:00
47d2326815 补充丢失的登录页面 2025-02-15 08:29:07 +08:00
a827a79b4d chore(ci): Remove redundant SSH deployment step from docker-build workflow 2025-02-15 08:08:52 +08:00
e89ef02205 特性(代理):通过端口和身份验证更新来增强服务器配置和安全性。
- 更新 docker-compose.yml 文件,使用端口 3336
- 修改 Dockerfile 以暴露端口 3336
- 重构 main.go 以支持新的路由和管理端点
- 在 auth.go 中实现健壮的身份验证中间件
- 通过加强错误检查来改进指标处理。
- 添加用于安全类型转换的实用函数
- 引入请求ID生成功能,以便更好地进行追踪。
2025-02-15 08:07:28 +08:00
wood chen
03ffec4760
Update readme.md 2025-02-15 02:00:49 +08:00
f76649d0e7 refactor(proxy): streamline target URL selection logic by removing deprecated path handling 2025-01-12 18:24:19 +08:00
8f27b8b70f Merge branch 'main' of https://github.com/woodchen-ink/proxy-go 2025-01-12 18:14:29 +08:00
f8a5999d36 fix(utils): update default size threshold and enhance logging for extension mapping 2025-01-12 18:14:27 +08:00
wood chen
49042362ed
Merge pull request #2 from woodchen-ink/dependabot/go_modules/golang.org/x/time-0.9.0
chore(deps): bump golang.org/x/time from 0.8.0 to 0.9.0
2025-01-12 01:54:55 +08:00
dependabot[bot]
d331ad036b
chore(deps): bump golang.org/x/time from 0.8.0 to 0.9.0
Bumps [golang.org/x/time](https://github.com/golang/time) from 0.8.0 to 0.9.0.
- [Commits](https://github.com/golang/time/compare/v0.8.0...v0.9.0)

---
updated-dependencies:
- dependency-name: golang.org/x/time
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-06 12:33:06 +00:00
wood chen
179898d01c
Update readme.md 2025-01-04 19:29:50 +08:00
wood chen
59af7fe312
Update readme.md 2025-01-01 02:56:38 +08:00
wood chen
8b99907dba
Update readme.md 2024-12-31 15:34:35 +08:00
wood chen
5c4701b99b
Update readme.md 2024-12-31 12:11:09 +08:00
9aedaf75c5 refactor(metrics): simplify auto-refresh logic in metrics template 2024-12-05 11:27:47 +08:00
ea4e7cc70b 状态码统计布局问题 2024-12-05 11:21:30 +08:00
1f2f78dc64 refactor(metrics): remove historical data handling and streamline collector logic
- Eliminated the historical data storage and related functions from the metrics collector to simplify the codebase.
- Removed the historical data display section from the metrics template, enhancing clarity and focus on current metrics.
- Updated the CheckDataConsistency method to implement a simpler validation check for total errors against total requests.

These changes improve the maintainability of the metrics system by removing outdated features and ensuring a more straightforward data validation process.
2024-12-05 11:16:58 +08:00
1440eec7ed refactor(metrics): remove deprecated metrics history endpoint and clean up related code
- Removed the MetricsHistoryHandler and associated historical data export functionality to streamline the metrics handling process.
- Updated the metrics template to improve label translations and ensure default values are used for optional data fields.
- Enhanced the JavaScript code for metrics display by adding checks for undefined data arrays, improving robustness.
- Cleaned up unused variables and functions to maintain code clarity and reduce complexity.

These changes simplify the metrics system by eliminating outdated features and improving the overall reliability of data presentation.
2024-12-05 11:09:44 +08:00
b82096227c feat(metrics): improve metrics handling with safe type conversions and default values
- Introduced safe type conversion functions to handle nil values gracefully, ensuring metrics integrity.
- Updated the MetricsHandler to return default values for metrics when stats retrieval fails, enhancing reliability.
- Streamlined the metrics initialization process by ensuring all necessary fields are populated, even in error scenarios.
- Improved memory usage reporting and response time metrics for better performance insights.

These changes enhance the robustness of the metrics system, ensuring accurate data handling and improved monitoring capabilities.
2024-12-05 10:59:55 +08:00
058244cc70 feat(metrics): enhance configuration and performance monitoring
- Added new performance monitoring settings in the configuration, including maximum requests per minute and data transfer limits.
- Introduced validation parameters for metrics, ensuring data integrity and consistency checks during collection.
- Refactored the metrics collector to streamline initialization and improve error handling.
- Removed deprecated database-related code and optimized metrics saving processes.
- Enhanced historical data management with regular clean-up routines to maintain performance.

These changes improve the configurability and reliability of the metrics system, ensuring accurate data handling and enhanced monitoring capabilities.
2024-12-05 10:56:27 +08:00
f360e13ca3 feat(metrics): optimize stats collection and enhance error handling
- Refactored the GetStats method to improve memory management by utilizing an object pool for stats initialization.
- Enhanced error rate calculation and added average response time metrics for better performance insights.
- Streamlined path and referer statistics collection, ensuring only relevant data is processed and displayed.
- Improved sorting and selection logic for top paths and referers, enhancing the clarity of metrics reporting.
- Updated comments for better code readability and understanding of the metrics collection process.

These changes enhance the efficiency and accuracy of the metrics collector, providing more reliable performance data and insights.
2024-12-05 10:37:47 +08:00
14843301f7 feat(metrics): enhance initialization process in metrics collector
- Improved the initialization sequence by clearly defining steps for cache, monitoring, and object pool setup.
- Enabled Feishu webhook alerts for real-time notifications based on configuration.
- Ensured last save time is set during initialization to maintain accurate data persistence.
- Streamlined historical data loading process to enhance metrics accuracy.

These changes improve the organization and functionality of the metrics collector, ensuring better performance and alerting capabilities.
2024-12-05 10:33:55 +08:00
c71da4c1fe feat(metrics): initialize cache and object pool in metrics collector
- Added cache initialization to enhance performance and data retrieval efficiency.
- Introduced an object pool for managing statistics, optimizing memory usage during metrics processing.
- Improved code organization by clarifying initialization steps for cache and monitoring components.

These changes enhance the metrics collector's efficiency and resource management, ensuring better performance in data handling.
2024-12-05 10:30:10 +08:00
ef3bc0c5a6 feat(metrics): enhance metrics initialization and consistency checks
- Added initialization of last save time during collector setup to ensure timely data persistence.
- Implemented immediate saving of metrics after loading historical data to maintain accurate statistics.
- Improved error handling in SaveMetrics by validating input types before updating persistent stats.
- Modified CheckDataConsistency logic to allow for a tolerance of 5% in total request comparisons, enhancing reliability in metrics validation.

These changes improve the accuracy and reliability of the metrics collection process, ensuring better monitoring and data integrity.
2024-12-05 10:26:09 +08:00
1c22e4c020 栈溢出 2024-12-05 10:21:50 +08:00
e275326d91 feat(metrics): enhance configuration and metrics validation
- Added new configuration structures for loading, saving, and validation settings in MetricsConfig.
- Introduced constants for load retry counts, intervals, and validation parameters to improve configurability.
- Enhanced metrics collector with data validation and consistency checks during metrics loading.
- Implemented backup and restore functionality for metrics data, ensuring data integrity and recoverability.
- Improved logging for metrics operations, providing better insights into the metrics collection process.

These changes enhance the flexibility and reliability of the metrics system, ensuring accurate data handling and improved monitoring capabilities.
2024-12-05 10:15:20 +08:00
8c266a1ec2 feat(metrics): enhance metrics collection and monitoring capabilities
- Added new performance monitoring thresholds for maximum requests and data transfer rates.
- Introduced dynamic save interval adjustments based on data change rates to optimize database writes.
- Implemented a retry mechanism for loading recent statistics, improving reliability in data retrieval.
- Consolidated metrics saving into a single method, SaveAllMetrics, to streamline database transactions and improve performance.
- Enhanced error handling and logging throughout the metrics collection process for better monitoring.

These changes improve the efficiency and reliability of the metrics system, ensuring more accurate and timely data collection.
2024-12-05 09:51:43 +08:00