Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ReqID ¶
type ReqID string
const RequestIDKey ReqID = "request_id"
func NewRequestID ¶
func NewRequestID() ReqID
NewRequestID creates and returns a 26-character base32 (RFC4648, no padding) string representing 128 bits composed of: - 48-bit big-endian timestamp (milliseconds since epoch) -> 6 bytes - 80-bit cryptographically secure random bytes -> 10 bytes
The resulting 16 bytes are base32-encoded without padding, producing 26 chars. This layout keeps IDs roughly sortable by creation time while maintaining strong randomness. If the crypto RNG fails, a time-seeded math/rand fallback is used to ensure an ID is still produced.
Click to show internal directories.
Click to hide internal directories.