From 06fe1982431b1f804f6a0aa7c4eeb6c8d77b5339 Mon Sep 17 00:00:00 2001 From: thh1451 <119903652+thh1451@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:57:19 +0800 Subject: [PATCH] add DeviceLimit to V2RaySocks (#622) --- 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..0ae98440 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("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