Documentation
¶
Overview ¶
Package newznab implements core.Indexer against Newznab-compatible Usenet indexers, with per-indexer daily budgets and a result cache.
Index ¶
- Constants
- Variables
- func BareMagnet(infoHash string) string
- func InfoHashFromMagnet(magnet string) string
- func MagnetFor(infoHash, name string, trackers []string) string
- func MagnetValues(magnet string) url.Values
- func NormalizeInfoHash(s string) string
- func ProwlarrIDPrefix(cfg config.Prowlarr) string
- func Test(ctx context.Context, cfg config.Indexer, policy config.ClientIdentity) error
- func TestCaps(ctx context.Context, cfg config.Indexer, policy config.ClientIdentity) (config.Identity, error)
- func TestCapsWithOptions(ctx context.Context, cfg config.Indexer, opts Options) (config.Identity, error)
- func TestWithOptions(ctx context.Context, cfg config.Indexer, opts Options) error
- type APIError
- type Backend
- type Caps
- type Client
- func (c *Client) Caps(ctx context.Context) (*Caps, error)
- func (c *Client) Config() config.Indexer
- func (c *Client) DailyAPILimit() int
- func (c *Client) Exhausted(ctx context.Context) bool
- func (c *Client) FetchNZB(ctx context.Context, r core.Release) ([]byte, error)
- func (c *Client) Name() string
- func (c *Client) Remaining(ctx context.Context) (Remaining, error)
- func (c *Client) ResolveTorrent(ctx context.Context, r core.Release) (core.Release, error)
- func (c *Client) Search(ctx context.Context, req core.SearchRequest) ([]core.Release, error)
- func (c *Client) SearchRescue(ctx context.Context, req core.SearchRequest) ([]core.Release, error)
- func (c *Client) SearchWith(ctx context.Context, req core.SearchRequest, arrived func([]core.Release)) ([]core.Release, error)
- func (c *Client) SetCacheTTL(d time.Duration)
- func (c *Client) SetClientIdentity(p config.ClientIdentity)
- func (c *Client) UpdateConfig(cfg config.Indexer)
- type Event
- type HostLimiter
- type IndexerUsage
- type Manager
- func (m *Manager) ApplyConfig(cfg config.Config)
- func (m *Manager) CachedReleases(ctx context.Context) ([]core.Release, error)
- func (m *Manager) Clients() []*Client
- func (m *Manager) FeedSources() []core.ReleaseFeed
- func (m *Manager) FetchNZB(ctx context.Context, r core.Release) ([]byte, error)
- func (m *Manager) HasTorrentIndexer() bool
- func (m *Manager) Indexers() []core.Indexer
- func (m *Manager) MissingSources() error
- func (m *Manager) Name() string
- func (m *Manager) Prune(ctx context.Context) (int64, error)
- func (m *Manager) PurgeLegacyCache(ctx context.Context) (int64, error)
- func (m *Manager) Recent(ctx context.Context, id string, offset, limit int) ([]core.Release, error)
- func (m *Manager) Reload(cfgs []config.Indexer)
- func (m *Manager) Remaining(ctx context.Context) ([]Remaining, error)
- func (m *Manager) ResolveTorrent(ctx context.Context, r core.Release) (core.Release, error)
- func (m *Manager) Search(ctx context.Context, req core.SearchRequest) ([]core.Release, error)
- func (m *Manager) SearchRescue(ctx context.Context, req core.SearchRequest) ([]core.Release, error)
- func (m *Manager) SearchRescueWith(ctx context.Context, req core.SearchRequest, arrived func([]core.Release)) ([]core.Release, error)
- func (m *Manager) SearchTimings() []SearchTiming
- func (m *Manager) SearchWith(ctx context.Context, req core.SearchRequest, arrived func([]core.Release)) ([]core.Release, error)
- func (m *Manager) Subscribe(fn func(Event)) func()
- func (m *Manager) TestIndexer(ctx context.Context, cfg config.Indexer, policy config.ClientIdentity) error
- func (m *Manager) TestIndexerCaps(ctx context.Context, cfg config.Indexer, policy config.ClientIdentity) (config.Identity, error)
- func (m *Manager) Usage(ctx context.Context) (UsageReport, error)
- func (m *Manager) UsageHandler() http.Handler
- type Options
- type PreviewCall
- type PreviewInput
- type PreviewProfile
- type ProwlarrDiscovery
- type ProwlarrTag
- type PurposeCount
- type RateLimitError
- type RecentBackend
- type Remaining
- type RequestPreview
- type SearchTiming
- type TorrentMeta
- type UsageDay
- type UsageReport
- type UsageWindow
Constants ¶
const DefaultMaxPerHost = 8
DefaultMaxPerHost bounds concurrent requests to any single indexer origin (scheme://host:port), so a shared proxy such as Prowlarr, Jackett or FlareSolverr with dozens of configured feeds is not hit with all of them at once. Eight keeps a 20-feed Prowlarr search to three short waves, so first-play search time barely moves while Prowlarr is never flooded.
const MaxRateLimitPause = maxRateLimitPause
MaxRateLimitPause is the shared cap on a service-requested pause, exported so HTTP handlers cap Retry-After exactly like this client instead of duplicating a literal bound.
const PurposeUnattributed = "unattributed"
PurposeUnattributed labels budget hits older than purpose tracking (or spent by a node that predates it): the budget counted them, newznab_usage did not.
Variables ¶
var ErrIndexerPaused = fmt.Errorf("indexer paused after repeated failures: %w", core.ErrSourceUnavailable)
ErrIndexerPaused reports a search skipped because the indexer failed repeatedly. It is transient: the indexer is tried again after the pause.
var ErrMissingDefinition = fmt.Errorf("indexer definition is not installed: %w", core.ErrSourceUnavailable)
ErrMissingDefinition reports a built-in site indexer whose definition is not installed on the server.
Functions ¶
func BareMagnet ¶
BareMagnet builds a trackerless magnet URI containing only the normalized v1 info hash.
func InfoHashFromMagnet ¶
InfoHashFromMagnet extracts the v1 info hash from a magnet URI's xt=urn:btih: parameter; "" when absent.
func MagnetValues ¶ added in v0.3.4
MagnetValues parses magnet query fields, tolerating malformed unrelated fields.
func NormalizeInfoHash ¶
NormalizeInfoHash returns a lower-case 40-character hex BitTorrent v1 info hash, converting a 32-character base32 hash; "" when s is neither.
func ProwlarrIDPrefix ¶ added in v0.2.34
ProwlarrIDPrefix returns the ID prefix of indexers imported from cfg's Prowlarr instance ("prowlarr-<scope>-"), or "" when the URL is not a usable base URL (same validation as discovery).
func Test ¶
Test verifies an indexer config for the setup wizard: caps plus one search, with human-readable errors. policy is the client identity the probe presents, so the probe matches the traffic the indexer will see.
func TestCaps ¶
func TestCaps(ctx context.Context, cfg config.Indexer, policy config.ClientIdentity) (config.Identity, error)
TestCaps runs a single t=caps request against cfg using the identity resolved from policy, returning the resolved identity and any error.
Types ¶
type APIError ¶
type APIError struct {
Code int
Description string
Budget bool // daily limit / rate limited; unwraps to core.ErrBudgetExhausted
}
APIError is a typed Newznab error document (<error code=".." description=".."/>) or an HTTP-level failure translated into the same shape.
type Backend ¶
type Backend interface {
Search(ctx context.Context, req core.SearchRequest, reserve func(context.Context, string) error) ([]core.Release, error)
FetchNZB(ctx context.Context, r core.Release, reserve func(context.Context, string) error) ([]byte, error)
ResolveTorrent(ctx context.Context, r core.Release, reserve func(context.Context, string) error) (core.Release, error)
}
Backend searches a site that is not a Newznab API, such as a built-in site run from an owner-installed definition. The Client keeps budgets, the result cache and events around it: a backend calls reserve with "hit" or "grab" before each request that counts against a daily budget.
type Caps ¶
type Caps struct {
ServerTitle string `json:"serverTitle,omitempty"`
ServerType string `json:"serverType,omitempty"`
LimitDefault int `json:"limitDefault,omitempty"`
LimitMax int `json:"limitMax,omitempty"`
SearchAvail bool `json:"searchAvailable"`
SearchParams []string `json:"searchParams,omitempty"`
MovieAvail bool `json:"movieSearchAvailable"`
MovieParams []string `json:"movieParams,omitempty"`
TVAvail bool `json:"tvSearchAvailable"`
TVParams []string `json:"tvParams,omitempty"`
Categories []int `json:"categories,omitempty"`
}
Caps is a parsed Newznab capabilities document.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is one configured Newznab indexer. It implements core.Indexer.
func New ¶
New builds a Client for one indexer. db may be nil (budgets and cache then live in memory).
func (*Client) Caps ¶
Caps returns the indexer's capabilities, cached for 24h per endpoint (URL and API key): an indexer edited to point elsewhere fetches anew, and a response from the old endpoint still in flight is not kept.
func (*Client) DailyAPILimit ¶ added in v0.3.3
DailyAPILimit is the indexer's daily API request limit: the owner's configured cap, otherwise the one the indexer reports, otherwise 0 (unknown). Background work takes only its share of it.
func (*Client) FetchNZB ¶
FetchNZB implements core.Indexer. Every call returns a slice of its own, which the caller may keep or modify.
func (*Client) ResolveTorrent ¶
ResolveTorrent fills a torrent release's InfoHash and MagnetURL by downloading its .torrent link (counting as a grab) when the indexer only supplied a download URL. Releases that already carry both are returned unchanged without a request.
func (*Client) SearchRescue ¶ added in v0.2.4
SearchRescue runs broader keyword, alias, OriginalTitle, miniseries and season-pack queries when the primary Search results had no playable candidate. Results are cached under a separate rescue key and respect the indexer's daily budget and rate-limit state.
func (*Client) SearchWith ¶ added in v0.2.9
func (c *Client) SearchWith(ctx context.Context, req core.SearchRequest, arrived func([]core.Release)) ([]core.Release, error)
SearchWith delivers complete items while the HTTP body is still arriving. Cache/backend answers use the same callback; each ID is emitted once even when fallback queries overlap. The cache only receives complete responses.
func (*Client) SetCacheTTL ¶
SetCacheTTL changes the result-cache TTL (called on config reload). A negative value disables the cache.
func (*Client) SetClientIdentity ¶ added in v0.3.2
func (c *Client) SetClientIdentity(p config.ClientIdentity)
SetClientIdentity stores the server-wide request identity rules and refreshes this indexer's resolved search/caps identity.
func (*Client) UpdateConfig ¶
UpdateConfig swaps the indexer config (called on config reload).
type Event ¶
type Event struct {
Indexer string
Kind string
Purpose string
Success bool
Empty bool // network search succeeded with zero releases
Cached bool // answered from Ether's cache without an HTTP request
BudgetExhausted bool // held back locally by Ether's budget or rate-limit pause
SpeculativeHeld bool // held back by the warm-up or viewer detail share
RateLimited bool // remote indexer answered HTTP 429 or quota error to a sent request
Results int
Duration time.Duration
AverageAge time.Duration
At time.Time
}
Event records one indexer's observed operation; no URLs or keys are exposed.
type HostLimiter ¶
type HostLimiter struct {
// contains filtered or unexported fields
}
HostLimiter bounds in-flight HTTP requests per origin (scheme://host:port). Idle host entries are dropped once their last holder or waiter leaves.
func NewHostLimiter ¶
func NewHostLimiter(limit int) *HostLimiter
NewHostLimiter returns a per-host concurrency limiter. limit == 0 uses DefaultMaxPerHost; limit < 0 disables limiting.
type IndexerUsage ¶ added in v0.3.3
type IndexerUsage struct {
ID string `json:"id"`
Name string `json:"name"`
Enabled bool `json:"enabled"`
Torrent bool `json:"torrent"`
DailyLimit int `json:"dailyLimit"`
DailyGrabs int `json:"dailyGrabs"`
RetryAt int64 `json:"retryAt,omitempty"`
PausedUntil int64 `json:"pausedUntil,omitempty"`
MissingDefinition bool `json:"missingDefinition,omitempty"`
Today UsageWindow `json:"today"`
Week UsageWindow `json:"week"`
Month UsageWindow `json:"month"`
Days []UsageDay `json:"days"`
}
IndexerUsage is one configured indexer's request history: what it would show on the indexer's own API-hit counter, by purpose.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager holds all configured indexers and spreads searches across them within their budgets. It implements core.Indexer so the resolver can treat the fleet as one indexer; FetchNZB routes by the release's Indexer name.
func NewManager ¶
NewManager builds a Manager from indexer configs.
func (*Manager) ApplyConfig ¶
ApplyConfig reloads indexers and the search-cache TTL from a full config snapshot; subscribe it to config.Store changes.
func (*Manager) CachedReleases ¶ added in v0.2.9
CachedReleases reuses a bounded set of already-paid-for search/feed results. It performs no requests, capability discovery, cache refresh, or downloads.
func (*Manager) FeedSources ¶ added in v0.2.8
func (m *Manager) FeedSources() []core.ReleaseFeed
FeedSources reports capabilities without making a request. Built-in sites remain searchable but are not treated as paginated feeds without that contract.
func (*Manager) FetchNZB ¶
FetchNZB implements core.Indexer by routing to the originating client. Events are emitted by the client at the point of cache hit, budget refusal or HTTP download.
func (*Manager) HasTorrentIndexer ¶ added in v0.2.20
HasTorrentIndexer reports whether an enabled indexer returns torrents (Torznab, a Stremio addon or a torrent built-in site).
func (*Manager) MissingSources ¶ added in v0.2.20
MissingSources reports core.ErrNoSources when no indexer is enabled: a search would return nothing whatever the title.
func (*Manager) Prune ¶
Prune deletes budget and usage rows older than budgetRetentionDays, any expired search-cache rows (normally removed on write, but an idle indexer never writes). It is meant to be called periodically.
func (*Manager) PurgeLegacyCache ¶ added in v0.2.4
PurgeLegacyCache deletes search-cache rows written before cached links were tokenized (they contain indexer API keys) and returns how many it removed. Call it once no node running an older release writes the cache.
func (*Manager) Recent ¶ added in v0.2.8
Recent fetches one page, charging the same account-wide limits as Search. It never invokes title searches, capability discovery, or implicit retries.
func (*Manager) Reload ¶
Reload replaces the indexer set (call on config change). Existing clients with an unchanged ID keep their in-memory caches.
func (*Manager) ResolveTorrent ¶
ResolveTorrent implements the debrid indexer's torrent resolution by routing to the release's originating indexer.
func (*Manager) Search ¶
Search implements core.Indexer: it queries enabled indexers in parallel (up to MaxParallel), letting each client check its cache before budgets, merges by priority order and de-duplicates by normalised name + size.
func (*Manager) SearchRescue ¶ added in v0.2.4
SearchRescue runs a second-pass rescue fan-out across all enabled indexers when the primary Search results had no playable candidate.
func (*Manager) SearchRescueWith ¶ added in v0.2.4
func (m *Manager) SearchRescueWith(ctx context.Context, req core.SearchRequest, arrived func([]core.Release)) ([]core.Release, error)
SearchRescueWith is SearchRescue with per-indexer early arrival callbacks. A rescue is Play's (or the owner's) second pass and is tagged rescue. Speculative work never fans out into one: under the rescue label it would escape the speculative share, so it sends nothing.
func (*Manager) SearchTimings ¶
func (m *Manager) SearchTimings() []SearchTiming
SearchTimings returns a copy of the most recent per-indexer search timings.
func (*Manager) SearchWith ¶ added in v0.2.4
func (m *Manager) SearchWith(ctx context.Context, req core.SearchRequest, arrived func([]core.Release)) ([]core.Release, error)
SearchWith is Search, also handing each indexer's results to arrived as soon as that indexer answers (concurrently, from its own goroutine), so callers can start follow-up work, such as debrid cache checks, before the slowest indexer is done.
func (*Manager) TestIndexer ¶ added in v0.3.3
func (m *Manager) TestIndexer(ctx context.Context, cfg config.Indexer, policy config.ClientIdentity) error
TestIndexer is Test, with the requests it makes recorded as manual tests in the usage breakdown and statistics. Test hits are real requests the indexer counts, but they never spend the daily budget.
func (*Manager) TestIndexerCaps ¶
func (m *Manager) TestIndexerCaps(ctx context.Context, cfg config.Indexer, policy config.ClientIdentity) (config.Identity, error)
TestIndexerCaps runs a single t=caps request through the resolved identity for cfg under policy, recording the request as a manual test without spending the daily budget.
func (*Manager) Usage ¶ added in v0.3.3
func (m *Manager) Usage(ctx context.Context) (UsageReport, error)
Usage reports each configured indexer's real API hits and grabs for today, the last 7 days and this UTC month, split by purpose. Totals are newznab_budget's counts (every request that reached the indexer) plus manual tests, which never spend the budget; budget hits the breakdown does not explain are reported as PurposeUnattributed.
func (*Manager) UsageHandler ¶ added in v0.3.3
UsageHandler serves Usage as JSON at its root (GET).
type Options ¶
type Options struct {
HTTPClient *http.Client
Logger *slog.Logger
SearchCacheTTL time.Duration // <0 disables cache, 0 = default 6h
Vault vault.Store
LegacyNZBDir func() string // non-empty only while migrating
PublicIndexer func(context.Context, config.Indexer) bool
MaxNZBBytes int64
Now func() time.Time // injected clock (tests)
MaxParallel int // Manager fan-out; 0 dispatches every configured indexer
MaxPerHost int // per-origin concurrency cap; 0 = DefaultMaxPerHost, <0 = unlimited
HostLimiter *HostLimiter // optional shared per-origin concurrency limiter
// ClientIdentity is the owner's policy for the client Ether presents to
// indexers; the zero value keeps the Ether identity.
ClientIdentity config.ClientIdentity
// Backend builds the search backend for an indexer whose Kind is not
// Newznab (built-in sites, internal/cardigann). Nil disables them.
Backend func(config.Indexer) (Backend, error)
// Events receives non-blocking indexer.* domain events when set.
Events *events.Bus
// contains filtered or unexported fields
}
Options tunes a Client or Manager. Zero values get sensible defaults.
type PreviewCall ¶
type PreviewCall struct {
RequestLine string `json:"requestLine"`
Headers []config.HeaderKV `json:"headers"`
Profile string `json:"profile"`
MatchedRuleID string `json:"matchedRuleId,omitempty"`
}
PreviewCall is one rendered sample HTTP request.
type PreviewInput ¶
type PreviewInput struct {
Rule *config.IdentityRule
Rules []config.IdentityRule
HasRules bool
Indexer *config.Indexer
SavedIndexers []config.Indexer
SavedPolicy config.ClientIdentity
}
PreviewInput specifies what PreviewRequestIdentity renders. When Rule is set, it previews that (possibly unsaved) rule with sample search and download requests appropriate to the rule's target. Otherwise it previews the effective search and download requests for Indexer.
type PreviewProfile ¶
PreviewProfile describes one selectable identity profile for the picker.
type ProwlarrDiscovery ¶ added in v0.2.34
type ProwlarrDiscovery struct {
Indexers []config.Indexer `json:"indexers"`
SkippedUnknownProtocol int `json:"skippedUnknownProtocol"`
Warnings []string `json:"warnings,omitempty"`
// PresentIDs are the scoped IDs of every enabled indexer the source
// reported, including ones filtered out below (unknown protocol or,
// when tags are set, a tag the owner did not choose). It is diagnostic
// only. Tag sync decides what to stop using from Indexers, never from
// this list, and an empty tag list stays additive.
PresentIDs []string `json:"presentIds,omitempty"`
}
ProwlarrDiscovery is the result of a successful Prowlarr discovery: the importable indexers plus what was left out and why, so a preview can report skips instead of dropping them silently (same pattern as the quality-profile import's Skipped/Warnings).
func DiscoverProwlarrReport ¶ added in v0.2.34
func DiscoverProwlarrReport(ctx context.Context, cfg config.Prowlarr, opts Options) (ProwlarrDiscovery, error)
DiscoverProwlarrReport is DiscoverProwlarr plus a count (and warning) for enabled indexers skipped because Prowlarr reported a protocol Ether cannot use.
It only reads Prowlarr's indexer list (GET /api/v1/indexer). It does not search or download, so indexer hit and grab quotas are not spent. cfg.Tags empty keeps every enabled Usenet and torrent indexer. With tags set, an indexer is kept only when its tags field shares one of those ids.
type ProwlarrTag ¶ added in v0.3.0
ProwlarrTag is one tag from Prowlarr's /api/v1/tag.
func ListProwlarrTags ¶ added in v0.3.0
func ListProwlarrTags(ctx context.Context, cfg config.Prowlarr, opts Options) ([]ProwlarrTag, error)
ListProwlarrTags reads Prowlarr's tag catalogue (GET /api/v1/tag) so the owner can pick tags. It does not search or download.
type PurposeCount ¶ added in v0.3.3
type PurposeCount struct {
Purpose string `json:"purpose"`
Hits int64 `json:"hits"`
Grabs int64 `json:"grabs"`
}
PurposeCount is one purpose's share of a usage window.
type RateLimitError ¶ added in v0.2.17
RateLimitError is a backend's rate-limit refusal (HTTP 429). The Client pauses the indexer until RetryAfter, a Retry-After header value ("" for the default pause), exactly as for a Newznab 429.
func (*RateLimitError) Error ¶ added in v0.2.17
func (e *RateLimitError) Error() string
func (*RateLimitError) Unwrap ¶ added in v0.2.17
func (e *RateLimitError) Unwrap() []error
type RecentBackend ¶ added in v0.3.3
type RecentBackend interface {
Recent(ctx context.Context, reserve func(context.Context, string) error) ([]core.Release, error)
}
RecentBackend is a Backend that can list a site's latest releases, the release feed of a site with no Newznab API.
type Remaining ¶
type Remaining struct {
Indexer string `json:"indexer"`
Day string `json:"day"`
HitsUsed int `json:"hitsUsed"`
HitsLimit int `json:"hitsLimit"`
HitsRemaining int `json:"hitsRemaining"`
GrabsUsed int `json:"grabsUsed"`
GrabsLimit int `json:"grabsLimit"`
GrabsRemaining int `json:"grabsRemaining"`
RetryAt int64 `json:"retryAt,omitempty"` // service-reported throttling; automatic retry (Unix seconds)
PausedUntil int64 `json:"pausedUntil,omitempty"` // circuit-breaker pause after repeated failures (Unix seconds)
MissingDefinition bool `json:"missingDefinition,omitempty"`
// Enabled and Torrent let the dashboard warn when nothing can be
// searched, or when debrid has no torrent indexer to search.
Enabled bool `json:"enabled"`
Torrent bool `json:"torrent"` // Torznab, a Stremio addon or a torrent built-in site
}
Remaining reports one indexer's budget state for today (UTC). A remaining value of -1 means there is no personal cap; service limits still apply.
type RequestPreview ¶
type RequestPreview struct {
Profile string `json:"profile"`
MatchedRuleID string `json:"matchedRuleId,omitempty"`
Search PreviewCall `json:"search"`
Download PreviewCall `json:"download"`
DownloadKind string `json:"downloadKind"` // "nzb" or "torrent"
Profiles []PreviewProfile `json:"profiles"`
}
RequestPreview is what the console renders as "What the indexer sees": the exact request line and ordered headers for a sample search and a sample download. API keys and sensitive header/parameter values are always masked.
func PreviewRequestIdentity ¶
func PreviewRequestIdentity(in PreviewInput) (*RequestPreview, error)
PreviewRequestIdentity builds the server-side preview for a rule or indexer. It performs no network I/O and never emits plaintext API keys or secrets.
type SearchTiming ¶
SearchTiming records the most recent aggregate search's per-indexer cost.
type TorrentMeta ¶
type TorrentMeta struct {
InfoHash string
Name string
Trackers []string
Private bool
Files []core.ReleaseFile
}
TorrentMeta is what a .torrent file contributes to a release.
func ParseTorrent ¶
func ParseTorrent(data []byte) (TorrentMeta, error)
ParseTorrent computes the info hash (SHA-1 of the bencoded info dictionary) and reads the name, trackers and file list of a .torrent file.
type UsageDay ¶ added in v0.3.3
type UsageDay struct {
Day string `json:"day"`
Hits int64 `json:"hits"`
Grabs int64 `json:"grabs"`
}
UsageDay is one UTC day's totals.
type UsageReport ¶ added in v0.3.3
type UsageReport struct {
Today string `json:"today"`
WeekStart string `json:"weekStart"`
MonthStart string `json:"monthStart"`
Indexers []IndexerUsage `json:"indexers"`
}
UsageReport is every configured indexer's usage. Days are UTC.
type UsageWindow ¶ added in v0.3.3
type UsageWindow struct {
Hits int64 `json:"hits"`
Grabs int64 `json:"grabs"`
Purposes []PurposeCount `json:"purposes"`
}
UsageWindow totals one indexer's real API hits and grabs over a window.
Source Files
¶
- api_limits.go
- breaker.go
- cache_secrets.go
- cache_ttl.go
- capability_assertions.go
- caps.go
- client.go
- domain_events.go
- errors.go
- events.go
- feed.go
- feed_mode.go
- host_limit.go
- manager.go
- nzb_payload.go
- origin.go
- parse.go
- prowlarr.go
- prune.go
- rate_limit.go
- request_preview.go
- search_stream.go
- store.go
- torrent.go
- torrent_cache.go
- usage.go