Clean up measure test config (#80)

- only outbound, dispatcher, log module is needed
- core app register order does not matter
This commit is contained in:
yuhan6665 authored and GitHub committed 2024-12-29 14:11:08 +08:00
1 parent afe477fb5e
commit bba66dc9f1
1 file changed
+8 -1
+8 -1
View File
@@ -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 {