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

12345678910111213141516171819202122232425262728293031
  1. package network
  2. import (
  3. "context"
  4. "errors"
  5. "net"
  6. "time"
  7. )
  8. const (
  9. DefaultTimeout = 10 * time.Second
  10. DefaultHTTPTimeout = 10 * time.Second
  11. DefaultBufferSize = 16 * 1024 // 16 kib
  12. ProxyDialerOpenThreshold = 5
  13. ProxyDialerHalfOpenTimeout = time.Minute
  14. ProxyDialerResetFailuresTimeout = 10 * time.Second
  15. DefaultDOHHostname = "9.9.9.9"
  16. DNSTimeout = 5 * time.Second
  17. )
  18. var (
  19. ErrCircuitBreakerOpened = errors.New("circuit breaker is opened")
  20. ErrCannotDialWithAllProxies = errors.New("cannot dial with all proxies")
  21. )
  22. type Dialer interface {
  23. Dial(network, address string) (net.Conn, error)
  24. DialContext(ctx context.Context, network, address string) (net.Conn, error)
  25. }