mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 09:18:34 +00:00
Fix Trojan XTLS
This commit is contained in:
parent
decb012f9d
commit
2e942e0303
4 changed files with 50 additions and 31 deletions
|
@ -52,6 +52,17 @@ func (c *TrojanClientConfig) Build() (proto.Message, error) {
|
|||
Password: rec.Password,
|
||||
Flow: rec.Flow,
|
||||
}
|
||||
|
||||
switch account.Flow {
|
||||
case "", "xtls-rprx-origin", "xtls-rprx-origin-udp443", "xtls-rprx-direct", "xtls-rprx-direct-udp443":
|
||||
case "xtls-rprx-splice", "xtls-rprx-splice-udp443":
|
||||
if runtime.GOOS != "linux" && runtime.GOOS != "android" {
|
||||
return nil, newError(`Trojan servers: "` + account.Flow + `" only support linux in this version`)
|
||||
}
|
||||
default:
|
||||
return nil, newError(`Trojan servers: "flow" doesn't support "` + account.Flow + `" in this version`)
|
||||
}
|
||||
|
||||
trojan := &protocol.ServerEndpoint{
|
||||
Address: rec.Address.Build(),
|
||||
Port: uint32(rec.Port),
|
||||
|
@ -107,6 +118,14 @@ func (c *TrojanServerConfig) Build() (proto.Message, error) {
|
|||
Flow: rawUser.Flow,
|
||||
}
|
||||
|
||||
switch account.Flow {
|
||||
case "", "xtls-rprx-origin", "xtls-rprx-direct":
|
||||
case "xtls-rprx-splice":
|
||||
return nil, newError(`Trojan clients: inbound doesn't support "xtls-rprx-splice" in this version, please use "xtls-rprx-direct" instead`)
|
||||
default:
|
||||
return nil, newError(`Trojan clients: "flow" doesn't support "` + account.Flow + `" in this version`)
|
||||
}
|
||||
|
||||
user.Email = rawUser.Email
|
||||
user.Level = uint32(rawUser.Level)
|
||||
user.Account = serial.ToTypedMessage(account)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue