Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: add SOCKS5/HTTP proxy support via --proxy flag and POLYMARKET_P…
…ROXY env var
  • Loading branch information
croll83 committed Feb 25, 2026
commit d3d1f23a6f5d28c8f492b56209684c9d72041880
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ serde = { version = "1", features = ["derive"] }
tabled = "0.17"
rust_decimal = "1"
anyhow = "1"
reqwest = { version = "0.13", features = ["socks"] }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cargo.lock missing tokio-socks breaks SOCKS5 proxy support

High Severity

The Cargo.toml adds reqwest with features = ["socks"], but the committed Cargo.lock does not contain tokio-socks anywhere — the required transitive dependency for SOCKS5 support. The reqwest 0.13.2 entry in the lockfile lists no socks-related dependencies. This means builds using cargo install --locked or CI with --locked will compile reqwest without actual SOCKS5 support, silently making the PR's core feature non-functional at runtime.

Additional Locations (1)

Fix in Cursor Fix in Web

chrono = "0.4"
dirs = "6"
rustyline = "15"
Expand Down
15 changes: 15 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ pub(crate) struct Cli {
/// Signature type: eoa, proxy, or gnosis-safe
#[arg(long, global = true)]
signature_type: Option<String>,

/// SOCKS5 or HTTP proxy URL (e.g., socks5://127.0.0.1:1080)
#[arg(long, global = true)]
proxy: Option<String>,
}

#[derive(Subcommand)]
Expand Down Expand Up @@ -71,6 +75,17 @@ async fn main() -> ExitCode {
let cli = Cli::parse();
let output = cli.output;

// Apply proxy: --proxy flag > POLYMARKET_PROXY > ALL_PROXY (already set by user)
let proxy_url = cli.proxy
.as_deref()
.map(String::from)
.or_else(|| std::env::var("POLYMARKET_PROXY").ok());
if let Some(ref url) = proxy_url {
// SAFETY: called before any threads are spawned by the async runtime
unsafe { std::env::set_var("HTTPS_PROXY", url); }
unsafe { std::env::set_var("HTTP_PROXY", url); }
}

if let Err(e) = run(cli).await {
match output {
OutputFormat::Json => {
Expand Down