feat: add SOCKS5/HTTP proxy support for all provider requests#347
Open
zergzorg wants to merge 2 commits intorobinebers:mainfrom
Open
feat: add SOCKS5/HTTP proxy support for all provider requests#347zergzorg wants to merge 2 commits intorobinebers:mainfrom
zergzorg wants to merge 2 commits intorobinebers:mainfrom
Conversation
Add centralized proxy configuration for all provider/plugin HTTP requests. - Config file at ~/.openusage/config.json with optional proxy settings - Resolved once at startup via OnceLock, zero per-request overhead - Localhost bypass (localhost, 127.0.0.1, ::1) via reqwest NoProxy - Supports SOCKS5 and HTTP/HTTPS proxies - Graceful fallback if config is missing, disabled, or invalid - Added reqwest 'socks' feature for SOCKS5 support Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Contributor
There was a problem hiding this comment.
1 issue found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src-tauri/src/config.rs">
<violation number="1" location="src-tauri/src/config.rs:38">
P2: Config path falls back to relative CWD when home directory resolution fails, allowing unintended proxy config loading from `./.openusage/config.json`.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
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.
Summary
Add minimal proxy support for personal use — all outgoing HTTP requests from providers/plugins can now be routed through a SOCKS5 or HTTP proxy.
Configuration
Create
~/.openusage/config.json:{ "proxy": { "enabled": true, "url": "socks5://127.0.0.1:10808" } }Details
OnceLock, cached as pre-resolvedreqwest::Proxylocalhost,127.0.0.1,::1always bypass the proxy (viareqwest::NoProxy)~/.openusage/config.jsonChanges
src-tauri/src/config.rsOnceLockcaching,NoProxybypass, URL redactionsrc-tauri/Cargo.tomlsocksfeature to reqwestsrc-tauri/src/lib.rssrc-tauri/src/plugin_engine/host_api.rsClient::builder()+connect_timeoutSummary by cubic
Add optional SOCKS5/HTTP proxy support for all provider/plugin HTTP requests, configurable via ~/.openusage/config.json. Defaults off; when enabled, requests use the proxy with a localhost bypass and safe fallback if the config is missing, invalid, or no home directory is found.
New Features
reqwest::Proxyto the shared HTTP client (OnceLock; supports SOCKS5/HTTP).connect_timeoutaligned with the request timeout.Bug Fixes
Written for commit 2c27806. Summary will update on new commits.