MTProto

  • Name: mtproto
  • Type: Inbound / Outbound

MTProto proxy is a special procol for Telegram. It consists of a pair of inbound and outboud proxies in V2Ray. They are usually used together for building a proxy for Telegram

For now V2Ray only supports IPv4 address of Telegram server.

InboundConfigurationObject

{
  "users": [{
    "email": "[email protected]",
    "level": 0,
    "secret": "b0cbcef5a486d9636472ac27f8e11a9d"
  }]
}

users: [UserObject]

An array of users. For now only the first user is effective.

UserObject

{
  "email": "[email protected]",
  "level": 0,
  "secret": "b0cbcef5a486d9636472ac27f8e11a9d"
}

email: string

User email. Used for tracking purposes. See Stats.

level: number

User level.

secret: string

User secret. In Telegram, user secret must be 32 characters long, and only contains characters between 0 to 9, and ato f.

You may use the following command to generate MTProto secret: openssl rand -hex 16

Outbound configuration

{
}

Sample

MTProto can only be used for Telegram traffic. You may need a routing rule to combine the corresponding inbound and outbound. Here is an incomplete sample.

Inbound:

{
  "tag": "tg-in",
  "port": 443,
  "protocol": "mtproto",
  "settings": {
    "users": [{"secret": "b0cbcef5a486d9636472ac27f8e11a9d"}]
  }
}

Outbound:

{
  "tag": "tg-out",
  "protocol": "mtproto",
  "settings": {}
}

Routing:

{
  "type": "field",
  "inboundTag": ["tg-in"],
  "outboundTag": "tg-out"
}

The configure your Telegram app to connect to 443 port on this machine.