Documentation
¶
Index ¶
Constants ¶
const ( CONCURRENT_REQUESTS_FOR_REUSABLE_CONNECTIONS_DEFAULT = 20 // CONCURRENT_REQUESTS_FOR_NON_REUSABLE_CONNECTIONS_DEFAULT is the default per-origin concurrency when range requests are not supported. CONCURRENT_REQUESTS_FOR_NON_REUSABLE_CONNECTIONS_DEFAULT = 5 // MAX_CONCURRENT_CONNECTIONS_GLOBAL_DEFAULT is the default global concurrency cap across origins. MAX_CONCURRENT_CONNECTIONS_GLOBAL_DEFAULT = 50 )
CONCURRENT_REQUESTS_FOR_REUSABLE_CONNECTIONS_DEFAULT is the default per-origin concurrency when range requests are supported.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetHTTPImageOptions ¶
type GetHTTPImageOptions struct {
// ConcurrentRequestsReusable is the per-origin limit when range requests are supported.
ConcurrentRequestsReusable int
// ConcurrentRequestsNonReusable is the per-origin limit when range requests are not supported.
ConcurrentRequestsNonReusable int
// MaxConcurrentConnections is the global limit across all origins.
MaxConcurrentConnections int
}
GetHTTPImageOptions controls concurrency behavior for HTTP image probing.
type GetHTTPImageResult ¶
type GetHTTPImageResult struct {
HTTPImageInfo
Error error `json:"error,omitempty"`
}
GetHTTPImageResult contains image metadata or an error for a given URL.
func GetHTTPImageDataWithOptions ¶
func GetHTTPImageDataWithOptions(ctx context.Context, urls []string, options GetHTTPImageOptions) []GetHTTPImageResult
GetHTTPImageDataWithOptions fetches basic image metadata for a list of URLs using custom options.
Errors:
- context.Canceled or context.DeadlineExceeded if the context ends.
- *url.Error from url.Parse or for invalid URLs.
- http.Client transport errors from http.Client.Do.
- io.ReadAll errors while reading the response body.
- *HTTPStatusError for non-200/206 responses.
- *RetryAfterError for 429/503 responses with parseable Retry-After.
- *InsufficientBytesError when there is not enough data to detect image info.
func GetHTTPImageInfo ¶
func GetHTTPImageInfo(ctx context.Context, urls []string) []GetHTTPImageResult
GetHTTPImageInfo fetches basic image metadata for a list of URLs using default options.
Errors:
- context.Canceled or context.DeadlineExceeded if the context ends.
- *url.Error from url.Parse or for invalid URLs.
- http.Client transport errors from http.Client.Do.
- io.ReadAll errors while reading the response body.
- *HTTPStatusError for non-200/206 responses.
- *RetryAfterError for 429/503 responses with parseable Retry-After.
- *InsufficientBytesError when there is not enough data to detect image info.
type HTTPImageInfo ¶
HTTPImageInfo holds the URL and detected image metadata.
type HTTPStatusError ¶ added in v0.1.1
func (*HTTPStatusError) Error ¶ added in v0.1.1
func (e *HTTPStatusError) Error() string
type Info ¶
type Info struct {
Type Type `json:"type"`
Width uint32 `json:"width"`
Height uint32 `json:"height"`
}
Info holds the type and dismissons of an image
type InsufficientBytesError ¶ added in v0.1.1
func (*InsufficientBytesError) Error ¶ added in v0.1.1
func (e *InsufficientBytesError) Error() string
func (*InsufficientBytesError) Unwrap ¶ added in v0.1.1
func (e *InsufficientBytesError) Unwrap() error
Let callers use errors.Is(err, io.ErrUnexpectedEOF).
type RetryAfterError ¶ added in v0.1.1
func (*RetryAfterError) Error ¶ added in v0.1.1
func (e *RetryAfterError) Error() string
type Type ¶
type Type uint64
Type represents the type of the image detected, or `Unknown`.
const ( // Unknown represents an unknown image type Unknown Type = iota // BMP represendts a BMP image BMP // BPM represendts a BPM image BPM // GIF represendts a GIF image GIF // JPEG represendts a JPEG image JPEG // MNG represendts a MNG image MNG // PBM represendts a PBM image PBM // PCX represendts a PCX image PCX // PGM represendts a PGM image PGM // PNG represendts a PNG image PNG // PPM represendts a PPM image PPM // PSD represendts a PSD image PSD // RAS represendts a RAS image RAS // RGB represendts a RGB image RGB // TIFF represendts a TIFF image TIFF // WEBP represendts a WEBP image WEBP // XBM represendts a XBM image XBM // XPM represendts a XPM image XPM // XV represendts a XV image XV // AVIF represendts a AVIF image AVIF )