mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-10 02:53:11 +00:00
Add XUDP support by simply renaming vudp to xudp
https://t.me/projectXray/243505
This commit is contained in:
parent
1174ff3090
commit
8ca8a7126b
|
@ -1,4 +1,4 @@
|
|||
package vudp
|
||||
package xudp
|
||||
|
||||
import (
|
||||
"io"
|
|
@ -16,7 +16,7 @@ import (
|
|||
"github.com/xtls/xray-core/common/session"
|
||||
"github.com/xtls/xray-core/common/signal"
|
||||
"github.com/xtls/xray-core/common/task"
|
||||
"github.com/xtls/xray-core/common/vudp"
|
||||
"github.com/xtls/xray-core/common/xudp"
|
||||
core "github.com/xtls/xray-core/core"
|
||||
"github.com/xtls/xray-core/features/policy"
|
||||
"github.com/xtls/xray-core/features/stats"
|
||||
|
@ -193,7 +193,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
|
|||
// default: serverWriter := bufferWriter
|
||||
serverWriter := encoding.EncodeBodyAddons(bufferWriter, request, requestAddons)
|
||||
if request.Command == protocol.RequestCommandMux && request.Port == 666 {
|
||||
serverWriter = vudp.NewPacketWriter(serverWriter, target)
|
||||
serverWriter = xudp.NewPacketWriter(serverWriter, target)
|
||||
}
|
||||
if err := buf.CopyOnceTimeout(clientReader, serverWriter, time.Millisecond*100); err != nil && err != buf.ErrNotTimeoutReader && err != buf.ErrReadTimeout {
|
||||
return err // ...
|
||||
|
@ -227,7 +227,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
|
|||
// default: serverReader := buf.NewReader(conn)
|
||||
serverReader := encoding.DecodeBodyAddons(conn, request, responseAddons)
|
||||
if request.Command == protocol.RequestCommandMux && request.Port == 666 {
|
||||
serverReader = vudp.NewPacketReader(conn)
|
||||
serverReader = xudp.NewPacketReader(conn)
|
||||
}
|
||||
|
||||
if rawConn != nil {
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
"github.com/xtls/xray-core/common/session"
|
||||
"github.com/xtls/xray-core/common/signal"
|
||||
"github.com/xtls/xray-core/common/task"
|
||||
"github.com/xtls/xray-core/common/vudp"
|
||||
"github.com/xtls/xray-core/common/xudp"
|
||||
core "github.com/xtls/xray-core/core"
|
||||
"github.com/xtls/xray-core/features/policy"
|
||||
"github.com/xtls/xray-core/proxy/vmess"
|
||||
|
@ -140,7 +140,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
|
|||
bodyWriter := session.EncodeRequestBody(request, writer)
|
||||
bodyWriter2 := bodyWriter
|
||||
if request.Command == protocol.RequestCommandMux && request.Port == 666 {
|
||||
bodyWriter = vudp.NewPacketWriter(bodyWriter, target)
|
||||
bodyWriter = xudp.NewPacketWriter(bodyWriter, target)
|
||||
}
|
||||
if err := buf.CopyOnceTimeout(input, bodyWriter, time.Millisecond*100); err != nil && err != buf.ErrNotTimeoutReader && err != buf.ErrReadTimeout {
|
||||
return newError("failed to write first payload").Base(err)
|
||||
|
@ -175,7 +175,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
|
|||
|
||||
bodyReader := session.DecodeResponseBody(request, reader)
|
||||
if request.Command == protocol.RequestCommandMux && request.Port == 666 {
|
||||
bodyReader = vudp.NewPacketReader(&buf.BufferedReader{Reader: bodyReader})
|
||||
bodyReader = xudp.NewPacketReader(&buf.BufferedReader{Reader: bodyReader})
|
||||
}
|
||||
|
||||
return buf.Copy(bodyReader, output, buf.UpdateActivity(timer))
|
||||
|
|
Loading…
Reference in a new issue