Documentation
¶
Overview ¶
File: backend/internal/config/app.go
File: backend/internal/config/redis_config.go
File: backend/internal/config/types.go
Index ¶
- Constants
- func DefaultHTTPConfigDetails(appDefaults HTTPValidatorConfig) models.HTTPConfigDetails
- func GetCipherSuites(suiteNames []string) ([]uint16, error)
- func GetCurvePreferences(curveNames []string) ([]tls.CurveID, error)
- func GetDatabaseDSN(config *DatabaseConfig) string
- func GetTLSVersion(versionStr string) (uint16, bool)
- func IsValidFingerprint(fingerprint string) bool
- func IsValidSessionID(sessionID string) bool
- func SaveAppConfig(cfg *AppConfig) error
- func SaveDNSPersonas(personas []DNSPersona, configDir string) error
- func SaveHTTPPersonas(personas []HTTPPersona, configDir string) error
- func SaveKeywordSets(configDir string, keywordSets []KeywordSet) error
- func SaveProxies(proxies []ProxyConfigEntry, configDir string) error
- func ValidateConfigBytes(b []byte) error
- func ValidateEnvironmentConfigBytes(b []byte) error
- type AppConfig
- func (ac *AppConfig) GetDNSPersonaConfigByID(personaID string) (*DNSPersona, error)
- func (ac *AppConfig) GetHTTPPersonaByID(personaID string) (*HTTPPersona, error)
- func (ac *AppConfig) GetKeywordSetByID(keywordSetID string) (*KeywordSet, error)
- func (ac *AppConfig) GetLoadedFromPath() string
- func (ac *AppConfig) GetProxyConfigByID(proxyID string) (*ProxyConfigEntry, error)
- type AppConfigJSON
- type AuthConfig
- type CacheTTLConfig
- type ConfigTemplate
- type CookieHandlingConfig
- type DNSPersona
- type DNSValidatorConfig
- type DNSValidatorConfigJSON
- type DatabaseConfig
- type DomainReconciliationConfig
- type DomainReconciliationConfigJSON
- type EnhancedServerConfig
- type EnvAuthConfig
- type EnvironmentConfig
- type EnvironmentManager
- type FallbackPolicy
- type FeatureFlagConfig
- type FeatureFlags
- type FingerprintConfig
- type HTTP2SettingsConfig
- type HTTPPersona
- type HTTPValidatorConfig
- type HTTPValidatorConfigJSON
- type KeywordRule
- type KeywordSet
- type LoggingConfig
- type OptimizationConfig
- type PerformanceConfig
- type PhaseConfig
- type ProxyConfigEntry
- type ProxyManagerConfig
- type ProxyManagerConfigJSON
- type RateLimiterConfig
- type RedisCacheConfig
- type RedisConfig
- func (rc *RedisConfig) GetEntityTTL(entityType string) time.Duration
- func (rc *RedisConfig) IsPerformanceAlertEnabled() bool
- func (rc *RedisConfig) ShouldAlertOnErrorRate(errorRate float64) bool
- func (rc *RedisConfig) ShouldAlertOnHitRatio(hitRatio float64) bool
- func (rc *RedisConfig) ShouldAlertOnLatency(latencyMs int64) string
- func (rc *RedisConfig) ToRedisCacheConfig() RedisCacheConfig
- func (rc *RedisConfig) Validate() error
- type ResolvedConfig
- type SecretManager
- type ServerConfig
- type SessionConfig
- type SessionConfigManager
- type SessionSettings
- type TLSClientHelloConfig
- type TemplateManager
- type ValidationRule
- type WorkerConfig
Constants ¶
const ( SessionCookieName = "domainflow_session" // Fixed to match frontend expectation AuthTokensCookieName = "auth_tokens" )
Cookie names - shared between frontend and backend
const ( CookieMaxAge = 86400 // 24 hours - much longer for convenience CookiePath = "/" CookieSecure = false // Not required on localhost CookieHttpOnly = true // Prevent JS access; cookies only sent by browser CookieSameSite = "Lax" // Acceptable for localhost cross-origin (same-site) calls )
Cookie settings - safe defaults for development on localhost
const ( DefaultRateLimitDPS = 10.0 DefaultRateLimitBurst = 5 DefaultHTTPRateLimitDPS = 5.0 DefaultHTTPRateLimitBurst = 3 DefaultSystemAPIKeyPlaceholder = "SET_A_REAL_KEY_IN_CONFIG_OR_ENV_d9f8s7d9f8s7d9f8" DefaultStreamChunkSize = 200 DefaultGinMode = "debug" DefaultDBMaxOpenConns = 300 // Phase 3: 3x increase for 125 concurrent workers (75 DNS + 50 HTTP) DefaultDBMaxIdleConns = 150 // Phase 3: 3x increase for optimized connection reuse DefaultDBConnMaxLifetimeMinutes = 30 // Increased for stability // Enterprise database optimization defaults DefaultDBMaxIdleTimeMinutes = 15 DefaultDBConnMaxIdleTime = 15 DefaultDBReadTimeoutSeconds = 30 DefaultDBWriteTimeoutSeconds = 30 DefaultDBQueryTimeoutSeconds = 60 DefaultDBPingTimeoutSeconds = 5 // WorkerConfig Defaults DefaultNumWorkers = 5 DefaultPollIntervalSeconds = 5 DefaultErrorRetryDelaySeconds = 30 DefaultMaxJobRetries = 3 DefaultJobProcessingTimeoutMinutes = 15 // HTTPValidatorConfig Defaults DefaultHTTPUserAgent = "DomainFlowBot/1.2 (DefaultStudioAgent)" DefaultMaxBodyReadBytes int64 = 10 * 1024 * 1024 // 10MB DefaultHTTPFollowRedirects = true DefaultHTTPRequestTimeoutSeconds = 15 DefaultHTTPMaxRedirects = 7 // ProxyManager defaults DefaultProxyTestTimeoutSeconds = 10 DefaultProxyTestURL = "https://httpbin.org/ip" DefaultProxyInitialHealthCheckTimeoutSeconds = 7 DefaultProxyMaxConcurrentInitialChecks = 10 // Global API rate limiter defaults DefaultAPIRateLimitWindowSeconds = 900 DefaultAPIRateLimitMaxRequests = 1000 DefaultLogFilePath = "logs/apiserver.log" )
const ( MinFingerprintLength = 16 MaxFingerprintLength = 64 DefaultFingerprintAlgorithm = "sha256" )
Security constants for fingerprinting
const (
CookieDomain = "" // Let browser decide
)
Cookie configuration
Variables ¶
This section is empty.
Functions ¶
func DefaultHTTPConfigDetails ¶
func DefaultHTTPConfigDetails(appDefaults HTTPValidatorConfig) models.HTTPConfigDetails
DefaultHTTPConfigDetails provides a default structure for HTTPConfigDetails.
func GetCipherSuites ¶
GetCipherSuites translates a list of string cipher suite names to their crypto/tls constants.
func GetCurvePreferences ¶
GetCurvePreferences translates a list of string curve names to their crypto/tls constants.
func GetDatabaseDSN ¶
func GetDatabaseDSN(config *DatabaseConfig) string
GetDatabaseDSN returns the database connection string
func GetTLSVersion ¶
GetTLSVersion translates a string representation of a TLS version to its crypto/tls constant.
func IsValidFingerprint ¶
IsValidFingerprint validates session fingerprint format
func IsValidSessionID ¶
IsValidSessionID validates session ID format and length
func SaveAppConfig ¶
SaveAppConfig saves the main application configuration (AppConfig) to its loadedFromPath.
func SaveDNSPersonas ¶
func SaveDNSPersonas(personas []DNSPersona, configDir string) error
SaveDNSPersonas saves the DNS personas to their configuration file.
func SaveHTTPPersonas ¶
func SaveHTTPPersonas(personas []HTTPPersona, configDir string) error
SaveHTTPPersonas saves the HTTP personas to their configuration file.
func SaveKeywordSets ¶
func SaveKeywordSets(configDir string, keywordSets []KeywordSet) error
SaveKeywordSets saves the provided keyword sets to the configuration file. It validates regex rules (when Type == "regex") and writes a pretty JSON file. The CompiledRegex field is never persisted.
func SaveProxies ¶
func SaveProxies(proxies []ProxyConfigEntry, configDir string) error
SaveProxies saves the proxy configurations to their file.
func ValidateConfigBytes ¶
ValidateConfigBytes validates the provided JSON configuration against the schema.
func ValidateEnvironmentConfigBytes ¶
ValidateEnvironmentConfigBytes validates EnvironmentConfig JSON bytes against the schema.
Types ¶
type AppConfig ¶
type AppConfig struct {
Server ServerConfig `json:"server"`
Worker WorkerConfig `json:"worker"` // Added WorkerConfig
DNSValidator DNSValidatorConfig `json:"dnsValidator"`
HTTPValidator HTTPValidatorConfig `json:"httpValidator"`
Logging LoggingConfig `json:"logging"`
RateLimiter RateLimiterConfig `json:"rateLimiter"`
ProxyManager ProxyManagerConfig `json:"proxyManager"`
Features FeatureFlags `json:"features"`
Optimization OptimizationConfig `json:"optimization"` // N+1 Optimization configuration
Reconciliation DomainReconciliationConfig `json:"reconciliation"`
DNSPersonas []DNSPersona `json:"dnsPersonas"`
HTTPPersonas []HTTPPersona `json:"httpPersonas"`
Proxies []ProxyConfigEntry `json:"proxies"`
KeywordSets []KeywordSet `json:"keywordSets"`
// contains filtered or unexported fields
}
AppConfig is the main application configuration structure. It aggregates all other configuration parts.
func ConvertJSONToAppConfig ¶
func ConvertJSONToAppConfig(jsonCfg AppConfigJSON) *AppConfig
ConvertJSONToAppConfig converts the JSON structure (AppConfigJSON) to the internal AppConfig model.
func DefaultConfig ¶
func DefaultConfig() *AppConfig
DefaultConfig initializes and returns a default AppConfig structure by converting DefaultAppConfigJSON.
func Load ¶
Load initializes the application configuration by reading config.json and supplemental files.
func LoadWithEnv ¶
LoadWithEnv loads configuration from JSON file and overrides with environment variables
func (*AppConfig) GetDNSPersonaConfigByID ¶
func (ac *AppConfig) GetDNSPersonaConfigByID(personaID string) (*DNSPersona, error)
GetDNSPersonaConfigByID retrieves a specific DNS persona configuration by its ID.
func (*AppConfig) GetHTTPPersonaByID ¶
func (ac *AppConfig) GetHTTPPersonaByID(personaID string) (*HTTPPersona, error)
GetHTTPPersonaByID retrieves a specific HTTP persona configuration by its ID.
func (*AppConfig) GetKeywordSetByID ¶
func (ac *AppConfig) GetKeywordSetByID(keywordSetID string) (*KeywordSet, error)
GetKeywordSetByID retrieves a specific KeywordSet by its ID.
func (*AppConfig) GetLoadedFromPath ¶
GetLoadedFromPath returns the file path from which the main config was loaded.
func (*AppConfig) GetProxyConfigByID ¶
func (ac *AppConfig) GetProxyConfigByID(proxyID string) (*ProxyConfigEntry, error)
GetProxyConfigByID retrieves a specific Proxy configuration by its ID.
type AppConfigJSON ¶
type AppConfigJSON struct {
Server ServerConfig `json:"server"`
Worker WorkerConfig `json:"worker,omitempty"` // WorkerConfig now includes the new fields
DNSValidator DNSValidatorConfigJSON `json:"dnsValidator"`
HTTPValidator HTTPValidatorConfigJSON `json:"httpValidator"`
Logging LoggingConfig `json:"logging"`
RateLimiter RateLimiterConfig `json:"rateLimiter,omitempty"`
ProxyManager ProxyManagerConfigJSON `json:"proxyManager"`
Features FeatureFlags `json:"features"`
Reconciliation DomainReconciliationConfigJSON `json:"reconciliation"`
}
AppConfigJSON defines the structure of the main config.json file. This struct is used to unmarshal the config.json file.
func ConvertAppConfigToJSON ¶
func ConvertAppConfigToJSON(appCfg *AppConfig) AppConfigJSON
ConvertAppConfigToJSON converts the internal AppConfig model to the AppConfigJSON structure for saving.
func DefaultAppConfigJSON ¶
func DefaultAppConfigJSON() AppConfigJSON
DefaultAppConfigJSON returns the default application configuration as an AppConfigJSON struct.
type AuthConfig ¶
type AuthConfig struct {
// Password security
BcryptCost int `json:"bcryptCost" mapstructure:"bcrypt_cost"`
PepperKey string `json:"pepperKey" mapstructure:"pepper_key"`
PasswordMinLength int `json:"passwordMinLength" mapstructure:"password_min_length"`
// Session configuration
SessionDuration time.Duration `json:"sessionDuration" mapstructure:"session_duration"`
SessionIdleTimeout time.Duration `json:"sessionIdleTimeout" mapstructure:"session_idle_timeout"`
SessionCookieName string `json:"sessionCookieName" mapstructure:"session_cookie_name"`
SessionCookieDomain string `json:"sessionCookieDomain" mapstructure:"session_cookie_domain"`
SessionCookieSecure bool `json:"sessionCookieSecure" mapstructure:"session_cookie_secure"`
// Token configuration
ResetTokenExpiry time.Duration `json:"resetTokenExpiry" mapstructure:"reset_token_expiry"`
// Account lockout
MaxFailedAttempts int `json:"maxFailedAttempts" mapstructure:"max_failed_attempts"`
AccountLockDuration time.Duration `json:"accountLockDuration" mapstructure:"account_lock_duration"`
// Rate limiting
RateLimitWindow time.Duration `json:"rateLimitWindow" mapstructure:"rate_limit_window"`
MaxLoginAttempts int `json:"maxLoginAttempts" mapstructure:"max_login_attempts"`
MaxPasswordResetAttempts int `json:"maxPasswordResetAttempts" mapstructure:"max_password_reset_attempts"`
// CAPTCHA configuration
RecaptchaSiteKey string `json:"recaptchaSiteKey" mapstructure:"recaptcha_site_key"`
RecaptchaSecretKey string `json:"recaptchaSecretKey" mapstructure:"recaptcha_secret_key"`
CaptchaThreshold int `json:"captchaThreshold" mapstructure:"captcha_threshold"`
// Email configuration (for password reset)
SMTPHost string `json:"smtpHost" mapstructure:"smtp_host"`
SMTPPort int `json:"smtpPort" mapstructure:"smtp_port"`
SMTPUsername string `json:"smtpUsername" mapstructure:"smtp_username"`
SMTPPassword string `json:"smtpPassword" mapstructure:"smtp_password"`
FromEmail string `json:"fromEmail" mapstructure:"from_email"`
FromName string `json:"fromName" mapstructure:"from_name"`
}
AuthConfig holds authentication-related configuration
func GetDefaultAuthConfig ¶
func GetDefaultAuthConfig() AuthConfig
GetDefaultAuthConfig returns default authentication configuration
type CacheTTLConfig ¶
type CacheTTLConfig struct {
Personas time.Duration `yaml:"personas" json:"personas"`
KeywordSets time.Duration `yaml:"keyword_sets" json:"keyword_sets"`
Keywords time.Duration `yaml:"keywords" json:"keywords"`
Proxies time.Duration `yaml:"proxies" json:"proxies"`
DNSValidation time.Duration `yaml:"dns_validation" json:"dns_validation"`
HTTPValidation time.Duration `yaml:"http_validation" json:"http_validation"`
}
CacheTTLConfig contains TTL settings for different entity types
type ConfigTemplate ¶
type ConfigTemplate struct {
Name string `json:"name"`
Type string `json:"type"`
Schema map[string]interface{} `json:"schema"`
ValidationRules []ValidationRule `json:"validation_rules"`
}
ConfigTemplate represents a reusable configuration template.
type CookieHandlingConfig ¶
type CookieHandlingConfig struct {
Mode string `json:"mode,omitempty"`
}
CookieHandlingConfig defines how cookies should be handled.
type DNSPersona ¶
type DNSPersona struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Config DNSValidatorConfigJSON `json:"config"` // Uses the JSON variant for easy load/save
}
DNSPersona defines the structure for a DNS persona, including its specific DNS validator configuration.
func LoadDNSPersonas ¶
func LoadDNSPersonas(configDir string) ([]DNSPersona, error)
LoadDNSPersonas loads DNS persona configurations from the specified file in configDir.
type DNSValidatorConfig ¶
type DNSValidatorConfig struct {
Resolvers []string
UseSystemResolvers bool
QueryTimeout time.Duration
MaxDomainsPerRequest int
ResolverStrategy string
ResolversWeighted map[string]int
ResolversPreferredOrder []string
ConcurrentQueriesPerDomain int
QueryDelayMin time.Duration
QueryDelayMax time.Duration
MaxConcurrentGoroutines int
RateLimitDPS float64
RateLimitBurst int
QueryTimeoutSeconds int `json:"-"`
JSONQueryDelayMinMs int `json:"-"`
JSONQueryDelayMaxMs int `json:"-"`
}
DNSValidatorConfig holds the effective configuration for DNSValidator.
func ConvertJSONToDNSConfig ¶
func ConvertJSONToDNSConfig(jsonCfg DNSValidatorConfigJSON) DNSValidatorConfig
type DNSValidatorConfigJSON ¶
type DNSValidatorConfigJSON struct {
Resolvers []string `json:"resolvers,omitempty"`
UseSystemResolvers bool `json:"useSystemResolvers"`
QueryTimeoutSeconds int `json:"queryTimeoutSeconds,omitempty"`
MaxDomainsPerRequest int `json:"maxDomainsPerRequest,omitempty"`
ResolverStrategy string `json:"resolverStrategy,omitempty"`
ResolversWeighted map[string]int `json:"resolversWeighted,omitempty"`
ResolversPreferredOrder []string `json:"resolversPreferredOrder,omitempty"`
ConcurrentQueriesPerDomain int `json:"concurrentQueriesPerDomain,omitempty"`
QueryDelayMinMs int `json:"queryDelayMinMs,omitempty"`
QueryDelayMaxMs int `json:"queryDelayMaxMs,omitempty"`
MaxConcurrentGoroutines int `json:"maxConcurrentGoroutines,omitempty"`
RateLimitDPS float64 `json:"rateLimitDps,omitempty"`
RateLimitBurst int `json:"rateLimitBurst,omitempty"`
}
DNSValidatorConfigJSON is used for marshalling/unmarshalling DNSValidator settings.
func ConvertDNSConfigToJSON ¶
func ConvertDNSConfigToJSON(cfg DNSValidatorConfig) DNSValidatorConfigJSON
type DatabaseConfig ¶
type DatabaseConfig struct {
Host string `json:"host"`
Port int `json:"port"`
Name string `json:"name"`
User string `json:"user"`
Password string `json:"password"`
SSLMode string `json:"sslmode"`
MaxConnections int `json:"maxConnections"`
MaxIdleConnections int `json:"maxIdleConnections"`
ConnectionLifetime int `json:"connectionLifetime"`
}
DatabaseConfig holds database connection settings
type DomainReconciliationConfig ¶
type DomainReconciliationConfig struct {
Enabled bool
IntervalMinutes int
DriftThresholdPct float64
AutoCorrect bool
MaxCorrectionsPerRun int
}
DomainReconciliationConfig controls the nightly domain counters reconciliation job.
func ConvertJSONToDomainReconciliationConfig ¶
func ConvertJSONToDomainReconciliationConfig(j DomainReconciliationConfigJSON) DomainReconciliationConfig
type DomainReconciliationConfigJSON ¶
type DomainReconciliationConfigJSON struct {
Enabled bool `json:"enabled"`
IntervalMinutes int `json:"intervalMinutes"`
DriftThresholdPct float64 `json:"driftThresholdPct"`
AutoCorrect bool `json:"autoCorrect"`
MaxCorrectionsPerRun int `json:"maxCorrectionsPerRun"`
}
DomainReconciliationConfigJSON is JSON representation.
func ConvertDomainReconciliationConfigToJSON ¶
func ConvertDomainReconciliationConfigToJSON(c DomainReconciliationConfig) DomainReconciliationConfigJSON
type EnhancedServerConfig ¶
type EnhancedServerConfig struct {
ServerConfig
DatabaseConfig *DatabaseConfig `json:"database,omitempty"`
AuthConfig *EnvAuthConfig `json:"auth,omitempty"`
}
Update ServerConfig to include database and auth configs
type EnvAuthConfig ¶
type EnvAuthConfig struct {
JWTSecret string `json:"jwtSecret"`
SessionSecret string `json:"sessionSecret"`
EncryptionKey string `json:"encryptionKey"`
APIKeySalt string `json:"apiKeySalt"`
SessionTimeout string `json:"sessionTimeout"`
CookieSecure bool `json:"cookieSecure"`
CookieHTTPOnly bool `json:"cookieHttpOnly"`
CookieSameSite string `json:"cookieSameSite"`
}
EnvAuthConfig holds authentication settings from environment variables
type EnvironmentConfig ¶
type EnvironmentConfig struct {
Environment string `json:"environment"`
ServiceName string `json:"service_name"`
Version string `json:"version"`
Configuration map[string]interface{} `json:"configuration"`
EncryptedFields []string `json:"encrypted_fields,omitempty"`
}
EnvironmentConfig holds environment specific configuration data.
type EnvironmentManager ¶
type EnvironmentManager struct {
// contains filtered or unexported fields
}
EnvironmentManager handles environment-specific configuration with overrides and secret resolution.
func NewEnvironmentManager ¶
func NewEnvironmentManager(base map[string]interface{}, sm *SecretManager) *EnvironmentManager
NewEnvironmentManager creates a new manager with the given base configuration.
func (*EnvironmentManager) ResolveConfiguration ¶
func (em *EnvironmentManager) ResolveConfiguration(serviceName, environment string) (*ResolvedConfig, error)
ResolveConfiguration returns the configuration with overrides and secrets resolved.
func (*EnvironmentManager) SetOverrides ¶
func (em *EnvironmentManager) SetOverrides(env string, cfg map[string]interface{})
SetOverrides sets overrides for an environment.
type FallbackPolicy ¶
type FallbackPolicy string
FallbackPolicy defines when to use headless browsing if standard HTTP fetch fails or is insufficient.
const ( FallbackNever FallbackPolicy = "never" // Only use standard HTTP. FallbackOnFetchError FallbackPolicy = "on_fetch_error" // Use headless if standard HTTP GET fails (e.g., network error, non-2xx/3xx). FallbackAlways FallbackPolicy = "always" // (Primarily for testing/specific needs) Use headless for all attempts after an initial standard try. )
type FeatureFlagConfig ¶
type FeatureFlagConfig struct {
GradualRollout bool `yaml:"gradual_rollout" json:"gradual_rollout"`
RolloutPercentage int `yaml:"rollout_percentage" json:"rollout_percentage"`
FallbackOnError bool `yaml:"fallback_on_error" json:"fallback_on_error"`
DebugLogging bool `yaml:"debug_logging" json:"debug_logging"`
}
FeatureFlagConfig controls gradual rollout and feature flags
type FeatureFlags ¶
type FeatureFlags struct {
EnableRealTimeUpdates bool `json:"enableRealTimeUpdates"`
EnableOfflineMode bool `json:"enableOfflineMode"`
EnableAnalytics bool `json:"enableAnalytics"`
EnableDebugMode bool `json:"enableDebugMode"`
EnableStealth bool `json:"enableStealth"`
// EnableStealthForceCursor forces stealth to use cursor pagination only (no legacy fallback)
EnableStealthForceCursor bool `json:"enableStealthForceCursor"`
}
FeatureFlags holds feature flag settings persisted in config.json.
type FingerprintConfig ¶
type FingerprintConfig struct {
IncludeIP bool `json:"include_ip"`
IncludeUserAgent bool `json:"include_user_agent"`
IncludeScreenRes bool `json:"include_screen_resolution"`
IncludeTimezone bool `json:"include_timezone"`
IncludeLanguage bool `json:"include_language"`
HashAlgorithm string `json:"hash_algorithm"`
TruncateLength int `json:"truncate_length"`
}
Fingerprinting configuration
func GetDefaultFingerprintConfig ¶
func GetDefaultFingerprintConfig() *FingerprintConfig
GetDefaultFingerprintConfig returns default fingerprinting configuration
type HTTP2SettingsConfig ¶
type HTTP2SettingsConfig struct {
Enabled *bool `json:"enabled,omitempty"`
}
HTTP2SettingsConfig defines HTTP/2 specific settings.
type HTTPPersona ¶
type HTTPPersona struct {
// Core Identification & Existing Fields
ID string `json:"id" yaml:"id"`
Name string `json:"name" yaml:"name"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
UserAgent string `json:"userAgent" yaml:"userAgent"`
Headers map[string]string `json:"headers" yaml:"headers"`
HeaderOrder []string `json:"headerOrder,omitempty" yaml:"headerOrder,omitempty"`
TLSClientHello TLSClientHelloConfig `json:"tlsClientHello,omitempty" yaml:"tlsClientHello,omitempty"`
HTTP2Settings HTTP2SettingsConfig `json:"http2Settings,omitempty" yaml:"http2Settings,omitempty"`
CookieHandling CookieHandlingConfig `json:"cookieHandling,omitempty" yaml:"cookieHandling,omitempty"`
Notes string `json:"notes,omitempty" yaml:"notes,omitempty"`
RateLimitDPS float64 `json:"rateLimitDps,omitempty" yaml:"rateLimitDps,omitempty"`
RateLimitBurst int `json:"rateLimitBurst,omitempty" yaml:"rateLimitBurst,omitempty"`
// Validation Rules
AllowedStatusCodes []int `json:"allowedStatusCodes,omitempty" yaml:"allowedStatusCodes,omitempty"`
RequiredHeaders map[string]string `json:"requiredHeaders,omitempty" yaml:"requiredHeaders,omitempty"`
ForbiddenHeaders []string `json:"forbiddenHeaders,omitempty" yaml:"forbiddenHeaders,omitempty"`
RequiredContent []string `json:"requiredContent,omitempty" yaml:"requiredContent,omitempty"`
ForbiddenContent []string `json:"forbiddenContent,omitempty" yaml:"forbiddenContent,omitempty"`
RequestTimeout time.Duration `json:"requestTimeoutSeconds,omitempty" yaml:"requestTimeoutSeconds,omitempty"`
FollowRedirects bool `json:"followRedirects" yaml:"followRedirects"`
// Headless Browser Configuration
UseHeadless bool `json:"useHeadless" yaml:"useHeadless"`
FallbackPolicy FallbackPolicy `json:"fallbackPolicy,omitempty" yaml:"fallbackPolicy,omitempty"`
ViewportWidth int `json:"viewportWidth,omitempty" yaml:"viewportWidth,omitempty"`
ViewportHeight int `json:"viewportHeight,omitempty" yaml:"viewportHeight,omitempty"`
HeadlessUserAgent string `json:"headlessUserAgent,omitempty" yaml:"headlessUserAgent,omitempty"`
ScriptExecution bool `json:"scriptExecution" yaml:"scriptExecution"`
LoadImages bool `json:"loadImages" yaml:"loadImages"`
Screenshot bool `json:"screenshot" yaml:"screenshot"`
DOMSnapshot bool `json:"domSnapshot" yaml:"domSnapshot"`
HeadlessTimeout time.Duration `json:"headlessTimeoutSeconds,omitempty" yaml:"headlessTimeoutSeconds,omitempty"`
WaitDelay time.Duration `json:"waitDelaySeconds,omitempty" yaml:"waitDelaySeconds,omitempty"`
FetchBodyForKeywords *bool `json:"fetchBodyForKeywords,omitempty" yaml:"fetchBodyForKeywords,omitempty"` // New field for keyword extraction control
// Common or Overarching Settings
MaxRetries int `json:"maxRetries,omitempty" yaml:"maxRetries,omitempty"`
// Metadata
CreatedAt time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"`
UpdatedAt time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"`
Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"`
}
HTTPPersona defines the structure for an HTTP persona. It includes settings for standard HTTP requests, TLS, HTTP/2, cookies, rate limiting, content validation rules, and headless browser interaction.
func LoadHTTPPersonas ¶
func LoadHTTPPersonas(configDir string) ([]HTTPPersona, error)
LoadHTTPPersonas loads HTTP persona configurations from the specified file in configDir.
type HTTPValidatorConfig ¶
type HTTPValidatorConfig struct {
DefaultUserAgent string
UserAgents []string
DefaultHeaders map[string]string
RequestTimeout time.Duration
MaxRedirects int
FollowRedirects bool
MaxDomainsPerRequest int
AllowInsecureTLS bool
MaxConcurrentGoroutines int
RateLimitDPS float64
RateLimitBurst int
MaxBodyReadBytes int64
RequestTimeoutSeconds int `json:"-"`
}
HTTPValidatorConfig holds the effective configuration for HTTPValidator.
func ConvertJSONToHTTPConfig ¶
func ConvertJSONToHTTPConfig(jsonCfg HTTPValidatorConfigJSON) HTTPValidatorConfig
func (*HTTPValidatorConfig) ToModelHTTPConfigDetails ¶
func (hvc *HTTPValidatorConfig) ToModelHTTPConfigDetails() models.HTTPConfigDetails
ToModelHTTPConfigDetails converts HTTPValidatorConfig to models.HTTPConfigDetails.
type HTTPValidatorConfigJSON ¶
type HTTPValidatorConfigJSON struct {
DefaultUserAgent string `json:"defaultUserAgent,omitempty"`
UserAgents []string `json:"userAgents,omitempty"`
DefaultHeaders map[string]string `json:"defaultHeaders,omitempty"`
RequestTimeoutSeconds int `json:"requestTimeoutSeconds,omitempty"`
MaxRedirects int `json:"maxRedirects,omitempty"`
FollowRedirects *bool `json:"followRedirects,omitempty"`
MaxDomainsPerRequest int `json:"maxDomainsPerRequest,omitempty"`
AllowInsecureTLS bool `json:"allowInsecureTLS"`
MaxConcurrentGoroutines int `json:"maxConcurrentGoroutines,omitempty"`
RateLimitDPS float64 `json:"rateLimitDps,omitempty"`
RateLimitBurst int `json:"rateLimitBurst,omitempty"`
MaxBodyReadBytes int64 `json:"maxBodyReadBytes,omitempty"`
}
HTTPValidatorConfigJSON is used for marshalling/unmarshalling HTTPValidator settings.
func ConvertHTTPConfigToJSON ¶
func ConvertHTTPConfigToJSON(cfg HTTPValidatorConfig) HTTPValidatorConfigJSON
type KeywordRule ¶
type KeywordRule struct {
ID string `json:"id,omitempty"`
Pattern string `json:"pattern"`
Type string `json:"type"` // "string" or "regex"
CaseSensitive bool `json:"caseSensitive"`
Category string `json:"category,omitempty"`
ContextChars int `json:"contextChars,omitempty"` // Characters for context snippet
CompiledRegex *regexp.Regexp `json:"-"` // Not stored in JSON, compiled at load time
}
KeywordRule defines a single rule for extracting keywords. Ensure Type is either "string" or "regex". CompiledRegex is populated internally if Type is "regex", not from JSON.
type KeywordSet ¶
type KeywordSet struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Rules []KeywordRule `json:"rules"`
}
KeywordSet groups related keyword rules.
func LoadKeywordSets ¶
func LoadKeywordSets(configDir string) ([]KeywordSet, error)
LoadKeywordSets loads keyword definitions from the configuration file.
type LoggingConfig ¶
type LoggingConfig struct {
Level string `json:"level"`
LogFilePath string `json:"logFilePath,omitempty"`
EnableFileLogging bool `json:"enableFileLogging,omitempty"`
LogDirectory string `json:"logDirectory,omitempty"`
MaxFileSize int `json:"maxFileSize,omitempty"`
MaxBackups int `json:"maxBackups,omitempty"`
MaxAge int `json:"maxAge,omitempty"`
EnableJSONFormat bool `json:"enableJSONFormat,omitempty"`
EnableRequestLogging bool `json:"enableRequestLogging,omitempty"`
EnablePerformanceLogging bool `json:"enablePerformanceLogging,omitempty"`
}
LoggingConfig defines logging parameters.
type OptimizationConfig ¶
type OptimizationConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Phases PhaseConfig `yaml:"phases" json:"phases"`
Redis RedisConfig `yaml:"redis" json:"redis"`
Performance PerformanceConfig `yaml:"performance" json:"performance"`
FeatureFlags FeatureFlagConfig `yaml:"feature_flags" json:"feature_flags"`
}
OptimizationConfig contains all configuration for N+1 optimization features
func GetDefaultOptimizationConfig ¶
func GetDefaultOptimizationConfig() OptimizationConfig
GetDefaultOptimizationConfig returns default optimization configuration
func GetDevelopmentOptimizationConfig ¶
func GetDevelopmentOptimizationConfig() OptimizationConfig
GetDevelopmentOptimizationConfig returns development-specific configuration
func GetProductionOptimizationConfig ¶
func GetProductionOptimizationConfig() OptimizationConfig
GetProductionOptimizationConfig returns production-specific configuration
func GetStagingOptimizationConfig ¶
func GetStagingOptimizationConfig() OptimizationConfig
GetStagingOptimizationConfig returns staging-specific configuration
type PerformanceConfig ¶
type PerformanceConfig struct {
BatchSize int `yaml:"batch_size" json:"batch_size"`
MaxConcurrentRequests int `yaml:"max_concurrent_requests" json:"max_concurrent_requests"`
DNSTimeout time.Duration `yaml:"dns_timeout" json:"dns_timeout"`
HTTPTimeout time.Duration `yaml:"http_timeout" json:"http_timeout"`
CacheTTL CacheTTLConfig `yaml:"cache_ttl" json:"cache_ttl"`
}
PerformanceConfig contains performance tuning parameters
type PhaseConfig ¶
type PhaseConfig struct {
BatchQueries bool `yaml:"batch_queries" json:"batch_queries"`
ServiceOptimization bool `yaml:"service_optimization" json:"service_optimization"`
ExternalValidation bool `yaml:"external_validation" json:"external_validation"`
Caching bool `yaml:"caching" json:"caching"`
}
PhaseConfig controls which optimization phases are enabled
type ProxyConfigEntry ¶
type ProxyConfigEntry struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Protocol string `json:"protocol"` // e.g., "http", "https", "socks5"
Address string `json:"address"` // e.g., "127.0.0.1:8080"
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
Notes string `json:"notes,omitempty"`
UserEnabled *bool `json:"userEnabled,omitempty"` // Pointer to distinguish not set, true, false. Defaults to true if nil.
}
ProxyConfigEntry defines the structure for a single proxy configuration.
func LoadProxies ¶
func LoadProxies(configDir string) ([]ProxyConfigEntry, error)
LoadProxies loads proxy configurations from the specified file in configDir.
type ProxyManagerConfig ¶
type ProxyManagerConfig struct {
TestTimeout time.Duration
TestURL string
InitialHealthCheckTimeout time.Duration
MaxConcurrentInitialChecks int
TestTimeoutSeconds int `json:"-"`
InitialHealthCheckTimeoutSeconds int `json:"-"`
}
ProxyManagerConfig holds settings for proxy health checks.
func ConvertJSONToProxyManagerConfig ¶
func ConvertJSONToProxyManagerConfig(jsonCfg ProxyManagerConfigJSON) ProxyManagerConfig
ConvertJSONToProxyManagerConfig applies defaults to ProxyManagerConfig from JSON.
type ProxyManagerConfigJSON ¶
type ProxyManagerConfigJSON struct {
TestTimeoutSeconds int `json:"testTimeoutSeconds"`
TestURL string `json:"testUrl"`
InitialHealthCheckTimeoutSeconds int `json:"initialHealthCheckTimeoutSeconds"`
MaxConcurrentInitialChecks int `json:"maxConcurrentInitialChecks"`
}
ProxyManagerConfigJSON is the JSON representation of ProxyManagerConfig.
func ConvertProxyManagerConfigToJSON ¶
func ConvertProxyManagerConfigToJSON(cfg ProxyManagerConfig) ProxyManagerConfigJSON
ConvertProxyManagerConfigToJSON prepares ProxyManagerConfig for JSON.
type RateLimiterConfig ¶
type RateLimiterConfig struct {
MaxRequests int `json:"maxRequests"`
WindowSeconds int `json:"windowSeconds"`
}
RateLimiterConfig defines global API rate limiting settings.
func ConvertJSONToRateLimiterConfig ¶
func ConvertJSONToRateLimiterConfig(jsonCfg RateLimiterConfig) RateLimiterConfig
ConvertJSONToRateLimiterConfig applies defaults to RateLimiterConfig from JSON.
func ConvertRateLimiterConfigToJSON ¶
func ConvertRateLimiterConfigToJSON(cfg RateLimiterConfig) RateLimiterConfig
ConvertRateLimiterConfigToJSON prepares RateLimiterConfig for JSON.
type RedisCacheConfig ¶
type RedisCacheConfig struct {
RedisAddr string `json:"redisAddr"`
RedisPassword string `json:"redisPassword"`
RedisDB int `json:"redisDB"`
DefaultTTL time.Duration `json:"defaultTTL"`
MaxRetries int `json:"maxRetries"`
PoolSize int `json:"poolSize"`
MinIdleConns int `json:"minIdleConns"`
IdleTimeout time.Duration `json:"idleTimeout"`
ConnMaxLifetime time.Duration `json:"connMaxLifetime"`
DialTimeout time.Duration `json:"dialTimeout"`
ReadTimeout time.Duration `json:"readTimeout"`
WriteTimeout time.Duration `json:"writeTimeout"`
EnableMetrics bool `json:"enableMetrics"`
MetricsFlushInterval time.Duration `json:"metricsFlushInterval"`
}
RedisCacheConfig represents the configuration for Redis cache
type RedisConfig ¶
type RedisConfig struct {
// Basic connection settings
Enabled bool `json:"enabled" env:"REDIS_ENABLED" default:"false"`
Addr string `json:"addr" env:"REDIS_ADDR" default:"localhost:6379"`
Password string `json:"password" env:"REDIS_PASSWORD" default:""`
DB int `json:"db" env:"REDIS_DB" default:"0"`
// Connection pool settings
PoolSize int `json:"poolSize" env:"REDIS_POOL_SIZE" default:"20"`
MinIdleConns int `json:"minIdleConns" env:"REDIS_MIN_IDLE_CONNS" default:"5"`
IdleTimeout time.Duration `json:"idleTimeout" env:"REDIS_IDLE_TIMEOUT" default:"5m"`
ConnMaxLifetime time.Duration `json:"connMaxLifetime" env:"REDIS_CONN_MAX_LIFETIME" default:"30m"`
// Timeouts
DialTimeout time.Duration `json:"dialTimeout" env:"REDIS_DIAL_TIMEOUT" default:"5s"`
ReadTimeout time.Duration `json:"readTimeout" env:"REDIS_READ_TIMEOUT" default:"3s"`
WriteTimeout time.Duration `json:"writeTimeout" env:"REDIS_WRITE_TIMEOUT" default:"3s"`
// Retry and reliability
MaxRetries int `json:"maxRetries" env:"REDIS_MAX_RETRIES" default:"3"`
// TTL settings for different entity types
EntityTTL struct {
PersonaTTL time.Duration `json:"personaTTL" env:"REDIS_PERSONA_TTL" default:"5m"`
KeywordSetTTL time.Duration `json:"keywordSetTTL" env:"REDIS_KEYWORD_SET_TTL" default:"10m"`
KeywordTTL time.Duration `json:"keywordTTL" env:"REDIS_KEYWORD_TTL" default:"15m"`
ProxyTTL time.Duration `json:"proxyTTL" env:"REDIS_PROXY_TTL" default:"5m"`
} `json:"entityTTL"`
// Validation result TTLs
ValidationTTL struct {
DNSValidationTTL time.Duration `json:"dnsValidationTTL" env:"REDIS_DNS_VALIDATION_TTL" default:"2m"`
HTTPValidationTTL time.Duration `json:"httpValidationTTL" env:"REDIS_HTTP_VALIDATION_TTL" default:"1m"`
ConfigFingerprintTTL time.Duration `json:"configFingerprintTTL" env:"REDIS_CONFIG_FINGERPRINT_TTL" default:"30m"`
} `json:"validationTTL"`
// Campaign data TTLs
CampaignTTL struct {
CampaignDetailsTTL time.Duration `json:"campaignDetailsTTL" env:"REDIS_CAMPAIGN_DETAILS_TTL" default:"3m"`
CampaignRelationshipTTL time.Duration `json:"campaignRelationshipTTL" env:"REDIS_CAMPAIGN_RELATIONSHIP_TTL" default:"5m"`
BatchQueryResultTTL time.Duration `json:"batchQueryResultTTL" env:"REDIS_BATCH_QUERY_RESULT_TTL" default:"2m"`
} `json:"campaignTTL"`
// Monitoring and metrics
Metrics struct {
Enabled bool `json:"enabled" env:"REDIS_METRICS_ENABLED" default:"true"`
FlushInterval time.Duration `json:"flushInterval" env:"REDIS_METRICS_FLUSH_INTERVAL" default:"30s"`
PerformanceThreshold struct {
LatencyWarningMs int64 `json:"latencyWarningMs" env:"REDIS_LATENCY_WARNING_MS" default:"50"`
LatencyCriticalMs int64 `json:"latencyCriticalMs" env:"REDIS_LATENCY_CRITICAL_MS" default:"100"`
HitRatioWarning float64 `json:"hitRatioWarning" env:"REDIS_HIT_RATIO_WARNING" default:"0.7"`
ErrorRateWarning float64 `json:"errorRateWarning" env:"REDIS_ERROR_RATE_WARNING" default:"0.05"`
} `json:"performanceThreshold"`
} `json:"metrics"`
}
RedisConfig holds Redis-specific configuration for caching
func DefaultRedisConfig ¶
func DefaultRedisConfig() RedisConfig
DefaultRedisConfig returns a production-ready Redis configuration
func (*RedisConfig) GetEntityTTL ¶
func (rc *RedisConfig) GetEntityTTL(entityType string) time.Duration
GetEntityTTL returns the appropriate TTL for a given entity type
func (*RedisConfig) IsPerformanceAlertEnabled ¶
func (rc *RedisConfig) IsPerformanceAlertEnabled() bool
IsPerformanceAlertEnabled checks if performance monitoring is enabled
func (*RedisConfig) ShouldAlertOnErrorRate ¶
func (rc *RedisConfig) ShouldAlertOnErrorRate(errorRate float64) bool
ShouldAlertOnErrorRate checks if error rate warrants an alert
func (*RedisConfig) ShouldAlertOnHitRatio ¶
func (rc *RedisConfig) ShouldAlertOnHitRatio(hitRatio float64) bool
ShouldAlertOnHitRatio checks if hit ratio warrants an alert
func (*RedisConfig) ShouldAlertOnLatency ¶
func (rc *RedisConfig) ShouldAlertOnLatency(latencyMs int64) string
ShouldAlertOnLatency checks if latency warrants an alert
func (*RedisConfig) ToRedisCacheConfig ¶
func (rc *RedisConfig) ToRedisCacheConfig() RedisCacheConfig
ToRedisCacheConfig converts RedisConfig to RedisCacheConfig
func (*RedisConfig) Validate ¶
func (rc *RedisConfig) Validate() error
Validate checks if the Redis configuration is valid
type ResolvedConfig ¶
type ResolvedConfig struct {
ServiceName string `json:"service_name"`
Environment string `json:"environment"`
Data map[string]interface{} `json:"data"`
}
ResolvedConfig represents a resolved configuration for a service/environment.
type SecretManager ¶
type SecretManager struct {
// contains filtered or unexported fields
}
SecretManager handles encryption/decryption of sensitive configuration fields.
func NewSecretManager ¶
func NewSecretManager(key []byte) *SecretManager
NewSecretManager creates a new SecretManager with the provided AES key.
func (*SecretManager) DecryptConfig ¶
func (sm *SecretManager) DecryptConfig(cfg *EnvironmentConfig) error
DecryptConfig decrypts the fields listed in cfg.EncryptedFields.
func (*SecretManager) EncryptConfig ¶
func (sm *SecretManager) EncryptConfig(cfg *EnvironmentConfig) error
EncryptConfig encrypts the fields listed in cfg.EncryptedFields.
type ServerConfig ¶
type ServerConfig struct {
Port string `json:"port"`
APIKey string `json:"apiKey"`
StreamChunkSize int `json:"streamChunkSize,omitempty"`
GinMode string `json:"ginMode,omitempty"`
DBMaxOpenConns int `json:"dbMaxOpenConns,omitempty"`
DBMaxIdleConns int `json:"dbMaxIdleConns,omitempty"`
DBConnMaxLifetimeMinutes int `json:"dbConnMaxLifetimeMinutes,omitempty"`
DatabaseConfig *DatabaseConfig `json:"database,omitempty"`
AuthConfig *AuthConfig `json:"auth,omitempty"`
}
ServerConfig defines server-specific settings.
type SessionConfig ¶
type SessionConfig struct {
Duration time.Duration // 2 hours
IdleTimeout time.Duration // 30 minutes
CleanupInterval time.Duration // 5 minutes
MaxSessionsPerUser int // 5 sessions per user
SessionIDLength int // 128 characters
RequireIPMatch bool // Whether to require IP address match
RequireUAMatch bool // Whether to require user agent match
}
SessionConfig holds configuration for session management
type SessionConfigManager ¶
type SessionConfigManager struct {
// contains filtered or unexported fields
}
SessionConfigManager manages session configuration for different environments
func NewSessionConfigManager ¶
func NewSessionConfigManager(environment string) *SessionConfigManager
NewSessionConfigManager creates a new session configuration manager
func (*SessionConfigManager) GetEnvironment ¶
func (m *SessionConfigManager) GetEnvironment() string
GetEnvironment returns the current environment
func (*SessionConfigManager) GetSettings ¶
func (m *SessionConfigManager) GetSettings() *SessionSettings
GetSettings returns the current session settings
func (*SessionConfigManager) UpdateSettings ¶
func (m *SessionConfigManager) UpdateSettings(settings *SessionSettings)
UpdateSettings updates the session settings
type SessionSettings ¶
type SessionSettings struct {
// Session duration and timeouts
SessionDuration time.Duration `json:"session_duration"`
IdleTimeout time.Duration `json:"idle_timeout"`
CleanupInterval time.Duration `json:"cleanup_interval"`
MaxSessionsPerUser int `json:"max_sessions_per_user"`
SessionIDLength int `json:"session_id_length"`
// Security settings
RequireIPMatch bool `json:"require_ip_match"`
RequireUAMatch bool `json:"require_ua_match"`
EnableFingerprinting bool `json:"enable_fingerprinting"`
// Cookie settings
CookieName string `json:"cookie_name"`
CookiePath string `json:"cookie_path"`
CookieDomain string `json:"cookie_domain"`
CookieSecure bool `json:"cookie_secure"`
CookieHttpOnly bool `json:"cookie_http_only"`
CookieSameSite string `json:"cookie_same_site"` // "strict", "lax", "none"
CookieMaxAge int `json:"cookie_max_age"`
// CSRF Protection (without tokens)
RequireOriginValidation bool `json:"require_origin_validation"`
RequireCustomHeader bool `json:"require_custom_header"`
AllowedOrigins []string `json:"allowed_origins"`
CustomHeaderName string `json:"custom_header_name"`
CustomHeaderValue string `json:"custom_header_value"`
// Rate limiting
RateLimitEnabled bool `json:"rate_limit_enabled"`
RateLimitWindow time.Duration `json:"rate_limit_window"`
MaxLoginAttempts int `json:"max_login_attempts"`
MaxSessionValidations int `json:"max_session_validations"`
}
SessionSettings contains all session-related configuration
func GetDefaultSessionSettings ¶
func GetDefaultSessionSettings() *SessionSettings
GetDefaultSessionSettings returns VERY RELAXED session configuration for easy development
func GetDevelopmentSessionSettings ¶
func GetDevelopmentSessionSettings() *SessionSettings
GetDevelopmentSessionSettings returns development-friendly session configuration
func GetProductionSessionSettings ¶
func GetProductionSessionSettings() *SessionSettings
GetProductionSessionSettings returns production-optimized session configuration
func (*SessionSettings) GetCookieSameSiteMode ¶
func (s *SessionSettings) GetCookieSameSiteMode() string
GetCookieSameSiteMode returns the appropriate SameSite mode
func (*SessionSettings) IsSecureCookie ¶
func (s *SessionSettings) IsSecureCookie() bool
IsSecureCookie returns whether cookies should be secure based on settings
func (*SessionSettings) ToServiceConfig ¶
func (s *SessionSettings) ToServiceConfig() *SessionConfig
ToServiceConfig converts SessionSettings to SessionConfig
func (*SessionSettings) ValidateCustomHeader ¶
func (s *SessionSettings) ValidateCustomHeader(headerValue string) bool
ValidateCustomHeader checks if the custom header is present and valid
func (*SessionSettings) ValidateOrigin ¶
func (s *SessionSettings) ValidateOrigin(origin string) bool
ValidateOrigin checks if an origin is allowed
type TLSClientHelloConfig ¶
type TLSClientHelloConfig struct {
MinVersion string `json:"minVersion,omitempty"`
MaxVersion string `json:"maxVersion,omitempty"`
CipherSuites []string `json:"cipherSuites,omitempty"`
CurvePreferences []string `json:"curvePreferences,omitempty"`
}
TLSClientHelloConfig defines TLS client hello parameters.
type TemplateManager ¶
type TemplateManager struct {
// contains filtered or unexported fields
}
TemplateManager manages config templates.
func NewTemplateManager ¶
func NewTemplateManager() *TemplateManager
NewTemplateManager creates a new TemplateManager.
func (*TemplateManager) GenerateFromTemplate ¶
func (tm *TemplateManager) GenerateFromTemplate(name string, data map[string]interface{}) (*EnvironmentConfig, error)
GenerateFromTemplate instantiates a configuration from a template.
func (*TemplateManager) RegisterTemplate ¶
func (tm *TemplateManager) RegisterTemplate(t *ConfigTemplate) error
RegisterTemplate registers a template.
type ValidationRule ¶
type ValidationRule struct {
Field string
}
ValidationRule defines a simple key requirement.
type WorkerConfig ¶
type WorkerConfig struct {
NumWorkers int `json:"numWorkers,omitempty"`
PollIntervalSeconds int `json:"pollIntervalSeconds,omitempty"`
ErrorRetryDelaySeconds int `json:"errorRetryDelaySeconds,omitempty"`
MaxJobRetries int `json:"maxJobRetries,omitempty"`
JobProcessingTimeoutMinutes int `json:"jobProcessingTimeoutMinutes,omitempty"`
BatchSize int `json:"batchSize,omitempty"`
MaxRetries int `json:"maxRetries,omitempty"`
RetryDelaySeconds int `json:"retryDelaySeconds,omitempty"`
DNSSubtaskConcurrency int `json:"dnsSubtaskConcurrency,omitempty"` // Added
HTTPKeywordSubtaskConcurrency int `json:"httpKeywordSubtaskConcurrency,omitempty"` // Added
}
WorkerConfig defines settings for the background campaign workers.
func ConvertJSONToWorkerConfig ¶
func ConvertJSONToWorkerConfig(jsonCfg WorkerConfig) WorkerConfig
ConvertJSONToWorkerConfig applies defaults to WorkerConfig from JSON.
func ConvertWorkerConfigToJSON ¶
func ConvertWorkerConfigToJSON(cfg WorkerConfig) WorkerConfig
ConvertWorkerConfigToJSON prepares WorkerConfig for JSON (currently same structure).