Help us shape the future of Go! Take the 2026 Go Developer Survey

httpsecurity

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package httpsecurity holds transport policies with no framework dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidRequestID

func ValidRequestID(id string) bool

ValidRequestID accepts bounded correlation identifiers, never arbitrary header text.

func ValidateTLSFiles

func ValidateTLSFiles(cert, key string) error

ValidateTLSFiles rejects a partially configured TLS identity. Both empty is allowed for a listener explicitly served behind a TLS-terminating proxy.

Types

type AccessLog

type AccessLog struct {
	Time      string `json:"time"`
	ID        string `json:"id"`
	Status    int    `json:"status"`
	Latency   string `json:"latency"`
	RemoteIP  string `json:"remote_ip"` //nolint:tagliatelle // preserved snake_case log keys for log ingestion compatibility
	Method    string `json:"method"`
	Host      string `json:"host"`
	Path      string `json:"path"`
	UserAgent string `json:"user_agent"` //nolint:tagliatelle // preserved snake_case log keys for log ingestion compatibility
	Failed    bool   `json:"failed"`
	BytesIn   int    `json:"bytes_in"`  //nolint:tagliatelle // preserved snake_case log keys for log ingestion compatibility
	BytesOut  int    `json:"bytes_out"` //nolint:tagliatelle // preserved snake_case log keys for log ingestion compatibility
}

AccessLog deliberately has no raw URL, query, headers, cookies, body or error message. Framework error strings can contain credentials and SQL arguments.

func (AccessLog) MarshalJSON

func (r AccessLog) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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