| 1 | # env_proxy |
| 2 | |
| 3 | [](https://travis-ci.org/inejge/env_proxy) |
| 4 | |
| 5 | Determination of proxy parameters for a URL from the environment. |
| 6 | |
| 7 | See the [documentation](https://inejge.github.io/env_proxy) for API reference. |
| 8 | |
| 9 | ## Getting Started |
| 10 | |
| 11 | Add the following to the `[dependencies]` section of your `Cargo.toml`: |
| 12 | |
| 13 | ```toml |
| 14 | env_proxy = "0.3" |
| 15 | ``` |
| 16 | |
| 17 | Also, import the crate in your crate root: |
| 18 | |
| 19 | ```rust |
| 20 | extern crate env_proxy; |
| 21 | ``` |
| 22 | |
| 23 | ## Example |
| 24 | |
| 25 | ```rust |
| 26 | use url::Url; |
| 27 | |
| 28 | let url = Url::parse("http://www.example.org").unwrap(); |
| 29 | if let Some(proxy) = env_proxy::for_url(&url).host_port() { |
| 30 | println!("Proxy host: {}", proxy.0); |
| 31 | println!("Proxy port: {}", proxy.1); |
| 32 | } |
| 33 | ``` |
| 34 | |
| 35 | ## License |
| 36 | |
| 37 | This program is distributed under the terms of both the MIT license |
| 38 | and the Apache License (Version 2.0), at your option. |
| 39 | |
| 40 | See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT). |