mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-11-27 12:00:07 +00:00
VLESS Multiplex, Reverse Proxy: Refactor to move code into VLESS; Mux only uses settings.multiplex in VLESS/VMess outbound (#7364)
https://github.com/XTLS/Xray-core/pull/6748#issuecomment-5752780799 https://github.com/XTLS/Xray-core/issues/7240#issuecomment-6439951754 https://github.com/XTLS/Xray-core/pull/4231#issuecomment-6679992732 https://github.com/XTLS/Xray-core/pull/7355#issuecomment-6739539943 https://github.com/XTLS/Xray-core/pull/7359#issuecomment-6742147165 https://github.com/XTLS/Xray-core/pull/7364#issuecomment-6784892866 https://github.com/XTLS/Xray-core/pull/7364#issuecomment-6812285253 https://github.com/XTLS/Xray-core/pull/7364#issuecomment-6842747639 https://github.com/XTLS/Xray-core/pull/4231#issuecomment-7012427059 https://github.com/XTLS/Xray-core/pull/7364#issuecomment-7108550396 https://github.com/XTLS/Xray-core/pull/7364#issuecomment-7129493942 https://github.com/XTLS/Xray-core/pull/7364#issuecomment-7130454962 --------- Co-authored-by: Codex <codex@users.noreply.github.com> Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
This commit is contained in:
committed by
RPRXX
co-authored by
Codex
RPRX
parent
15b2499d34
commit
e17392a96e
@@ -19,6 +19,7 @@ import (
|
||||
feature_inbound "github.com/xtls/xray-core/features/inbound"
|
||||
"github.com/xtls/xray-core/features/policy"
|
||||
"github.com/xtls/xray-core/features/routing"
|
||||
"github.com/xtls/xray-core/proxy/vless/multiplex"
|
||||
"github.com/xtls/xray-core/proxy/vmess"
|
||||
"github.com/xtls/xray-core/proxy/vmess/encoding"
|
||||
"github.com/xtls/xray-core/transport"
|
||||
@@ -238,7 +239,6 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s
|
||||
if err != nil {
|
||||
return errors.New("failed to start decoding").Base(err)
|
||||
}
|
||||
|
||||
writer := buf.NewBufferedWriter(buf.NewWriter(connection))
|
||||
response := &protocol.ResponseHeader{
|
||||
Command: h.generateCommand(ctx, request),
|
||||
@@ -249,12 +249,14 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s
|
||||
return errors.New("failed to start decoding response").Base(err)
|
||||
}
|
||||
writer.SetFlushNext()
|
||||
link := &transport.Link{Reader: bodyReader, Writer: bodyWriter}
|
||||
|
||||
if err := dispatcher.DispatchLink(ctx, request.Destination(), &transport.Link{
|
||||
Reader: bodyReader,
|
||||
Writer: bodyWriter,
|
||||
},
|
||||
); err != nil {
|
||||
if request.Command == protocol.RequestCommandMux {
|
||||
worker := multiplex.NewServerWorker(ctx, dispatcher.DispatchLink, link)
|
||||
<-worker.WaitClosed()
|
||||
return worker.Err()
|
||||
}
|
||||
if err := dispatcher.DispatchLink(ctx, request.Destination(), link); err != nil {
|
||||
return errors.New("failed to dispatch request").Base(err)
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user