mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-25 10:01:30 +00:00
Fix missing source address in inbound logs in QUIC inbounds
This commit is contained in:
parent
7fd9abe802
commit
ba67633ee8
|
@ -116,6 +116,7 @@ func NewHysteria(ctx context.Context, router adapter.Router, logger log.ContextL
|
||||||
func (h *Hysteria) newConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext) error {
|
func (h *Hysteria) 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
|
||||||
|
@ -129,6 +130,7 @@ func (h *Hysteria) newConnection(ctx context.Context, conn net.Conn, metadata ad
|
||||||
func (h *Hysteria) newPacketConnection(ctx context.Context, conn N.PacketConn, metadata adapter.InboundContext) error {
|
func (h *Hysteria) 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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -98,6 +98,7 @@ func NewTUIC(ctx context.Context, router adapter.Router, logger log.ContextLogge
|
||||||
func (h *TUIC) newConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext) error {
|
func (h *TUIC) 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
|
||||||
|
@ -111,6 +112,7 @@ func (h *TUIC) newConnection(ctx context.Context, conn net.Conn, metadata adapte
|
||||||
func (h *TUIC) newPacketConnection(ctx context.Context, conn N.PacketConn, metadata adapter.InboundContext) error {
|
func (h *TUIC) 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
|
||||||
|
|
Loading…
Reference in a new issue