|
@@ -127,6 +127,7 @@ func NewHysteria2(ctx context.Context, router adapter.Router, logger log.Context
|
|
func (h *Hysteria2) newConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext) error {
|
|
func (h *Hysteria2) newConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext) error {
|
|
ctx = log.ContextWithNewID(ctx)
|
|
ctx = log.ContextWithNewID(ctx)
|
|
metadata = h.createMetadata(conn, metadata)
|
|
metadata = h.createMetadata(conn, metadata)
|
|
|
|
+ h.logger.InfoContext(ctx, "inbound connection from ", metadata.Source)
|
|
userID, _ := auth.UserFromContext[int](ctx)
|
|
userID, _ := auth.UserFromContext[int](ctx)
|
|
if userName := h.userNameList[userID]; userName != "" {
|
|
if userName := h.userNameList[userID]; userName != "" {
|
|
metadata.User = userName
|
|
metadata.User = userName
|
|
@@ -140,6 +141,7 @@ func (h *Hysteria2) newConnection(ctx context.Context, conn net.Conn, metadata a
|
|
func (h *Hysteria2) newPacketConnection(ctx context.Context, conn N.PacketConn, metadata adapter.InboundContext) error {
|
|
func (h *Hysteria2) newPacketConnection(ctx context.Context, conn N.PacketConn, metadata adapter.InboundContext) error {
|
|
ctx = log.ContextWithNewID(ctx)
|
|
ctx = log.ContextWithNewID(ctx)
|
|
metadata = h.createPacketMetadata(conn, metadata)
|
|
metadata = h.createPacketMetadata(conn, metadata)
|
|
|
|
+ h.logger.InfoContext(ctx, "inbound packet connection from ", metadata.Source)
|
|
userID, _ := auth.UserFromContext[int](ctx)
|
|
userID, _ := auth.UserFromContext[int](ctx)
|
|
if userName := h.userNameList[userID]; userName != "" {
|
|
if userName := h.userNameList[userID]; userName != "" {
|
|
metadata.User = userName
|
|
metadata.User = userName
|