feat(client): add iOS system proxy detection via CFNetworkCopySystemProxySettings#291
Open
trypsynth wants to merge 1 commit into
Open
feat(client): add iOS system proxy detection via CFNetworkCopySystemProxySettings#291trypsynth wants to merge 1 commit into
trypsynth wants to merge 1 commit into
Conversation
…roxySettings
Adds a `mod ios` in `src/client/proxy/matcher.rs`, gated on
`#[cfg(all(feature = "client-proxy-system", target_os = "ios"))]`,
that reads HTTP/HTTPS proxy settings using `CFNetworkCopySystemProxySettings()`
from CFNetwork.framework. Wires it into `from_system()` alongside the
existing macOS and Windows paths.
Adds `core-foundation = { version = "0.9", optional = true }` as a
target-specific dependency for iOS and includes it in the
`client-proxy-system` feature.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
iOS system proxy support
from_system()already reads system proxy settings on macOS (viaSCDynamicStore) and Windows (via the registry). This PR adds a parallel implementation for iOS usingCFNetworkCopySystemProxySettings()from CFNetwork.framework, so that callers get the same automatic proxy pickup on iOS that they already get on macOS.What changed
ios::with_system(&mut builder)call infrom_system(), gated on#[cfg(all(feature = "client-proxy-system", target_os = "ios"))].mod ios, which declaresCFNetworkCopySystemProxySettingsand thekCFNetworkProxies*key constants viaunsafe extern "C"linking against CFNetwork.framework.Testing
cargo check --features client-proxy,client-proxy-system(macOS host): clean.cargo check --target aarch64-apple-ios --features client-proxy,client-proxy-system: clean.aarch64-apple-ios-simwithcargo test --target aarch64-apple-ios-sim --features client-proxy,client-proxy-system --no-run, then ran the binary on a booted iPhone 15 Pro simulator viaxcrun simctl spawn. All 12 proxy matcher unit tests passed.Note:
CFNetworkCopySystemProxySettingsreturns null when no proxy is configured, which the implementation handles by returning early. Since the simulator has no proxy configured, the system path is exercised but returns early. The unit tests confirm the parsing and matching logic is correct beyond just linking cleanly. Also verified on a real device (iPad mini 6th gen) with a proxy configured --CFNetworkCopySystemProxySettingsreturned the expected host and port.