plex

package
v2.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2026 License: GPL-2.0, GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package plex adapts the shared github.com/cplieger/plexapi client for the exporter. The transport — header-borne token, refuse-all redirects, same-origin path guard, CA pinning, transparent retry with Retry-After honoring, bounded reads — is the library's; this package owns the exporter's construction shape (env-derived CA path, retry counter metric) and re-exports the ErrNotFound sentinel the startup classifier and the Plex Pass graceful-degradation path key on.

Package plex provides the HTTP client used to talk to a Plex Media Server, including retry semantics and the ErrNotFound sentinel used by the Plex Pass graceful-degradation path; status-code classification uses the shared plexapi library's StatusError directly.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = plexapi.ErrNotFound

ErrNotFound is the library's 404 sentinel, re-exported so call sites and the Plex Pass graceful-degradation path keep reading plex.ErrNotFound. Status-code classification needs no re-export: callers match the library's plexapi.StatusError / plexapi.IsConfigError directly.

Functions

This section is empty.

Types

type Client

type Client struct {
	*plexapi.Client
	// contains filtered or unexported fields
}

Client is the exporter's Plex client: the library client plus the cumulative retry counter surfaced as plex_http_retries_total.

func NewClient

func NewClient(serverURL, token, caCertPath string) (*Client, error)

NewClient parses serverURL and returns a Client. When caCertPath is non-empty, the PEM file at that path is pinned as the sole TLS trust anchor (verification stays ON) — the recommended setup for a self-signed Plex. An empty caCertPath uses the OS trust store (right for *.plex.direct and plain http URLs).

func NewClientFromHTTP added in v2.0.30

func NewClientFromHTTP(serverURL, token string, hc *http.Client) (*Client, error)

NewClientFromHTTP builds a Client over a caller-supplied *http.Client — the test-fixture path (httptest servers). No retry transport or counter is installed; Retries() reports 0.

func (*Client) Retries

func (c *Client) Retries() int64

Retries returns the cumulative number of HTTP retry attempts across all requests on this client (the plex_http_retries_total metric).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL