Documentation
¶
Index ¶
- Constants
- func Collect[T any](seq iter.Seq2[T, error]) ([]T, error)
- func Query(ctx context.Context, domain string, opts ...Option) iter.Seq2[sources.Result, error]
- func Subdomains(ctx context.Context, domain string, opts ...Option) iter.Seq2[string, error]
- func URLs(ctx context.Context, domain string, opts ...Option) iter.Seq2[string, error]
- type Option
- func WithAPIKey(source, key string) Option
- func WithGlobalRateLimit(rps float64) Option
- func WithHTTPClient(c *http.Client) Option
- func WithParallelism(n int) Option
- func WithSourceRateLimit(source string, rps float64) Option
- func WithSources(srcs []sources.Source) Option
- func WithTimeout(d time.Duration) Option
- type Options
Constants ¶
const Version = "0.1.0"
Variables ¶
This section is empty.
Functions ¶
func Collect ¶
Collect iterates over all results, collecting results without error. Returned are the collected non-error results, if any errors occurred they will be joined into a non-nil error result. Partial results are returned alongside errors.
func Query ¶
Query runs sources against a domain and yields results. By default all registered sources are queried; use WithSources to override. Results are deduplicated across all sources.
func Subdomains ¶
Subdomains is a convenience wrapper that filters for Subdomain results only. By default only subdomain-yielding sources are queried; use WithSources to override.
Types ¶
type Option ¶
type Option func(*Options)
Option is a functional option for configuring Query.
func WithAPIKey ¶
WithAPIKey sets an API key for a specific source.
func WithGlobalRateLimit ¶
WithGlobalRateLimit sets a global rate limit (requests/second).
func WithHTTPClient ¶
WithHTTPClient sets a custom HTTP client.
func WithParallelism ¶
WithParallelism sets the number of concurrent sources.
func WithSourceRateLimit ¶
WithSourceRateLimit sets a rate limit for a specific source.
func WithSources ¶
WithSources sets the sources to query.
func WithTimeout ¶
WithTimeout sets the per-source timeout.
type Options ¶
type Options struct {
// Sources specifies which sources to query. If nil, sensible default source selections are made.
Sources []sources.Source
// HTTPClient is the client used for all requests. If nil, a default client with sensible timeouts is used.
HTTPClient *http.Client
// Parallelism controls how many sources run concurrently. Set to 1 for sequential execution.
Parallelism int
// GlobalRateLimit limits requests/second across all sources. Default is 0 (unlimited).
GlobalRateLimit rate.Limit
// SourceRateLimits sets per-source rate limits. Key is source name, value is requests/second.
SourceRateLimits map[string]rate.Limit
// Timeout is the per-source timeout.
Timeout time.Duration
// APIKeys maps source names to their API keys. Optional keys improve rate limits for some sources.
APIKeys map[string]string
}
Options configures the behavior of Query and related functions.