upgrade libraries (#16)

* chore: upgrade hyper/tokio libraries

* updates tokio reactor version

* doc: updates documentation in README and rust code doc
This commit is contained in:
Bruno Thomas 2022-03-12 15:47:58 +01:00 committed by GitHub
parent a01c1381b7
commit 6e9aa4501f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 13 deletions

View File

@ -26,16 +26,14 @@ Add these dependencies to your `Cargo.toml` file.
[dependencies]
hyper-reverse-proxy = "0.5"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "0.3", features = ["full"] }
tokio = { version = "1", features = ["full"] }
```
The following example will set up a reverse proxy listening on `127.0.0.1:13900`,
and will proxy these calls:
* `"/target/first"` will be proxied to `http://127.0.0.1:13901`
* `"/target/second"` will be proxied to `http://127.0.0.1:13902`
* All other URLs will be handled by `debug_request` function, that will display request information.
```rust,no_run
@ -52,8 +50,8 @@ fn debug_request(req: Request<Body>) -> BoxFut {
Box::new(future::ok(response))
}
#[tokio::main]
fn main() {
// This is our socket address...
let addr = ([127, 0, 0, 1], 13900).into();
@ -78,13 +76,12 @@ fn main() {
})
});
let server = Server::bind(&addr)
.serve(make_svc)
.map_err(|e| eprintln!("server error: {}", e));
println!("Running server on {:?}", addr);
let server = Server::bind(&addr).serve(make_svc);
// Run this server for... forever!
hyper::rt::run(server);
println!("Running server on {:?}", addr);
if let Err(e) = server.await {
eprintln!("server error: {}", e);
}
}
```

View File

@ -18,8 +18,8 @@
//! ```toml
//! [dependencies]
//! hyper-reverse-proxy = "0.5"
//! hyper = "0.13"
//! tokio = { version = "0.2", features = ["full"] }
//! hyper = { version = "0.14", features = ["full"] }
//! tokio = { version = "1", features = ["full"] }
//! ```
//!
//! The following example will set up a reverse proxy listening on `127.0.0.1:13900`,