From 4f8b73bb1f482e04bd5f946e8c1de95a8688dbf1 Mon Sep 17 00:00:00 2001 From: hossinasaadi Date: Sat, 21 Oct 2023 15:43:37 +0400 Subject: [PATCH] fix override Inbounds in multi config --- infra/conf/xray.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/infra/conf/xray.go b/infra/conf/xray.go index 7bfc53e3..c5459c44 100644 --- a/infra/conf/xray.go +++ b/infra/conf/xray.go @@ -489,16 +489,16 @@ func (c *Config) Override(o *Config, fn string) { // update the Inbound in slice if the only one in overide config has same tag if len(o.InboundConfigs) > 0 { - if len(c.InboundConfigs) > 0 && len(o.InboundConfigs) == 1 { - if idx := c.findInboundTag(o.InboundConfigs[0].Tag); idx > -1 { - c.InboundConfigs[idx] = o.InboundConfigs[0] + for i := range o.InboundConfigs { + if idx := c.findInboundTag(o.InboundConfigs[i].Tag); idx > -1 { + c.InboundConfigs[idx] = o.InboundConfigs[i] ctllog.Println("[", fn, "] updated inbound with tag: ", o.InboundConfigs[0].Tag) + } else { - c.InboundConfigs = append(c.InboundConfigs, o.InboundConfigs[0]) + c.InboundConfigs = append(c.InboundConfigs, o.InboundConfigs[i]) ctllog.Println("[", fn, "] appended inbound with tag: ", o.InboundConfigs[0].Tag) } - } else { - c.InboundConfigs = o.InboundConfigs + } }