diff --git a/inbound/default.go b/inbound/default.go index b4b529d4..87477a4e 100644 --- a/inbound/default.go +++ b/inbound/default.go @@ -177,7 +177,7 @@ func (a *myInboundAdapter) loopTCPIn() { if err != nil { return } - go a.injectTCP(conn) + go a.injectTCP(conn, adapter.InboundContext{}) } } @@ -199,9 +199,9 @@ func (a *myInboundAdapter) createMetadata(conn net.Conn, metadata adapter.Inboun return metadata } -func (a *myInboundAdapter) injectTCP(conn net.Conn) { +func (a *myInboundAdapter) injectTCP(conn net.Conn, metadata adapter.InboundContext) { ctx := log.ContextWithNewID(a.ctx) - metadata := a.createMetadata(conn, adapter.InboundContext{}) + metadata = a.createMetadata(conn, metadata) a.logger.InfoContext(ctx, "inbound connection from ", metadata.Source) hErr := a.connHandler.NewConnection(ctx, conn, metadata) if hErr != nil { diff --git a/inbound/trojan.go b/inbound/trojan.go index 7255a84f..30a3a484 100644 --- a/inbound/trojan.go +++ b/inbound/trojan.go @@ -146,7 +146,7 @@ func (h *Trojan) Close() error { } func (h *Trojan) newTransportConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext) error { - h.injectTCP(conn) + h.injectTCP(conn, metadata) return nil } diff --git a/inbound/vmess.go b/inbound/vmess.go index 6ba8a4c7..4d5ce743 100644 --- a/inbound/vmess.go +++ b/inbound/vmess.go @@ -126,7 +126,7 @@ func (h *VMess) Close() error { } func (h *VMess) newTransportConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext) error { - h.injectTCP(conn) + h.injectTCP(conn, metadata) return nil }