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
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

init.go 552B

123456789101112131415161718192021222324252627282930313233
  1. package hub
  2. import (
  3. "context"
  4. "errors"
  5. "sync"
  6. "go.uber.org/zap"
  7. )
  8. var (
  9. Registry *registry
  10. Hub *hub
  11. ErrTimeout = errors.New("timeout")
  12. ErrClosed = errors.New("channel was closed")
  13. ErrCannotCreateConnection = errors.New("cannot create connection")
  14. initOnce sync.Once
  15. )
  16. func Init(ctx context.Context) {
  17. initOnce.Do(func() {
  18. Registry = &registry{
  19. conns: map[string]*ctxChannel{},
  20. ctx: ctx,
  21. }
  22. Hub = &hub{
  23. subs: map[string]*connectionHub{},
  24. logger: zap.S().Named("hub"),
  25. }
  26. })
  27. }