network

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: AGPL-3.0 Imports: 12 Imported by: ? 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

View Source
const BrowserUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15"

BrowserUserAgent is used for media endpoints that expect a browser request.

Variables

This section is empty.

Functions

func Fetch

func Fetch(url string) ([]byte, error)

Fetch downloads a public media resource.

func FetchContext

func FetchContext(ctx context.Context, url string) ([]byte, error)

FetchContext downloads a public media resource for the lifetime of ctx.

func SizedArtworkURL

func SizedArtworkURL(pic string, n int) string

SizedArtworkURL keeps the cache and request format of the original artwork references. Plugin references carry their rendering size in the size query.

func Transport

func Transport() *http.Transport

Transport keeps Go's HTTP implementation while honoring the desktop user's configured proxy. Explicit environment proxy settings retain precedence.

Types

type MediaEndpoint

type MediaEndpoint struct {
	URL    string
	Header http.Header
}

MediaEndpoint holds the address and request headers for the same audio.

type MediaRenew

type MediaRenew func(context.Context, MediaEndpoint) (MediaEndpoint, error)

type MediaSource

type MediaSource struct {
	// contains filtered or unexported fields
}

MediaSource keeps refreshed credentials local to one playback resource.

func NewMediaSource

func NewMediaSource(rawURL string, header func() http.Header, renew MediaRenew, userAgent string) *MediaSource

func (*MediaSource) Open

func (s *MediaSource) Open(ctx context.Context, client *http.Client, method string, options http.Header) (*http.Response, error)

Open retries an unauthorized request once before returning any audio. The caller's Range and other explicit request options are used on both requests.

Jump to

Keyboard shortcuts

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