Documentation
¶
Index ¶
- Constants
- Variables
- func IsLikelyFeedURL(rawURL string) bool
- func NewAuditInventory(feeds []store.Feed, userAgent string, allowPrivateNetwork bool) audit.UpstreamInventory
- func NormalizeFeedURL(raw string) (string, string, error)
- type AddOptions
- type DiscoveryCandidate
- type FetchResult
- type Fetcher
- type HTTPFetcher
- type HTTPFetcherOptions
- type Options
- type Result
- type RunFunc
- type Stats
- func Add(ctx context.Context, cfg config.Config, st *store.Store, rawURL string, ...) (store.Feed, bool, Stats, error)
- func CheckFeed(ctx context.Context, cfg config.Config, st *store.Store, feed store.Feed, ...) (Stats, error)
- func Run(ctx context.Context, cfg config.Config, st *store.Store, opts Options) (Stats, error)
Constants ¶
const ( DefaultPollInterval = time.Hour DefaultTimeout = 30 * time.Second DefaultMaxBodyBytes = 10 << 20 DefaultConcurrency = 6 DefaultUserAgent = "" )
Variables ¶
Functions ¶
func IsLikelyFeedURL ¶ added in v0.8.17
IsLikelyFeedURL reports whether a URL has a feed-shaped path and can skip HTML discovery before feed import.
func NewAuditInventory ¶ added in v0.7.0
func NewAuditInventory(feeds []store.Feed, userAgent string, allowPrivateNetwork bool) audit.UpstreamInventory
NewAuditInventory constructs a bounded read-only inventory over configured feed rows supplied by the caller's existing query-only snapshot. The public API deliberately exposes no HTTP client, transport, DNS, redirect, or URL override capability.
Types ¶
type AddOptions ¶
type AddOptions struct {
Enabled bool
Disabled bool
Import bool
PollInterval time.Duration
UserTags string
Fetch bool
DefaultPollInterval time.Duration
Timeout time.Duration
MaxBodyBytes int64
UserAgent string
AllowPrivateNetwork bool
Client *http.Client
Fetcher Fetcher
Now func() time.Time
Logger *slog.Logger
}
type DiscoveryCandidate ¶
type DiscoveryCandidate struct {
URL string `json:"url"`
Title string `json:"title,omitempty"`
Type string `json:"type,omitempty"`
}
func DiscoverFromHTML ¶
func DiscoverFromHTML(pageURL, htmlBody string) ([]DiscoveryCandidate, error)
func DiscoverURL ¶
func DiscoverURL(ctx context.Context, rawURL string, opts AddOptions) ([]DiscoveryCandidate, bool)
type FetchResult ¶
type HTTPFetcher ¶
type HTTPFetcher struct {
// contains filtered or unexported fields
}
func NewHTTPFetcher ¶
func NewHTTPFetcher(client *http.Client) HTTPFetcher
func NewHTTPFetcherWithOptions ¶ added in v0.1.7
func NewHTTPFetcherWithOptions(client *http.Client, opts HTTPFetcherOptions) HTTPFetcher
func (HTTPFetcher) Fetch ¶
func (f HTTPFetcher) Fetch(ctx context.Context, feed store.Feed, opts Options) (FetchResult, error)
type HTTPFetcherOptions ¶ added in v0.1.7
type HTTPFetcherOptions struct {
AllowPrivateNetwork bool
}
type Result ¶
type Result struct {
FeedKey string `json:"feed_key"`
URL string `json:"url"`
Status string `json:"status"`
HTTPStatus int `json:"http_status,omitempty"`
EntriesSeen int `json:"entries_seen"`
ItemsCreated int `json:"items_created"`
ItemsUpdated int `json:"items_updated"`
ItemsUnchanged int `json:"items_unchanged"`
SourceIDs []int64 `json:"source_ids,omitempty"`
Error string `json:"error,omitempty"`
}
type Stats ¶
type Stats struct {
FeedsChecked int `json:"feeds_checked"`
FeedsChanged int `json:"feeds_changed"`
FeedsUnchanged int `json:"feeds_unchanged"`
FeedsFailed int `json:"feeds_failed"`
EntriesSeen int `json:"entries_seen"`
ItemsCreated int `json:"items_created"`
ItemsUpdated int `json:"items_updated"`
ItemsUnchanged int `json:"items_unchanged"`
VersionsCreated int `json:"versions_created"`
SourcesCreated int `json:"sources_created"`
SourcesLinked int `json:"sources_linked"`
SourceIDs []int64 `json:"source_ids,omitempty"`
ItemsRendered int `json:"items_rendered"`
IdentityConflicts int `json:"identity_conflicts"`
Errors int `json:"errors"`
Results []Result `json:"results,omitempty"`
}