Home / File/ transport.go — fiber Source File

transport.go — fiber Source File

Architecture documentation for transport.go, a go file in the fiber codebase. 1 imports, 0 dependents.

File go FiberClient Transport 1 imports 9 functions 3 classes

Entity Profile

Dependency Diagram

graph LR
  cfe2515b_ab6b_e576_a031_f986d4835acf["transport.go"]
  c0b86961_3ef1_0168_52fc_98627566ed27["bytes"]
  cfe2515b_ab6b_e576_a031_f986d4835acf --> c0b86961_3ef1_0168_52fc_98627566ed27
  style cfe2515b_ab6b_e576_a031_f986d4835acf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// Transport adapters unify fasthttp clients behind a shared interface so the
// Fiber client can coordinate behavior like redirects, TLS overrides, and
// dial customizations regardless of the underlying transport type.
package client

import (
	"bytes"
	"crypto/tls"
	"time"

	"github.com/valyala/fasthttp"
)

// defaultRedirectLimit mirrors fasthttp's default when callers supply a negative redirect cap.
const defaultRedirectLimit = 16

var (
	// Pre-allocated byte slice for http/https scheme comparison
	httpScheme  = []byte("http")
	httpsScheme = []byte("https")
)

// httpClientTransport unifies the operations exposed by the Fiber client across
// the fasthttp.Client, fasthttp.HostClient, and fasthttp.LBClient adapters so
// helper logic can treat the concrete transports uniformly.
type httpClientTransport interface {
	Do(req *fasthttp.Request, resp *fasthttp.Response) error
	DoTimeout(req *fasthttp.Request, resp *fasthttp.Response, timeout time.Duration) error
	DoDeadline(req *fasthttp.Request, resp *fasthttp.Response, deadline time.Time) error
	DoRedirects(req *fasthttp.Request, resp *fasthttp.Response, maxRedirects int) error
	CloseIdleConnections()
	TLSConfig() *tls.Config
	SetTLSConfig(config *tls.Config)
	SetDial(dial fasthttp.DialFunc)
	Client() any
	StreamResponseBody() bool
	SetStreamResponseBody(enable bool)
}

// standardClientTransport adapts fasthttp.Client to the httpClientTransport
// interface used by Fiber's client helpers.
type standardClientTransport struct {
	client *fasthttp.Client
}

func newStandardClientTransport(client *fasthttp.Client) *standardClientTransport {
	return &standardClientTransport{client: client}
}

func (s *standardClientTransport) Do(req *fasthttp.Request, resp *fasthttp.Response) error {
	return s.client.Do(req, resp)
}

func (s *standardClientTransport) DoTimeout(req *fasthttp.Request, resp *fasthttp.Response, timeout time.Duration) error {
	return s.client.DoTimeout(req, resp, timeout)
}

func (s *standardClientTransport) DoDeadline(req *fasthttp.Request, resp *fasthttp.Response, deadline time.Time) error {
	return s.client.DoDeadline(req, resp, deadline)
}
// ... (318 more lines)

Domain

Subdomains

Dependencies

  • bytes

Frequently Asked Questions

What does transport.go do?
transport.go is a source file in the fiber codebase, written in go. It belongs to the FiberClient domain, Transport subdomain.
What functions are defined in transport.go?
transport.go defines 9 function(s): composeRedirectURL, doRedirectsWithClient, extractTLSConfig, forEachHostClient, newHostClientTransport, newLBClientTransport, newStandardClientTransport, walkBalancingClient, walkBalancingClientWithBreak.
What does transport.go depend on?
transport.go imports 1 module(s): bytes.
Where is transport.go in the architecture?
transport.go is located at client/transport.go (domain: FiberClient, subdomain: Transport, directory: client).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free