Skip to content

Commit

Permalink
use edition 2018. bump dependencies. (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
felipenoris authored Mar 11, 2019
1 parent 48ed13e commit b53642d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hyper-reverse-proxy"
version = "0.3.0"
version = "0.4.0"
authors = ["Brendan Zabarauskas <[email protected]>", "Felipe Noronha <[email protected]>"]
license = "Apache-2.0"
description = "A simple reverse proxy, to be used with Hyper and Tokio."
Expand All @@ -10,6 +10,7 @@ repository = "https://github.com/felipenoris/hyper-reverse-proxy"
keywords = ["http", "hyper"]
categories = ["network-programming", "web-programming"]
readme = "README.md"
edition = "2018"

include = [
"Cargo.toml",
Expand All @@ -18,7 +19,7 @@ include = [
]

[dependencies]
hyper = "0.12.24"
hyper = "0.12"
futures = "0.1"
lazy_static = "1.2"
unicase = "2.2"
lazy_static = "1.3"
unicase = "2.3"
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Add these dependencies to your `Cargo.toml` file.

```toml
[dependencies]
hyper-reverse-proxy = "0.3.0"
hyper = "0.12.24"
hyper-reverse-proxy = "0.4"
hyper = "0.12"
futures = "0.1"
```

Expand All @@ -39,10 +39,6 @@ and will proxy these calls:
* All other URLs will be handled by `debug_request` function, that will display request information.

```rust,no_run
extern crate hyper;
extern crate hyper_reverse_proxy;
extern crate futures;
use hyper::server::conn::AddrStream;
use hyper::{Body, Request, Response, Server};
use hyper::service::{service_fn, make_service_fn};
Expand All @@ -66,11 +62,16 @@ fn main() {
let remote_addr = socket.remote_addr();
service_fn(move |req: Request<Body>| { // returns BoxFut
// Auth
if req.uri().path().starts_with("/target/first") {
// will forward requests to port 13901
return hyper_reverse_proxy::call(remote_addr.ip(), "http://127.0.0.1:13901", req)
} else if req.uri().path().starts_with("/target/second") {
// will forward requests to port 13902
return hyper_reverse_proxy::call(remote_addr.ip(), "http://127.0.0.1:13902", req)
} else {
debug_request(req)
}
Expand Down
20 changes: 8 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
//!
//! ```toml
//! [dependencies]
//! hyper-reverse-proxy = "0.3.0"
//! hyper = "0.12.24"
//! hyper-reverse-proxy = "0.4"
//! hyper = "0.12"
//! futures = "0.1"
//! ```
//!
Expand All @@ -32,10 +32,6 @@
//! * All other URLs will be handled by `debug_request` function, that will display request information.
//!
//! ```rust,no_run
//! extern crate hyper;
//! extern crate hyper_reverse_proxy;
//! extern crate futures;
//!
//! use hyper::server::conn::AddrStream;
//! use hyper::{Body, Request, Response, Server};
//! use hyper::service::{service_fn, make_service_fn};
Expand All @@ -59,11 +55,16 @@
//! let remote_addr = socket.remote_addr();
//! service_fn(move |req: Request<Body>| { // returns BoxFut
//!
//! // Auth
//! if req.uri().path().starts_with("/target/first") {
//!
//! // will forward requests to port 13901
//! return hyper_reverse_proxy::call(remote_addr.ip(), "http://127.0.0.1:13901", req)
//!
//! } else if req.uri().path().starts_with("/target/second") {
//!
//! // will forward requests to port 13902
//! return hyper_reverse_proxy::call(remote_addr.ip(), "http://127.0.0.1:13902", req)
//!
//! } else {
//! debug_request(req)
//! }
Expand All @@ -82,11 +83,6 @@
//! ```
//!

extern crate hyper;
extern crate futures;
extern crate lazy_static;
extern crate unicase;

use hyper::Body;
use std::net::IpAddr;
use std::str::FromStr;
Expand Down

0 comments on commit b53642d

Please sign in to comment.