docs(idlewatcher): update README to include loading page and SSE endpoint details

- Added information about the loading page (HTML + JS + CSS) and the SSE endpoint for wake events.
- Clarified the health monitor implementation and readiness tracking in the architecture overview.
- Correct state machine syntax.
This commit is contained in:
yusing
2026-01-08 20:31:44 +08:00
parent a5c74d6773
commit 2f2828ec48
5 changed files with 227 additions and 2 deletions

92
.kilocode/rules/godoxy.md Normal file
View File

@@ -0,0 +1,92 @@
# godoxy.md
## Project Overview
GoDoxy is a lightweight reverse proxy with WebUI written in Go. It automatically configures routes for Docker containers using labels and provides SSL certificate management, access control, and monitoring capabilities.
## Development Commands
You should not run any commands to build or run the project.
## Documentation
If `README.md` exists in the package:
- Read it to understand what the package does and how it works.
- Update it with the changes you made (if any).
Update the roort `README.md` if relevant.
## Architecture
### Core Components
1. **Main Entry Point** (`cmd/main.go`)
- Initializes configuration and logging
- Starts the proxy server and WebUI
2. **Internal Packages** (`internal/`)
- `config/` - Configuration management with YAML files
- `route/` - HTTP routing and middleware management
- `docker/` - Docker container integration and auto-discovery
- `autocert/` - SSL certificate management with Let's Encrypt
- `acl/` - Access control lists (IP/CIDR, country, timezone)
- `api/` - REST API server with Swagger documentation
- `homepage/` - WebUI dashboard and configuration interface
- `metrics/` - System metrics and uptime monitoring
- `idlewatcher/` - Container idle detection and power management
- `watcher/` - File and container state watchers
3. **Sub-projects**
- `agent/` - System agent for monitoring containers
- `socket-proxy/` - Docker socket proxy
### Key Patterns
- **Task Management**: Use `internal/task/task.go` for managing object lifetimes and background operations
- **Concurrent Maps**: Use `github.com/puzpuzpuz/xsync/v4` instead of maps with mutexes
- **Error Handling**: Use `pkg/gperr` for nested errors with subjects
- **Configuration**: YAML-based configuration in `config/` directory
## Go Guidelines (from .cursor/rules/go.mdc)
1. Use builtin `min` and `max` functions instead of custom helpers
2. Prefer range-over-integer syntax (`for i := range 10`) over traditional loops
3. Use `xsync/v4` for concurrent maps instead of map+mutex
4. Beware of variable shadowing when making edits
5. Use `internal/task/task.go` for lifetime management:
- `task.RootTask()` for background operations
- `parent.Subtask()` for nested tasks
- `OnFinished()` and `OnCancel()` callbacks for cleanup
6. Use `pkg/gperr` for complex error scenarios:
- `gperr.Multiline()` for multiple operation attempts
- `gperr.NewBuilder()` for collecting multiple errors
- `gperr.NewGroup() + group.Go()` for collecting errors of multiple concurrent operations
- `gperr.New().Subject()` for errors with subjects
## Configuration Structure
- `config/config.yml` - Main configuration
- `config/middlewares/` - HTTP middleware configurations
- `config/*.yml` - Provider and service configurations
- `.env` - Environment variables for ports and settings
## Testing
Tests are located in `internal/` packages and can be run with:
- `make test` - Run all internal package tests
- Individual package tests: `go test ./internal/config/...`
- You MUST use `-ldflags="-checklinkname=0"` otherwise compiler will complain
- prefer `testify/require` over `expect`
## Docker Integration
GoDoxy integrates with Docker by:
1. Listing all containers and reading their labels
2. Creating routes based on `proxy.aliases` label or container name
3. Watching for container/config changes and updating automatically
4. Supporting both Docker and Podman runtimes

97
CLAUDE.md Normal file
View File

