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
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

init.go 497B

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