From 05ea92b88de9d6a657b52567a3d34b46f1100475 Mon Sep 17 00:00:00 2001 From: patterniha <71074308+patterniha@users.noreply.github.com> Date: Fri, 1 Aug 2025 11:58:43 +0330 Subject: [PATCH 1/2] add 3 alias --- infra/conf/xray.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/infra/conf/xray.go b/infra/conf/xray.go index f1d9fb08030a..e9ef2776bb07 100644 --- a/infra/conf/xray.go +++ b/infra/conf/xray.go @@ -22,6 +22,7 @@ import ( var ( inboundConfigLoader = NewJSONConfigLoader(ConfigCreatorCache{ "dokodemo-door": func() interface{} { return new(DokodemoConfig) }, + "tunnel": func() interface{} { return new(DokodemoConfig) }, "http": func() interface{} { return new(HTTPServerConfig) }, "shadowsocks": func() interface{} { return new(ShadowsocksServerConfig) }, "mixed": func() interface{} { return new(SocksServerConfig) }, @@ -34,8 +35,10 @@ var ( outboundConfigLoader = NewJSONConfigLoader(ConfigCreatorCache{ "blackhole": func() interface{} { return new(BlackholeConfig) }, + "block": func() interface{} { return new(BlackholeConfig) }, "loopback": func() interface{} { return new(LoopbackConfig) }, "freedom": func() interface{} { return new(FreedomConfig) }, + "direct": func() interface{} { return new(FreedomConfig) }, "http": func() interface{} { return new(HTTPClientConfig) }, "shadowsocks": func() interface{} { return new(ShadowsocksClientConfig) }, "socks": func() interface{} { return new(SocksClientConfig) }, From dad19c4b6c40ae2fdbd482f9f7e6c0b295c718fe Mon Sep 17 00:00:00 2001 From: patterniha <71074308+patterniha@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:52:49 +0330 Subject: [PATCH 2/2] add default tag --- infra/conf/xray.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/infra/conf/xray.go b/infra/conf/xray.go index e9ef2776bb07..0b6b1195573f 100644 --- a/infra/conf/xray.go +++ b/infra/conf/xray.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/xtls/xray-core/common/uuid" "log" "os" "path/filepath" @@ -252,6 +253,11 @@ func (c *InboundDetourConfig) Build() (*core.InboundHandlerConfig, error) { return nil, errors.New("failed to build inbound handler for protocol ", c.Protocol).Base(err) } + if c.Tag == "" { + id := uuid.New() + c.Tag = "xray.inbound." + id.String() + } + return &core.InboundHandlerConfig{ Tag: c.Tag, ReceiverSettings: serial.ToTypedMessage(receiverSettings), @@ -351,6 +357,21 @@ func (c *OutboundDetourConfig) Build() (*core.OutboundHandlerConfig, error) { return nil, errors.New("failed to build outbound handler for protocol ", c.Protocol).Base(err) } + if c.Tag == "" { + switch strings.ToLower(c.Protocol) { + case "vless", "vmess", "trojan", "shadowsocks", "wireguard": + c.Tag = "proxy" + case "freedom", "direct": + c.Tag = "direct" + case "blackhole", "block": + c.Tag = "block" + case "dns": + c.Tag = "dns-out" + default: + id := uuid.New() + c.Tag = "xray.outbound." + id.String() + } + } return &core.OutboundHandlerConfig{ SenderSettings: serial.ToTypedMessage(senderSettings), Tag: c.Tag,