-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from gauravssnl/develop
Add command line flags for the app
- Loading branch information
Showing
10 changed files
with
421 additions
and
201 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
[package] | ||
name = "rserver" | ||
version = "0.1.5" | ||
version = "0.1.6" | ||
authors = ["Gaurav <[email protected]>"] | ||
edition = "2018" | ||
license = "MIT" | ||
description = "A TCP server for intercepting requests, modifying request headers, and replacing responses." | ||
description = "Asynchronous TCP server for intercepting requests, modifying request headers, and replacing responses." | ||
readme = "README.md" | ||
repository = "https://github.com/gauravssnl/rserver" | ||
keywords = ["server", "socket", "TCP"] | ||
|
@@ -15,4 +15,5 @@ categories = ["web-programming::http-server", "command-line-utilities"] | |
[dependencies] | ||
futures = "0.3.24" | ||
tokio = { version = "1.21.0", features = ["full"] } | ||
urlparse = "0.7.3" | ||
urlparse = "0.7.3" | ||
structopt = { version = "0.3", default-features = false } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use structopt::StructOpt; | ||
|
||
#[derive(Debug, StructOpt)] | ||
#[structopt( | ||
name = "rserver", | ||
about = "Asynchronous TCP server for intercepting requests, modifying request headers, and replacing responses" | ||
)] | ||
pub struct CliOption { | ||
/// Server host | ||
#[structopt(short, long, default_value = "127.0.0.1")] | ||
pub host: String, | ||
|
||
/// Server port | ||
#[structopt(short, long, default_value = "8080")] | ||
pub port: i32, | ||
|
||
/// Enable proxy flag | ||
#[structopt(long, default_value = "false")] | ||
pub enable_proxy: String, | ||
|
||
/// Proxy host | ||
#[structopt(long, required_if("enable-proxy", "true"))] | ||
pub proxy_host: Option<String>, | ||
|
||
/// Proxy port | ||
#[structopt(long, required_if("enable-proxy", "true"))] | ||
pub proxy_port: Option<i32>, | ||
} | ||
|
||
impl CliOption { | ||
pub fn parse() -> Self { | ||
Self::from_args() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.