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
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

example.config.toml 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. # Path to access file. Each time when proxy starts up, it writes an
  41. # access file. This file contains a JSON with settings how to access
  42. # this proxy.
  43. #
  44. # Pass filepath here or '-' if you want to dump into stdout.
  45. access-file = "-"
  46. # network defines different network-related settings
  47. [network]
  48. # please be aware that mtg needs to do some external requests. For
  49. # example, if you do not pass public ips, it will request your public ip
  50. # address from some external service.
  51. #
  52. # As for 2.0, if you set a public-ip on your own, mtg won't issue any
  53. # network requests except of those required for Telegram.
  54. #
  55. # so, in order of doing them, it needs to do DNS lookup. mtg ignores DNS
  56. # resolver of the operating system and uses DOH instead. This is a host
  57. # it has to access.
  58. #
  59. # By default we use Quad9.
  60. doh-hostname = "9.9.9.9"
  61. # public ip addresses of the server. Actually, it is required only to
  62. # generate a correct access file. if you use default values here, mtg
  63. # will try to resolve these IPs on its own.
  64. [network.public-ip]
  65. ipv4 = ""
  66. ipv6 = ""
  67. # you can redefine a dialer for mtg. Dialer is how we 'dial' to either
  68. # some external services or telegram. empty string means default
  69. # connectivity.
  70. #
  71. # it is also possible to use socks5 or shadowsocks here
  72. #
  73. # socks5 example:
  74. # socks5://user:password@host:port
  75. # shadowsocks example (SIP002):
  76. # ss://YWVzLTEyOC1nY206dGVzdA@192.168.100.1:8888
  77. #
  78. # You can define 2 dialers here: telegram and default. Telegram dialer
  79. # is used to connect to Telegram servers only. Default is used for other
  80. # purposes, like accessing ifconfig.co to obtains public address (DNS is
  81. # resolved via DoH)
  82. #
  83. # Please also be aware that dialers are only doing TCP. If UDP is
  84. # required (for statsd for example), then these dialers are going to be
  85. # ignored.
  86. #
  87. # If telegram dialer is not defined, a default one is going to be used.
  88. [network.dialers]
  89. telegram = ""
  90. default = ""
  91. # FakeTLS can compare timestamps to prevent probes. Each message has
  92. # encrypted timestamp. So, mtg can compare this timestamp and decide if
  93. # we need to proceed with connection or not.
  94. #
  95. # Please ensure that you have some ntp active on this host. Otherwise,
  96. # you can endup with badly performing proxy.
  97. [probes.time]
  98. # You can enable/disable that. A good idea is always enable.
  99. enabled = true
  100. # Time can be skewed by many reasons. So, this is a time interval
  101. # when message is cosidered as a good one.
  102. allow-skewness = "5s"
  103. # Some countries do active probing on Telegram connections. This technique
  104. # allows to protect from such effort.
  105. #
  106. # mtg has a cache of some connection fingerprints. Actually, first bytes
  107. # of each connection. So, it stores them in some in-memory LRU+TTL cache.
  108. # You can configure this cache here.
  109. [probes.anti-replay]
  110. # You can enable/disable this feature.
  111. enabled = true
  112. # max size of such a cache. Please be aware that this number is
  113. # approximate we try hard to store data quite dense but it is possible
  114. # that we can go over this limit for 10-20% under some conditions and
  115. # architectures.
  116. max-size = "16mb"
  117. # TTL for each cache record.
  118. ttl = "8h"
  119. # statsd statistics integration.
  120. [stats.statsd]
  121. # enabled/disabled
  122. enabled = false
  123. # host:port for UDP endpoint of statsd
  124. address = "127.0.0.1:8888"
  125. # prefix of metric for statsd
  126. metric-prefix = "mtg"
  127. # prometheus metrics integration.
  128. [stats.prometheus]
  129. # enabled/disabled
  130. enabled = true
  131. # host:port where to start http server for endpoint
  132. bind-to = "127.0.0.1:3129"
  133. # prefix of http path
  134. http-path = "/"
  135. # prefix for metrics for prometheus
  136. metric-prefix = "mtg"