From 08301e272c8989ada2087751f92809911b603213 Mon Sep 17 00:00:00 2001 From: hexband <1512655+hexband@users.noreply.github.com> Date: Sat, 4 Apr 2026 00:26:25 +0300 Subject: [PATCH] Hysteria inbound: Unwrap stats conn before extracting user (#5870) Fixes https://github.com/XTLS/Xray-core/issues/5868 --- proxy/hysteria/server.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/proxy/hysteria/server.go b/proxy/hysteria/server.go index dcb99e92..43596b6d 100644 --- a/proxy/hysteria/server.go +++ b/proxy/hysteria/server.go @@ -83,10 +83,12 @@ func (s *Server) Process(ctx context.Context, network net.Network, conn stat.Con inbound.Name = "hysteria" inbound.CanSpliceCopy = 3 + iConn := stat.TryUnwrapStatsConn(conn) + var useremail string var userlevel uint32 type User interface{ User() *protocol.MemoryUser } - if v, ok := conn.(User); ok { + if v, ok := iConn.(User); ok { inbound.User = v.User() if inbound.User != nil { useremail = inbound.User.Email @@ -94,7 +96,6 @@ func (s *Server) Process(ctx context.Context, network net.Network, conn stat.Con } } - iConn := stat.TryUnwrapStatsConn(conn) if _, ok := iConn.(*hysteria.InterUdpConn); ok { r := io.Reader(conn) b := make([]byte, MaxUDPSize)