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
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

init.go 729B

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