Documentation
¶
Overview ¶
Package discovery provides network discovery functionality using nmap. This package handles host discovery operations and integrates with the database for proper target generation and result storage.
Index ¶
- type Config
- type Engine
- func (e *Engine) Discover(ctx context.Context, config *Config) (*db.DiscoveryJob, error)
- func (e *Engine) ScanNetwork(ctx context.Context, cfg *Config) (int, error)
- func (e *Engine) SetConcurrency(concurrency int)
- func (e *Engine) SetTimeout(timeout time.Duration)
- func (e *Engine) WaitForCompletion(ctx context.Context, jobID uuid.UUID, timeout time.Duration) error
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Networks []string `json:"networks"`
Network string `json:"network"`
Method string `json:"method"`
DetectOS bool `json:"detect_os"`
Timeout time.Duration `json:"timeout"`
Concurrency int `json:"concurrency"`
MaxHosts int `json:"max_hosts"`
}
Config holds discovery configuration parameters.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine handles network discovery operations.
func (*Engine) ScanNetwork ¶ added in v0.21.0
ScanNetwork performs host discovery for the given config without creating or managing any discovery_jobs DB rows. It validates the config, runs the nmap scan, persists discovered hosts, and returns the number of hosts found. Callers are responsible for updating the job status and counts in the DB.
func (*Engine) SetConcurrency ¶
SetConcurrency sets the concurrency level for discovery operations.
func (*Engine) SetTimeout ¶
SetTimeout sets the timeout for discovery operations.
type Result ¶
type Result struct {
IPAddress net.IP `json:"ip_address"`
Status string `json:"status"`
ResponseTime time.Duration `json:"response_time"`
OSInfo string `json:"os_info"`
Method string `json:"method"`
Error string `json:"error,omitempty"`
}
Result represents a discovery result for a single host.