proxy

package
v0.0.0-...-9914b64 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

func (*Handler) Handle

func (h *Handler) Handle(c *echo.Context) error

Handle processes GET /proxy/* requests.

URL extraction:

  • Query param ?url=X takes priority
  • Otherwise, path after /proxy/ is treated as the URL (prefixed with "https://")

Query params: emoji, avatar, static, preview, badge, origin, fallback, sig

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 の形に写す」ことなので、そこだけを見る。

Jump to

Keyboard shortcuts

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