mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-07-05 03:08:54 +00:00
Hysteria inbound: Unwrap stats conn before extracting user (#5870)
Fixes https://github.com/XTLS/Xray-core/issues/5868
This commit is contained in:
@@ -83,10 +83,12 @@ func (s *Server) Process(ctx context.Context, network net.Network, conn stat.Con
|
|||||||
inbound.Name = "hysteria"
|
inbound.Name = "hysteria"
|
||||||
inbound.CanSpliceCopy = 3
|
inbound.CanSpliceCopy = 3
|
||||||
|
|
||||||
|
iConn := stat.TryUnwrapStatsConn(conn)
|
||||||
|
|
||||||
var useremail string
|
var useremail string
|
||||||
var userlevel uint32
|
var userlevel uint32
|
||||||
type User interface{ User() *protocol.MemoryUser }
|
type User interface{ User() *protocol.MemoryUser }
|
||||||
if v, ok := conn.(User); ok {
|
if v, ok := iConn.(User); ok {
|
||||||
inbound.User = v.User()
|
inbound.User = v.User()
|
||||||
if inbound.User != nil {
|
if inbound.User != nil {
|
||||||
useremail = inbound.User.Email
|
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 {
|
if _, ok := iConn.(*hysteria.InterUdpConn); ok {
|
||||||
r := io.Reader(conn)
|
r := io.Reader(conn)
|
||||||
b := make([]byte, MaxUDPSize)
|
b := make([]byte, MaxUDPSize)
|
||||||
|
|||||||
Reference in New Issue
Block a user