| Crates.io | proxyvars |
| lib.rs | proxyvars |
| version | 0.2.0 |
| created_at | 2023-04-21 09:32:13.406348+00 |
| updated_at | 2024-05-03 13:12:37.913256+00 |
| description | Parser for the HTTP_PROXY, HTTPS_PROXY and NO_PROXY environment variables, with a Go-like matcher for the NO_PROXY variable. |
| homepage | |
| repository | https://github.com/goenning/proxyvars |
| max_upload_size | |
| id | 845157 |
| size | 19,913 |
proxyvars is a parser for the HTTP_PROXY, HTTPS_PROXY and NO_PROXY environment variables, with NO_PROXY matcher based on Go's implementation.
This crate can:
HTTPS_PROXY and HTTP_PROXY and its lowercase variantsNO_PROXY environment variables against a given URL
if let Some(no_proxy) = proxyvars::no_proxy() {
// This environment has NO_PROXY defined
if no_proxy.matches("https://company.com") {
// We should not use a proxy for this URL
} else {
// We should use a proxy for this URL, which are available at:
let https_proxy = proxyvars::https_proxy();
let http_proxy = proxyvars::http_proxy();
}
}
NO_PROXY matcher is heavily inspired by Go's implementation located at http/httpproxy/proxy.go.