Mining/cmd/mining/cmd
snider 95ae55e4fa feat: Add rate limiter with cleanup and custom error types
Rate Limiter:
- Extract rate limiting to pkg/mining/ratelimiter.go with proper lifecycle
- Add Stop() method to gracefully shutdown cleanup goroutine
- Add RateLimiter.Middleware() for Gin integration
- Add ClientCount() for monitoring
- Fix goroutine leak in previous inline implementation

Custom Errors:
- Add pkg/mining/errors.go with MiningError type
- Define error codes: MINER_NOT_FOUND, INSTALL_FAILED, TIMEOUT, etc.
- Add predefined error constructors (ErrMinerNotFound, ErrStartFailed, etc.)
- Support error chaining with WithCause, WithDetails, WithSuggestion
- Include HTTP status codes and retry policies

Service:
- Add Service.Stop() method for graceful cleanup
- Update CLI commands to use context.Background() for Manager methods

Tests:
- Add comprehensive tests for RateLimiter (token bucket, multi-IP, refill)
- Add comprehensive tests for MiningError (codes, status, retryable)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 10:56:26 +00:00
..
doctor.go feat: Enhance mining configuration management and API documentation 2025-12-07 16:26:18 +00:00
install.go feat: Enhance mining configuration management and API documentation 2025-12-07 16:26:18 +00:00
list.go adds miner-cli, a miner management and lifecycle tool 2025-11-09 01:02:31 +00:00
node.go feat: Implement logging functionality for miners with log buffer and retrieval endpoint 2025-12-29 22:10:45 +00:00
peer.go feat: Add multi-node P2P mining management system 2025-12-29 19:49:33 +00:00
remote.go feat: Add multi-node P2P mining management system 2025-12-29 19:49:33 +00:00
root.go feat: Add WebSocket events, simulation mode, and redesigned Miners page 2025-12-31 07:11:41 +00:00
serve.go feat: Add rate limiter with cleanup and custom error types 2025-12-31 10:56:26 +00:00
simulate.go feat: Add rate limiter with cleanup and custom error types 2025-12-31 10:56:26 +00:00
start.go feat: Add rate limiter with cleanup and custom error types 2025-12-31 10:56:26 +00:00
status.go fix: Address race conditions and network blocking issues 2025-12-31 01:55:24 +00:00
stop.go feat: Add rate limiter with cleanup and custom error types 2025-12-31 10:56:26 +00:00
uninstall.go feat: Add rate limiter with cleanup and custom error types 2025-12-31 10:56:26 +00:00
update.go adds miner-cli, a miner management and lifecycle tool 2025-11-09 01:02:31 +00:00