From e9dbf21993538e4ff8e43aa4e9888b5589416c58 Mon Sep 17 00:00:00 2001 From: thh1451 <119903652+thh1451@users.noreply.github.com> Date: Sat, 23 Mar 2024 15:06:58 +0800 Subject: [PATCH] add DeviceLimit to V2RaySocks --- api/v2raysocks/v2raysocks.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/api/v2raysocks/v2raysocks.go b/api/v2raysocks/v2raysocks.go index e7fe1c60..000c1cb4 100644 --- a/api/v2raysocks/v2raysocks.go +++ b/api/v2raysocks/v2raysocks.go @@ -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("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("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("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