[GH-ISSUE #5288] [Feature]: A proposal to add the adTag function, which can be obtained from the MTProxy Admin Bot. #3700

Closed
opened 2026-10-31 20:34:21 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @cflowstudio on GitHub (Jun 13, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5288

Yes, I can't add the adTag to the config, and there's no such functionality, but I'd like to have this small setting for MTProto.

"settings": {
        "fakeTlsDomain": "<domain>",
        "secret": "ee<secret>",
        "adTag": "<secret tag from the bot>",
        "domainFronting": {
            "proxyProtocol": false
        },
        "routeThroughXray": false
    }

Describe the solution you'd like

I want to add the adTag feature (the sponsor's channel above Telegram chats). This feature may not be useful for everyone, but it can help those who sell to advertise their Telegram channel and promote their Telegram sponsors.

Alternatives you've considered

I tried to solve it by editing the JSON file, but it didn't work.

Concrete use case

No response

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

No response

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @cflowstudio on GitHub (Jun 13, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5288 ### Is your feature request related to a problem? Yes, I can't add the adTag to the config, and there's no such functionality, but I'd like to have this small setting for MTProto. ``` "settings": { "fakeTlsDomain": "<domain>", "secret": "ee<secret>", "adTag": "<secret tag from the bot>", "domainFronting": { "proxyProtocol": false }, "routeThroughXray": false } ``` ### Describe the solution you'd like I want to add the adTag feature (the sponsor's channel above Telegram chats). This feature may not be useful for everyone, but it can help those who sell to advertise their Telegram channel and promote their Telegram sponsors. ### Alternatives you've considered I tried to solve it by editing the JSON file, but it didn't work. ### Concrete use case _No response_ ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? _No response_ ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [ ] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
bsakaguchi 2026-10-31 20:34:21 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 13, 2026):

The adTag field cannot be supported in the current MTProto implementation. Here is why.

3x-ui's MTProto inbounds are backed by mtg (github.com/9seconds/mtg), an independent open-source reimplementation of the MTProxy protocol — confirmed in internal/mtproto/process.go (package comment) and internal/mtproto/manager.go (renderConfig). The panel launches one mtg process per inbound and generates a TOML config for it.

adTag is a feature of Telegram's official MTProxy C server (github.com/TelegramMessenger/MTProxy), not of mtg. The mtg binary has no concept of advertisement tags and its TOML config format has no adTag key. Even if you embed adTag in the panel's stored settings JSON, two things prevent it from working:

  1. InstanceFromInbound in internal/mtproto/manager.go parses only the fields it knows (secret, fakeTlsDomain, domainFronting, routeThroughXray, etc.) and silently ignores all others.
  2. renderConfig generates the TOML passed to mtg and has no path that would ever emit an adTag line, because mtg itself does not accept one.

This is why editing the JSON manually had no effect.

For adTag support to be possible in 3x-ui, the MTProto backend would need to be switched from (or augmented with) Telegram's official MTProxy binary, which would be a significant architectural change. This is a valid enhancement request, but its feasibility depends entirely on whether mtg or an alternative backend the project is willing to ship adds adTag support upstream.

If you require adTag today, the only working path is to run Telegram's official MTProxy server (TelegramMessenger/MTProxy) directly, outside of 3x-ui.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4699138951 --> @github-actions[bot] commented on GitHub (Jun 13, 2026): The `adTag` field cannot be supported in the current MTProto implementation. Here is why. 3x-ui's MTProto inbounds are backed by **`mtg` (`github.com/9seconds/mtg`)**, an independent open-source reimplementation of the MTProxy protocol — confirmed in `internal/mtproto/process.go` (package comment) and `internal/mtproto/manager.go` (`renderConfig`). The panel launches one `mtg` process per inbound and generates a TOML config for it. `adTag` is a feature of **Telegram's official MTProxy C server** (`github.com/TelegramMessenger/MTProxy`), not of `mtg`. The `mtg` binary has no concept of advertisement tags and its TOML config format has no `adTag` key. Even if you embed `adTag` in the panel's stored settings JSON, two things prevent it from working: 1. `InstanceFromInbound` in `internal/mtproto/manager.go` parses only the fields it knows (`secret`, `fakeTlsDomain`, `domainFronting`, `routeThroughXray`, etc.) and silently ignores all others. 2. `renderConfig` generates the TOML passed to `mtg` and has no path that would ever emit an `adTag` line, because `mtg` itself does not accept one. This is why editing the JSON manually had no effect. For `adTag` support to be possible in 3x-ui, the MTProto backend would need to be switched from (or augmented with) Telegram's official MTProxy binary, which would be a significant architectural change. This is a valid enhancement request, but its feasibility depends entirely on whether `mtg` or an alternative backend the project is willing to ship adds `adTag` support upstream. If you require `adTag` today, the only working path is to run **Telegram's official MTProxy server** (`TelegramMessenger/MTProxy`) directly, outside of 3x-ui. _This reply was generated automatically; a maintainer may follow up._
Author
Owner

@MHSanaei commented on GitHub (Jul 3, 2026):

Thanks for the suggestion, but this is not something 3x-ui can implement with its current MTProto backend. Our MTProto inbounds are powered by mtg (9seconds/mtg v2), and mtg v2 intentionally removed ADTag support upstream — its configuration format has no adTag option at all, which is also why editing the inbound JSON has no effect.

Supporting adTag would require replacing mtg with Telegram's official MTProxy server, a different proxy implementation and out of scope for the panel. If you need adTag today, running TelegramMessenger/MTProxy directly alongside the panel is the working option; if mtg ever reintroduces ADTag upstream, we'd be happy to revisit.

<!-- gh-comment-id:4873799430 --> @MHSanaei commented on GitHub (Jul 3, 2026): Thanks for the suggestion, but this is not something 3x-ui can implement with its current MTProto backend. Our MTProto inbounds are powered by mtg (9seconds/mtg v2), and mtg v2 intentionally removed ADTag support upstream — its configuration format has no adTag option at all, which is also why editing the inbound JSON has no effect. Supporting adTag would require replacing mtg with Telegram's official MTProxy server, a different proxy implementation and out of scope for the panel. If you need adTag today, running TelegramMessenger/MTProxy directly alongside the panel is the working option; if mtg ever reintroduces ADTag upstream, we'd be happy to revisit.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3700
No description provided.