backupy-agent/apps/agent/internal/discovery/discovery.go
TronoSfera 8b0c978337 feat(initial): Backupy agent + backupy-decrypt CLI
Source ports from the TronoSfera/backupy-cloud monorepo:
- apps/agent/        — Go agent (WSS client, persistent queue, Docker
                       discovery, 5 DB drivers: PG/MySQL/Mongo/Redis/SQLite,
                       pre/post hooks, Prometheus metrics)
- apps/backupy-decrypt/ — standalone CLI for client-side decryption
- packages/proto/    — protobuf wire format (generated .pb.go committed
                       so the repo builds without protoc)
- docs/              — agent spec + wire-protocol contract

Apache-2.0 license. Image published to ghcr.io/tronosfera/backupy-agent
on every v* tag via .github/workflows/release.yml (multi-arch amd64+arm64).
2026-05-17 20:22:35 +03:00

21 lines
1.1 KiB
Go

// Package discovery scans the local Docker socket and reports discovered
// database containers (postgres, mysql, mariadb, mongo, redis).
//
// Implementation notes (D-05):
//
// - We talk to /var/run/docker.sock directly over HTTP via a custom
// net.Dialer wired into http.Transport. NO Docker SDK dependency.
// - Container detection is purely image-name heuristic plus a small set
// of env-var name hints. We do NOT exfiltrate env values, only the
// keys — the spec is explicit that plaintext secrets must stay on the
// host. See docs/03-agent-spec.md → "Auto-discovery".
// - The returned Container struct mirrors the proto DiscoveredContainer
// message so callers can map 1:1 without an extra translation layer.
package discovery
// File split:
// - scanner.go : the Scanner interface, Container/PortBinding types,
// NewDockerScanner constructor, BuildReport helper.
// - docker.go : the unix-socket HTTP client + Docker API parsing logic.
//
// This file exists so go-doc on the package shows the high-level overview.