Add configuration system and ARP-based device discovery

Implement comprehensive configuration management with CLI flags for WiFi interface, device discovery method, and file paths. Add ARP table parsing as an alternative to DHCP leases for more reliable device detection. Improve WiFi scanning to handle concurrent scan requests gracefully.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
nemunaire 2025-12-28 18:51:15 +07:00
commit 2b3a5b89f8
8 changed files with 156 additions and 28 deletions

View file

@ -4,6 +4,7 @@ import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/nemunaire/repeater/internal/config"
"github.com/nemunaire/repeater/internal/device"
"github.com/nemunaire/repeater/internal/hotspot"
"github.com/nemunaire/repeater/internal/logging"
@ -103,8 +104,8 @@ func ToggleHotspot(c *gin.Context, status *models.SystemStatus) {
}
// GetDevices returns connected devices
func GetDevices(c *gin.Context) {
devices, err := device.GetConnectedDevices()
func GetDevices(c *gin.Context, cfg *config.Config) {
devices, err := device.GetConnectedDevices(cfg)
if err != nil {
logging.AddLog("Système", "Erreur lors de la récupération des appareils: "+err.Error())
c.JSON(http.StatusInternalServerError, gin.H{"error": "Erreur lors de la récupération des appareils"})

View file

@ -7,11 +7,12 @@ import (
"github.com/gin-gonic/gin"
"github.com/nemunaire/repeater/internal/api/handlers"
"github.com/nemunaire/repeater/internal/config"
"github.com/nemunaire/repeater/internal/models"
)
// SetupRouter creates and configures the Gin router
func SetupRouter(status *models.SystemStatus, assets embed.FS) *gin.Engine {
func SetupRouter(status *models.SystemStatus, cfg *config.Config, assets embed.FS) *gin.Engine {
// Set Gin to release mode (can be overridden with GIN_MODE env var)
gin.SetMode(gin.ReleaseMode)
@ -38,7 +39,9 @@ func SetupRouter(status *models.SystemStatus, assets embed.FS) *gin.Engine {
}
// Device endpoints
api.GET("/devices", handlers.GetDevices)
api.GET("/devices", func(c *gin.Context) {
handlers.GetDevices(c, cfg)
})
// Status endpoint
api.GET("/status", func(c *gin.Context) {