From 9da4339d8af0cf20054d3e3da6188adc3e8628f5 Mon Sep 17 00:00:00 2001 From: lucifer9 Date: Mon, 13 Jul 2020 21:02:19 +0800 Subject: [PATCH] Add access log for dokodemo inbound --- proxy/dokodemo/dokodemo.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/proxy/dokodemo/dokodemo.go b/proxy/dokodemo/dokodemo.go index 33930cc4..c351b437 100644 --- a/proxy/dokodemo/dokodemo.go +++ b/proxy/dokodemo/dokodemo.go @@ -12,6 +12,7 @@ import ( "v2ray.com/core" "v2ray.com/core/common" "v2ray.com/core/common/buf" + "v2ray.com/core/common/log" "v2ray.com/core/common/net" "v2ray.com/core/common/protocol" "v2ray.com/core/common/session" @@ -106,6 +107,14 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn in } } + ctx = log.ContextWithAccessMessage(ctx, &log.AccessMessage{ + From: conn.RemoteAddr(), + To: dest, + Status: log.AccessAccepted, + Reason: "", + }) + newError("received request for ", conn.RemoteAddr()).WriteToLog(session.ExportIDToError(ctx)) + plcy := d.policy() ctx, cancel := context.WithCancel(ctx) timer := signal.CancelAfterInactivity(ctx, cancel, plcy.Timeouts.ConnectionIdle)