httptee

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneURL

func CloneURL(u *url.URL) *url.URL

CloneURL clones a URL.

func DuplicateRequest

func DuplicateRequest(request *http.Request) *http.Request

DuplicateRequest duplicate http req

func InsertForwardedHeaders

func InsertForwardedHeaders(request *http.Request)

InsertForwardedHeaders insert header X-Forwarded-For and Forwarded headers.

func MakeTransport

func MakeTransport(t time.Duration, closeConnections bool) *http.Transport

MakeTransport makes a new http.Transport.

func SetRequestTarget

func SetRequestTarget(request *http.Request, b Backend)

SetRequestTarget sets the req URL. this turns a inbound req (a req without URL) into an outbound req.

Types

type AlternativeReq

type AlternativeReq struct {
	Handler *Handler
	// contains filtered or unexported fields
}

AlternativeReq represents the alternative request.

func (AlternativeReq) Run

func (r AlternativeReq) Run() error

Run Do do the request.

type Backend

type Backend struct {
	Host string
	Addr *url.URL
}

Backend represents the backend server.

func (*Backend) ParseAddress

func (b *Backend) ParseAddress(addr string) (err error)

ParseAddress parses an address to https, host(ip:port)

type Handler

type Handler struct {
	Alternatives []Backend
	// contains filtered or unexported fields
}

Handler contains the address of the main PrimaryTarget and the one for the Host target

func CreateHandler

func CreateHandler(addrs string) (*Handler, error)

func (*Handler) Tee

func (h *Handler) Tee(req *http.Request)

Tee duplicates the incoming req (req) and does the req to the

type Pool

type Pool interface {
	Run(ctx context.Context, job Runnable) error
}

Pool means the pool that can be run by pooling workers.

func NewWorkerPool

func NewWorkerPool(maxWorkers int) Pool

NewWorkerPool creates a limited pool of permissions in order to limit the number of concurrent jobs.

type Runnable

type Runnable interface {
	Run() error
}

Runnable means anythings that can be run.

type WorkerPool

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

WorkerPool carries a pool to deliver job.

func (WorkerPool) Run

func (p WorkerPool) Run(ctx context.Context, job Runnable) error

Run runs the job by the worker.

Jump to

Keyboard shortcuts

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