Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: zdz/ServerStatus-Rust
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.5.2
Choose a base ref
...
head repository: zdz/ServerStatus-Rust
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.5.3
Choose a head ref
  • 5 commits
  • 18 files changed
  • 2 contributors

Commits on Jul 1, 2022

  1. Update Rust crate lettre to 0.10.0

    renovate[bot] authored and zdz committed Jul 1, 2022
    Copy the full SHA
    9a2fe37 View commit details
  2. Update Rust Crate

    zdz committed Jul 1, 2022
    Copy the full SHA
    d35679c View commit details
  3. fmt

    zdz committed Jul 1, 2022
    Copy the full SHA
    b5a283c View commit details
  4. Copy the full SHA
    b03003a View commit details
  5. v1.5.3

    zdz committed Jul 1, 2022
    Copy the full SHA
    9326c87 View commit details
1 change: 1 addition & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
max_width = 120
76 changes: 38 additions & 38 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
edition = "2021"
name = "stat_client"
version = "1.5.2"
version = "1.5.3"

rust-version = "1.60"
rust-version = "1.62"

authors = ["doge <doge.py@gmail.com>"]
categories = ["monitoring-tools"]
22 changes: 8 additions & 14 deletions client/src/grpc.rs
Original file line number Diff line number Diff line change
@@ -16,10 +16,7 @@ use crate::INTERVAL_MS;
// TODO TLS

pub async fn report(args: &Args, stat_base: &mut StatRequest) -> anyhow::Result<()> {
if !vec![stat_base.online4, stat_base.online6]
.iter()
.any(|&x| x)
{
if !vec![stat_base.online4, stat_base.online6].iter().any(|&x| x) {
eprintln!("try get target network...");
let addr = args.addr.replace("grpc://", "");
let sock_addr = addr.to_socket_addrs()?.next().unwrap();
@@ -44,19 +41,16 @@ pub async fn report(args: &Args, stat_base: &mut StatRequest) -> anyhow::Result<
}
let token = MetadataValue::try_from(format!("{}@_@{}", auth_user, args.pass))?;

let channel = Channel::from_shared(args.addr.to_string())?
.connect()
.await?;
let channel = Channel::from_shared(args.addr.to_string())?.connect().await?;
let timeout_channel = Timeout::new(channel, Duration::from_millis(3000));

let grpc_client =
ServerStatusClient::with_interceptor(timeout_channel, move |mut req: Request<()>| {
req.metadata_mut().insert("authorization", token.clone());
req.metadata_mut()
.insert("ssr-auth", MetadataValue::try_from(ssr_auth).unwrap());
let grpc_client = ServerStatusClient::with_interceptor(timeout_channel, move |mut req: Request<()>| {
req.metadata_mut().insert("authorization", token.clone());
req.metadata_mut()
.insert("ssr-auth", MetadataValue::try_from(ssr_auth).unwrap());

Ok(req)
});
Ok(req)
});

loop {
let stat_rt = sample_all(args, stat_base);
Loading