Skip to content

Comments

Add SOCKS5 proxy support via [proxy] config#575

Open
KaraZajac wants to merge 2 commits intoulyssa:mainfrom
KaraZajac:main
Open

Add SOCKS5 proxy support via [proxy] config#575
KaraZajac wants to merge 2 commits intoulyssa:mainfrom
KaraZajac:main

Conversation

@KaraZajac
Copy link

Summary

Adds optional proxy support for Matrix HTTP traffic using reqwest’s socks feature and a new [proxy] section in the config. Users can set a global proxy or override it per profile. If no proxy is configured, behavior is unchanged (no proxy and no use of ALL_PROXY).

Changes

Cargo

  • Cargo.toml: Depend on reqwest with the socks feature so the client can use SOCKS5 (and other proxy URLs reqwest supports).

Configuration

  • src/config.rs:
    • New ProxyConfig with optional url and a merge() for profile override.
    • IambConfig and ProfileConfig each have an optional proxy: Option<ProxyConfig>.
    • ApplicationSettings gains proxy_url: Option<String>; in load(), global and profile proxy are merged (profile overrides global) and the result is stored in proxy_url.

HTTP client

  • src/worker.rs: In create_client_inner, when settings.proxy_url is set, the reqwest client is built with reqwest::Proxy::all(proxy_url). Invalid proxy URL is reported with a clear .expect(...) message at startup.

Docs and examples

  • config.example.toml: Added a commented [proxy] example with url = "socks5://127.0.0.1:1080".
  • docs/iamb.5: New PROXY section documenting [proxy] and url, and proxy listed as overridable per profile.

Tests

  • src/tests.rs: mock_settings() updated so ProfileConfig includes proxy: None and ApplicationSettings includes proxy_url: None.

Usage

  • Global: add [proxy] with url = "socks5://host:port" (or another supported proxy URL).
  • Per-profile: set proxy = { url = "socks5://..." } under a profile; it overrides the global proxy for that profile.
  • Omit [proxy] or leave url unset to use no proxy.

@VAWVAW
Copy link
Contributor

VAWVAW commented Feb 23, 2026

would fix #80 if this wasn't AI slop that ignores the coding style of this project and doesn't even compile (without openssl available).

@KaraZajac
Copy link
Author

Hey thanks! I updated the styling and removed the OpenSSL dependency! I hope it looks better. You are correct that I did have AI's help in creating this. Thank you for taking the time to review the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants