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 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package mtglib
  2. import (
  3. "context"
  4. "errors"
  5. "net"
  6. "net/http"
  7. "time"
  8. )
  9. var ErrSecretEmpty = errors.New("secret is empty")
  10. type Network interface {
  11. Dial(network, address string) (net.Conn, error)
  12. DialContext(ctx context.Context, network, address string) (net.Conn, error)
  13. MakeHTTPClient(func(ctx context.Context, network, address string) (net.Conn, error)) *http.Client
  14. IdleTimeout() time.Duration
  15. }
  16. type AntiReplayCache interface {
  17. SeenBefore(data []byte) bool
  18. Shutdown()
  19. }
  20. type IPBlocklist interface {
  21. Contains(net.IP) bool
  22. Shutdown()
  23. }
  24. type Event interface {
  25. ConnectionID() string
  26. }
  27. type EventStream interface {
  28. Send(context.Context, Event)
  29. Shutdown()
  30. }
  31. type Logger interface {
  32. Named(name string) Logger
  33. BindInt(name string, value int) Logger
  34. BindStr(name, value string) Logger
  35. Info(msg string)
  36. InfoError(msg string, err error)
  37. Warning(msg string)
  38. WarningError(msg string, err error)
  39. Debug(msg string)
  40. DebugError(msg string, err error)
  41. }