MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / GenerateRequestID

Function GenerateRequestID

internal/logging/requestid.go:18–24  ·  view source on GitHub ↗

GenerateRequestID creates a new 8-character hex request ID.

()

Source from the content-addressed store, hash-verified

16
17// GenerateRequestID creates a new 8-character hex request ID.
18func GenerateRequestID() string {
19 b := make([]byte, 4)
20 if _, err := rand.Read(b); err != nil {
21 return "00000000"
22 }
23 return hex.EncodeToString(b)
24}
25
26// WithRequestID returns a new context with the request ID attached.
27func WithRequestID(ctx context.Context, requestID string) context.Context {

Callers 1

GinLogrusLoggerFunction · 0.85

Calls 1

ReadMethod · 0.45

Tested by

no test coverage detected