v1.65.0 Latest Latest

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

Go to latest
Published: Oct 24, 2023 License: AGPL-3.0 Imports: 34 Imported by: 0




This section is empty.


View Source
var ParseV2FromHeaderError = errs.Class("header")

ParseV2FromHeaderError is the default error class for V2 parsing header errors.

View Source
var ParseV2FromMPartError = errs.Class("V2 multipart form")

ParseV2FromMPartError is the default error class for V2 parsing multipart form errors.

View Source
var ParseV2FromQueryError = errs.Class("query")

ParseV2FromQueryError is the default error class for V2 parsing query errors.

View Source
var ParseV4CredentialError = errs.Class("credential")

ParseV4CredentialError is the default error class for V4 parsing credential errors.

View Source
var ParseV4FromHeaderError = errs.Class("header")

ParseV4FromHeaderError is the default error class for V4 parsing header errors.

View Source
var ParseV4FromMPartError = errs.Class("V4 multipart form")

ParseV4FromMPartError is the default error class for V4 parsing multipart form errors.

View Source
var ParseV4FromQueryError = errs.Class("query")

ParseV4FromQueryError is the default error class for V4 parsing query errors.


func AccessKey added in v1.15.0

func AccessKey(authClient *authclient.AuthClient, trustedIPs trustedip.List, log *zap.Logger) mux.MiddlewareFunc

AccessKey implements mux.Middlware and saves the accesskey to context.

func CollectEvent added in v1.41.0

func CollectEvent(h http.Handler) http.Handler

CollectEvent collects event data to send to eventkit.

func GetAccessKeyID added in v1.15.0

func GetAccessKeyID(r *http.Request) (string, error)

GetAccessKeyID returns the access key ID from the request and a signature validator.

func LogRequests added in v1.38.0

func LogRequests(log *zap.Logger, h http.Handler, insecureLogPaths bool) http.Handler

LogRequests logs requests.

func LogResponses added in v1.38.0

func LogResponses(log *zap.Logger, h http.Handler, insecureLogAll bool) http.Handler

LogResponses logs responses.

func Metrics

func Metrics(prefix string, next http.Handler) http.Handler

Metrics sends a bunch of useful metrics using monkit: - response time - time to write header - bytes written partitioned by method, status code, API.

It also sends unmapped errors (in the case of Gateway-MT) through eventkit.

TODO(artur): calculate approximate request size.

func MonitorMinioGlobalHandler added in v1.46.0

func MonitorMinioGlobalHandler(i int, f mux.MiddlewareFunc) mux.MiddlewareFunc

MonitorMinioGlobalHandler adds monkit metrics atop minio middlewares.

func NewLogRequests added in v1.38.0

func NewLogRequests(log *zap.Logger, insecureLogPaths bool) mux.MiddlewareFunc

NewLogRequests is a convenience wrapper around LogRequests that returns LogRequests as mux.MiddlewareFunc.

func NewLogResponses added in v1.38.0

func NewLogResponses(log *zap.Logger, insecureLogPaths bool) mux.MiddlewareFunc

NewLogResponses is a convenience wrapper around LogResponses that returns LogResponses as mux.MiddlewareFunc.

func NewMetrics added in v1.24.0

func NewMetrics(prefix string) mux.MiddlewareFunc

NewMetrics is a convenience wrapper around Metrics that returns Metrics with prefix as mux.MiddlewareFunc.

func ParseFromForm added in v1.38.0

func ParseFromForm(r *http.Request) (string, error)

ParseFromForm parses V2 or V4 credentials from multipart form credentials.

func SetInMemory

func SetInMemory(next http.Handler) http.Handler

SetInMemory sets appropriate context value for every request with information for uplink to perform in-memory segment encoding while uploading a file.


type BodyCache added in v1.15.0

