proxyparser
A cross-platform Rust library and CLI for resolving the proxy that should be used for a URL. It supports environment variables, operating system proxy settings, PAC files, and normalized proxy result parsing.
Features
- Cross-platform system proxy detection
- macOS: SystemConfiguration/CoreFoundation manual proxy and PAC settings
- Windows: WinHTTP/IE proxy config, manual proxy lists, bypass rules, WPAD
- Linux: GNOME
gsettingsand KDEkreadconfig5/kreadconfig6
- PAC support
- Downloads
http://andhttps://PAC files - Loads
file://and local PAC files - Executes
FindProxyForURLwithboa_engine - Implements common PAC helpers such as
dnsResolve,myIpAddress,isInNet,shExpMatch,dnsDomainIs,localHostOrDomainIs,dnsDomainLevels, andweekdayRange
- Downloads
- Proxy parsing and post-processing
- Normalizes manual and PAC proxy results to full URLs
- Deduplicates proxy entries
- Supports protocol filtering and maximum result limits
- Converts
SOCKS/SOCKS5PAC directives tosocks5:// - Preserves
DIRECTfallback semantics
- Priority order: environment variables -> system proxy/PAC ->
DIRECT
Validation report
Latest local validation:
| Check | Result | Notes |
|---|---|---|
cargo fmt --check |
PASS | Rust formatting is clean |
cargo test |
PASS | 9 unit tests + 1 doctest passed |
cargo package --allow-dirty |
PASS | Crate packages and verifies successfully |
| Open-marker scan | PASS | No open implementation markers remain in source/config files |
The repository CI runs the same Rust checks natively on Ubuntu, macOS, and Windows through GitHub Actions, so platform-specific system proxy modules are validated on their own operating systems instead of relying on fragile local cross-compilation.
Installation
Or build from source:
CLI usage
# Query the proxy for a specific URL
# Use the default target (https://www.google.com)
Output is either DIRECT or a normalized proxy list, for example:
Proxy for https://example.com -> http://proxy.local:8080; socks5://backup.local:1080; DIRECT
Library usage
use find_proxy_for_url;
Proxy parser APIs are also public:
use ;
let options = ProxyParseOptions ;
let parsed = parse_proxy_result;
assert_eq!;
License
This project is licensed under the MIT License.