mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-25 18:11:27 +00:00
XTLS Vision supports acceptProxyProtocol (test needed)
Fixes https://github.com/XTLS/Xray-core/issues/1339
This commit is contained in:
parent
9bc1564b0a
commit
8c0d3c0257
|
@ -13,6 +13,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/pires/go-proxyproto"
|
||||||
"github.com/xtls/xray-core/common"
|
"github.com/xtls/xray-core/common"
|
||||||
"github.com/xtls/xray-core/common/buf"
|
"github.com/xtls/xray-core/common/buf"
|
||||||
"github.com/xtls/xray-core/common/errors"
|
"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
|
var p uintptr
|
||||||
if tlsConn, ok := iConn.(*tls.Conn); ok {
|
if tlsConn, ok := iConn.(*tls.Conn); ok {
|
||||||
netConn = tlsConn.NetConn()
|
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 {
|
if sc, ok := netConn.(syscall.Conn); ok {
|
||||||
rawConn, _ = sc.SyscallConn()
|
rawConn, _ = sc.SyscallConn()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue