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 771B

123456789101112131415161718192021222324252627282930313233343536
  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. }
  19. type Logger interface {
  20. Named(name string) Logger
  21. BindInt(name string, value int) Logger
  22. BindStr(name, value string) Logger
  23. Info(msg string)
  24. InfoError(msg string, err error)
  25. Warning(msg string)
  26. WarningError(msg string, err error)
  27. Debug(msg string)
  28. DebugError(msg string, err error)
  29. }