httpproxy

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 16 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 GzipMiddleware

func GzipMiddleware(next http.Handler) http.Handler

GzipMiddleware compresses HTTP responses and decompresses requests.

It handles both request decompression (Content-Encoding: gzip) and response compression (Accept-Encoding: gzip).

Requests without compression are handled normally for backward compatibility.

Types

type BackendRegistry

type BackendRegistry interface {
	GetBackend(service string) (proxy.Backend, func(), bool)
	HasBackend(service string) bool
}

BackendRegistry is the subset of backend lookup API required by the HTTP proxy.

GetBackend leases the returned backend: the caller must call the release function exactly once when it is done using the backend, or the connection may be kept open past the point it should have closed. HasBackend performs the same lookup without leasing, so a handler can reject an unregistered service before it pays for reading the request body.

type Option

type Option func(*handlerOptions)

Option configures the HTTPHandler constructor.

func WithLog

func WithLog(log *zap.Logger) Option

WithLog sets the logger for the HTTP handler.

type TransparentWebGRPCProxy

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

TransparentWebGRPCProxy is an HTTP handler that translates HTTP requests with binary protobuf payloads to gRPC calls.

func NewHTTPHandler

func NewHTTPHandler(registry BackendRegistry, options ...Option) *TransparentWebGRPCProxy

NewHTTPHandler creates a new HTTPHandler.

func (*TransparentWebGRPCProxy) ServeHTTP

ServeHTTP handles HTTP requests.

Jump to

Keyboard shortcuts

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