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个字符

init.go 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. // Stats package has implementations of [events.Observer] for different
  2. // monitoring systems.
  3. //
  4. // Observer is a consumer of events produced by mtg. Consumers, defined
  5. // in this package, process these events and provide information used by
  6. // different monitoring system or time series databases.
  7. package stats
  8. const (
  9. // DefaultMetricPrefix defines a base prefix for all metrics.
  10. DefaultMetricPrefix = "mtg"
  11. // DefaultStatsdMetricPrefix defines a base prefix for metrics
  12. // which are passed to statsd.
  13. DefaultStatsdMetricPrefix = DefaultMetricPrefix + "."
  14. // DefaultStatsdTagFormat defines a format of tags for statsd
  15. // observer.
  16. DefaultStatsdTagFormat = "datadog"
  17. // MetricClientConnections defines a metric which is responsible for a
  18. // number of currently active connections established by client.
  19. //
  20. // Type: gauge
  21. // Tags:
  22. // ip_family | A type of ip (ipv4 or ipv6) of the client.
  23. MetricClientConnections = "client_connections"
  24. // MetricTelegramConnections defines a metric which is responsible for
  25. // a count of active connections to Telegram servers.
  26. //
  27. // Type: gauge
  28. // Tags:
  29. // telegram_ip | IP address of the telegram server.
  30. // dc | Index of the datacenter to connect to.
  31. MetricTelegramConnections = "telegram_connections"
  32. // MetricDomainFrontingConnections defines a metric which is
  33. // responsible for a count of active connections to a fronting domain.
  34. // Fronting domain is that one that is encoded in a secret.
  35. //
  36. // Type: gauge
  37. // Tags:
  38. // ip_family | A type of IP (ipv4 or ipv6) that was used.
  39. MetricDomainFrontingConnections = "domain_fronting_connections"
  40. // MetricTelegramTraffic defines a metric for traffic (in bytes) that
  41. // is sent to and from Telegram servers.
  42. //
  43. // Type: counter
  44. // Tags:
  45. // telegram_ip | IP address of the telegram server.
  46. // dc | Index of the datacenter
  47. // direction | Direction of the traffc flow. Values are
  48. // | 'to_client' and 'from_client'
  49. MetricTelegramTraffic = "telegram_traffic"
  50. // MetricDomainFrontingTraffic defines a metric for traffic (in bytes)
  51. // that is sent to and from fronting domain.
  52. //
  53. // Type: counter
  54. // Tags:
  55. // direction | Direction of the traffc flow. Values are
  56. // | 'to_client' and 'from_client'
  57. MetricDomainFrontingTraffic = "domain_fronting_traffic"
  58. // MetricDomainFronting defines a metric for a number of domain
  59. // fronting routing events.
  60. //
  61. // Type: counter
  62. MetricDomainFronting = "domain_fronting"
  63. // MetricConcurrencyLimited defines a metric for a count of events,
  64. // when the client was blocked due to the concurrency limit.
  65. //
  66. // Type: counter
  67. MetricConcurrencyLimited = "concurrency_limited"
  68. // MetricIPBlocklisted defines a metric for a count of events, when
  69. // client was blocked because her IP address was found in blocklists.
  70. //
  71. // Type: counter
  72. MetricIPBlocklisted = "ip_blocklisted"
  73. // MetricReplayAttacks defines a metric for a count of events, when
  74. // mtg has detected a replay attack. Just a reminder: mtg immediately
  75. // routes a connection to a fronting domain if such event is detected.
  76. //
  77. // Type: counter
  78. MetricReplayAttacks = "replay_attacks"
  79. // MetricIPListSize defines a metric for the size of the the ip list.
  80. //
  81. // Type: gauge
  82. // Tags:
  83. // ip_list | 'allowlist' or 'blocklist'
  84. MetricIPListSize = "iplist_size"
  85. // TagIPFamily defines a name of the 'ip_family' tag and all values.
  86. TagIPFamily = "ip_family"
  87. // TagIPFamilyIPv4 defines a value of 'ip_family' of IPv4.
  88. TagIPFamilyIPv4 = "ipv4"
  89. // TagIPFamilyIPv6 defines a value of 'ip_family' of IPv6.
  90. TagIPFamilyIPv6 = "ipv6"
  91. // TagTelegramIP defines a name of the 'telegram_ip' tag.
  92. TagTelegramIP = "telegram_ip"
  93. // TagDC defines a name of the 'dc' tag.
  94. TagDC = "dc"
  95. // TagDirection defines a name of the 'direction' tag.
  96. TagDirection = "direction"
  97. // TagDirectionToClient defines that traffic is sent from Telegram to a
  98. // client.
  99. TagDirectionToClient = "to_client"
  100. // TagDirectionFromClient defines that traffic is sent from a client to
  101. // Telegram.
  102. TagDirectionFromClient = "from_client"
  103. // TagIPList defines a name of the 'ip_list' and all values.
  104. TagIPList = "ip_list"
  105. // TagIPListAllow defines a value of 'ip_list' of allowlist.
  106. TagIPListAllow = "allowlist"
  107. // TagIPListBlock defines a value of 'ip_list' of blocklist.
  108. TagIPListBlock = "blocklist"
  109. )