1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-30 15:56:28 -04:00
v2fly/infra/conf/v5cfg/common.go
2021-09-05 16:37:27 +01:00

17 lines
581 B
Go

package v5cfg
import (
"context"
"encoding/json"
"github.com/golang/protobuf/proto"
"github.com/v2fly/v2ray-core/v4/common/environment/envctx"
"github.com/v2fly/v2ray-core/v4/common/environment/envimpl"
"github.com/v2fly/v2ray-core/v4/common/registry"
)
func loadHeterogeneousConfigFromRawJson(interfaceType, name string, rawJson json.RawMessage) (proto.Message, error) {
fsdef := envimpl.NewDefaultFileSystemDefaultImpl()
ctx := envctx.ContextWithEnvironment(context.TODO(), fsdef)
return registry.LoadImplementationByAlias(ctx, interfaceType, name, []byte(rawJson))
}