Highly-opinionated (ex-bullshit-free) MTPROTO proxy for Telegram. If you use v1.0 or upgrade broke you proxy, please read the chapter Version 2
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

init.go 472B

123456789101112131415161718192021222324252627282930
  1. package antireplay
  2. import (
  3. "sync"
  4. "github.com/9seconds/mtg/config"
  5. "github.com/VictoriaMetrics/fastcache"
  6. )
  7. type CacheInterface interface {
  8. AddObfuscated2([]byte)
  9. AddTLS([]byte)
  10. HasObfuscated2([]byte) bool
  11. HasTLS([]byte) bool
  12. }
  13. var (
  14. Cache CacheInterface
  15. initOnce sync.Once
  16. )
  17. func Init() {
  18. initOnce.Do(func() {
  19. if config.C.AntiReplayMaxSize == 0 {
  20. Cache = nilCache{}
  21. } else {
  22. Cache = cache{fastcache.New(config.C.AntiReplayMaxSize)}
  23. }
  24. })
  25. }