Help us shape the future of Go! Take the 2026 Go Developer Survey

s3api

package
v0.0.0-...-9842166 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminOpt

type AdminOpt func(s *S3AdminServer)

func WithAdminCORSAllowOrigin

func WithAdminCORSAllowOrigin(origin string) AdminOpt

WithAdminCORSAllowOrigin sets the default CORS Access-Control-Allow-Origin value for the standalone admin server.

func WithAdminConcurrencyLimiter

func WithAdminConcurrencyLimiter(maxConnections, maxRequests int) AdminOpt

WithAdminConcurrencyLimiter sets the admin standalone server's maximum connection limit and the hard limit for in-flight requests.

func WithAdminDebug

func WithAdminDebug() AdminOpt

WithAdminDebug enables the debug logging

func WithAdminQuiet

func WithAdminQuiet() AdminOpt

WithQuiet silences default logging output

func WithAdminRootUser

func WithAdminRootUser(root middlewares.RootUserConfig) AdminOpt

WithAdminRootUser enables the built-in root account on the admin server (see WithRootUser).

func WithAdminSocketPerm

func WithAdminSocketPerm(perm os.FileMode) AdminOpt

WithAdminSocketPerm sets the file-mode permissions applied to file-backed UNIX domain sockets after binding. It has no effect on TCP/IP or abstract namespace sockets.

func WithAdminSrvTLS

func WithAdminSrvTLS(cs *utils.CertStorage) AdminOpt

type Option

type Option func(*S3ApiServer)

Option sets various options for New()

func WithAdminServer

func WithAdminServer() Option

WithAdminServer runs admin endpoints with the gateway in the same network

func WithCORSAllowOrigin

func WithCORSAllowOrigin(origin string) Option

WithCORSAllowOrigin sets the default CORS Access-Control-Allow-Origin value. This is applied when no bucket CORS configuration exists, and for admin APIs.

func WithCompleteMultipartKeepalive

func WithCompleteMultipartKeepalive(interval time.Duration) Option

WithCompleteMultipartKeepalive keeps a slow CompleteMultipartUpload's connection alive, as S3 does: the response commits to 200 OK and sends a newline every interval until the result, or an <Error> document in its place, ends the body. It commits when the backend reports the response headers (backend.CompleteMultipartUploadReporter), with x-amz-version-id and x-amz-server-side-encryption, or for any other backend once the completion has run for interval, without them. A completion that finishes before the commit is answered as usual. Either way, the completion keeps its slot under the request limit until it finishes. Zero or negative leaves the keepalive off.

func WithConcurrencyLimiter

func WithConcurrencyLimiter(maxConnections, maxRequests int) Option

WithConcurrencyLimiter sets the server's maximum connection limit and the hard limit for in-flight requests.

func WithDisableACL

func WithDisableACL() Option

WithDisableACL disables the s3 api server ACLs, by ignoring all bucket/object ACL headers

func WithDisableObjNameTraversalCheck

func WithDisableObjNameTraversalCheck() Option

WithDisableObjNameTraversalCheck disables the path-traversal rejection in object-name validation. Backends that store keys opaquely (not as filesystem paths) set this so keys like "../file.txt" are accepted and stored literally, matching AWS. The empty/"."/".."/"/" and control-character rejections stay on.

func WithHealth

func WithHealth(health string) Option

WithHealth sets up a GET health endpoint

func WithHostStyle

func WithHostStyle(virtualDomain string) Option

WithHostStyle enabled host-style bucket addressing on the server

func WithKeepAlive

func WithKeepAlive() Option

WithKeepAlive enables the server keep alive

func WithMiddleware

func WithMiddleware(prefix string, handler fiber.Handler) Option

WithMiddleware mounts a Fiber middleware after the gateway rate limiter and before the S3 route table is registered. The middleware must call ctx.Next() for requests it does not fully handle.

func WithMpMaxParts

func WithMpMaxParts(n int) Option

WithMpMaxParts sets the maximum number of parts allowed in a multipart upload.

func WithOnListen

func WithOnListen(fn func()) Option

WithOnListen registers a callback that is invoked once the server is bound and ready to accept requests. It is called from the fiber OnListen hook, which fires immediately before the server begins serving the first connection. Use this instead of a fixed sleep to detect readiness reliably.

