Documentation
¶
Overview ¶
Package domain contains the core business logic interfaces and contracts
Package domain contains parameter implementations ¶
Package domain contains result implementations ¶
Package domain contains core domain types and value objects
Index ¶
- type ASNInfo
- type BaseParameters
- type BaseResult
- type Config
- type ConfigurationManager
- type Contact
- type DNSParameters
- type DNSRecord
- type DNSRecordType
- type DNSResult
- type DiagnosticTool
- type ErrorHandler
- type ErrorType
- type ExportConfig
- type ExportFormat
- type GeoLocation
- type GeoLocationService
- type ISPInfo
- type Logger
- type LoggingConfig
- type NetTraceError
- type NetworkClient
- type NetworkConfig
- type NetworkHost
- type OutputFormatter
- type Parameters
- type PingOptions
- type PingParameters
- type PingResult
- type PluginConfig
- type PluginRegistry
- type Result
- type SSLParameters
- type SSLResult
- type TUIComponent
- type Theme
- type TraceHop
- type TraceOptions
- type TracerouteParameters
- type UIConfig
- type ValidationRule
- type Validator
- type WHOISParameters
- type WHOISResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ASNInfo ¶
type ASNInfo struct {
Number int `json:"number"`
Name string `json:"name"`
Description string `json:"description"`
Country string `json:"country"`
Registry string `json:"registry"`
}
ASNInfo contains Autonomous System information
type BaseParameters ¶
type BaseParameters struct {
// contains filtered or unexported fields
}
BaseParameters provides a basic implementation of the Parameters interface
func NewParameters ¶
func NewParameters() *BaseParameters
NewParameters creates a new BaseParameters instance
func (*BaseParameters) Get ¶
func (p *BaseParameters) Get(key string) interface{}
Get retrieves a parameter value by key
func (*BaseParameters) Set ¶
func (p *BaseParameters) Set(key string, value interface{})
Set sets a parameter value by key
func (*BaseParameters) ToMap ¶
func (p *BaseParameters) ToMap() map[string]interface{}
ToMap returns all parameters as a map
func (*BaseParameters) Validate ¶
func (p *BaseParameters) Validate() error
Validate validates all parameters
type BaseResult ¶
type BaseResult struct {
// contains filtered or unexported fields
}
BaseResult provides a basic implementation of the Result interface
func NewResult ¶
func NewResult(data interface{}) *BaseResult
NewResult creates a new BaseResult instance
func (*BaseResult) Export ¶
func (r *BaseResult) Export(format ExportFormat) ([]byte, error)
Export exports the result in the specified format
func (*BaseResult) Format ¶
func (r *BaseResult) Format(formatter OutputFormatter) string
Format formats the result using the provided formatter
func (*BaseResult) Metadata ¶
func (r *BaseResult) Metadata() map[string]interface{}
Metadata returns the result metadata
func (*BaseResult) SetMetadata ¶
func (r *BaseResult) SetMetadata(key string, value interface{})
SetMetadata sets a metadata value
type Config ¶
type Config struct {
Network NetworkConfig `json:"network" mapstructure:"network"`
UI UIConfig `json:"ui" mapstructure:"ui"`
Plugins PluginConfig `json:"plugins" mapstructure:"plugins"`
Export ExportConfig `json:"export" mapstructure:"export"`
Logging LoggingConfig `json:"logging" mapstructure:"logging"`
}
Config represents the complete application configuration
type ConfigurationManager ¶
type ConfigurationManager interface {
Load() error
Save() error
Get(key string) interface{}
Set(key string, value interface{}) error
Validate() error
GetNetworkConfig() NetworkConfig
GetUIConfig() UIConfig
}
ConfigurationManager handles application configuration Follows Interface Segregation Principle - focused on configuration operations
type Contact ¶
type Contact struct {
Name string `json:"name"`
Organization string `json:"organization"`
Email string `json:"email"`
Phone string `json:"phone"`
Address string `json:"address"`
}
Contact represents WHOIS contact information
type DNSParameters ¶
type DNSParameters struct {
*BaseParameters
}
DNSParameters represents parameters for DNS operations
func NewDNSParameters ¶
func NewDNSParameters(domain string, recordType DNSRecordType) *DNSParameters
NewDNSParameters creates new DNS parameters
func (*DNSParameters) Validate ¶
func (p *DNSParameters) Validate() error
Validate validates DNS parameters
type DNSRecord ¶
type DNSRecord struct {
Name string `json:"name"`
Type DNSRecordType `json:"type"`
Value string `json:"value"`
TTL uint32 `json:"ttl"`
Priority int `json:"priority,omitempty"`
}
DNSRecord represents a single DNS record
type DNSRecordType ¶
type DNSRecordType int
DNSRecordType represents different DNS record types
const ( DNSRecordTypeA DNSRecordType = iota DNSRecordTypeAAAA DNSRecordTypeMX DNSRecordTypeTXT DNSRecordTypeCNAME DNSRecordTypeNS DNSRecordTypeSOA DNSRecordTypePTR )
type DNSResult ¶
type DNSResult struct {
Query string `json:"query"`
RecordType DNSRecordType `json:"record_type"`
Records []DNSRecord `json:"records"`
Authority []DNSRecord `json:"authority"`
Additional []DNSRecord `json:"additional"`
ResponseTime time.Duration `json:"response_time"`
Server string `json:"server"`
}
DNSResult contains DNS lookup results
type DiagnosticTool ¶
type DiagnosticTool interface {
Name() string
Description() string
Execute(ctx context.Context, params Parameters) (Result, error)
Validate(params Parameters) error
GetModel() tea.Model
}
DiagnosticTool defines the contract for all network diagnostic tools Follows Single Responsibility Principle - each tool has one diagnostic purpose
type ErrorHandler ¶
type ErrorHandler interface {
Handle(err error) error
HandleWithContext(err error, ctx map[string]interface{}) error
CanRecover(err error) bool
Recover(err error) error
}
ErrorHandler manages error processing and recovery
type ExportConfig ¶
type ExportConfig struct {
DefaultFormat ExportFormat `json:"default_format" mapstructure:"default_format"`
OutputDirectory string `json:"output_directory" mapstructure:"output_directory"`
IncludeMetadata bool `json:"include_metadata" mapstructure:"include_metadata"`
Compression bool `json:"compression" mapstructure:"compression"`
}
ExportConfig contains export settings
type ExportFormat ¶
type ExportFormat int
ExportFormat represents different export formats
const ( ExportFormatJSON ExportFormat = iota ExportFormatCSV ExportFormatText )
type GeoLocation ¶
type GeoLocation struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
City string `json:"city"`
Region string `json:"region"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
Timezone string `json:"timezone"`
}
GeoLocation represents geographic coordinates
type GeoLocationService ¶
type GeoLocationService interface {
GetLocation(ip net.IP) (*GeoLocation, error)
GetASNInfo(ip net.IP) (*ASNInfo, error)
GetISPInfo(ip net.IP) (*ISPInfo, error)
}
GeoLocationService provides geographic data for network hops
type ISPInfo ¶
type ISPInfo struct {
Name string `json:"name"`
Organization string `json:"organization"`
ASN int `json:"asn"`
Country string `json:"country"`
}
ISPInfo contains Internet Service Provider information
type Logger ¶
type Logger interface {
Debug(msg string, fields ...interface{})
Info(msg string, fields ...interface{})
Warn(msg string, fields ...interface{})
Error(msg string, fields ...interface{})
Fatal(msg string, fields ...interface{})
}
Logger defines logging operations
type LoggingConfig ¶
type LoggingConfig struct {
Level string `json:"level" mapstructure:"level"`
Format string `json:"format" mapstructure:"format"`
Output string `json:"output" mapstructure:"output"`
MaxSize int `json:"max_size" mapstructure:"max_size"`
MaxBackups int `json:"max_backups" mapstructure:"max_backups"`
MaxAge int `json:"max_age" mapstructure:"max_age"`
}
LoggingConfig contains logging settings
type NetTraceError ¶
type NetTraceError struct {
Type ErrorType `json:"type"`
Message string `json:"message"`
Cause error `json:"cause,omitempty"`
Context map[string]interface{} `json:"context,omitempty"`
Timestamp time.Time `json:"timestamp"`
Code string `json:"code"`
}
NetTraceError represents application-specific errors
func (*NetTraceError) Error ¶
func (e *NetTraceError) Error() string
Error implements the error interface
func (*NetTraceError) Unwrap ¶
func (e *NetTraceError) Unwrap() error
Unwrap returns the underlying error
type NetworkClient ¶
type NetworkClient interface {
Ping(ctx context.Context, host string, opts PingOptions) (<-chan PingResult, error)
Traceroute(ctx context.Context, host string, opts TraceOptions) (<-chan TraceHop, error)
DNSLookup(ctx context.Context, domain string, recordType DNSRecordType) (DNSResult, error)
WHOISLookup(ctx context.Context, query string) (WHOISResult, error)
SSLCheck(ctx context.Context, host string, port int) (SSLResult, error)
}
NetworkClient abstracts network operations for testing and flexibility Follows Dependency Inversion Principle - high-level modules depend on abstractions
type NetworkConfig ¶
type NetworkConfig struct {
Timeout time.Duration `json:"timeout" mapstructure:"timeout"`
MaxHops int `json:"max_hops" mapstructure:"max_hops"`
PacketSize int `json:"packet_size" mapstructure:"packet_size"`
DNSServers []string `json:"dns_servers" mapstructure:"dns_servers"`
UserAgent string `json:"user_agent" mapstructure:"user_agent"`
MaxConcurrency int `json:"max_concurrency" mapstructure:"max_concurrency"`
RetryAttempts int `json:"retry_attempts" mapstructure:"retry_attempts"`
RetryDelay time.Duration `json:"retry_delay" mapstructure:"retry_delay"`
}
NetworkConfig contains network operation settings
type NetworkHost ¶
type NetworkHost struct {
Hostname string `json:"hostname"`
IPAddress net.IP `json:"ip_address"`
Port int `json:"port"`
ASN *ASNInfo `json:"asn,omitempty"`
Geographic *GeoLocation `json:"geographic,omitempty"`
}
NetworkHost represents a network endpoint
type OutputFormatter ¶
type OutputFormatter interface {
Format(data interface{}) string
SetOptions(options map[string]interface{})
}
OutputFormatter defines how results are formatted for display
type Parameters ¶
type Parameters interface {
Get(key string) interface{}
Set(key string, value interface{})
Validate() error
ToMap() map[string]interface{}
}
Parameters represents input parameters for diagnostic operations
type PingOptions ¶
type PingOptions struct {
Count int `json:"count"`
Interval time.Duration `json:"interval"`
Timeout time.Duration `json:"timeout"`
PacketSize int `json:"packet_size"`
TTL int `json:"ttl"`
IPv6 bool `json:"ipv6"`
}
PingOptions contains configuration for ping operations
type PingParameters ¶
type PingParameters struct {
*BaseParameters
}
PingParameters represents parameters for ping operations
func NewPingParameters ¶
func NewPingParameters(host string, options PingOptions) *PingParameters
NewPingParameters creates new ping parameters
func (*PingParameters) Validate ¶
func (p *PingParameters) Validate() error
Validate validates ping parameters
type PingResult ¶
type PingResult struct {
Host NetworkHost `json:"host"`
Sequence int `json:"sequence"`
RTT time.Duration `json:"rtt"`
TTL int `json:"ttl"`
PacketSize int `json:"packet_size"`
Timestamp time.Time `json:"timestamp"`
Error error `json:"error,omitempty"`
}
PingResult contains ping operation results
type PluginConfig ¶
type PluginConfig struct {
EnabledPlugins []string `json:"enabled_plugins" mapstructure:"enabled_plugins"`
DisabledPlugins []string `json:"disabled_plugins" mapstructure:"disabled_plugins"`
PluginPaths []string `json:"plugin_paths" mapstructure:"plugin_paths"`
PluginSettings map[string]interface{} `json:"plugin_settings" mapstructure:"plugin_settings"`
}
PluginConfig contains plugin settings
type PluginRegistry ¶
type PluginRegistry interface {
Register(tool DiagnosticTool) error
Get(name string) (DiagnosticTool, bool)
List() []DiagnosticTool
Unregister(name string) error
}
PluginRegistry manages diagnostic tool plugins Follows Single Responsibility Principle - manages plugin lifecycle
type Result ¶
type Result interface {
Data() interface{}
Metadata() map[string]interface{}
Format(formatter OutputFormatter) string
Export(format ExportFormat) ([]byte, error)
}
Result represents the output of a diagnostic operation Follows Interface Segregation Principle - focused on result operations
type SSLParameters ¶
type SSLParameters struct {
*BaseParameters
}
SSLParameters represents parameters for SSL operations
func NewSSLParameters ¶
func NewSSLParameters(host string, port int) *SSLParameters
NewSSLParameters creates new SSL parameters
func (*SSLParameters) Validate ¶
func (p *SSLParameters) Validate() error
Validate validates SSL parameters
type SSLResult ¶
type SSLResult struct {
Host string `json:"host"`
Port int `json:"port"`
Certificate *x509.Certificate `json:"certificate"`
Chain []*x509.Certificate `json:"chain"`
Valid bool `json:"valid"`
Errors []string `json:"errors"`
Expiry time.Time `json:"expiry"`
Issuer string `json:"issuer"`
Subject string `json:"subject"`
SANs []string `json:"sans"`
}
SSLResult contains SSL certificate information
type TUIComponent ¶
type TUIComponent interface {
tea.Model
SetSize(width, height int)
SetTheme(theme Theme)
Focus()
Blur()
}
TUIComponent defines reusable UI components Follows Open/Closed Principle - extensible without modification
type Theme ¶
type Theme interface {
GetColor(element string) string
GetStyle(element string) map[string]interface{}
SetColor(element, color string)
}
Theme defines UI theming interface
type TraceHop ¶
type TraceHop struct {
Number int `json:"number"`
Host NetworkHost `json:"host"`
RTT []time.Duration `json:"rtt"`
Timeout bool `json:"timeout"`
Timestamp time.Time `json:"timestamp"`
}
TraceHop represents a single hop in traceroute
type TraceOptions ¶
type TraceOptions struct {
MaxHops int `json:"max_hops"`
Timeout time.Duration `json:"timeout"`
PacketSize int `json:"packet_size"`
Queries int `json:"queries"`
IPv6 bool `json:"ipv6"`
}
TraceOptions contains configuration for traceroute operations
type TracerouteParameters ¶
type TracerouteParameters struct {
*BaseParameters
}
TracerouteParameters represents parameters for traceroute operations
func NewTracerouteParameters ¶
func NewTracerouteParameters(host string, options TraceOptions) *TracerouteParameters
NewTracerouteParameters creates new traceroute parameters
func (*TracerouteParameters) Validate ¶
func (p *TracerouteParameters) Validate() error
Validate validates traceroute parameters
type UIConfig ¶
type UIConfig struct {
Theme string `json:"theme" mapstructure:"theme"`
AnimationSpeed time.Duration `json:"animation_speed" mapstructure:"animation_speed"`
KeyBindings map[string]string `json:"key_bindings" mapstructure:"key_bindings"`
AutoRefresh bool `json:"auto_refresh" mapstructure:"auto_refresh"`
RefreshInterval time.Duration `json:"refresh_interval" mapstructure:"refresh_interval"`
ShowHelp bool `json:"show_help" mapstructure:"show_help"`
ColorMode string `json:"color_mode" mapstructure:"color_mode"`
}
UIConfig contains UI preferences
type ValidationRule ¶
ValidationRule represents a single validation rule
type Validator ¶
type Validator interface {
Validate(data interface{}) error
ValidateField(field string, value interface{}) error
GetRules() map[string][]ValidationRule
}
Validator defines validation operations
type WHOISParameters ¶
type WHOISParameters struct {
*BaseParameters
}
WHOISParameters represents parameters for WHOIS operations
func NewWHOISParameters ¶
func NewWHOISParameters(query string) *WHOISParameters
NewWHOISParameters creates new WHOIS parameters
func (*WHOISParameters) Validate ¶
func (p *WHOISParameters) Validate() error
Validate validates WHOIS parameters
type WHOISResult ¶
type WHOISResult struct {
Domain string `json:"domain"`
Registrar string `json:"registrar"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
Expires time.Time `json:"expires"`
NameServers []string `json:"name_servers"`
Contacts map[string]Contact `json:"contacts"`
Status []string `json:"status"`
RawData string `json:"raw_data"`
}
WHOISResult contains WHOIS lookup data