http

package
v0.0.0-...-1d6e856 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package http provides a HTTP transport and some utitities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClientIP

func GetClientIP(r *http.Request) net.IP

GetClientIP returns client ip from following sources, in this order: X-Real-Ip, X-Forwarded-For (first ip in an eventual list), r.RemoteAddr. Note: we assume these headers come from a trusted proxy, as client can also set them to any arbitrary value which may lead to ip spoofing.

func GetRequestBody

func GetRequestBody(w http.ResponseWriter, r *http.Request, maxBodyBytes ...int64) io.Reader

GetRequestBody MaxBytesReader prevents clients from accidentally or maliciously sending a large request and wasting server resources.

func Health

func Health(probe *xtransport.Probe) http.HandlerFunc

Health can be registered as health probe endpoint.

func NewHTTPTransport

func NewHTTPTransport(
	httpSrv *http.Server,
	logger xlog.Logger,
	probe *xtransport.Probe,
) xtransport.Transport

NewHTTPTransport instantiates a new HTTP transport.

Types

This section is empty.

Directories

Path Synopsis
Package client provides http client contract and utitlities.
Package client provides http client contract and utitlities.
Package middleware provides HTTP handler useful decorators.
Package middleware provides HTTP handler useful decorators.

Jump to

Keyboard shortcuts

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