type BodyCache struct {
	// contains filtered or unexported fields

BodyCache wraps a ReadCloser to allow seeking the first N bytes.

func NewBodyCache added in v1.15.0

func NewBodyCache(stream io.ReadCloser, bufferSize int64) (*BodyCache, error)

NewBodyCache return a ReadCloser than can Seek the first bufferSize bytes.

func (*BodyCache) Close added in v1.15.0

func (r *BodyCache) Close() error

Close closes the underlying stream.

func (*BodyCache) Read added in v1.15.0

func (r *BodyCache) Read(b []byte) (n int, err error)

Read implements the io.Reader interface.

func (*BodyCache) Seek added in v1.15.0

func (r *BodyCache) Seek(offset int64, whence int) (int64, error)

Seek implements the io.Seeker interface.

type Credentials added in v1.15.0

type Credentials struct {
	AccessKey string
	Error error

Credentials contains an AccessKey, SecretKey, AccessGrant, and IsPublic flag.

func GetAccess added in v1.15.0

func GetAccess(ctx context.Context) *Credentials

GetAccess returns the credentials.

type Limiter added in v1.22.0

type Limiter struct {
	// contains filtered or unexported fields

Limiter imposes a limit per key.

func NewLimiter added in v1.22.0

func NewLimiter(allowed uint, keyFunc func(*http.Request) (string, error), limitFunc func(w http.ResponseWriter, r *http.Request)) *Limiter

NewLimiter constructs a concurrency Limiter. Error and Limit functions are user defined in part because referencing the "minio" package here would cause an import loop.

func NewMacaroonLimiter added in v1.22.0

func NewMacaroonLimiter(allowed uint, limitFunc func(w http.ResponseWriter, r *http.Request)) *Limiter

NewMacaroonLimiter constructs a Limiter that limits based on macaroon credentials. It relies on the AccessKey middleware being run to append credentials to the request context.

func (*Limiter) Limit added in v1.22.0

func (l *Limiter) Limit(next http.Handler) http.Handler

Limit applies per-key request concurrency limiting as an HTTP middleware.

type V2 added in v1.15.0

type V2 struct {
	AccessKeyID string
	Signature   string
	Expires     time.Time

	FromHeader bool

V2 represents S3 V2 all security related data.

func ParseV2FromFormValues added in v1.15.0

func ParseV2FromFormValues(formValues http.Header) (_ *V2, err error)

ParseV2FromFormValues parses a V2 signature from the multipart form parameters.

func ParseV2FromHeader added in v1.15.0

func ParseV2FromHeader(r *http.Request) (_ *V2, err error)

ParseV2FromHeader parses a V2 signature from the request headers.

func ParseV2FromQuery added in v1.15.0

func ParseV2FromQuery(r *http.Request) (_ *V2, err error)

ParseV2FromQuery parses a V2 signature from the query parameters.

type V4 added in v1.15.0

type V4 struct {
	Credential    *V4Credential
	SignedHeaders []string
	Signature     string

	ContentSHA256 string
	Date          time.Time

	FromHeader bool

V4 represents S3 V4 all security related data.

func ParseV4FromFormValues added in v1.15.0

func ParseV4FromFormValues(formValues http.Header) (_ *V4, err error)

ParseV4FromFormValues parses a V4 signature from the multipart form parameters.

func ParseV4FromHeader added in v1.15.0

func ParseV4FromHeader(r *http.Request) (_ *V4, err error)

ParseV4FromHeader parses a V4 signature from the request headers.

func ParseV4FromQuery added in v1.15.0

func ParseV4FromQuery(r *http.Request) (_ *V4, err error)

ParseV4FromQuery parses a V4 signature from the query parameters.

type V4Credential added in v1.15.0

type V4Credential struct {
	AccessKeyID string
	Date        time.Time
	Region      string
	Service     string

V4Credential represents S3 V4 protocol credentials.

func ParseV4Credential added in v1.15.0

func ParseV4Credential(data string) (*V4Credential, error)

ParseV4Credential parses the credential into it's parts.

Jump to

Keyboard shortcuts

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