This commit is contained in:
RPRX 2020-12-04 09:36:16 +08:00
parent ed8d6d743c
commit 16544c18ab
627 changed files with 3247 additions and 2635 deletions

View file

@ -3,12 +3,12 @@ package jsonem
import (
"io"
"github.com/xtls/xray-core/v1/common"
"github.com/xtls/xray-core/v1/common/cmdarg"
"github.com/xtls/xray-core/v1/core"
"github.com/xtls/xray-core/v1/infra/conf"
"github.com/xtls/xray-core/v1/infra/conf/serial"
"github.com/xtls/xray-core/v1/main/confloader"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/cmdarg"
"github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/infra/conf"
"github.com/xtls/xray-core/infra/conf/serial"
"github.com/xtls/xray-core/main/confloader"
)
func init() {
@ -19,12 +19,18 @@ func init() {
switch v := input.(type) {
case cmdarg.Arg:
cf := &conf.Config{}
for _, arg := range v {
for i, arg := range v {
newError("Reading config: ", arg).AtInfo().WriteToLog()
r, err := confloader.LoadConfig(arg)
common.Must(err)
c, err := serial.DecodeJSONConfig(r)
common.Must(err)
if i == 0 {
// This ensure even if the muti-json parser do not support a setting,
// It is still respected automatically for the first configure file
*cf = *c
continue
}
cf.Override(c, arg)
}
return cf.Build()