1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-08 02:16:28 -05:00
v2fly/proxy/internal/config/json/json.go

17 lines
359 B
Go

package json
import (
"encoding/json"
"github.com/v2ray/v2ray-core/common/log"
)
func JsonConfigLoader(newConfig func() interface{}) func(data []byte) (interface{}, error) {
return func(data []byte) (interface{}, error) {
obj := newConfig()
log.Debug("Unmarshalling JSON: %s", string(data))
err := json.Unmarshal(data, obj)
return obj, err
}
}