1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-21 15:05:23 +00:00

added build context to V5 conf

This commit is contained in:
Shelikhoo 2021-09-04 21:46:10 +01:00
parent 62f71c80ca
commit ae46fb7b28
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316

View File

@ -7,7 +7,10 @@ import (
core "github.com/v2fly/v2ray-core/v4"
"github.com/v2fly/v2ray-core/v4/app/dispatcher"
"github.com/v2fly/v2ray-core/v4/app/proxyman"
"github.com/v2fly/v2ray-core/v4/common/platform"
"github.com/v2fly/v2ray-core/v4/common/serial"
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon"
"github.com/v2fly/v2ray-core/v4/infra/conf/geodata"
"github.com/v2fly/v2ray-core/v4/infra/conf/synthetic/log"
"google.golang.org/protobuf/types/known/anypb"
)
@ -81,7 +84,19 @@ func loadJsonConfig(data []byte) (*core.Config, error) {
return nil, newError("unable to load json").Base(err)
}
message, err := rootConfig.BuildV5(context.TODO())
buildctx := cfgcommon.NewConfigureLoadingContext(context.Background())
geoloadername := platform.NewEnvFlag("v2ray.conf.geoloader").GetValue(func() string {
return "standard"
})
if loader, err := geodata.GetGeoDataLoader(geoloadername); err == nil {
cfgcommon.SetGeoDataLoader(buildctx, loader)
} else {
return nil, newError("unable to create geo data loader ").Base(err)
}
message, err := rootConfig.BuildV5(buildctx)
if err != nil {
return nil, newError("unable to build config").Base(err)
}