Documentation
¶
Index ¶
- type DKIMSummary
- type DMARCSummary
- type ReputationScore
- type SPFSummary
- type SecuritySummary
- type TestConfig
- type TestResult
- type TestRunner
- func (r *TestRunner) Close() error
- func (r *TestRunner) Config() TestConfig
- func (r *TestRunner) FetchLatestMessage() (*imap.Message, error)
- func (r *TestRunner) IMAPClient() *client.Client
- func (r *TestRunner) Run(ctx context.Context, scenario TestScenario) (*TestResult, error)
- func (r *TestRunner) SMTPClient() *smtp.Client
- func (r *TestRunner) SendEmail(from, to, subject, body string) error
- func (r *TestRunner) Tracer() *TraceCollector
- func (r *TestRunner) WaitForMessage(timeout time.Duration) (*imap.Message, error)
- type TestScenario
- type TraceCollector
- func (tc *TraceCollector) AddEvent(event TraceEvent)
- func (tc *TraceCollector) Clear()
- func (tc *TraceCollector) Count() int
- func (tc *TraceCollector) Events() []TraceEvent
- func (tc *TraceCollector) FilterByComponent(component string) []TraceEvent
- func (tc *TraceCollector) FilterByPhase(phase string) []TraceEvent
- func (tc *TraceCollector) FilterByStatus(status string) []TraceEvent
- func (tc *TraceCollector) Start(phase string) *TraceSpan
- func (tc *TraceCollector) StartWithComponent(phase, component string) *TraceSpan
- func (tc *TraceCollector) StartWithDetails(phase, component, action string) *TraceSpan
- type TraceEvent
- type TraceSpan
- func (ts *TraceSpan) Action() string
- func (ts *TraceSpan) Component() string
- func (ts *TraceSpan) Details() map[string]interface{}
- func (ts *TraceSpan) Duration() time.Duration
- func (ts *TraceSpan) End()
- func (ts *TraceSpan) EndWithError(err error)
- func (ts *TraceSpan) EndWithStatus(status string, err error)
- func (ts *TraceSpan) IsFinished() bool
- func (ts *TraceSpan) Phase() string
- func (ts *TraceSpan) WithAction(action string) *TraceSpan
- func (ts *TraceSpan) WithComponent(component string) *TraceSpan
- func (ts *TraceSpan) WithDetail(key string, value interface{}) *TraceSpan
- func (ts *TraceSpan) WithDetails(details map[string]interface{}) *TraceSpan
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DKIMSummary ¶
type DKIMSummary struct {
Signed bool `json:"signed"`
Verified bool `json:"verified"`
Selector string `json:"selector"`
KeySize int `json:"key_size"`
Algorithm string `json:"algorithm"`
ValidFrom time.Time `json:"valid_from"`
Error string `json:"error,omitempty"`
}
DKIMSummary contains DKIM verification results
type DMARCSummary ¶
type DMARCSummary struct {
Result string `json:"result"`
Policy string `json:"policy"`
Aligned bool `json:"aligned"`
Alignment string `json:"alignment"`
Pct int `json:"pct"`
Error string `json:"error,omitempty"`
}
DMARCSummary contains DMARC verification results
type ReputationScore ¶
type ReputationScore struct {
Score int `json:"score"`
DeliveryRate float64 `json:"delivery_rate"`
BounceRate float64 `json:"bounce_rate"`
ComplaintRate float64 `json:"complaint_rate"`
Status string `json:"status"`
}
ReputationScore contains reputation information
type SPFSummary ¶
type SPFSummary struct {
Result string `json:"result"`
Record string `json:"record"`
IPRange string `json:"ip_range"`
Aligned bool `json:"aligned"`
Error string `json:"error,omitempty"`
}
SPFSummary contains SPF verification results
type SecuritySummary ¶
type SecuritySummary struct {
DKIM DKIMSummary `json:"dkim"`
SPF SPFSummary `json:"spf"`
DMARC DMARCSummary `json:"dmarc"`
Reputation ReputationScore `json:"reputation"`
OverallStatus string `json:"overall_status"`
}
SecuritySummary contains security verification results
type TestConfig ¶
type TestConfig struct {
// Server configuration
SMTPAddr string `yaml:"smtp_addr" json:"smtp_addr"`
IMAPAddr string `yaml:"imap_addr" json:"imap_addr"`
HTTPAddr string `yaml:"http_addr" json:"http_addr"`
DatabasePath string `yaml:"database_path" json:"database_path"`
// Test settings
Timeout time.Duration `yaml:"timeout" json:"timeout"`
Verbose bool `yaml:"verbose" json:"verbose"`
Debug bool `yaml:"debug" json:"debug"`
// Authentication
Username string `yaml:"username" json:"username"`
Password string `yaml:"password" json:"password"`
// Security settings
VerifyDKIM bool `yaml:"verify_dkim" json:"verify_dkim"`
VerifySPF bool `yaml:"verify_spf" json:"verify_spf"`
VerifyDMARC bool `yaml:"verify_dmarc" json:"verify_dmarc"`
// Report settings
OutputDir string `yaml:"output_dir" json:"output_dir"`
HTMLReport bool `yaml:"html_report" json:"html_report"`
JSONReport bool `yaml:"json_report" json:"json_report"`
// Advanced settings
MaxRetries int `yaml:"max_retries" json:"max_retries"`
RetryDelay time.Duration `yaml:"retry_delay" json:"retry_delay"`
}
TestConfig holds configuration for test execution
func DefaultTestConfig ¶
func DefaultTestConfig() TestConfig
DefaultTestConfig returns a default test configuration
type TestResult ¶
type TestResult struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Passed bool `json:"passed"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Duration time.Duration `json:"duration"`
Trace []TraceEvent `json:"trace"`
Errors []error `json:"errors"`
Summary string `json:"summary"`
}
TestResult represents the result of a test execution
func NewTestResult ¶
func NewTestResult(name, description string) *TestResult
NewTestResult creates a new test result
func (*TestResult) AddError ¶
func (r *TestResult) AddError(err error)
AddError adds an error to the test result
func (*TestResult) AddTrace ¶
func (r *TestResult) AddTrace(event TraceEvent)
AddTrace adds a trace event to the result
func (*TestResult) Complete ¶
func (r *TestResult) Complete(passed bool, summary string)
Complete marks the test result as completed
type TestRunner ¶
type TestRunner struct {
// contains filtered or unexported fields
}
TestRunner orchestrates test execution
func NewTestRunner ¶
func NewTestRunner(config TestConfig) *TestRunner
NewTestRunner creates a new test runner
func (*TestRunner) Close ¶
func (r *TestRunner) Close() error
Close closes the test runner and cleans up resources
func (*TestRunner) Config ¶
func (r *TestRunner) Config() TestConfig
Config returns the test configuration
func (*TestRunner) FetchLatestMessage ¶
func (r *TestRunner) FetchLatestMessage() (*imap.Message, error)
FetchLatestMessage is a convenience method for fetching the latest IMAP message
func (*TestRunner) IMAPClient ¶
func (r *TestRunner) IMAPClient() *client.Client
IMAPClient returns the IMAP client for test scenarios
func (*TestRunner) Run ¶
func (r *TestRunner) Run(ctx context.Context, scenario TestScenario) (*TestResult, error)
Run executes a test scenario
func (*TestRunner) SMTPClient ¶
func (r *TestRunner) SMTPClient() *smtp.Client
SMTPClient returns the SMTP client for test scenarios
func (*TestRunner) SendEmail ¶
func (r *TestRunner) SendEmail(from, to, subject, body string) error
SendEmail is a convenience method for sending email via SMTP
func (*TestRunner) Tracer ¶
func (r *TestRunner) Tracer() *TraceCollector
Tracer returns the trace collector
func (*TestRunner) WaitForMessage ¶
WaitForMessage waits for a message to arrive in the mailbox
type TestScenario ¶
type TestScenario interface {
// Name returns the scenario name
Name() string
// Description returns a description of the scenario
Description() string
// Setup prepares the scenario for execution
Setup(ctx context.Context) error
// Execute runs the main scenario logic
Execute(ctx context.Context) error
// Verify checks that the scenario executed correctly
Verify(ctx context.Context) error
// Cleanup cleans up after the scenario
Cleanup(ctx context.Context) error
}
TestScenario defines the interface for test scenarios
type TraceCollector ¶
type TraceCollector struct {
// contains filtered or unexported fields
}
TraceCollector collects and manages trace events during test execution
func NewTraceCollector ¶
func NewTraceCollector() *TraceCollector
NewTraceCollector creates a new trace collector
func (*TraceCollector) AddEvent ¶
func (tc *TraceCollector) AddEvent(event TraceEvent)
AddEvent adds a trace event manually
func (*TraceCollector) Count ¶
func (tc *TraceCollector) Count() int
Count returns the number of trace events
func (*TraceCollector) Events ¶
func (tc *TraceCollector) Events() []TraceEvent
Events returns all collected trace events
func (*TraceCollector) FilterByComponent ¶
func (tc *TraceCollector) FilterByComponent(component string) []TraceEvent
FilterByComponent returns events filtered by component
func (*TraceCollector) FilterByPhase ¶
func (tc *TraceCollector) FilterByPhase(phase string) []TraceEvent
FilterByPhase returns events filtered by phase
func (*TraceCollector) FilterByStatus ¶
func (tc *TraceCollector) FilterByStatus(status string) []TraceEvent
FilterByStatus returns events filtered by status
func (*TraceCollector) Start ¶
func (tc *TraceCollector) Start(phase string) *TraceSpan
Start begins tracing for a specific phase/component/action
func (*TraceCollector) StartWithComponent ¶
func (tc *TraceCollector) StartWithComponent(phase, component string) *TraceSpan
StartWithComponent begins tracing with component specified
func (*TraceCollector) StartWithDetails ¶
func (tc *TraceCollector) StartWithDetails(phase, component, action string) *TraceSpan
StartWithDetails begins tracing with full details
type TraceEvent ¶
type TraceEvent struct {
Timestamp time.Time `json:"timestamp"`
Phase string `json:"phase"`
Component string `json:"component"`
Action string `json:"action"`
Duration time.Duration `json:"duration"`
Status string `json:"status"`
Details map[string]interface{} `json:"details,omitempty"`
Error string `json:"error,omitempty"`
}
TraceEvent represents a single trace event
type TraceSpan ¶
type TraceSpan struct {
// contains filtered or unexported fields
}
TraceSpan represents an active trace span
func (*TraceSpan) End ¶
func (ts *TraceSpan) End()
End completes this trace span with success status
func (*TraceSpan) EndWithError ¶
EndWithError completes this trace span with error status
func (*TraceSpan) EndWithStatus ¶
EndWithStatus completes this trace span with specified status
func (*TraceSpan) IsFinished ¶
IsFinished returns whether this span is finished
func (*TraceSpan) WithAction ¶
WithAction sets the action for this span
func (*TraceSpan) WithComponent ¶
WithComponent sets the component for this span
func (*TraceSpan) WithDetail ¶
WithDetail adds a single detail to this span
func (*TraceSpan) WithDetails ¶
WithDetails adds details to this span