From bba66dc9f12c9196fc9332cac4d318d07275a383 Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Sun, 29 Dec 2024 01:11:08 -0500 Subject: [PATCH] Clean up measure test config (#80) - only outbound, dispatcher, log module is needed - core app register order does not matter --- libv2ray_main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libv2ray_main.go b/libv2ray_main.go index 9a66d00..0921d9e 100644 --- a/libv2ray_main.go +++ b/libv2ray_main.go @@ -18,6 +18,7 @@ import ( v2net "github.com/xtls/xray-core/common/net" v2filesystem "github.com/xtls/xray-core/common/platform/filesystem" + "github.com/xtls/xray-core/common/serial" v2core "github.com/xtls/xray-core/core" v2stats "github.com/xtls/xray-core/features/stats" v2serial "github.com/xtls/xray-core/infra/conf/serial" @@ -212,7 +213,13 @@ func MeasureOutboundDelay(ConfigureFileContent string, url string) (int64, error config.Inbound = nil // config.App: (fakedns), log, dispatcher, InboundConfig, OutboundConfig, (stats), router, dns, (policy) // keep only basic features - config.App = config.App[:5] + var essentialApp []*serial.TypedMessage + for _, app := range config.App { + if app.Type == "xray.app.proxyman.OutboundConfig" || app.Type == "xray.app.dispatcher.Config" || app.Type == "xray.app.log.Config" { + essentialApp = append(essentialApp, app) + } + } + config.App = essentialApp inst, err := v2core.New(config) if err != nil {