Files
XTLS_Xray-docs-next/docs/config/outbounds/trojan.md
T
2026-05-25 18:39:42 +08:00

1.1 KiB

Trojan

Trojan 协议

::: danger Trojan 被设计工作在正确配置的加密 TLS 隧道 :::

OutboundConfigurationObject

OutboundConfigurationObject 对应 OutboundObject 中的 settings 项。

{
  "outbounds": [
    {
      // ...
      "protocol": "trojan",
      // [!code focus:7]
      "settings": {
        "address": "127.0.0.1",
        "port": 1234,
        "password": "password",
        "email": "love@xray.com",
        "level": 0
      }
    }
  ]
}

address: address

服务端地址,支持 IPv4、IPv6 和域名。必填。

port: number

服务端端口,通常与服务端监听的端口相同。

password: string

密码. 必填,任意字符串。

email: string

邮件地址,可选,用于标识用户

level: number

用户等级,连接会使用这个用户等级对应的 本地策略。

level 的值, 对应 policy 中 level 的值。 如不指定, 默认为 0。