Skip to content

Commit

Permalink
Show used proxies during startup
Browse files Browse the repository at this point in the history
  • Loading branch information
svenstaro committed Jul 4, 2020
1 parent b7079c4 commit b79d92e
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## [Unreleased]

## [0.2.2] - 2020-07-04
- Show used proxies during startup

## [0.2.1] - 2020-07-03
- Build Linux target using musl to ensure it's perfectly static

Expand Down
37 changes: 37 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ hyper = "0.13"
lazy_static = "1.0"
strum = "0.18"
strum_macros = "0.18"
regex = "1"
18 changes: 17 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,23 @@ async fn main() -> Result<()> {
site24x7_client_info.zoho_endpoint
);

debug!("Reqwest client:\n{:#?}", reqwest::Client::new());
// Info print used proxies if there are any.
// Currently we have to do this in a stupid backwards way by parsing the debug output.
// Hopefully, we'll be able to do this properly once this is fixed:
// https://github.com/seanmonstar/reqwest/issues/967
let debug_output = format!("{:?}", *CLIENT);
let re = regex::Regex::new(r"^.*System\(\{(.*?)\}").unwrap();
if let Some(caps) = re.captures(&debug_output) {
if let Some(cap) = caps.get(1) {
if cap.as_str().is_empty() {
info!("Not using any proxies");
} else {
info!("Picked up proxies: {}", &caps[1]);
}
}
}

debug!("Reqwest client:\n{:#?}", *CLIENT);

// An access token is only available for a period of time.
// We sometimes have to refresh it.
Expand Down

0 comments on commit b79d92e

Please sign in to comment.