1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-25 19:45:38 -05:00

get rid off ioutil

This commit is contained in:
Darien Raymond
2017-11-04 01:33:28 +01:00
parent ba16987a07
commit 4412d73b28
2 changed files with 43 additions and 4 deletions

View File

@@ -2,10 +2,11 @@ package core
import (
"io"
"io/ioutil"
"v2ray.com/core/common"
"v2ray.com/core/common/buf"
"github.com/golang/protobuf/proto"
"v2ray.com/core/common"
)
// ConfigLoader is an utility to load V2Ray config from external source.
@@ -30,7 +31,10 @@ func LoadConfig(format ConfigFormat, input io.Reader) (*Config, error) {
func loadProtobufConfig(input io.Reader) (*Config, error) {
config := new(Config)
data, _ := ioutil.ReadAll(input)
data, err := buf.ReadAllToBytes(input)
if err != nil {
return nil, err
}
if err := proto.Unmarshal(data, config); err != nil {
return nil, err
}