mirror of
https://github.com/yusing/godoxy.git
synced 2026-01-11 21:10:30 +01:00
- Replaced `goutils/server` helper library with manual HTTP server configuration for agent socketproxy - Removed entire `agent/pkg/server/server.go` package (43 lines) that wrapped TLS/HTTP server functionality - Added explicit TCP listener and integrated zerolog with server's error logging - Cleaned up 17 unused indirect agent dependencies
agent/cmd
The main entry point for the GoDoxy Agent, a secure monitoring and proxy agent that runs alongside Docker containers.
Overview
This package contains the main.go entry point for the GoDoxy Agent. The agent is a TLS-enabled server that provides:
- Secure Docker socket proxying with client certificate authentication
- HTTP proxy capabilities for container traffic
- System metrics collection and monitoring
- Health check endpoints
Architecture
graph TD
A[main] --> B[Logger Init]
A --> C[Load CA Certificate]
A --> D[Load Server Certificate]
A --> E[Log Version Info]
A --> F[Start Agent Server]
A --> G[Start Socket Proxy]
A --> H[Start System Info Poller]
A --> I[Wait Exit]
F --> F1[TLS with mTLS]
F --> F2[Agent Handler]
G --> G1[Docker Socket Proxy]
Main Function Flow
- Logger Setup: Configures zerolog with console output
- Certificate Loading: Loads CA and server certificates for TLS/mTLS
- Version Logging: Logs agent version and configuration
- Agent Server: Starts the main HTTPS server with agent handlers
- Socket Proxy: Starts Docker socket proxy if configured
- System Monitoring: Starts system info polling
- Graceful Shutdown: Waits for exit signal (3 second timeout)
Configuration
See agent/pkg/env/README.md for configuration options.
Dependencies
agent/pkg/agent- Core agent types and constantsagent/pkg/env- Environment configurationagent/pkg/server- Server implementationsocketproxy/pkg- Docker socket proxyinternal/metrics/systeminfo- System metrics