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

example.config.toml 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. # This is an example of the configuration file for mtg. You actually can
  2. # run mtg with it. It starts a proxy on all interfaces with a secret
  3. # ee367a189aee18fa31c190054efd4a8e9573746f726167652e676f6f676c65617069732e636f6d
  4. #
  5. # It has all possible options with default values. So, a real world
  6. # configuration file should contain only those options you are going to
  7. # use. You do not need to enumerate all of them. In other words, each
  8. # option here has a default value. If you comment a key-value pair, it
  9. # should not make any effect.
  10. #
  11. # stats is the only exception.
  12. # Debug starts application in debug mode. It starts to be quite verbose
  13. # in output. Actually, the idea is that you run it in debug mode only if
  14. # you have any issue.
  15. debug = false
  16. # A secret. Please remember that mtg supports only FakeTLS mode, legacy
  17. # simple and secured mode are prohibited. For you it means that secret
  18. # should either be base64-encoded or starts with ee.
  19. secret = "ee367a189aee18fa31c190054efd4a8e9573746f726167652e676f6f676c65617069732e636f6d"
  20. # Host:port pair to run proxy on.
  21. bind-to = "0.0.0.0:3128"
  22. # A size of user-space buffer for TCP to use. Since we do 2 connections,
  23. # then we have tcp-buffer * (4 + 2) per each connection: read/write for
  24. # each connection + 2 copy buffers to pump the data between sockets.
  25. tcp-buffer = "4kb"
  26. # Sometimes you want to enforce mtg to use some types of
  27. # IP connectivity to Telegram. We have 4 modes:
  28. # - prefer-ipv6:
  29. # We can use both ipv4 and ipv6 but ipv6 has a preference
  30. # - prefer-ipv4:
  31. # We can use both ipv4 and ipv6 but ipv4 has a preference
  32. # - only-ipv6:
  33. # Only ipv6 connectivity is used
  34. # - only-ipv4:
  35. # Only ipv4 connectivity is used
  36. prefer-ips = "prefer-ipv6"
  37. # FakeTLS uses domain fronting protection. So it needs to know a port to
  38. # access.
  39. cloak-port = 443
  40. # network defines different network-related settings
  41. [network]
  42. # please be aware that mtg needs to do some external requests. For
  43. # example, if you do not pass public ips, it will request your public ip
  44. # address from some external service.
  45. #
  46. # As for 2.0, if you set a public-ip on your own, mtg won't issue any
  47. # network requests except of those required for Telegram.
  48. #
  49. # so, in order of doing them, it needs to do DNS lookup. mtg ignores DNS
  50. # resolver of the operating system and uses DOH instead. This is a host
  51. # it has to access.
  52. #
  53. # By default we use Quad9.
  54. doh-hostname = "9.9.9.9"
  55. # public ip addresses of the server. Actually, it is required only to
  56. # generate a correct access file. if you use default values here, mtg
  57. # will try to resolve these IPs on its own.
  58. [network.public-ip]
  59. ipv4 = ""
  60. ipv6 = ""
  61. # you can redefine a dialer for mtg. Dialer is how we 'dial' to either
  62. # some external services or telegram. empty string means default
  63. # connectivity.
  64. #
  65. # it is also possible to use socks5 or shadowsocks here
  66. #
  67. # socks5 example:
  68. # socks5://user:password@host:port
  69. # shadowsocks example (SIP002):
  70. # ss://YWVzLTEyOC1nY206dGVzdA@192.168.100.1:8888
  71. #
  72. # You can define 2 dialers here: telegram and default. Telegram dialer
  73. # is used to connect to Telegram servers only. Default is used for other
  74. # purposes, like accessing ifconfig.co to obtains public address (DNS is
  75. # resolved via DoH)
  76. #
  77. # Please also be aware that dialers are only doing TCP. If UDP is
  78. # required (for statsd for example), then these dialers are going to be
  79. # ignored.
  80. #
  81. # If telegram dialer is not defined, a default one is going to be used.
  82. [network.dialers]
  83. telegram = ""
  84. default = ""
  85. # FakeTLS can compare timestamps to prevent probes. Each message has
  86. # encrypted timestamp. So, mtg can compare this timestamp and decide if
  87. # we need to proceed with connection or not.
  88. #
  89. # Please ensure that you have some ntp active on this host. Otherwise,
  90. # you can endup with badly performing proxy.
  91. [probes.time]
  92. # You can enable/disable that. A good idea is always enable.
  93. enabled = true
  94. # Time can be skewed by many reasons. So, this is a time interval
  95. # when message is cosidered as a good one.
  96. allow-skewness = "5s"
  97. # Some countries do active probing on Telegram connections. This technique
  98. # allows to protect from such effort.
  99. #
  100. # mtg has a cache of some connection fingerprints. Actually, first bytes
  101. # of each connection. So, it stores them in some in-memory LRU+TTL cache.
  102. # You can configure this cache here.
  103. [probes.anti-replay]
  104. # You can enable/disable this feature.
  105. enabled = true
  106. # max size of such a cache. Please be aware that this number is
  107. # approximate we try hard to store data quite dense but it is possible
  108. # that we can go over this limit for 10-20% under some conditions and
  109. # architectures.
  110. max-size = "16mb"
  111. # TTL for each cache record.
  112. ttl = "8h"
  113. # statsd statistics integration.
  114. [stats.statsd]
  115. # enabled/disabled
  116. enabled = false
  117. # host:port for UDP endpoint of statsd
  118. address = "127.0.0.1:8888"
  119. # prefix of metric for statsd
  120. metric-prefix = "mtg"
  121. # prometheus metrics integration.
  122. [stats.prometheus]
  123. # enabled/disabled
  124. enabled = true
  125. # host:port where to start http server for endpoint
  126. bind-to = "127.0.0.1:3129"
  127. # prefix of http path
  128. http-path = "/"
  129. # prefix for metrics for prometheus
  130. metric-prefix = "mtg"