mirror of
https://github.com/XrayR-project/XrayR.git
synced 2025-06-08 05:19:54 +00:00
fix: add error to ss2022's length check
This commit is contained in:
parent
acd3cce667
commit
a6dbf757e9
@ -78,12 +78,20 @@ 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)
|
||||
userKey := user.Passwd[:32]
|
||||
if strings.Contains(method, "128") {
|
||||
userKey = userKey[:16]
|
||||
if len(user.Passwd) < 16 {
|
||||
newError("shadowsocks2022 key's length must be greater than 16").AtError().WriteToLog()
|
||||
return
|
||||
}
|
||||
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
|
||||
}
|
||||
userKey = userKey[:32]
|
||||
}
|
||||
users[i] = &protocol.User{
|
||||
Level: 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user