-
Notifications
You must be signed in to change notification settings - Fork 142
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
sessionresolver: refactor and cleanup #2135
Closed
8 of 10 tasks
Labels
cleanup
There's need to cleanup stuff a bit
ooni/probe-engine
priority/low
refactoring
techdebt
This issue describes technical debt
Comments
bassosimone
added
priority/low
refactoring
ooni/probe-engine
techdebt
This issue describes technical debt
cleanup
There's need to cleanup stuff a bit
labels
Jun 8, 2022
bassosimone
added a commit
to ooni/probe-cli
that referenced
this issue
Jun 8, 2022
This diff addresses the following points of ooni/probe#2135: - [ ] the `childResolver` type is useless and we can use `model.Resolver` directly; - [ ] we should use `model/mocks` instead of custom fakes; - [ ] we should not use `log.Log` rather we should use `model.DiscardLogger`; - [ ] make `timeLimitedLookup` easier to test with a `-short` tests; - [ ] ensure `timeLimitedLookup` returns as soon as its context expires regardless of the child resolver; Subsequent diffs will address more points mentioned in there.
5 tasks
bassosimone
added a commit
to ooni/probe-cli
that referenced
this issue
Jun 8, 2022
This diff addresses the following points of ooni/probe#2135: - [x] the `childResolver` type is useless and we can use `model.Resolver` directly; - [x] we should use `model/mocks` instead of custom fakes; - [x] we should not use `log.Log` rather we should use `model.DiscardLogger`; - [x] make `timeLimitedLookup` easier to test with a `-short` tests; - [x] ensure `timeLimitedLookup` returns as soon as its context expires regardless of the child resolver; Subsequent diffs will address more points mentioned in there.
It seems my recent PR, ooni/probe-cli#807, introduced this data race:
See https://github.com/ooni/probe-cli/runs/6793211653?check_suite_focus=true. I am going to re-run the tests but obviously we need to understand and fix the data race as part of this PR. |
bassosimone
added a commit
to ooni/probe-cli
that referenced
this issue
Jun 8, 2022
bassosimone
added a commit
to ooni/probe-cli
that referenced
this issue
Jun 8, 2022
bassosimone
added a commit
to ooni/probe-cli
that referenced
this issue
Jun 8, 2022
bassosimone
added a commit
to ooni/probe-cli
that referenced
this issue
Jun 8, 2022
bassosimone
added a commit
to ooni/probe-cli
that referenced
this issue
Jun 8, 2022
bassosimone
added a commit
to ooni/probe-cli
that referenced
this issue
Jun 8, 2022
bassosimone
added a commit
to ooni/probe-cli
that referenced
this issue
Jun 8, 2022
bassosimone
added a commit
to ooni/probe-cli
that referenced
this issue
Jun 8, 2022
bassosimone
added a commit
to ooni/probe-cli
that referenced
this issue
Jun 8, 2022
bassosimone
added a commit
to ooni/probe-cli
that referenced
this issue
Jun 8, 2022
These factories will soon be useful to finish with ooni/probe#2135.
bassosimone
added a commit
to ooni/probe-cli
that referenced
this issue
Jun 8, 2022
#813) These factories will soon be useful to finish with ooni/probe#2135.
bassosimone
added a commit
to ooni/probe-cli
that referenced
this issue
Feb 1, 2023
This diff closes ooni/probe#2121 because it removes the last unnecessary netx usage. All the other packages that currently use netx are network experiments. We will eventually convert them to not use netx as part of other tracked issues. This diff closes ooni/probe#2135 because now the sessionresolver does not depend on netx anymore. We refactor the way in which we conditionally configure byte counting for HTTP such that we use a free function rather than a method (we can use methods with nil receiver in Go, but the free function seems to be a better choice in this case). We introduce and use a new bytecounter specifically for the system resolver. This byte counter is very imprecise but seems still better than using the system resolver doesn't use any network I/O. We stop printing the sessionresolver stats when we close a session, since this component has been in production for years now. We improve the model.UnderlyingNetwork model to add support for changing the root cert pool, which helps with writing some integration tests. We modify the protocol to use and modify the netxlite tproxy (a singleton instance of UnderlyingNetwork) to make it goroutine safe. We introduce a new file inside sessionresolver, factory.go, which creates and properly wraps the resolvers. This code replaces code for which we previously used netx, and is the core change introduced here. While there, we refactor how we log in the session resolver to use the operation logger as we do in some experiments. We write some additional tests that take advantage of the new netxlite tproxy mocking functionality to ensure the sessionresolver continues to work in two extreme use cases: no resolver is available and just the system resolver is available. I introduced these new tests because I originally broke the system resolver when I introduced factory.go and I felt like it was useful to have more robustness here.
bassosimone
added a commit
to ooni/probe-cli
that referenced
this issue
Feb 1, 2023
This diff tweaks #1068 to make sure overriding the default cert pool works. In #1068 we introduced code to add this functionality but we never tested it was working as intended. It turns out it was not! Because this diff amends the previous diff, we'll consider it part of ooni/probe#2135.
bassosimone
added a commit
to ooni/probe-cli
that referenced
this issue
Feb 1, 2023
This diff tweaks #1068 to make sure overriding the default cert pool works. In #1068 we introduced code to add this functionality but we never tested it was working as intended. It turns out it was not! Because this diff amends the previous diff, we'll consider it part of ooni/probe#2135.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
cleanup
There's need to cleanup stuff a bit
ooni/probe-engine
priority/low
refactoring
techdebt
This issue describes technical debt
While working on #2121, I noticed that the
sessionresolver
package needs refactoring and cleanup. I will document in this issue what changes are required while I implement them.childResolver
type is useless and we can usemodel.Resolver
directly;model/mocks
instead of custom fakes;log.Log
rather we should usemodel.DiscardLogger
;timeLimitedLookup
easier to test with a-short
tests;timeLimitedLookup
returns as soon as its context expires regardless of the child resolver;dnsclientmaker
with a private function;netx
rather we should usenetxlite
;This issue is related to #2121 and #2115.
The text was updated successfully, but these errors were encountered: