Config: Move inbound module initialization to the end (#7284)

Fixes https://github.com/XTLS/Xray-core/pull/7284#issuecomment-6491545028

---------

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
j2rong4cn
2026-10-29 08:34:16 +00:00
committed by GitHub
co-authored by Copilot
parent 2dfee4b842
commit 55eecaed16
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -609,7 +609,6 @@ func (c *Config) Build() (*core.Config, error) {
config := &core.Config{
App: []*serial.TypedMessage{
serial.ToTypedMessage(&dispatcher.Config{}),
serial.ToTypedMessage(&proxyman.InboundConfig{}),
serial.ToTypedMessage(&proxyman.OutboundConfig{}),
},
}
@@ -719,6 +718,9 @@ func (c *Config) Build() (*core.Config, error) {
config.App = append(config.App, serial.ToTypedMessage(r))
}
// Initialize the inbound module last to ensure inbound connections are handled correctly.
config.App = append(config.App, serial.ToTypedMessage(&proxyman.InboundConfig{}))
var inbounds []InboundDetourConfig
if len(c.InboundConfigs) > 0 {
+1 -1
View File
@@ -90,7 +90,6 @@ func TestXrayConfig(t *testing.T) {
AccessLogPath: "/var/log/xray/access.log",
}),
serial.ToTypedMessage(&dispatcher.Config{}),
serial.ToTypedMessage(&proxyman.InboundConfig{}),
serial.ToTypedMessage(&proxyman.OutboundConfig{}),
serial.ToTypedMessage(&router.Config{
DomainStrategy: router.Config_AsIs,
@@ -111,6 +110,7 @@ func TestXrayConfig(t *testing.T) {
},
},
}),
serial.ToTypedMessage(&proxyman.InboundConfig{}),
},
Inbound: []*core.InboundHandlerConfig{
{