mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 01:08:33 +00:00
Remove slices dependency. (#2930)
* Remove slices dependency. * Fix nil pointer dereference bug. --------- Co-authored-by: nobody <nobody@nowhere.mars>
This commit is contained in:
parent
2b08d8638e
commit
961cf9d3b1
2 changed files with 31 additions and 26 deletions
|
@ -2,7 +2,6 @@ package core
|
|||
|
||||
import (
|
||||
"io"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/xtls/xray-core/common"
|
||||
|
@ -60,9 +59,12 @@ func GetMergedConfig(args cmdarg.Arg) (string, error) {
|
|||
supported := []string{"json", "yaml", "toml"}
|
||||
for _, file := range args {
|
||||
format := getFormat(file)
|
||||
if slices.Contains(supported, format) {
|
||||
files = append(files, file)
|
||||
formats = append(formats, format)
|
||||
for _, s := range supported {
|
||||
if s == format {
|
||||
files = append(files, file)
|
||||
formats = append(formats, format)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return ConfigMergedFormFiles(files, formats)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue