feat: add CrowdSecWhitelist model and integrate into API route registration

This commit is contained in:
GitHub Actions
2026-04-15 19:49:43 +00:00
parent 40090cda23
commit 1726a19cb6
2 changed files with 14 additions and 0 deletions

View File

@@ -122,6 +122,7 @@ func RegisterWithDeps(ctx context.Context, router *gin.Engine, db *gorm.DB, cfg
&models.DNSProviderCredential{}, // Multi-credential support (Phase 3)
&models.Plugin{}, // Phase 5: DNS provider plugins
&models.ManualChallenge{}, // Phase 1: Manual DNS challenges
&models.CrowdSecWhitelist{}, // Issue #939: CrowdSec IP whitelist management
); err != nil {
return fmt.Errorf("auto migrate: %w", err)
}

View File

@@ -0,0 +1,13 @@
package models
import "time"
// CrowdSecWhitelist represents a single IP or CIDR block that CrowdSec should never ban.
type CrowdSecWhitelist struct {
ID uint `json:"-" gorm:"primaryKey"`
UUID string `json:"uuid" gorm:"uniqueIndex;not null"`
IPOrCIDR string `json:"ip_or_cidr" gorm:"not null;uniqueIndex"`
Reason string `json:"reason" gorm:"not null;default:''"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}