import "github.com/kinorai/omnifeed/internal/engine"
Package engine defines the dispatch mechanism that picks the right per-URL handler. New engines (Hacker News, Stack Overflow, …) plug in by implementing domain.Engine and being Registered before the fallback.
Registry holds an ordered list of engines and a fallback. Lookup is first-match-wins; the fallback handles anything no engine claimed.
type Registry struct {
// contains filtered or unexported fields
}
func New() *Registry
New returns an empty Registry. Use Register and Fallback to populate it.
func (r *Registry) BlockPrivateIPs(block bool) *Registry
BlockPrivateIPs configures the SSRF choke point. Crawl validates every URL before dispatch, so no transport (HTTP loader, MCP HTTP, MCP stdio) can forget the check. The http(s)-scheme and non-empty-host checks always run; the private/reserved-IP rejection is gated on block.
func (r *Registry) Crawl(ctx context.Context, rawURL string, opts domain.EngineOptions) (domain.Document, error)
Crawl dispatches rawURL to the resolved engine, after validating it at the SSRF choke point (see BlockPrivateIPs). Validating here — rather than in each transport — guarantees every inbound path is covered.
func (r *Registry) Fallback(e domain.Engine) *Registry
Fallback sets the engine used when no Registered engine claims a URL.
func (r *Registry) Logger(l *slog.Logger) *Registry
Logger sets the logger used to report engine→fallback handoffs.
func (r *Registry) Metrics(m *observability.Metrics) *Registry
Metrics sets the collectors used to count engine→fallback handoffs (omnifeed_engine_fallbacks_total). Nil disables the counter.
func (r *Registry) Register(e domain.Engine) *Registry
Register appends an engine to the dispatch chain. Order matters — earlier engines get first crack at each URL.
func (r *Registry) Resolve(rawURL string) domain.Engine
Resolve returns the engine that should handle rawURL.
Generated by gomarkdoc