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

12345678910111213141516171819202122232425262728293031
  1. package network
  2. import (
  3. "context"
  4. "errors"
  5. "net"
  6. "time"
  7. )
  8. const (
  9. DefaultTimeout = 10 * time.Second
  10. DefaultDNSTimeout = time.Second
  11. DefaultHTTPTimeout = DefaultTimeout
  12. DefaultBufferSize = 4096
  13. ProxyDialerOpenThreshold = 5
  14. ProxyDialerHalfOpenTimeout = time.Minute
  15. ProxyDialerResetFailuresTimeout = 10 * time.Second
  16. DefaultDOHHostname = "9.9.9.9"
  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. }