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

Bug31157 #13

Closed
wants to merge 0 commits into from
Closed

Bug31157 #13

wants to merge 0 commits into from

Conversation

cohosh
Copy link
Owner

@cohosh cohosh commented Nov 20, 2019

@@ -408,7 +408,6 @@ func TestMetrics(t *testing.T) {
w := httptest.NewRecorder()
data := bytes.NewReader([]byte("{\"Sid\":\"ymbcCMto7KHNGYlp\",\"Version\":\"1.0\"}"))
r, err := http.NewRequest("POST", "snowflake.broker/proxy", data)
r.Header.Set("X-Session-ID", "test")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why are we removing the X-Session-ID headers in the tests?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't actually related to this commit, but we removed the use of X-Session-ID headers previously. See: https://gitweb.torproject.org/pluggable-transports/snowflake.git/commit/?id=c4ae64905b69512e50587c1ee749cddfc0937a4c

I caught that this was still there and figured I could remove it while I was modifying the file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. I would suggest to move unrelated changes to separate commits in the future, to make the commit history easier to follow.

@@ -19,6 +19,24 @@ We export metrics in the following format:
A count of the total number of unique IP addresses of snowflake
proxies that have polled.

"snowflake-ips-standalone" NUM NL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we also add this to our specification in doc/broker-spec.txt? In fact, we may want to put the metrics specification in one place only, and link to it from other places.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I put it all in doc/broker-spec.txt and linked to it from metrics.go

@@ -10,6 +10,7 @@ over the offer and answer channels.
*/
type Snowflake struct {
id string
ptype string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Can we call this (and other variables) proxyType instead of ptype? I think it would make the code a bit more accessible.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, fixed :)

)

const version = "1.0"
const version = "1.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we decide if we increment the major or the minor version number here? I assume this patch set is backwards-compatible, so we're only increasing the minor version number?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was thinking of using major versions for changes that are not backwards compatible with proxies running a lower version.

Version: 1.0
Sid: [generated session id of proxy],
Version: 1.1,
Type: [badge|webext|standalone]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Maybe we want this to be Type: ["badge"|"webext"|"standalone"] instead, to make it clear that these are string literals.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

return json.Marshal(ProxyPollRequest{
Sid: sid,
Version: version,
Type: ptype,
})
}

// Decodes a poll message from a snowflake proxy and returns the
// sid of the proxy on success and an error if it failed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment should probably also mention the proxy type.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

@cohosh
Copy link
Owner Author

cohosh commented Nov 26, 2019

Okay I pushed an update, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants