FILE / ScuroNeko/mtg

antireplay/init.go

Исходный файл и его история в репозитории.
FILE ac0b442b4322d183d2822aa409ecbc0c74971238
Files
mtg/antireplay/init.go
T
2020-08-10 14:39:50 +03:00

31 lines
472 B
Go

package antireplay
import (
"sync"
"github.com/9seconds/mtg/config"
"github.com/VictoriaMetrics/fastcache"
)
type CacheInterface interface {
AddObfuscated2([]byte)
AddTLS([]byte)
HasObfuscated2([]byte) bool
HasTLS([]byte) bool
}
var (
Cache CacheInterface
initOnce sync.Once
)
func Init() {
initOnce.Do(func() {
if config.C.AntiReplayMaxSize == 0 {
Cache = nilCache{}
} else {
Cache = cache{fastcache.New(config.C.AntiReplayMaxSize)}
}
})
}