mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-05 12:44:22 +00:00
Third and fourth link generators. genTrojanLink mirrors genVlessLink's
shape (URLSearchParams + network/security branches + remark hash) minus
the encryption/flow VLESS-isms. genShadowsocksLink shares the same query
construction but base64-encodes the userinfo portion as method:password
or method:settingsPw:clientPw depending on whether SS-2022 is in
single-user or multi-user mode.
Three reusable helpers move out of the per-protocol functions:
- writeNetworkParams: the per-network switch that all param-style
links share (tcp http header / kcp mtu+tti / ws path+host /
grpc serviceName+authority / httpupgrade / xhttp extras)
- writeTlsParams: fingerprint/alpn/ech/sni
- writeRealityParams: pbk/sid/spx/pqv (preserves the SNI-omission
legacy parity quirk noted in the genVlessLink commit)
genVmessLink stays with its inline switch — it builds a JSON obj instead
of URLSearchParams and has per-network quirks (kcp emits mtu+tti at
the obj root, grpc maps multiMode to obj.type='multi') that don't
factor cleanly through the shared writer.
Two new full-inbound fixtures (trojan-ws-tls, shadowsocks-tcp-2022)
plus matching parity tests bring the suite to 74 tests across 8 files;
typecheck + lint clean.
73 lines
1.6 KiB
JSON
73 lines
1.6 KiB
JSON
{
|
|
"id": 13,
|
|
"up": 0,
|
|
"down": 0,
|
|
"total": 0,
|
|
"remark": "eve-trojan-ws-tls",
|
|
"enable": true,
|
|
"expiryTime": 0,
|
|
"listen": "",
|
|
"port": 443,
|
|
"tag": "inbound-trojan-ws",
|
|
"sniffing": {
|
|
"enabled": true,
|
|
"destOverride": ["http", "tls", "quic", "fakedns"],
|
|
"metadataOnly": false,
|
|
"routeOnly": false,
|
|
"ipsExcluded": [],
|
|
"domainsExcluded": []
|
|
},
|
|
"protocol": "trojan",
|
|
"settings": {
|
|
"clients": [
|
|
{
|
|
"password": "trojan-test-pw-XYZ",
|
|
"email": "eve@example.test",
|
|
"limitIp": 0,
|
|
"totalGB": 0,
|
|
"expiryTime": 0,
|
|
"enable": true,
|
|
"tgId": 0,
|
|
"subId": "trj-001",
|
|
"comment": "",
|
|
"reset": 0
|
|
}
|
|
],
|
|
"fallbacks": []
|
|
},
|
|
"streamSettings": {
|
|
"network": "ws",
|
|
"wsSettings": {
|
|
"acceptProxyProtocol": false,
|
|
"path": "/trojan",
|
|
"host": "trojan.example.test",
|
|
"headers": {},
|
|
"heartbeatPeriod": 0
|
|
},
|
|
"security": "tls",
|
|
"tlsSettings": {
|
|
"serverName": "trojan.example.test",
|
|
"minVersion": "1.2",
|
|
"maxVersion": "1.3",
|
|
"cipherSuites": "",
|
|
"rejectUnknownSni": false,
|
|
"disableSystemRoot": false,
|
|
"enableSessionResumption": false,
|
|
"certificates": [
|
|
{
|
|
"certificateFile": "/etc/ssl/certs/trojan.crt",
|
|
"keyFile": "/etc/ssl/private/trojan.key",
|
|
"oneTimeLoading": false,
|
|
"usage": "encipherment",
|
|
"buildChain": false
|
|
}
|
|
],
|
|
"alpn": ["h2", "http/1.1"],
|
|
"echServerKeys": "",
|
|
"settings": {
|
|
"fingerprint": "chrome",
|
|
"echConfigList": ""
|
|
}
|
|
}
|
|
}
|
|
}
|