Browse Source

clean up logging

master
Jonathan Cobb 4 years ago
parent
commit
dfc51a4c76
2 changed files with 2 additions and 5 deletions
  1. +1
    -4
      src/ping.rs
  2. +1
    -1
      src/proxy.rs

+ 1
- 4
src/ping.rs View File

@@ -48,7 +48,6 @@ impl Ping {
false false
} else { } else {
let hash = hash_token_with_salt(auth_token, self.time, &self.salt); let hash = hash_token_with_salt(auth_token, self.time, &self.salt);
eprintln!("Ping.verify: INFO: comparing provided hash={} with calculated hash={}", self.hash, hash);
self.hash.eq(&hash) self.hash.eq(&hash)
} }
} }
@@ -63,7 +62,5 @@ fn hash_token_with_salt(auth_token: Arc<String>, time : u128, salt: &String) ->
hasher.update(b":"); hasher.update(b":");
hasher.update(auth_token.to_string()); hasher.update(auth_token.to_string());
let digest = hasher.finalize(); let digest = hasher.finalize();
let hash = hex::encode(digest);
eprintln!("hash_token_with_salt: INFO: salt={} and token={} created hash={}", salt, auth_token.to_string(), hash);
hash
hex::encode(digest)
} }

+ 1
- 1
src/proxy.rs View File

@@ -97,7 +97,7 @@ async fn proxy(client: Client<HttpsConnector<HttpConnector<CacheResolver>>>,
let body_bytes = hyper::body::to_bytes(req.into_body()).await?; let body_bytes = hyper::body::to_bytes(req.into_body()).await?;
let body = String::from_utf8(body_bytes.to_vec()).unwrap(); let body = String::from_utf8(body_bytes.to_vec()).unwrap();
let ping : Ping = serde_json::from_str(body.as_str()).unwrap(); let ping : Ping = serde_json::from_str(body.as_str()).unwrap();
eprintln!("proxy: INFO: received body: {:?}", ping);
eprintln!("proxy: DEBUG: received body: {:?}", ping);
if !ping.verify(auth_token.clone()) { if !ping.verify(auth_token.clone()) {
eprintln!("proxy: ERROR: invalid ping hash"); eprintln!("proxy: ERROR: invalid ping hash");
bad_request("invalid ping hash") bad_request("invalid ping hash")


Loading…
Cancel
Save