change sled to sqlite and remove lic

This commit is contained in:
rustdesk
2022-05-12 20:00:33 +08:00
parent d36d6da445
commit b3f39598a7
33 changed files with 4125 additions and 2646 deletions

View File

@@ -1,34 +1,41 @@
use clap::App;
mod common;
mod relay_server;
use hbb_common::{env_logger::*, ResultType};
use flexi_logger::*;
use hbb_common::{config::RELAY_PORT, ResultType};
use relay_server::*;
use std::sync::{Arc, Mutex};
mod lic;
mod version;
fn main() -> ResultType<()> {
init_from_env(Env::default().filter_or(DEFAULT_FILTER_ENV, "info"));
let _logger = Logger::try_with_env_or_str("info")?
.log_to_stdout()
.format(opt_format)
.write_mode(WriteMode::Async)
.start()?;
let args = format!(
"-p, --port=[NUMBER(default={})] 'Sets the listening port'
-k, --key=[KEY] 'Only allow the client with the same key'
{}
",
DEFAULT_PORT,
lic::EMAIL_ARG
RELAY_PORT,
);
let matches = App::new("hbbr")
.version(hbbs::VERSION)
.author("CarrieZ Studio<info@rustdesk.com>")
.version(version::VERSION)
.author("Purslane Ltd. <info@rustdesk.com>")
.about("RustDesk Relay Server")
.args_from_usage(&args)
.get_matches();
if !lic::check_lic(matches.value_of("email").unwrap_or(""), hbbs::VERSION) {
if let Ok(v) = ini::Ini::load_from_file(".env") {
if let Some(section) = v.section(None::<String>) {
section.iter().for_each(|(k, v)| std::env::set_var(k, v));
}
}
#[cfg(not(debug_assertions))]
if !lic::check_lic(matches.value_of("email").unwrap_or(""), version::VERSION) {
return Ok(());
}
let stop: Arc<Mutex<bool>> = Default::default();
start(
matches.value_of("port").unwrap_or(DEFAULT_PORT),
matches.value_of("port").unwrap_or(&RELAY_PORT.to_string()),
matches.value_of("key").unwrap_or(""),
stop,
)?;
Ok(())
}