Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles the /proxy/* media proxy endpoint.
func NewHandler ¶
func NewHandler(service MediaProxy, cfg *config.Config) *Handler
NewHandler creates a new proxy Handler.
type MediaProxy ¶
type MediaProxy interface {
Authorize(ctx context.Context, rawURL, sig string) error
Fetch(ctx context.Context, rawURL string, mode mediaproxy.ProxyMode, out mediaproxy.OutputFormat, animated bool) (*mediaproxy.ProxyResult, error)
}
MediaProxy is the subset of *mediaproxy.Service this handler needs.
**インターフェースにしてあるのは、失敗の分岐をテストから決定的に踏むため (#3032)。** 過負荷や not-found を実サービスで再現しようとすると、枠を 埋める側と観測する側の競争になって flaky になる。handler の責務は 「error を wire の形に写す」ことなので、そこだけを見る。