From 2203dbb34e494444ed21dd7d0cd2dfc91636fb45 Mon Sep 17 00:00:00 2001 From: xqzr <34030394+xqzr@users.noreply.github.com> Date: Wed, 25 Jun 2025 04:42:59 +0800 Subject: [PATCH 1/4] Fallback: default `dest` 127.0.0.1 > localhost Fix https://github.com/XTLS/Xray-examples/issues/234 --- infra/conf/vless.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infra/conf/vless.go b/infra/conf/vless.go index 27da68dc..5d4ace6f 100644 --- a/infra/conf/vless.go +++ b/infra/conf/vless.go @@ -111,7 +111,7 @@ func (c *VLessInboundConfig) Build() (proto.Message, error) { } } else { if _, err := strconv.Atoi(fb.Dest); err == nil { - fb.Dest = "127.0.0.1:" + fb.Dest + fb.Dest = "localhost:" + fb.Dest } if _, _, err := net.SplitHostPort(fb.Dest); err == nil { fb.Type = "tcp" From 8d5677059c53ee309c989e12e7ffb4611a43dd15 Mon Sep 17 00:00:00 2001 From: xqzr <34030394+xqzr@users.noreply.github.com> Date: Wed, 25 Jun 2025 04:47:00 +0800 Subject: [PATCH 2/4] Update trojan.go --- infra/conf/trojan.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infra/conf/trojan.go b/infra/conf/trojan.go index 62c8f55b..4a230514 100644 --- a/infra/conf/trojan.go +++ b/infra/conf/trojan.go @@ -155,7 +155,7 @@ func (c *TrojanServerConfig) Build() (proto.Message, error) { } } else { if _, err := strconv.Atoi(fb.Dest); err == nil { - fb.Dest = "127.0.0.1:" + fb.Dest + fb.Dest = "localhost:" + fb.Dest } if _, _, err := net.SplitHostPort(fb.Dest); err == nil { fb.Type = "tcp" From 621c8a03d7dedb0254fca47e62c99e19ddef5b35 Mon Sep 17 00:00:00 2001 From: xqzr <34030394+xqzr@users.noreply.github.com> Date: Wed, 25 Jun 2025 04:48:32 +0800 Subject: [PATCH 3/4] Update transport_internet.go --- infra/conf/transport_internet.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infra/conf/transport_internet.go b/infra/conf/transport_internet.go index d762be32..f6c46efb 100644 --- a/infra/conf/transport_internet.go +++ b/infra/conf/transport_internet.go @@ -544,7 +544,7 @@ func (c *REALITYConfig) Build() (proto.Message, error) { } default: if _, err = strconv.Atoi(s); err == nil { - s = "127.0.0.1:" + s + s = "localhost:" + s } if _, _, err = net.SplitHostPort(s); err == nil { c.Type = "tcp" From 9c435bea19c7cefef066b115fddb9175094039e5 Mon Sep 17 00:00:00 2001 From: xqzr <34030394+xqzr@users.noreply.github.com> Date: Wed, 25 Jun 2025 04:50:02 +0800 Subject: [PATCH 4/4] Update vless_test.go --- infra/conf/vless_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infra/conf/vless_test.go b/infra/conf/vless_test.go index 0f702437..8f1baaa5 100644 --- a/infra/conf/vless_test.go +++ b/infra/conf/vless_test.go @@ -110,7 +110,7 @@ func TestVLessInbound(t *testing.T) { Alpn: "", Path: "", Type: "tcp", - Dest: "127.0.0.1:80", + Dest: "localhost:80", Xver: 0, }, {