mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 09:36:34 -05:00
Feat: add bytes support to v5 configuration
This commit is contained in:
parent
28d197b6f3
commit
2e1d542a5c
@ -1,6 +1,7 @@
|
||||
package v5cfg
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
|
||||
core "github.com/v2fly/v2ray-core/v5"
|
||||
@ -30,6 +31,15 @@ func init() {
|
||||
return nil, err
|
||||
}
|
||||
return loadJSONConfig(data)
|
||||
case []byte:
|
||||
r := &json.Reader{
|
||||
Reader: bytes.NewReader(v),
|
||||
}
|
||||
data, err := buf.ReadAllToBytes(r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return loadJSONConfig(data)
|
||||
case io.Reader:
|
||||
data, err := buf.ReadAllToBytes(&json.Reader{
|
||||
Reader: v,
|
||||
|
Loading…
Reference in New Issue
Block a user