func WithQuiet

func WithQuiet() Option

WithQuiet silences default logging output

func WithReadOnly

func WithReadOnly() Option

func WithRootUser

func WithRootUser(root middlewares.RootUserConfig) Option

WithRootUser enables the built-in root account: an access key the auth middlewares resolve ahead of the IAM service, with the admin role and every ACL / policy check skipped. A config missing either credential is ignored. Without a root account the gateway resolves every access key through iam (see middlewares.RootUserConfig for the ownership consequences).

func WithRoute

func WithRoute(method, path string, handlers ...fiber.Handler) Option

WithRoute registers a top-level Fiber route after the gateway rate limiter and before S3 routes are registered. Handlers are terminal unless they explicitly call ctx.Next().

func WithSocketPerm

func WithSocketPerm(perm os.FileMode) Option

WithSocketPerm sets the file-mode permissions applied to file-backed UNIX domain sockets after binding. It has no effect on TCP/IP or abstract namespace sockets.

func WithTLS

func WithTLS(cs *utils.CertStorage) Option

WithTLS sets TLS Credentials

func WithWebUI

func WithWebUI(prefix string, cfg *webui.ServerConfig) Option

WithWebUI mounts the WebUI on the S3 server's Fiber app at the given path prefix, before S3 routes are registered. The prefix must start with "/" and must not be empty or just "/".

type S3AdminRouter

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

func (*S3AdminRouter) Init

func (ar *S3AdminRouter) Init(app *fiber.App, be backend.Backend, iam auth.IAMService, logger s3log.AuditLogger, root middlewares.RootUserConfig, region string, debug bool, corsAllowOrigin string)

type S3AdminServer

type S3AdminServer struct {
	CertStorage *utils.CertStorage
	// contains filtered or unexported fields
}

func NewAdminServer

func NewAdminServer(be backend.Backend, region string, iam auth.IAMService, l s3log.AuditLogger, ctrl controllers.S3ApiController, opts ...AdminOpt) *S3AdminServer

NewAdminServer constructs the admin API server. The root account is disabled unless WithAdminRootUser is passed.

func (*S3AdminServer) ServeMultiPort

func (sa *S3AdminServer) ServeMultiPort(ports []string) error

ServeMultiPort creates listeners for multiple port specifications and serves on all of them simultaneously. This supports listening on multiple ports and/or addresses (e.g., [":8080", "localhost:8081"]).

func (S3AdminServer) Shutdown

func (sa S3AdminServer) Shutdown() error

ShutDown gracefully shuts down the server with a context timeout

type S3ApiRouter

type S3ApiRouter struct {
	WithAdmSrv bool

	Ctrl controllers.S3ApiController
	// contains filtered or unexported fields
}

func (*S3ApiRouter) Init

func (sa *S3ApiRouter) Init()

type S3ApiServer

type S3ApiServer struct {
	Router *S3ApiRouter

	CertStorage *utils.CertStorage
	// contains filtered or unexported fields
}

func New

func New(
	be backend.Backend,
	region string,
	iam auth.IAMService,
	l s3log.AuditLogger,
	adminLogger s3log.AuditLogger,
	evs s3event.S3EventSender,
	mm metrics.Manager,
	opts ...Option,
) (*S3ApiServer, error)

New constructs the S3 API server. The gateway runs without a root account unless WithRootUser is passed: every non-empty access key then resolves through iam, and an empty access key is rejected before any lookup.

func (*S3ApiServer) ServeMultiPort

func (sa *S3ApiServer) ServeMultiPort(ports []string) error

ServeMultiPort creates listeners for multiple port specifications and serves on all of them simultaneously. This supports listening on multiple ports and/or addresses (e.g., [":7070", "localhost:8080", "0.0.0.0:9090"]).

func (*S3ApiServer) ShutDown

func (sa *S3ApiServer) ShutDown() error

ShutDown gracefully shuts down the server with a context timeout

Directories

Path Synopsis
code modified from golang std library src/internal/filepathlite/path.go to support path separator '/' for all platforms.
code modified from golang std library src/internal/filepathlite/path.go to support path separator '/' for all platforms.

Jump to

Keyboard shortcuts

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