requestid

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package requestid mints and checks the correlation ID a request carries.

None of it touches a request. Both middleware chains read the header on their own transport and hand the string here, so the rule for what may be echoed back is one rule rather than two — which matters more than it sounds, because the rule is a security check: an ID arrives from the client and leaves in a response header, and a second copy of the check would be a second chance to get the escaping wrong.

Index

Constants

View Source
const DefaultHeader = "X-Request-ID"

DefaultHeader carries the correlation ID in both directions.

Variables

This section is empty.

Functions

func Random

func Random() string

Random builds an ID from 16 cryptographically random bytes.

func Sequential

func Sequential() string

Sequential builds an ID from the clock and a process counter.

func Valid

func Valid(value string) bool

Valid reports whether a client-supplied ID is safe to echo back.

The bound and the character range are the check: anything outside printable ASCII could terminate the header or inject another one, and an unbounded value would let a client choose how much of every log line is theirs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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