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

Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
@cohosh
Copy link
Owner

@cohosh cohosh commented Nov 20, 2019

Implements https://trac.torproject.org/projects/tor/ticket/31157

@@ -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

@NullHypothesis NullHypothesis Nov 25, 2019

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

Copy link
Owner Author

@cohosh cohosh Nov 25, 2019

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

@NullHypothesis NullHypothesis Nov 27, 2019

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

@NullHypothesis NullHypothesis Nov 25, 2019

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

@cohosh cohosh Nov 26, 2019

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

@NullHypothesis NullHypothesis Nov 25, 2019

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

@cohosh cohosh Nov 26, 2019

Yep, fixed :)

)

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

@NullHypothesis NullHypothesis Nov 25, 2019

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

@cohosh cohosh Nov 25, 2019

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

@NullHypothesis NullHypothesis Nov 25, 2019

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

@cohosh cohosh Nov 26, 2019

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

@NullHypothesis NullHypothesis Nov 25, 2019

The comment should probably also mention the proxy type.

Copy link
Owner Author

@cohosh cohosh Nov 26, 2019

Added.

@cohosh
Copy link
Owner Author

@cohosh cohosh commented Nov 26, 2019

Okay I pushed an update, thanks!

@cohosh cohosh closed this Dec 6, 2019
@cohosh cohosh deleted the bug31157 branch Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment