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.

direct.go 899B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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) (conntypes.StreamReadWriteCloser, error) {
  28. switch {
  29. case dc < 0:
  30. dc = -dc
  31. case dc == 0:
  32. dc = conntypes.DCDefaultIdx
  33. }
  34. return d.baseTelegram.dial(dc-1, protocol)
  35. }