minio/minio
http and net
The HTTP server, transport defaults, and helpers that sit between the Go standard library and cmd/.
internal/http
The customised HTTP server MinIO listens on. Highlights:
Serverwrapsnet/http.Serverwith sensible idle/read/write timeouts (DefaultIdleTimeout,DefaultReadHeaderTimeout).- Connection-level rate limiting (
MINIO_API_REQUESTS_MAXandMINIO_API_REQUESTS_DEADLINE). - Request-size enforcement before bodies hit the application.
- Custom
Listenerthat supports SO_REUSEPORT-style multi-listener mode. NewHTTPClientreturns a transport tuned for inter-cluster traffic (large connection pools, custom DNS cache).
Used by cmd/server-main.go for the public HTTP listener and by internal/rest for the per-peer client.
internal/handlers
Shared HTTP middleware used by the API router: RealIP, RequestID, OPTIONS handling, body-size limits. They are simple enough to be reusable across routers.
internal/mcontext
A wrapper around context.Context that carries request-scoped metadata across middleware boundaries: request ID, trace flags, host, user agent. Most handlers read this context to log structured data.
internal/net
Small helpers that don't fit in internal/http:
- IPv4/IPv6 helpers for endpoint parsing.
- Reverse-DNS lookups guarded by a cache.
internal/deadlineconn
A net.Conn wrapper that enforces both a read and a write deadline that resets on activity. Used to bound how long an erasure-write can stall on a slow peer.
internal/ioutil
I/O helpers used by drives and replication:
LimitedReaderwith size-aware errors.Copywith cancellation context.WriteOnCloserpatterns for atomic writes.- Aligned reads/writes for DirectIO drives (when supported by
internal/disk).
internal/handlers and request lifecycle
The router (cmd/api-router.go) chains generic middleware → auth → handler. The middleware in internal/handlers/ is the boring-but-essential layer that makes the chain consistent across S3, admin, KMS, and STS routes.
Integration points
cmd/server-main.goconstructs theinternal/http.Server.internal/restandcmd/storage-rest-client.gouseinternal/http.NewHTTPClient.- Most packages don't depend on
internal/httpdirectly; they go throughcmd/orinternal/rest.
Entry points for modification
- Tune defaults.
internal/http/const.go-style constants are read by the server bootstrap. - New middleware. Add it to
internal/handlers/and wire fromcmd/routers.go. - New transport behaviour. Don't reach for
net/http.Transportdirectly; extendNewHTTPClientso the change applies cluster-wide.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.