-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
poc: rewrite urlgetter using step-by-step
This diff shows how we could incrementally rewrite urlgetter using a step-by-step measurement style. Additionally, this diff modifies the facebook_messanger experiment to show what changes are required to upgrade it. The general idea of these changes is to incrementally move experiments away from depending on ./internal/experiment/urlgetter, and instead use a near drop-in replacement implementation, implemented in ./internal/urlgetter, which uses step-by-step to measure. Because ./internal/experiment/urlgetter depends on ./internal/legacy/netx and, instead, ./internal/urlgetter depends on ./internal/measurexlite, by performing this kind of migration we make ./internal/legacy/netx unnecessary. Also, because most users of ./internal/experiment/urlgetter only use limited functionality, incremental refactoring would be possible. Closes ooni/probe#2751 because we have investigated the matter, understood that it is possible, and produced an initial diff for further design and code review.
- Loading branch information
1 parent
5be3a9a
commit 01649b1
Showing
16 changed files
with
1,397 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package urlgetter | ||
|
||
// Config contains the configuration. | ||
type Config struct { | ||
// HTTPHost allows overriding the default HTTP host. | ||
HTTPHost string `ooni:"Force using specific HTTP Host header"` | ||
|
||
// HTTPReferer sets the HTTP referer value. | ||
HTTPReferer string `ooni:"Force using the specific HTTP Referer header"` | ||
|
||
// Method selects the HTTP method to use. | ||
Method string `ooni:"Force HTTP method different than GET"` | ||
|
||
// NoFollowRedirects disables following redirects. | ||
NoFollowRedirects bool `ooni:"Disable following redirects"` | ||
|
||
// TLSNextProtos is an OPTIONAL comma separated ALPN list. | ||
TLSNextProtos string `ooni:"Comma-separated list of next protocols for ALPN"` | ||
|
||
// TLSServerName is the OPTIONAL SNI value. | ||
TLSServerName string `ooni:"SNI value to use"` | ||
} | ||
|
||
// Clone returns a deep copy of the given [*Config]. | ||
func (cx *Config) Clone() *Config { | ||
return &Config{ | ||
HTTPHost: cx.HTTPHost, | ||
HTTPReferer: cx.HTTPReferer, | ||
Method: cx.Method, | ||
NoFollowRedirects: cx.NoFollowRedirects, | ||
TLSNextProtos: cx.TLSNextProtos, | ||
TLSServerName: cx.TLSServerName, | ||
} | ||
} |
Oops, something went wrong.