Unify environment var readers

This commit is contained in:
yuhan6665 2023-10-28 17:24:54 -04:00
parent e241e5bda6
commit 4f05e0ac2b
9 changed files with 32 additions and 23 deletions

View file

@ -2,11 +2,11 @@ package core
import (
"context"
"os"
"reflect"
"sync"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/platform"
"github.com/xtls/xray-core/common/serial"
"github.com/xtls/xray-core/features"
"github.com/xtls/xray-core/features/dns"
@ -181,7 +181,8 @@ func NewWithContext(ctx context.Context, config *Config) (*Instance, error) {
}
func initInstanceWithConfig(config *Config, server *Instance) (bool, error) {
server.ctx = context.WithValue(server.ctx, "cone", os.Getenv("XRAY_CONE_DISABLED") != "true")
server.ctx = context.WithValue(server.ctx, "cone",
platform.NewEnvFlag(platform.UseCone).GetValue(func() string { return "" }) != "true")
if config.Transport != nil {
features.PrintDeprecatedFeatureWarning("global transport settings")