Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't calculate tunneltime for unauthenticated connections #209

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions cmd/outline-ss-server/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,13 @@ func (cm *tcpConnMetrics) AddClosed(status string, data metrics.ProxyMetrics, du
cm.tcpServiceMetrics.proxyCollector.addClientTarget(data.ClientProxy, data.ProxyTarget, cm.accessKey, cm.clientInfo)
cm.tcpServiceMetrics.proxyCollector.addTargetClient(data.TargetProxy, data.ProxyClient, cm.accessKey, cm.clientInfo)
cm.tcpServiceMetrics.closeConnection(status, duration, cm.accessKey, cm.clientInfo)
ipKey, err := toIPKey(cm.clientAddr, cm.accessKey)
if err == nil {
cm.tunnelTimeMetrics.stopConnection(*ipKey)
// We only track authenticated TCP connections, so ignore unauthenticated closed connections
// when calculating tunneltime. See https://github.com/Jigsaw-Code/outline-server/issues/1590.
if cm.accessKey != "" {
ipKey, err := toIPKey(cm.clientAddr, cm.accessKey)
if err == nil {
cm.tunnelTimeMetrics.stopConnection(*ipKey)
}
}
}

Expand Down
Loading