proxyvars

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:

Usage

rust 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(); } }

Notes

  1. The implementation of the NO_PROXY matcher is heavily inspired by Go's implementation located at http/httpproxy/proxy.go.
  2. It's outside the scope of this crate to actually perform the proxying.