feat: use random request IDs instead of sequential counter

Replace the atomic counter-based request ID generation with random
int64 values using math/rand/v2. This improves unpredictability and
avoids potential ID collisions across client instances or restarts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Oliver Jakoubek 2026-01-27 10:21:14 +01:00
commit f8daa20ddd
9 changed files with 402 additions and 26 deletions

View file

@ -12,6 +12,9 @@ var (
// ErrTimeout indicates a request timed out.
ErrTimeout = errors.New("request timed out")
// ErrTooManyRedirects indicates the server returned too many redirects.
ErrTooManyRedirects = errors.New("too many redirects")
)
// Authentication errors