upgrade libraries (#16)

* chore: upgrade hyper/tokio libraries

* updates tokio reactor version

* doc: updates documentation in README and rust code doc
pull/6/head
Bruno Thomas 2 years ago committed by GitHub
parent a01c1381b7
commit 6e9aa4501f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      README.md
  2. 4
      src/lib.rs

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

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

Loading…
Cancel
Save