mirror of
https://github.com/mjl-/mox.git
synced 2024-12-27 08:53:48 +03:00
18 lines
239 B
Go
18 lines
239 B
Go
|
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)
|
||
|
}
|