How lovelaze/nebula-sync works
Project Type and Purpose
• This is a Go-based CLI tool (that can also run in a Docker container) designed to synchronize the configuration of a primary Pi-hole instance with one or more replica instances.
• The README highlights two main synchronization modes ("Full sync" via Teleporter and "Selective sync"). It also shows that the tool can be scheduled via cron and run in containerized environments.
File Structure
• Top-Level Directories/Files:
• cmd: Contains the main entry points (root.go, run.go) where command-line parsing and the program startup happen.
• internal: Holds the core business logic:
▪ config: Reads and validates environment variables and configuration settings.
▪ log: Handles logging across the application.
▪ pihole: Encapsulates interactions with Pi-hole’s API including data model definitions.
▪ service: Likely acts as an orchestrator for the overall synchronization logic.
▪ sync: Contains modules for the synchronization process with subdivisions for “full”, “selective”, “retry” and filtering logic.
▪ mocks: Contains mocks for Pi-hole and sync components for testing purposes.
• e2e, testdata: For end-to-end and other tests.
• version: Provides versioning information.
• Others: GitHub workflows, Dockerfile, and related build/release configurations.