mirror of
https://github.com/cbeuw/Cloak.git
synced 2024-11-11 13:11:03 +00:00
25 lines
325 B
Go
25 lines
325 B
Go
package common
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"io"
|
|
"time"
|
|
)
|
|
|
|
var RealWorldState = WorldState{
|
|
Rand: rand.Reader,
|
|
Now: time.Now,
|
|
}
|
|
|
|
type WorldState struct {
|
|
Rand io.Reader
|
|
Now func() time.Time
|
|
}
|
|
|
|
func WorldOfTime(t time.Time) WorldState {
|
|
return WorldState{
|
|
Rand: rand.Reader,
|
|
Now: func() time.Time { return t },
|
|
}
|
|
}
|