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
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

init.go 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Network contains a default implementation of the network.
  2. //
  3. // Please see [mtglib.Network] interface to get some basic idea behind this
  4. // abstraction.
  5. //
  6. // This implementation is more simple that v1 because life shows that all
  7. // this complexity, especially around circuit breakers and DoH is not really
  8. // required. There is no chance that if DNS address is spoofed, that real
  9. // IP would work as expected.
  10. package network
  11. import (
  12. "errors"
  13. "time"
  14. )
  15. const (
  16. // DefaultTimeout is a default timeout for establishing TCP connection.
  17. DefaultTimeout = 10 * time.Second
  18. // DefaultHTTPTimeout defines a default timeout for making HTTP request.
  19. DefaultHTTPTimeout = 10 * time.Second
  20. // DefaultIdleTimeout defines a timeout for idle HTTP connections
  21. DefaultIdleTimeout = time.Minute
  22. // DefaultTCPKeepAlivePeriod defines a time period between 2 consecuitive
  23. // probes.
  24. DefaultTCPKeepAlivePeriod = 10 * time.Second
  25. // User Agent to use in HTTP client.
  26. UserAgent = "curl/8.5.0"
  27. // tcpLingerTimeout defines a number of seconds to wait for sending
  28. // unacknowledged data.
  29. tcpLingerTimeout = 1
  30. )
  31. var ErrCannotDial = errors.New("cannot dial to any address")