Access accounting observed, not reported #45
No reviewers
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
mikluko/multiproxy!45
Loading…
Reference in a new issue
No description provided.
Delete branch "refactor/observed-accounting"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Candidate 3 of the architecture review.
Handlers pushed status and byte counts into the log context, ten calls across three handlers, and a handler that forgot one logged no status. That happened for errors multiproxy answered itself and for refused
CONNECTrequests.Unwrap, and records status and body bytes itself.HTTPHandlerloses itsio.Pipe, WaitGroup, context key andModifyResponsehook, which existed only to measure content length.CONNECTsessions: recorded in the one accept step (connectAcceptor): status 200 on accept, bytes written to the client when the connection closes. AConnectAcceptorsits behindUnwrap, out of reach of a ResponseWriter hook, so the middleware alone could not see SOCKS sessions.Tunnel and MITM no longer report anything to the log.
log.WithStatusCodeandlog.WithContentLengthstay, and override what was observed.TestAccessAccountingcovers plain HTTP, tunnel, MITM and a refusedCONNECT; the last fails onmain.TestLogObservesTheResponsecovers the middleware. The suite passes three times in a row under-race.