From 8ca8a7126b6074906f8876944865195c376b6e9f Mon Sep 17 00:00:00 2001 From: RPRX <63339210+rprx@users.noreply.github.com> Date: Thu, 11 Feb 2021 11:33:08 +0000 Subject: [PATCH] Add XUDP support by simply renaming vudp to xudp https://t.me/projectXray/243505 --- common/{vudp/vudp.go => xudp/xudp.go} | 2 +- proxy/vless/outbound/outbound.go | 6 +++--- proxy/vmess/outbound/outbound.go | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) rename common/{vudp/vudp.go => xudp/xudp.go} (99%) diff --git a/common/vudp/vudp.go b/common/xudp/xudp.go similarity index 99% rename from common/vudp/vudp.go rename to common/xudp/xudp.go index 434f8063..80a35e41 100644 --- a/common/vudp/vudp.go +++ b/common/xudp/xudp.go @@ -1,4 +1,4 @@ -package vudp +package xudp import ( "io" diff --git a/proxy/vless/outbound/outbound.go b/proxy/vless/outbound/outbound.go index 88720436..543595f7 100644 --- a/proxy/vless/outbound/outbound.go +++ b/proxy/vless/outbound/outbound.go @@ -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 { diff --git a/proxy/vmess/outbound/outbound.go b/proxy/vmess/outbound/outbound.go index 0e35be26..854f3e8b 100644 --- a/proxy/vmess/outbound/outbound.go +++ b/proxy/vmess/outbound/outbound.go @@ -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))