aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-08-25 20:11:12 -0700
committerBryan Newbold <bnewbold@archive.org>2020-08-25 20:11:12 -0700
commit03fac454b613662c354ffefbad9f758f1ce23259 (patch)
tree17d2a170bdf013c8ca95d5d810a7f71d7bad6881 /src
parente77a94189ecbf13f041346e7d7b6d3ecf5876a6b (diff)
downloades-public-proxy-03fac454b613662c354ffefbad9f758f1ce23259.tar.gz
es-public-proxy-03fac454b613662c354ffefbad9f758f1ce23259.zip
add --version flag
Diffstat (limited to 'src')
-rw-r--r--src/main.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index d1c0f02..a1e8c5b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -9,6 +9,8 @@ extern crate log;
use es_public_proxy::{filter_request, ProxyConfig};
+const CARGO_VERSION: Option<&'static str> = option_env!("CARGO_PKG_VERSION");
+
async fn upstream_req(
req: Request<Body>,
config: ProxyConfig,
@@ -75,6 +77,10 @@ fn load_config() -> ProxyConfig {
println!("{}", usage());
std::process::exit(0);
}
+ [_, "--version"] => {
+ println!("es-public-proxy v{}", CARGO_VERSION.unwrap_or("UNKNOWN"));
+ std::process::exit(0);
+ }
[_, "--example-config"] => {
println!("{}", include_str!("../extra/example_config.toml"));
std::process::exit(0);