Fallback: default dest 127.0.0.1 > localhost

Fix https://github.com/XTLS/Xray-examples/issues/234
This commit is contained in:
xqzr 2025-06-25 04:42:59 +08:00 committed by GitHub
parent cb1afb33e6
commit 2203dbb34e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -111,7 +111,7 @@ func (c *VLessInboundConfig) Build() (proto.Message, error) {
} }
} else { } else {
if _, err := strconv.Atoi(fb.Dest); err == nil { 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 { if _, _, err := net.SplitHostPort(fb.Dest); err == nil {
fb.Type = "tcp" fb.Type = "tcp"