mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-10 02:53:12 +00:00
Fix user from stream packet conn
This commit is contained in:
parent
4d2185a2d4
commit
9e67f3b4a5
|
@ -102,6 +102,12 @@ func (a *myInboundAdapter) newUserConnection(ctx context.Context, conn net.Conn,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *myInboundAdapter) streamUserPacketConnection(ctx context.Context, conn N.PacketConn, metadata adapter.InboundContext) error {
|
func (a *myInboundAdapter) streamUserPacketConnection(ctx context.Context, conn N.PacketConn, metadata adapter.InboundContext) error {
|
||||||
a.logger.InfoContext(ctx, "inbound packet connection to ", metadata.Destination)
|
user, loaded := auth.UserFromContext[string](ctx)
|
||||||
|
if !loaded {
|
||||||
|
a.logger.InfoContext(ctx, "inbound packet connection to ", metadata.Destination)
|
||||||
|
return a.router.RoutePacketConnection(ctx, conn, metadata)
|
||||||
|
}
|
||||||
|
metadata.User = user
|
||||||
|
a.logger.InfoContext(ctx, "[", user, "] inbound packet connection to ", metadata.Destination)
|
||||||
return a.router.RoutePacketConnection(ctx, conn, metadata)
|
return a.router.RoutePacketConnection(ctx, conn, metadata)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue