Documentation
¶
Index ¶
- func FallbackExtract(html string) string
- func IsCode(err error, code ErrorCode) bool
- func IsRetryableError(err error) bool
- func NewBackendError(code ErrorCode, backend, operation string, retryable bool, err error) error
- func StripInlineTags(content string) string
- type Backend
- type BackendError
- type BrowserBackend
- func (b *BrowserBackend) Available() bool
- func (b *BrowserBackend) Name() string
- func (b *BrowserBackend) Priority() int
- func (b *BrowserBackend) Read(ctx context.Context, req *ReadRequest) (*ReadResponse, error)
- func (b *BrowserBackend) Search(ctx context.Context, req *SearchRequest) (*SearchResponse, error)
- type DirectBackend
- func (b *DirectBackend) Available() bool
- func (b *DirectBackend) Name() string
- func (b *DirectBackend) Priority() int
- func (b *DirectBackend) Read(ctx context.Context, req *ReadRequest) (*ReadResponse, error)
- func (b *DirectBackend) Search(ctx context.Context, req *SearchRequest) (*SearchResponse, error)
- type ErrorCode
- type ReadRequest
- type ReadResponse
- type Router
- type RouterOptions
- type SearchRequest
- type SearchResponse
- type SearchResult
- type StealthBackend
- func (b *StealthBackend) Available() bool
- func (b *StealthBackend) Name() string
- func (b *StealthBackend) Priority() int
- func (b *StealthBackend) Read(ctx context.Context, req *ReadRequest) (*ReadResponse, error)
- func (b *StealthBackend) Search(ctx context.Context, req *SearchRequest) (*SearchResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FallbackExtract ¶
FallbackExtract does a simple HTML-to-text conversion for when readability fails.
func IsRetryableError ¶
func NewBackendError ¶
func StripInlineTags ¶
StripInlineTags removes residual HTML tags that readability may leave behind while preserving non-tag angle bracket text (emails, ABNF, generics).
Types ¶
type Backend ¶
type Backend interface {
Name() string
Priority() int
Available() bool
Read(ctx context.Context, req *ReadRequest) (*ReadResponse, error)
Search(ctx context.Context, req *SearchRequest) (*SearchResponse, error)
}
type BackendError ¶
type BackendError struct {
Code ErrorCode
Backend string
Operation string
Retryable bool
Err error
}
func (*BackendError) Error ¶
func (e *BackendError) Error() string
func (*BackendError) IsRetryable ¶
func (e *BackendError) IsRetryable() bool
func (*BackendError) Unwrap ¶
func (e *BackendError) Unwrap() error
type BrowserBackend ¶
type BrowserBackend struct {
// contains filtered or unexported fields
}
func NewBrowserBackend ¶
func NewBrowserBackend(timeout time.Duration) *BrowserBackend
func (*BrowserBackend) Available ¶
func (b *BrowserBackend) Available() bool
func (*BrowserBackend) Name ¶
func (b *BrowserBackend) Name() string
func (*BrowserBackend) Priority ¶
func (b *BrowserBackend) Priority() int
func (*BrowserBackend) Read ¶
func (b *BrowserBackend) Read(ctx context.Context, req *ReadRequest) (*ReadResponse, error)
func (*BrowserBackend) Search ¶
func (b *BrowserBackend) Search(ctx context.Context, req *SearchRequest) (*SearchResponse, error)
type DirectBackend ¶
type DirectBackend struct {
// contains filtered or unexported fields
}
func NewDirectBackend ¶
func NewDirectBackend(timeout time.Duration) *DirectBackend
func (*DirectBackend) Available ¶
func (b *DirectBackend) Available() bool
func (*DirectBackend) Name ¶
func (b *DirectBackend) Name() string
func (*DirectBackend) Priority ¶
func (b *DirectBackend) Priority() int
func (*DirectBackend) Read ¶
func (b *DirectBackend) Read(ctx context.Context, req *ReadRequest) (*ReadResponse, error)
func (*DirectBackend) Search ¶
func (b *DirectBackend) Search(ctx context.Context, req *SearchRequest) (*SearchResponse, error)
type ReadRequest ¶
type ReadResponse ¶
type ReadResponse struct {
URL string `json:"url" yaml:"url"`
Title string `json:"title" yaml:"title"`
Content string `json:"content" yaml:"content"`
Backend string `json:"backend" yaml:"backend"`
FetchedAt time.Time `json:"fetched_at" yaml:"fetched_at"`
Metadata map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty"`
CacheHit bool `json:"cache_hit" yaml:"cache_hit"`
}
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func NewRouter ¶
func NewRouter(backends []Backend, opts RouterOptions) *Router
func (*Router) Read ¶
func (r *Router) Read(ctx context.Context, preferred string, req *ReadRequest) (*ReadResponse, error)
func (*Router) Search ¶
func (r *Router) Search(ctx context.Context, preferred string, req *SearchRequest) (*SearchResponse, error)
type RouterOptions ¶
type SearchRequest ¶
type SearchResponse ¶
type SearchResponse struct {
Query string `json:"query" yaml:"query"`
Results []SearchResult `json:"results" yaml:"results"`
Limit int `json:"limit" yaml:"limit"`
Backend string `json:"backend" yaml:"backend"`
FetchedAt time.Time `json:"fetched_at" yaml:"fetched_at"`
CacheHit bool `json:"cache_hit" yaml:"cache_hit"`
}
type SearchResult ¶
type StealthBackend ¶
type StealthBackend struct {
// contains filtered or unexported fields
}
func NewStealthBackend ¶
func NewStealthBackend(timeout time.Duration) *StealthBackend
func (*StealthBackend) Available ¶
func (b *StealthBackend) Available() bool
func (*StealthBackend) Name ¶
func (b *StealthBackend) Name() string
func (*StealthBackend) Priority ¶
func (b *StealthBackend) Priority() int
func (*StealthBackend) Read ¶
func (b *StealthBackend) Read(ctx context.Context, req *ReadRequest) (*ReadResponse, error)
func (*StealthBackend) Search ¶
func (b *StealthBackend) Search(ctx context.Context, req *SearchRequest) (*SearchResponse, error)
Click to show internal directories.
Click to hide internal directories.