package sendingdomain import ( "context" "regexp" "strings" "sync" "time" "github.com/google/uuid" "github.com/rs/zerolog/log" "github.com/warmbly/warmbly/internal/config" "github.com/warmbly/warmbly/internal/errx" "github.com/warmbly/warmbly/internal/models" ) // MaxBulkDomains bounds one bulk setup; the dashboard sends larger selections in chunks. const MaxBulkDomains = 100 // ErrIDBulkInvalid refuses a bulk setup that names no domain, too many, or nothing to do. const ErrIDBulkInvalid = "sending_domain_bulk_invalid" // bulkConcurrency bounds the vendor calls and DNS probes one bulk setup runs at once. const bulkConcurrency = 4 // bulkDomainTimeout bounds one domain, so a slow vendor or resolver cannot hold a slot for the whole request. const bulkDomainTimeout = 20 * time.Second var dnsLabel = regexp.MustCompile(`^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$`) // BulkInput applies one tracking subdomain and one redirect target to many domains. type BulkInput struct { Domains []string `json:"domains"` // TrackingLabel sets