-
Notifications
You must be signed in to change notification settings - Fork 189
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
Bugfix: track the keyID for UDP connections #97
Conversation
This is important for applying usage limits to UDP streams. It also fixes a bug in metrics reporting, because the shared metrics are not tolerant of proxy<->target traffic that lacks a keyID.
service/udp_test.go
Outdated
t.Errorf("Expected 2 reports, not %v", metrics.upstreamPackets) | ||
} | ||
for _, report := range metrics.upstreamPackets { | ||
if report.clientProxyBytes == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to use testify to make the assertions more concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
if metrics.natEntriesAdded != 0 { | ||
t.Error("Unexpected NAT entry on rejected packet") | ||
metrics := sendToDiscard(payloads, onet.RequirePublicIP) | ||
assert.Equal(t, 0, metrics.natEntriesAdded, "Unexpected NAT entry on rejected packet") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, assert doesn't stop the execution. For that you may want require.Equal()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to stop execution if this fails.
Could you start a v1.3.3 release after you merge? I should include this on next weeks release. |
This is important for applying usage limits to UDP streams. It also
fixes a bug in metrics reporting, because the shared metrics are not
tolerant of proxy<->target traffic that lacks a keyID.