From 8c0d3c02570a73cd55f4f61025701bad7cb63c08 Mon Sep 17 00:00:00 2001 From: RPRX <63339210+RPRX@users.noreply.github.com> Date: Sat, 7 Jan 2023 11:01:53 +0000 Subject: [PATCH] XTLS Vision supports acceptProxyProtocol (test needed) Fixes https://github.com/XTLS/Xray-core/issues/1339 --- proxy/vless/inbound/inbound.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/proxy/vless/inbound/inbound.go b/proxy/vless/inbound/inbound.go index aa63a95b..b623fe6e 100644 --- a/proxy/vless/inbound/inbound.go +++ b/proxy/vless/inbound/inbound.go @@ -13,6 +13,7 @@ import ( "time" "unsafe" + "github.com/pires/go-proxyproto" "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/errors" @@ -471,6 +472,10 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s var p uintptr if tlsConn, ok := iConn.(*tls.Conn); ok { netConn = tlsConn.NetConn() + if pc, ok := netConn.(*proxyproto.Conn); ok { + netConn = pc.Raw() + // 8192 > 4096, there is no need to process pc's bufReader + } if sc, ok := netConn.(syscall.Conn); ok { rawConn, _ = sc.SyscallConn() }