mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-21 15:08:08 +00:00
revert back to multiconfig
This commit is contained in:
1 parent
bda694dd8e
commit
8896ffdea8
19 files changed
+557
-83
No files matched your search
@@ -38,7 +38,9 @@ func findOffset(b []byte, o int) *offset {
|
||||
return &offset{line: line, char: char}
|
||||
}
|
||||
|
||||
func LoadJSONConfig(reader io.Reader) (*core.Config, error) {
|
||||
// DecodeJSONConfig reads from reader and decode the config into *conf.Config
|
||||
// syntax error could be detected.
|
||||
func DecodeJSONConfig(reader io.Reader) (*conf.Config, error) {
|
||||
jsonConfig := &conf.Config{}
|
||||
|
||||
jsonContent := bytes.NewBuffer(make([]byte, 0, 10240))
|
||||
@@ -62,6 +64,15 @@ func LoadJSONConfig(reader io.Reader) (*core.Config, error) {
|
||||
return nil, newError("failed to read config file").Base(err)
|
||||
}
|
||||
|
||||
return jsonConfig, nil
|
||||
}
|
||||
|
||||
func LoadJSONConfig(reader io.Reader) (*core.Config, error) {
|
||||
jsonConfig, err := DecodeJSONConfig(reader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pbConfig, err := jsonConfig.Build()
|
||||
if err != nil {
|
||||
return nil, newError("failed to parse json config").Base(err)
|
||||
|
||||
Reference in new issue
Block a user