mirror of
https://github.com/XrayR-project/XrayR.git
synced 2025-06-08 13:29:54 +00:00
update: add ss plugin support ss2022
The error message will have more details
This commit is contained in:
parent
b09f371447
commit
0777cc8892
@ -217,7 +217,7 @@ func (c *APIClient) GetUserList() (UserList *[]api.UserInfo, err error) {
|
||||
if c.SpeedLimit > 0 {
|
||||
u.SpeedLimit = uint64(c.SpeedLimit * 1000000 / 8)
|
||||
} else {
|
||||
u.SpeedLimit = uint64(user.Get("speed_limit").MustUint64() * 1000000 / 8)
|
||||
u.SpeedLimit = user.Get("speed_limit").MustUint64() * 1000000 / 8
|
||||
}
|
||||
|
||||
u.DeviceLimit = c.DeviceLimit // todo waiting v2board send configuration
|
||||
|
@ -78,18 +78,18 @@ func (c *Controller) buildSSUser(userInfo *[]api.UserInfo, method string) (users
|
||||
users = make([]*protocol.User, len(*userInfo))
|
||||
|
||||
for i, user := range *userInfo {
|
||||
// // shadowsocks2022 Key = "openssl rand -base64 32" and multi users needn't cipher method
|
||||
// shadowsocks2022 Key = "openssl rand -base64 32" and multi users needn't cipher method
|
||||
if C.Contains(shadowaead_2022.List, strings.ToLower(method)) {
|
||||
e := c.buildUserTag(&user)
|
||||
if len(user.Passwd) < 16 {
|
||||
newError("shadowsocks2022 key's length must be greater than 16").AtError().WriteToLog()
|
||||
return
|
||||
newError(fmt.Errorf("[UID: %d] shadowsocks2022 key's length must be greater than 16", user.UID)).AtError().WriteToLog()
|
||||
continue
|
||||
}
|
||||
userKey := user.Passwd[:16]
|
||||
if strings.Contains(method, "256") {
|
||||
if len(user.Passwd) < 32 {
|
||||
newError("shadowsocks2022 key's length must be greater than 32").AtError().WriteToLog()
|
||||
return
|
||||
newError(fmt.Errorf("[UID: %d] shadowsocks2022 key's length must be greater than 32", user.UID)).AtError().WriteToLog()
|
||||
continue
|
||||
}
|
||||
userKey = user.Passwd[:32]
|
||||
}
|
||||
@ -123,11 +123,23 @@ func (c *Controller) buildSSPluginUser(userInfo *[]api.UserInfo) (users []*proto
|
||||
// shadowsocks2022 Key = openssl rand -base64 32 and multi users needn't cipher method
|
||||
if C.Contains(shadowaead_2022.List, strings.ToLower(user.Method)) {
|
||||
e := c.buildUserTag(&user)
|
||||
if len(user.Passwd) < 16 {
|
||||
newError(fmt.Errorf("[UID: %d] shadowsocks2022 key's length must be greater than 16", user.UID)).AtError().WriteToLog()
|
||||
continue
|
||||
}
|
||||
userKey := user.Passwd[:16]
|
||||
if strings.Contains(user.Method, "256") {
|
||||
if len(user.Passwd) < 32 {
|
||||
newError(fmt.Errorf("[UID: %d] shadowsocks2022 key's length must be greater than 32", user.UID)).AtError().WriteToLog()
|
||||
continue
|
||||
}
|
||||
userKey = user.Passwd[:32]
|
||||
}
|
||||
users[i] = &protocol.User{
|
||||
Level: 0,
|
||||
Email: e,
|
||||
Account: serial.ToTypedMessage(&shadowsocks_2022.User{
|
||||
Key: base64.StdEncoding.EncodeToString([]byte(user.Passwd)),
|
||||
Key: base64.StdEncoding.EncodeToString([]byte(userKey)),
|
||||
Email: e,
|
||||
Level: 0,
|
||||
}),
|
||||
|
Loading…
x
Reference in New Issue
Block a user