Skip to content

Commit b53642d

Browse files
authored
use edition 2018. bump dependencies. (#5)
1 parent 48ed13e commit b53642d

File tree

3 files changed

+21
-23
lines changed

3 files changed

+21
-23
lines changed

Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hyper-reverse-proxy"
3-
version = "0.3.0"
3+
version = "0.4.0"
44
authors = ["Brendan Zabarauskas <[email protected]>", "Felipe Noronha <[email protected]>"]
55
license = "Apache-2.0"
66
description = "A simple reverse proxy, to be used with Hyper and Tokio."
@@ -10,6 +10,7 @@ repository = "https://github.com/felipenoris/hyper-reverse-proxy"
1010
keywords = ["http", "hyper"]
1111
categories = ["network-programming", "web-programming"]
1212
readme = "README.md"
13+
edition = "2018"
1314

1415
include = [
1516
"Cargo.toml",
@@ -18,7 +19,7 @@ include = [
1819
]
1920

2021
[dependencies]
21-
hyper = "0.12.24"
22+
hyper = "0.12"
2223
futures = "0.1"
23-
lazy_static = "1.2"
24-
unicase = "2.2"
24+
lazy_static = "1.3"
25+
unicase = "2.3"

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ Add these dependencies to your `Cargo.toml` file.
2424

2525
```toml
2626
[dependencies]
27-
hyper-reverse-proxy = "0.3.0"
28-
hyper = "0.12.24"
27+
hyper-reverse-proxy = "0.4"
28+
hyper = "0.12"
2929
futures = "0.1"
3030
```
3131

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

4141
```rust,no_run
42-
extern crate hyper;
43-
extern crate hyper_reverse_proxy;
44-
extern crate futures;
45-
4642
use hyper::server::conn::AddrStream;
4743
use hyper::{Body, Request, Response, Server};
4844
use hyper::service::{service_fn, make_service_fn};
@@ -66,11 +62,16 @@ fn main() {
6662
let remote_addr = socket.remote_addr();
6763
service_fn(move |req: Request<Body>| { // returns BoxFut
6864
69-
// Auth
7065
if req.uri().path().starts_with("/target/first") {
66+
67+
// will forward requests to port 13901
7168
return hyper_reverse_proxy::call(remote_addr.ip(), "http://127.0.0.1:13901", req)
69+
7270
} else if req.uri().path().starts_with("/target/second") {
71+
72+
// will forward requests to port 13902
7373
return hyper_reverse_proxy::call(remote_addr.ip(), "http://127.0.0.1:13902", req)
74+
7475
} else {
7576
debug_request(req)
7677
}

src/lib.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
//!
1818
//! ```toml
1919
//! [dependencies]
20-
//! hyper-reverse-proxy = "0.3.0"
21-
//! hyper = "0.12.24"
20+
//! hyper-reverse-proxy = "0.4"
21+
//! hyper = "0.12"
2222
//! futures = "0.1"
2323
//! ```
2424
//!
@@ -32,10 +32,6 @@
3232
//! * All other URLs will be handled by `debug_request` function, that will display request information.
3333
//!
3434
//! ```rust,no_run
35-
//! extern crate hyper;
36-
//! extern crate hyper_reverse_proxy;
37-
//! extern crate futures;
38-
//!
3935
//! use hyper::server::conn::AddrStream;
4036
//! use hyper::{Body, Request, Response, Server};
4137
//! use hyper::service::{service_fn, make_service_fn};
@@ -59,11 +55,16 @@
5955
//! let remote_addr = socket.remote_addr();
6056
//! service_fn(move |req: Request<Body>| { // returns BoxFut
6157
//!
62-
//! // Auth
6358
//! if req.uri().path().starts_with("/target/first") {
59+
//!
60+
//! // will forward requests to port 13901
6461
//! return hyper_reverse_proxy::call(remote_addr.ip(), "http://127.0.0.1:13901", req)
62+
//!
6563
//! } else if req.uri().path().starts_with("/target/second") {
64+
//!
65+
//! // will forward requests to port 13902
6666
//! return hyper_reverse_proxy::call(remote_addr.ip(), "http://127.0.0.1:13902", req)
67+
//!
6768
//! } else {
6869
//! debug_request(req)
6970
//! }
@@ -82,11 +83,6 @@
8283
//! ```
8384
//!
8485
85-
extern crate hyper;
86-
extern crate futures;
87-
extern crate lazy_static;
88-
extern crate unicase;
89-
9086
use hyper::Body;
9187
use std::net::IpAddr;
9288
use std::str::FromStr;

0 commit comments

Comments
 (0)