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
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package telegram
  2. import "github.com/9seconds/mtg/conntypes"
  3. const (
  4. directV4DefaultIdx conntypes.DC = 1
  5. directV6DefaultIdx conntypes.DC = 1
  6. )
  7. var (
  8. directV4Addresses = map[conntypes.DC][]string{
  9. 0: {"149.154.175.50:443"},
  10. 1: {"149.154.167.51:443"},
  11. 2: {"149.154.175.100:443"},
  12. 3: {"149.154.167.91:443"},
  13. 4: {"149.154.171.5:443"},
  14. }
  15. directV6Addresses = map[conntypes.DC][]string{
  16. 0: {"[2001:b28:f23d:f001::a]:443"},
  17. 1: {"[2001:67c:04e8:f002::a]:443"},
  18. 2: {"[2001:b28:f23d:f003::a]:443"},
  19. 3: {"[2001:67c:04e8:f004::a]:443"},
  20. 4: {"[2001:b28:f23f:f005::a]:443"},
  21. }
  22. )
  23. type directTelegram struct {
  24. baseTelegram
  25. }
  26. func (d *directTelegram) Dial(dc conntypes.DC,
  27. protocol conntypes.ConnectionProtocol,
  28. ) (conntypes.StreamReadWriteCloser, error) {
  29. switch {
  30. case dc < 0:
  31. dc = -dc
  32. case dc == 0:
  33. dc = conntypes.DCDefaultIdx
  34. }
  35. return d.baseTelegram.dial(dc-1, conntypes.ConnectionProtocolAny)
  36. }