{"id":17820458,"url":"https://github.com/tafia/hyper-proxy","last_synced_at":"2025-05-16T10:08:40.434Z","repository":{"id":27473916,"uuid":"114060174","full_name":"tafia/hyper-proxy","owner":"tafia","description":"A proxy connector for Hyper-based crates","archived":false,"fork":false,"pushed_at":"2024-04-14T10:24:43.000Z","size":107,"stargazers_count":106,"open_issues_count":17,"forks_count":68,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-12T03:09:26.377Z","etag":null,"topics":["connector","futures","hyper","proxy","ssl","tls","tokio"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tafia.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE-MIT.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-13T01:52:51.000Z","updated_at":"2025-03-09T09:12:26.000Z","dependencies_parsed_at":"2024-06-18T20:12:07.063Z","dependency_job_id":null,"html_url":"https://github.com/tafia/hyper-proxy","commit_stats":{"total_commits":52,"total_committers":20,"mean_commits":2.6,"dds":0.5384615384615384,"last_synced_commit":"aca1e1f5546ed5530e1a72dc5e07c5ed4b6099b3"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tafia%2Fhyper-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tafia%2Fhyper-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tafia%2Fhyper-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tafia%2Fhyper-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tafia","download_url":"https://codeload.github.com/tafia/hyper-proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509477,"owners_count":22082892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["connector","futures","hyper","proxy","ssl","tls","tokio"],"created_at":"2024-10-27T17:05:07.144Z","updated_at":"2025-05-16T10:08:35.424Z","avatar_url":"https://github.com/tafia.png","language":"Rust","readme":"# hyper-proxy\n\n[![Travis Build Status](https://travis-ci.org/tafia/hyper-proxy.svg?branch=master)](https://travis-ci.org/tafia/hyper-proxy)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n[![crates.io](http://meritbadge.herokuapp.com/hyper-proxy)](https://crates.io/crates/hyper-proxy)\n\nA proxy connector for [hyper][1] based applications.\n\n[Documentation][3]\n\n## Example\n\n```rust,no_run\nuse hyper::{Client, Request, Uri};\nuse hyper::client::HttpConnector;\nuse futures::{TryFutureExt, TryStreamExt};\nuse hyper_proxy::{Proxy, ProxyConnector, Intercept};\nuse headers::Authorization;\nuse std::error::Error;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn Error\u003e\u003e {\n    let proxy = {\n        let proxy_uri = \"http://my-proxy:8080\".parse().unwrap();\n        let mut proxy = Proxy::new(Intercept::All, proxy_uri);\n        proxy.set_authorization(Authorization::basic(\"John Doe\", \"Agent1234\"));\n        let connector = HttpConnector::new();\n        let proxy_connector = ProxyConnector::from_proxy(connector, proxy).unwrap();\n        proxy_connector\n    };\n\n    // Connecting to http will trigger regular GETs and POSTs.\n    // We need to manually append the relevant headers to the request\n    let uri: Uri = \"http://my-remote-website.com\".parse().unwrap();\n    let mut req = Request::get(uri.clone()).body(hyper::Body::empty()).unwrap();\n\n    if let Some(headers) = proxy.http_headers(\u0026uri) {\n        req.headers_mut().extend(headers.clone().into_iter());\n    }\n\n    let client = Client::builder().build(proxy);\n    let fut_http = client.request(req)\n        .and_then(|res| res.into_body().map_ok(|x|x.to_vec()).try_concat())\n        .map_ok(move |body| ::std::str::from_utf8(\u0026body).unwrap().to_string());\n\n    // Connecting to an https uri is straightforward (uses 'CONNECT' method underneath)\n    let uri = \"https://my-remote-websitei-secured.com\".parse().unwrap();\n    let fut_https = client.get(uri)\n        .and_then(|res| res.into_body().map_ok(|x|x.to_vec()).try_concat())\n        .map_ok(move |body| ::std::str::from_utf8(\u0026body).unwrap().to_string());\n\n    let (http_res, https_res) = futures::future::join(fut_http, fut_https).await;\n    let (_, _) = (http_res?, https_res?);\n\n    Ok(())\n}\n```\n\n## Features\n\n`hyper-proxy` exposes three main Cargo features, to configure which TLS implementation it uses to\nconnect to a proxy. It can also be configured without TLS support, by compiling without default\nfeatures entirely. The supported list of configurations is:\n\n1. No TLS support (`default-features = false`)\n2. TLS support via `native-tls` to link against the operating system's native TLS implementation\n   (default)\n3. TLS support via `rustls` (`default-features = false, features = [\"rustls\"]`)\n4. TLS support via `rustls`, using a statically-compiled set of CA certificates to bypass the\n   operating system's default store (`default-features = false, features = [\"rustls-webpki\"]`)\n\n## Credits\n\nLarge part of the code comes from [reqwest][2].\nThe core part as just been extracted and slightly enhanced.\n\n Main changes are:\n- support for authentication\n- add non secured tunneling\n- add the possibility to add additional headers when connecting to the proxy\n\n[1]: https://crates.io/crates/hyper\n[2]: https://github.com/seanmonstar/reqwest\n[3]: https://docs.rs/hyper-proxy\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftafia%2Fhyper-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftafia%2Fhyper-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftafia%2Fhyper-proxy/lists"}