Skip to content

Commit

Permalink
feat(server): add version display for server
Browse files Browse the repository at this point in the history
  • Loading branch information
fu050409 committed Apr 25, 2024
1 parent f74ee1b commit 6716123
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oblivion"
version = "2.0.0"
version = "2.0.1"
authors = ["苏向夜 <fu050409@163.com>"]
description = "Rust High Concurrency Implementation of Oblivion, an End-to-End Encryption Protocol Based on ECDHE Encryption Algorithm"
edition = "2021"
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,5 @@ macro_rules! regex_route {
);
}};
}

pub static VERSION: &'static str = env!("CARGO_PKG_VERSION");
14 changes: 14 additions & 0 deletions src/models/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::net::SocketAddr;
use std::sync::Arc;

use crate::utils::gear::Socket;
use crate::VERSION;

use anyhow::{Error, Result};
use chrono::Local;
Expand Down Expand Up @@ -138,6 +139,19 @@ impl Server {
std::process::exit(0);
});

#[cfg(feature = "unsafe")]
println!(
"Oblivion version {}, using '{}'",
VERSION.bright_yellow(),
"p256".bright_red()
);
#[cfg(not(feature = "unsafe"))]
println!(
"Oblivion version {}, using '{}'",
VERSION.bright_yellow(),
"ring".bright_green()
);

println!(
"Starting server at {}",
format!("Oblivion://{}:{}/", self.host, self.port).bright_cyan()
Expand Down

0 comments on commit 6716123

Please sign in to comment.