http

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClientIP added in v0.3.0

func GetClientIP(r *http.Request) string

GetClientIP returns the client's IP address from the request.

By default, it trusts proxy headers and reads the client IP from the x-forwarded-for header (or the header named by AIKIDO_CLIENT_IP_HEADER). It returns the first valid non-private IP found in that header, falling back to the TCP remote address if none is found.

Set AIKIDO_TRUST_PROXY=false to disable proxy header trust entirely and always use the raw TCP remote address instead.

func OnPostRequest

func OnPostRequest(ctx context.Context, statusCode int)

OnPostRequest gets called after a response is ready to be sent out.

func TryExtractBody

func TryExtractBody(req *http.Request, parser MultipartFormParser) any

TryExtractBody attempts to extract body data from a request, trying JSON first, then forms

Types

type MultipartFormParser

type MultipartFormParser interface {
	MultipartForm() (*multipart.Form, error)
}

MultipartFormParser defines the interface for extracting multipart form data

type Response

type Response struct {
	StatusCode int
	Message    string
}

func OnInitRequest

func OnInitRequest(ctx context.Context) *Response

Jump to

Keyboard shortcuts

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