mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 17:04:39 +03:00
mox!
This commit is contained in:
17
mox-/cid.go
Normal file
17
mox-/cid.go
Normal file
@ -0,0 +1,17 @@
|
||||
package mox
|
||||
|
||||
import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
)
|
||||
|
||||
var cid atomic.Int64
|
||||
|
||||
func init() {
|
||||
cid.Store(time.Now().UnixMilli())
|
||||
}
|
||||
|
||||
// Cid returns a new unique id to be used for connections/sessions/requests.
|
||||
func Cid() int64 {
|
||||
return cid.Add(1)
|
||||
}
|
Reference in New Issue
Block a user