-
Notifications
You must be signed in to change notification settings - Fork 69
Clean up proxy feature
#182
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
base: master
Are you sure you want to change the base?
Clean up proxy feature
#182
Conversation
Before, the `client` module was gated on the "proxy" feature, which caused unnecessary coupling since proxy is only required for the Socks5 client type. This change removes the client module's dependency on the "proxy" feature in favor of more precise feature gating of the Socks5 client type and related functions calling into the `socks` module. Note that `Client` still requires a TLS backend to be enabled by one of "use-openssl", "use-rustls" or "use-rustls-ring".
The "default" feature argument is redundant and unclear, as it requires the developer to know which aspects of the default features apply to a particular cfg attribute. This change simplifies feature gating logic by only requiring the features necessary to build with a given feature set.
Introduce simpler feature names "openssl", "rustls", and "rustls-ring". The original "use-" style names are still available for backwards compatibility.
925a9f6 to
ce7a0eb
Compare
Removes conditional compilation of `ElectrumApi::calls_made`. As a result the `debug-calls` feature flag is also removed.
oleonardolima
left a comment
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.
utACK 51cfd77
| - run: cargo check --verbose --no-default-features --features=proxy | ||
| - run: cargo check --verbose --no-default-features --features=minimal | ||
| - run: cargo check --verbose --no-default-features --features=minimal,debug-calls | ||
| - run: cargo check --verbose --no-default-features --features=debug-calls |
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.
awesome! thanks for removing it 😁
oleonardolima
left a comment
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've tested it a bit with the examples we have in the repository, see the comment above.
The same problem above occurs when trying to use proxy feature to connect via tor to a tcp:// server
Also, I wasn't able to use the proxy via Tor with TLS, still unsure if it's related to mempool.space server though.
As a general comment, we don't have any integration test or CI for the proxy feature (besides the ones in socks module), I think it's a good idea add it in the future.
| run: cargo test -- --ignored test_local_timeout | ||
| - run: cargo check --verbose --features=use-openssl | ||
| - run: cargo check --verbose --no-default-features --features=proxy | ||
| - run: cargo check --verbose --no-default-features --features=minimal |
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.
nit: it could be addressed in a follow-up, but I think we should take advantage of a matrix strategy here, instead of having each combination written down.
| all(feature = "proxy", feature = "use-rustls"), | ||
| all(feature = "proxy", feature = "use-rustls-ring") | ||
| ))] | ||
| #[cfg(any(feature = "openssl", feature = "rustls", feature = "rustls-ring"))] |
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 was trying to test the client usage through plaintext (with --no-default-features), but it's not possible due to the way we have these features here.
It wasn't even working on master, though.
Description
This PR is meant to streamline the handling of feature flags in the library, in particular by removing the Client's dependency on the
proxyfeature and overall simplifying the feature gating logic. Additionally, we move away from the olduse-*feature naming convention by introducing simpler feature names, remove the unusedminimalfeature, and get rid of conditional compilation fordebug-callswhile retaining the ability to atomically count calls made.fixes #91
fixes #42