17 lines
268 B
Go
17 lines
268 B
Go
package middleware
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"encoding/hex"
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
func newRequestID() string {
|
|
value := make([]byte, 16)
|
|
if _, err := rand.Read(value); err == nil {
|
|
return hex.EncodeToString(value)
|
|
}
|
|
return fmt.Sprintf("%d", time.Now().UnixNano())
|
|
}
|