use edition 2018. bump dependencies. (#5)
This commit is contained in:
parent
48ed13e6ae
commit
b53642da26
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "hyper-reverse-proxy"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
authors = ["Brendan Zabarauskas <bjzaba@yahoo.com.au>", "Felipe Noronha <felipenoris@gmail.com>"]
|
||||
license = "Apache-2.0"
|
||||
description = "A simple reverse proxy, to be used with Hyper and Tokio."
|
||||
@ -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",
|
||||
@ -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
README.md
15
README.md
@ -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"
|
||||
```
|
||||
|
||||
@ -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};
|
||||
@ -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)
|
||||
}
|
||||
|
20
src/lib.rs
20
src/lib.rs
@ -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"
|
||||
//! ```
|
||||
//!
|
||||
@ -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};
|
||||
@ -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)
|
||||
//! }
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user