Trojan outbound fields
This page describes clients in the Clash ecosystem proxies Trojan outbound fields in the array. Trojan uses password authentication and requires TLS, so the client must match the server address, port, password, and TLS name.
The minimum configuration consists of four common required fields plus password . SNI may be left blank and fall back to the server address, but it usually needs to be specified when using a domain certificate, CDN, or Reality.
nameRequired- The node name, which must be unique within the configuration.
typeRequired- Set this to
trojan。 serverRequired- The domain name or IP address of the Trojan server.
portRequired- The server listening port, commonly 443, but always use the server configuration.
passwordRequired- The Trojan server password. It must exactly match the value assigned by the server.
TLS, SNI, and certificate validation
Trojan always enables TLS in the current core; it does not depend on tls: true to become a TLS node. The fields below control the handshake name, ALPN, client fingerprint, and certificate validation.
sniOptional- The TLS server name. When left blank, it uses the
serveraddress. Domain certificates and CDN deployments usually require an explicit match. alpnOptional- The TLS application protocol list. It must be compatible with both the server and the selected transport.
client-fingerprintOptional- A uTLS client fingerprint, such as
chromeorrandom, not a certificate fingerprint. fingerprintOptional- The SHA-256 fingerprint of the server certificate, which differs from
client-fingerprint. skip-cert-verifyUse with caution- Set to
trueskips certificate validation and should not be used as a long-term troubleshooting measure. name-cert-verifyOptional- changes only the certificate DNSName validation target; it does not change the SNI that is sent.
certificate / private-keyOptional- Providing both enables client mTLS. Standard Trojan nodes usually do not need them.
Reality and other TLS wrappers
Reality, ShadowTLS, Restls, and JLS are all TLS connection-layer extensions. Add one only when the server explicitly supports it, and do not enable conflicting connection-layer configurations together.
reality-opts.public-keyReality- The public key corresponding to the server's Reality private key.
reality-opts.short-idReality- Provide one of the short IDs allowed by the server.
reality-opts.support-x25519mlkem768Optional- Declares support for X25519-MLKEM768 key exchange; the server must support it as well.
shadow-tls-optsFollow the server- Set the version and password only when the server uses ShadowTLS, and continue using
snias the handshake name. restls-optsFollow the server- Set the password and TLS version hint only when the server uses Restls.
jls-optsFollow the server- Set the username and password only when the server uses JLS.
Choose a Trojan transport
Trojan currently lists only WebSocket and gRPC as optional transports. If network is omitted or set to another value, TCP is used.
| network | Related fields | When to use it |
|---|---|---|
| tcp | No dedicated opts | Default transport |
| ws | ws-opts | WebSocket path, Host, and Early Data |
| grpc | grpc-opts | gRPC service name and connection parameters |
networkOptional- Use only
wsorgrpc; all other values are handled as TCP. ws-optsWebSocket- The path, Host, and Early Data fields must match the server or reverse proxy.
grpc-optsgRPCgrpc-service-nameand the connection parameters must match the server.smuxTCP only- Generic sing-mux applies only to TCP transport; do not confuse it with gRPC's own multiplexing.
UDP and the trojan-go AEAD extension
The UDP switch and trojan-go's Shadowsocks AEAD extension are independent. A standard Trojan node does not need ss-opts。
udpOptional- Common field; the default is
false. Set it totrue, and you must confirm that the server supports it. ss-opts.enabledOptional- When the trojan-go server enables the Shadowsocks AEAD extension, set this to
true。 ss-opts.methodDefault: aes-128-gcm- Available
aes-128-gcm、aes-256-gcmorchacha20-ietf-poly1305。 ss-opts.passwordRequired when enabled- The trojan-go AEAD extension password must not be empty and does not replace the top-level
password。
Base configuration and error checks
This example shows a standard Trojan over TLS node. If the server does not enable WebSocket, gRPC, Reality, or ss-opts , do not add those fields yourself.
- Writing
networkash2, assuming it is the same setting asalpn: [h2]. - The SNI, certificate validation name, and reverse-proxy domain do not match, causing the TLS handshake to fail.
- Only
ss-opts.passwordis provided, while omitting the required top-level Trojanpassword。 - The server uses gRPC, but the client still connects over the default TCP transport, or
grpc-service-namedoes not match.
proxies:
- name: trojan-tls
type: trojan
server: edge.example.com
port: 443
password: your-trojan-password
sni: origin.example.com
alpn:
- h2
- http/1.1
client-fingerprint: chrome
udp: true
network: tcp