Skip to content

Commit

Permalink
add DeviceLimit to V2RaySocks (#622)
Browse files Browse the repository at this point in the history
  • Loading branch information
theresaarcher authored Apr 10, 2024
1 parent b3f31bf commit 06fe198
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion api/v2raysocks/v2raysocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,20 +243,27 @@ func (c *APIClient) GetUserList() (UserList *[]api.UserInfo, err error) {
user.Passwd = response.Get("data").GetIndex(i).Get("shadowsocks_user").Get("secret").MustString()
user.Method = response.Get("data").GetIndex(i).Get("shadowsocks_user").Get("cipher").MustString()
user.SpeedLimit = response.Get("data").GetIndex(i).Get("shadowsocks_user").Get("speed_limit").MustUint64() * 1000000 / 8
user.DeviceLimit = response.Get("data").GetIndex(i).Get("shadowsocks_user").Get("device_limit").MustInt()
case "Trojan":
user.UUID = response.Get("data").GetIndex(i).Get("trojan_user").Get("password").MustString()
user.Email = response.Get("data").GetIndex(i).Get("trojan_user").Get("password").MustString()
user.SpeedLimit = response.Get("data").GetIndex(i).Get("trojan_user").Get("speed_limit").MustUint64() * 1000000 / 8
user.DeviceLimit = response.Get("data").GetIndex(i).Get("trojan_user").Get("device_limit").MustInt()
case "V2ray":
user.UUID = response.Get("data").GetIndex(i).Get("v2ray_user").Get("uuid").MustString()
user.Email = response.Get("data").GetIndex(i).Get("v2ray_user").Get("email").MustString()
user.AlterID = uint16(response.Get("data").GetIndex(i).Get("v2ray_user").Get("alter_id").MustUint64())
user.SpeedLimit = response.Get("data").GetIndex(i).Get("v2ray_user").Get("speed_limit").MustUint64() * 1000000 / 8
user.DeviceLimit = response.Get("data").GetIndex(i).Get("v2ray_user").Get("device_limit").MustInt()
}
if c.SpeedLimit > 0 {
user.SpeedLimit = uint64((c.SpeedLimit * 1000000) / 8)
}
user.DeviceLimit = c.DeviceLimit

if c.DeviceLimit > 0 {
user.DeviceLimit = c.DeviceLimit
}

userList[i] = user
}
return &userList, nil
Expand Down

0 comments on commit 06fe198

Please sign in to comment.