@@ -0,0 +1,97 @@
______________________________________________________________________
## alwaysApply: true
# Cursor Rules
## Project Overview
GoDoxy is a lightweight reverse proxy with WebUI written in Go. It automatically configures routes for Docker containers using labels and provides SSL certificate management, access control, and monitoring capabilities.
## Development Commands
You should not run any commands to build or run the project.
## Documentation
If `README.md` exists in the package:
- Read it to understand what the package does and how it works.
- Update it with the changes you made (if any).
Update the roort `README.md` if relevant.
## Architecture
### Core Components
1. **Main Entry Point** (`cmd/main.go`)
- Initializes configuration and logging
- Starts the proxy server and WebUI
1. **Internal Packages** (`internal/`)
- `config/` - Configuration management with YAML files
- `route/` - HTTP routing and middleware management
- `docker/` - Docker container integration and auto-discovery
- `autocert/` - SSL certificate management with Let's Encrypt
- `acl/` - Access control lists (IP/CIDR, country, timezone)
- `api/` - REST API server with Swagger documentation
- `homepage/` - WebUI dashboard and configuration interface
- `metrics/` - System metrics and uptime monitoring
- `idlewatcher/` - Container idle detection and power management
- `watcher/` - File and container state watchers
1. **Sub-projects**
- `agent/` - System agent for monitoring containers
- `socket-proxy/` - Docker socket proxy
### Key Patterns
- **Task Management**: Use `internal/task/task.go` for managing object lifetimes and background operations
- **Concurrent Maps**: Use `github.com/puzpuzpuz/xsync/v4` instead of maps with mutexes
- **Error Handling**: Use `pkg/gperr` for nested errors with subjects
- **Configuration**: YAML-based configuration in `config/` directory
## Go Guidelines (from .cursor/rules/go.mdc)
1. Use builtin `min` and `max` functions instead of custom helpers
1. Prefer range-over-integer syntax (`for i := range 10`) over traditional loops
1. Use `xsync/v4` for concurrent maps instead of map+mutex
1. Beware of variable shadowing when making edits
1. Use `internal/task/task.go` for lifetime management:
- `task.RootTask()` for background operations
- `parent.Subtask()` for nested tasks
- `OnFinished()` and `OnCancel()` callbacks for cleanup
1. Use `pkg/gperr` for complex error scenarios:
- `gperr.Multiline()` for multiple operation attempts
- `gperr.NewBuilder()` for collecting multiple errors
- `gperr.NewGroup() + group.Go()` for collecting errors of multiple concurrent operations
- `gperr.New().Subject()` for errors with subjects
## Configuration Structure
- `config/config.yml` - Main configuration
- `config/middlewares/` - HTTP middleware configurations
- `config/*.yml` - Provider and service configurations
- `.env` - Environment variables for ports and settings
## Testing
Tests are located in `internal/` packages and can be run with:
- `make test` - Run all internal package tests
- Individual package tests: `go test ./internal/config/...`
- You MUST use `-ldflags="-checklinkname=0"` otherwise compiler will complain
- prefer `testify/require` over `expect`
## Docker Integration
GoDoxy integrates with Docker by:
1. Listing all containers and reading their labels
1. Creating routes based on `proxy.aliases` label or container name
1. Watching for container/config changes and updating automatically
1. Supporting both Docker and Podman runtimes

36
RELEASE_NOTES.md Normal file
View File

@@ -0,0 +1,36 @@
# GoDoxy v0.24.0 Release Notes
## New
- **Core/Agent**: stream tunneling (TLS/dTLS) with multiplexed TLS port supporting HTTP API and custom stream protocol via ALPN #188
- **Core/Agent**: TCP and DTLS/UDP stream tunneling with health-check support and runtime capability detection
- **Core/Router**: TCP/UDP route configurable bind address support
- **WebUI/Autocert**: multiple certificates display with Carousel component
- **WebUI/Agent**: stream support status display (TCP/UDP capabilities)
## Changes
- **Core/Agent**: refactored HTTP server to use direct setup instead of goutils/server helper
- **Core/HealthCheck**: restructured into dedicated `internal/health/check/` package
- **Core/Dockerfile**: updated to use bun runtime with distroless base images
- **Core/Compose**: updated agent compose template to expose TCP and UDP ports for stream tunneling
## Fixes
- **Core/Stream**: fixed stream headers with read deadlines to prevent hangs
- **Core/Icon**: fixed icons provider initialization on first load
- **Core/Docker**: fixed TLS verification and dial handling for custom Docker providers
- **Core/Stream**: fixed hostname handling for stream routes
- **Core/HTTP**: fixed HTTPS redirect for IPv6 with `net.JoinHostPort`
- **Core/Stream**: fixed remote stream scheme for IPv4 and IPv6 addresses
- **Core/HealthCheck**: fixed panic on TLS errors during HTTP health checks
- **Core/Stream**: fixed nil panic for excluded routes
- **Core/Store**: fixed empty segment handling in nested paths
## Refactoring
- **Core/Agent**: extracted agent pool and HTTP utilities to dedicated package
- **Core/Route**: improved References method for FQDN alias handling
- **Core/Icon**: reorganized with health checking and retry logic
- **Core/Error**: replaced `gperr.Builder` with `gperr.Group` for concurrent error handling
- **Core/Utils**: removed `internal/utils` entirely, moved `RefCounter` to goutils

Submodule goutils updated: 4b046d275f...326c1f1eb3