1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-04-18 11:39:11 -04:00

main loads multiple

This commit is contained in:
vcptr
2019-12-14 22:24:32 +08:00
parent 904db6bd61
commit 1e76123a4c
9 changed files with 118 additions and 96 deletions

View File

@@ -3,7 +3,9 @@ package json
//go:generate errorgen
import (
"encoding/json"
"io"
"io/ioutil"
"v2ray.com/core"
"v2ray.com/core/common"
@@ -16,7 +18,10 @@ func init() {
Name: "JSON",
Extension: []string{"json"},
Loader: func(input io.Reader) (*core.Config, error) {
jsonContent, err := ctlcmd.Run([]string{"config"}, input)
fns := []string{}
data, _ := ioutil.ReadAll(input)
json.Unmarshal(data, &fns)
jsonContent, err := ctlcmd.Run(append([]string{"config"}, fns...), nil)
if err != nil {
return nil, newError("failed to execute v2ctl to convert config file.").Base(err).AtWarning()
}