Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/web/job
diff options
context:
space:
mode:
authormhsanaei <ho3ein.sanaei@gmail.com>2025-03-12 22:13:51 +0300
committermhsanaei <ho3ein.sanaei@gmail.com>2025-03-12 22:43:43 +0300
commit0bde51b91ea505e38569ae3cbe575695abd2db60 (patch)
tree3d27346586f5802d12cdbb7a1fe95c2b5d46156f /web/job
parent280a22b57d14a372d99bcc49add515721290678b (diff)
Refactor: Use any instead of interface{}
Diffstat (limited to 'web/job')
-rw-r--r--web/job/check_client_ip_job.go9
-rw-r--r--web/job/xray_traffic_job.go2
2 files changed, 3 insertions, 8 deletions
diff --git a/web/job/check_client_ip_job.go b/web/job/check_client_ip_job.go
index c960268d..b95c8ee2 100644
--- a/web/job/check_client_ip_job.go
+++ b/web/job/check_client_ip_job.go
@@ -11,6 +11,7 @@ import (
"sort"
"time"
+ "slices"
"x-ui/database"
"x-ui/database/model"
"x-ui/logger"
@@ -193,13 +194,7 @@ func (j *CheckClientIpJob) checkError(e error) {
}
func (j *CheckClientIpJob) contains(s []string, str string) bool {
- for _, v := range s {
- if v == str {
- return true
- }
- }
-
- return false
+ return slices.Contains(s, str)
}
func (j *CheckClientIpJob) getInboundClientIps(clientEmail string) (*model.InboundClientIps, error) {
diff --git a/web/job/xray_traffic_job.go b/web/job/xray_traffic_job.go
index 12c64092..76022bc9 100644
--- a/web/job/xray_traffic_job.go
+++ b/web/job/xray_traffic_job.go
@@ -52,7 +52,7 @@ func (j *XrayTrafficJob) informTrafficToExternalAPI(inboundTraffics []*xray.Traf
logger.Warning("get ExternalTrafficInformURI failed:", err)
return
}
- requestBody, err := json.Marshal(map[string]interface{}{"clientTraffics": clientTraffics, "inboundTraffics": inboundTraffics})
+ requestBody, err := json.Marshal(map[string]any{"clientTraffics": clientTraffics, "inboundTraffics": inboundTraffics})
if err != nil {
logger.Warning("parse client/inbound traffic failed:", err)
return