From b0bf0d7fd5e4942b063fd8f9d2080944189c803f Mon Sep 17 00:00:00 2001 From: Allo Date: Fri, 22 Dec 2023 17:42:04 +0800 Subject: [PATCH] fix(conf): add Windows support for Unix Domain Socket --- infra/conf/xray.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/infra/conf/xray.go b/infra/conf/xray.go index 0935b1b0..10944826 100644 --- a/infra/conf/xray.go +++ b/infra/conf/xray.go @@ -5,6 +5,7 @@ import ( "fmt" "log" "os" + "path/filepath" "strings" "github.com/xtls/xray-core/app/dispatcher" @@ -188,7 +189,7 @@ func (c *InboundDetourConfig) Build() (*core.InboundHandlerConfig, error) { } else { // Listen on specific IP or Unix Domain Socket receiverSettings.Listen = c.ListenOn.Build() - listenDS := c.ListenOn.Family().IsDomain() && (c.ListenOn.Domain()[0] == '/' || c.ListenOn.Domain()[0] == '@') + listenDS := c.ListenOn.Family().IsDomain() && (filepath.IsAbs(c.ListenOn.Domain()) || c.ListenOn.Domain()[0] == '@') listenIP := c.ListenOn.Family().IsIP() || (c.ListenOn.Family().IsDomain() && c.ListenOn.Domain() == "localhost") if listenIP { // Listen on specific IP, must set PortList