mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-19 13:32:24 +00:00
[api] fix actions for shadowsocks
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
This commit is contained in:
parent
c2b1fb4855
commit
4cfed17650
1 changed files with 26 additions and 3 deletions
29
xray/api.go
29
xray/api.go
|
@ -15,6 +15,7 @@ import (
|
||||||
"github.com/xtls/xray-core/common/serial"
|
"github.com/xtls/xray-core/common/serial"
|
||||||
"github.com/xtls/xray-core/infra/conf"
|
"github.com/xtls/xray-core/infra/conf"
|
||||||
"github.com/xtls/xray-core/proxy/shadowsocks"
|
"github.com/xtls/xray-core/proxy/shadowsocks"
|
||||||
|
"github.com/xtls/xray-core/proxy/shadowsocks_2022"
|
||||||
"github.com/xtls/xray-core/proxy/trojan"
|
"github.com/xtls/xray-core/proxy/trojan"
|
||||||
"github.com/xtls/xray-core/proxy/vless"
|
"github.com/xtls/xray-core/proxy/vless"
|
||||||
"github.com/xtls/xray-core/proxy/vmess"
|
"github.com/xtls/xray-core/proxy/vmess"
|
||||||
|
@ -99,9 +100,31 @@ func (x *XrayAPI) AddUser(Protocol string, inboundTag string, user map[string]in
|
||||||
Password: user["password"].(string),
|
Password: user["password"].(string),
|
||||||
})
|
})
|
||||||
case "shadowsocks":
|
case "shadowsocks":
|
||||||
account = serial.ToTypedMessage(&shadowsocks.Account{
|
var ssCipherType shadowsocks.CipherType
|
||||||
Password: user["password"].(string),
|
switch user["cipher"].(string) {
|
||||||
})
|
case "aes-128-gcm":
|
||||||
|
ssCipherType = shadowsocks.CipherType_AES_128_GCM
|
||||||
|
case "aes-256-gcm":
|
||||||
|
ssCipherType = shadowsocks.CipherType_AES_256_GCM
|
||||||
|
case "chacha20-poly1305":
|
||||||
|
ssCipherType = shadowsocks.CipherType_CHACHA20_POLY1305
|
||||||
|
case "xchacha20-poly1305":
|
||||||
|
ssCipherType = shadowsocks.CipherType_XCHACHA20_POLY1305
|
||||||
|
default:
|
||||||
|
ssCipherType = shadowsocks.CipherType_NONE
|
||||||
|
}
|
||||||
|
|
||||||
|
if ssCipherType != shadowsocks.CipherType_NONE {
|
||||||
|
account = serial.ToTypedMessage(&shadowsocks.Account{
|
||||||
|
Password: user["password"].(string),
|
||||||
|
CipherType: ssCipherType,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
account = serial.ToTypedMessage(&shadowsocks_2022.User{
|
||||||
|
Key: user["password"].(string),
|
||||||
|
Email: user["email"].(string),
|
||||||
|
})
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue