proxy

package
v2.6.7 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 17 Imported by: 1 module, 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

Overview

Package proxy implements a storage proxy that provides presigned URL generation

Index

Constants

View Source
const (
	// DefaultPresignDuration is the default duration for presigned URLs
	DefaultPresignDurationMinutes = 15
	// SecretDivisor is used to split the secret into nonce and key components
	SecretDivisor = 2
)

Variables

View Source
var (
	// ErrMissingFileID indicates that the file ID is missing
	ErrMissingFileID = errors.New("missing file id")
	// ErrMissingObjectURI indicates that the file metadata is missing the object URI
	ErrMissingObjectURI = errors.New("file metadata missing object URI")
	// ErrInvalidSecretLength indicates that the secret must be 128 bytes when provided
	ErrInvalidSecretLength = errors.New("secret must be 128 bytes when provided")
	// ErrCallerRequired indicates that a caller is required in the context.
	ErrCallerRequired = errors.New("caller required in context")
)
View Source
var (
	// ErrTokenManagerRequired indicates proxy signing is impossible without a token manager.
	ErrTokenManagerRequired = errors.New("proxy presign requires token manager")
	// ErrEntClientRequired indicates storing secrets requires an ent client.
	ErrEntClientRequired = errors.New("storing secrets requires ent client")
)

Functions

func GenerateDownloadURL

func GenerateDownloadURL(ctx context.Context, file *storagetypes.File, duration time.Duration, cfg *storage.ProxyPresignConfig) (string, error)

GenerateDownloadURL builds a proxy download URL and persists the signing secret for validation.

func GenerateDownloadURLWithSecret

func GenerateDownloadURLWithSecret(file *storagetypes.File, secret []byte, duration time.Duration, cfg *storage.ProxyPresignConfig) (string, error)

GenerateDownloadURLWithSecret builds a proxy download URL using the provided secret for testing.

func ShouldBypassPresignInterceptor

func ShouldBypassPresignInterceptor(ctx context.Context) bool

ShouldBypassPresignInterceptor reports whether presign interceptors should be skipped.

func WithPresignInterceptorBypass

func WithPresignInterceptorBypass(ctx context.Context) context.Context

WithPresignInterceptorBypass marks the context so downstream Ent interceptors skip presign handling.

Types

This section is empty.

Jump to

Keyboard shortcuts

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