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 4.7KB

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