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/sub
diff options
context:
space:
mode:
authorIlya Kryuchkov <42733472+kr-ilya@users.noreply.github.com>2026-01-05 07:54:56 +0300
committerGitHub <noreply@github.com>2026-01-05 07:54:56 +0300
commit6041d10e3d5d8b0021dd596bdee8f0064a495f80 (patch)
tree897ac55d8389dfea859e6071d08c56f97e843a09 /sub
parent4800f8fb706a092a38255ee70904227238b2a6f6 (diff)
Refactor code and fix linter warnings (#3627)
* refactor: use any instead of empty interface * refactor: code cleanup
Diffstat (limited to 'sub')
-rw-r--r--sub/subJsonService.go6
-rw-r--r--sub/subService.go11
2 files changed, 7 insertions, 10 deletions
diff --git a/sub/subJsonService.go b/sub/subJsonService.go
index 86a7a405..8222491a 100644
--- a/sub/subJsonService.go
+++ b/sub/subJsonService.go
@@ -4,6 +4,7 @@ import (
_ "embed"
"encoding/json"
"fmt"
+ "maps"
"strings"
"github.com/mhsanaei/3x-ui/v2/database/model"
@@ -197,9 +198,8 @@ func (s *SubJsonService) getConfig(inbound *model.Inbound, client model.Client,
newOutbounds = append(newOutbounds, s.defaultOutbounds...)
newConfigJson := make(map[string]any)
- for key, value := range s.configJson {
- newConfigJson[key] = value
- }
+ maps.Copy(newConfigJson, s.configJson)
+
newConfigJson["outbounds"] = newOutbounds
newConfigJson["remarks"] = s.SubService.genRemark(inbound, client.Email, extPrxy["remark"].(string))
diff --git a/sub/subService.go b/sub/subService.go
index ade871df..e046ebb4 100644
--- a/sub/subService.go
+++ b/sub/subService.go
@@ -484,8 +484,8 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string {
externalProxies, _ := stream["externalProxy"].([]any)
if len(externalProxies) > 0 {
- links := ""
- for index, externalProxy := range externalProxies {
+ links := make([]string, 0, len(externalProxies))
+ for _, externalProxy := range externalProxies {
ep, _ := externalProxy.(map[string]any)
newSecurity, _ := ep["forceTls"].(string)
dest, _ := ep["dest"].(string)
@@ -511,12 +511,9 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string {
url.Fragment = s.genRemark(inbound, email, ep["remark"].(string))
- if index > 0 {
- links += "\n"
- }
- links += url.String()
+ links = append(links, url.String())
}
- return links
+ return strings.Join(links, "\n")
}
link := fmt.Sprintf("vless://%s@%s:%d", uuid, address, port)