adaptor.go — fiber Source File
Architecture documentation for adaptor.go, a go file in the fiber codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 69780622_2588_e0fa_ab5a_13dcfd3559e7["adaptor.go"] cc7104af_aece_1fe5_3985_791c7f34910c["context"] 69780622_2588_e0fa_ab5a_13dcfd3559e7 --> cc7104af_aece_1fe5_3985_791c7f34910c style 69780622_2588_e0fa_ab5a_13dcfd3559e7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
package adaptor
import (
"context"
"errors"
"fmt"
"io"
"net"
"net/http"
"reflect"
"sync"
"unsafe"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/utils/v2"
"github.com/valyala/fasthttp"
"github.com/valyala/fasthttp/fasthttpadaptor"
)
// disableLogger implements the fasthttp Logger interface and discards log output.
type disableLogger struct{}
// Printf implements the fasthttp Logger interface and discards log output.
func (*disableLogger) Printf(string, ...any) {
}
var ctxPool = sync.Pool{
New: func() any {
return new(fasthttp.RequestCtx)
},
}
// LocalContextKey is the key used to store the user's context.Context in the fasthttp request context.
// Adapted http.Handler functions can retrieve this context using r.Context().Value(adaptor.LocalContextKey)
var localContextKey = &struct{}{}
const bufferSize = 32 * 1024
var bufferPool = sync.Pool{
New: func() any {
return new([bufferSize]byte)
},
}
var (
ErrRemoteAddrEmpty = errors.New("remote address cannot be empty")
ErrRemoteAddrTooLong = errors.New("remote address too long")
)
// HTTPHandlerFunc wraps net/http handler func to fiber handler
func HTTPHandlerFunc(h http.HandlerFunc) fiber.Handler {
return HTTPHandler(h)
}
// HTTPHandler wraps net/http handler to fiber handler
func HTTPHandler(h http.Handler) fiber.Handler {
handler := fasthttpadaptor.NewFastHTTPHandler(h)
return func(c fiber.Ctx) error {
handler(c.RequestCtx())
return nil
// ... (271 more lines)
Domain
Subdomains
Functions
Types
Dependencies
- context
Source
Frequently Asked Questions
What does adaptor.go do?
adaptor.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Adapters subdomain.
What functions are defined in adaptor.go?
adaptor.go defines 13 function(s): ConvertRequest, CopyContextToFiberContext, FiberApp, FiberHandler, FiberHandlerFunc, HTTPHandler, HTTPHandlerFunc, HTTPHandlerWithContext, HTTPMiddleware, LocalContextFromHTTPRequest, and 3 more.
What does adaptor.go depend on?
adaptor.go imports 1 module(s): context.
Where is adaptor.go in the architecture?
adaptor.go is located at middleware/adaptor/adaptor.go (domain: FiberCore, subdomain: Adapters, directory: middleware/adaptor).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free