Skip to content

Commit

Permalink
XRV should work without rawConn
Browse files Browse the repository at this point in the history
  • Loading branch information
maskedeken authored and yuhan6665 committed Jun 22, 2023
1 parent 828a632 commit 6d8fe73
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion proxy/vless/encoding/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,11 @@ func XtlsRead(reader buf.Reader, writer buf.Writer, timer signal.ActivityUpdater
}
}
}
reader = buf.NewReadVReader(conn, rawConn, nil)
if rawConn != nil {
reader = buf.NewReadVReader(conn, rawConn, nil)
} else {
reader = buf.NewReader(conn)
}
ct = counter
newError("XtlsRead readV").WriteToLog(session.ExportIDToError(ctx))
}
Expand Down
4 changes: 2 additions & 2 deletions proxy/vless/inbound/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s

var err error

if rawConn != nil {
if requestAddons.Flow == vless.XRV {
var counter stats.Counter
if statConn != nil {
counter = statConn.ReadCounter
Expand Down Expand Up @@ -591,7 +591,7 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s
}

var err error
if rawConn != nil && requestAddons.Flow == vless.XRV {
if requestAddons.Flow == vless.XRV {
var counter stats.Counter
if statConn != nil {
counter = statConn.WriteCounter
Expand Down
4 changes: 2 additions & 2 deletions proxy/vless/outbound/outbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
}

var err error
if rawConn != nil && requestAddons.Flow == vless.XRV {
if requestAddons.Flow == vless.XRV {
if tlsConn, ok := iConn.(*tls.Conn); ok {
if tlsConn.ConnectionState().Version != gotls.VersionTLS13 {
return newError(`failed to use `+requestAddons.Flow+`, found outer tls version `, tlsConn.ConnectionState().Version).AtWarning()
Expand Down Expand Up @@ -292,7 +292,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
serverReader = xudp.NewPacketReader(conn)
}

if rawConn != nil {
if requestAddons.Flow == vless.XRV {
var counter stats.Counter
if statConn != nil {
counter = statConn.ReadCounter
Expand Down

0 comments on commit 6d8fe73

Please sign in to comment.