mirror of
https://github.com/rustdesk/rustdesk-server.git
synced 2024-11-23 19:49:20 +08:00
CI
This commit is contained in:
parent
33f54ba5aa
commit
7e307a5a1c
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@ debian/debhelper-build-stamp
|
||||
.vscode
|
||||
src/version.rs
|
||||
db_v2.sqlite3
|
||||
test.*
|
||||
|
@ -2,7 +2,7 @@ fn main() {
|
||||
let out_dir = format!("{}/protos", std::env::var("OUT_DIR").unwrap());
|
||||
|
||||
std::fs::create_dir_all(&out_dir).unwrap();
|
||||
|
||||
|
||||
protobuf_codegen::Codegen::new()
|
||||
.pure()
|
||||
.out_dir(out_dir)
|
||||
|
@ -1 +1 @@
|
||||
include!(concat!(env!("OUT_DIR"), "/protos/mod.rs"));
|
||||
include!(concat!(env!("OUT_DIR"), "/protos/mod.rs"));
|
||||
|
@ -134,7 +134,7 @@ pub fn gen_sk(wait: u64) -> (String, Option<sign::SecretKey>) {
|
||||
}
|
||||
(pk, sk) = gen_func();
|
||||
}
|
||||
let pub_file = format!("{}.pub", sk_file);
|
||||
let pub_file = format!("{sk_file}.pub");
|
||||
if let Ok(mut f) = std::fs::File::create(&pub_file) {
|
||||
f.write_all(pk.as_bytes()).ok();
|
||||
if let Ok(mut f) = std::fs::File::create(sk_file) {
|
||||
|
@ -13,10 +13,9 @@ fn main() -> ResultType<()> {
|
||||
.write_mode(WriteMode::Async)
|
||||
.start()?;
|
||||
let args = format!(
|
||||
"-p, --port=[NUMBER(default={})] 'Sets the listening port'
|
||||
"-p, --port=[NUMBER(default={RELAY_PORT})] 'Sets the listening port'
|
||||
-k, --key=[KEY] 'Only allow the client with the same key'
|
||||
",
|
||||
RELAY_PORT,
|
||||
);
|
||||
let matches = App::new("hbbr")
|
||||
.version(version::VERSION)
|
||||
|
@ -3,4 +3,5 @@ pub use rendezvous_server::*;
|
||||
pub mod common;
|
||||
mod database;
|
||||
mod peer;
|
||||
#[rustfmt::skip]
|
||||
mod version;
|
||||
|
@ -15,16 +15,14 @@ fn main() -> ResultType<()> {
|
||||
.start()?;
|
||||
let args = format!(
|
||||
"-c --config=[FILE] +takes_value 'Sets a custom config file'
|
||||
-p, --port=[NUMBER(default={})] 'Sets the listening port'
|
||||
-p, --port=[NUMBER(default={RENDEZVOUS_PORT})] 'Sets the listening port'
|
||||
-s, --serial=[NUMBER(default=0)] 'Sets configure update serial number'
|
||||
-R, --rendezvous-servers=[HOSTS] 'Sets rendezvous servers, seperated by colon'
|
||||
-u, --software-url=[URL] 'Sets download url of RustDesk software of newest version'
|
||||
-r, --relay-servers=[HOST] 'Sets the default relay servers, seperated by colon'
|
||||
-M, --rmem=[NUMBER(default={})] 'Sets UDP recv buffer size, set system rmem_max first, e.g., sudo sysctl -w net.core.rmem_max=52428800. vi /etc/sysctl.conf, net.core.rmem_max=52428800, sudo sysctl –p'
|
||||
-M, --rmem=[NUMBER(default={RMEM})] 'Sets UDP recv buffer size, set system rmem_max first, e.g., sudo sysctl -w net.core.rmem_max=52428800. vi /etc/sysctl.conf, net.core.rmem_max=52428800, sudo sysctl –p'
|
||||
, --mask=[MASK] 'Determine if the connection comes from LAN, e.g. 192.168.0.0/16'
|
||||
-k, --key=[KEY] 'Only allow the client with the same key'",
|
||||
RENDEZVOUS_PORT,
|
||||
RMEM,
|
||||
);
|
||||
init_args(&args, "hbbs", "RustDesk ID/Rendezvous Server");
|
||||
let port = get_arg_or("port", RENDEZVOUS_PORT.to_string()).parse::<i32>()?;
|
||||
|
@ -77,7 +77,7 @@ impl PeerMap {
|
||||
}
|
||||
#[cfg(not(windows))]
|
||||
{
|
||||
db = format!("./{}", db);
|
||||
db = format!("./{db}");
|
||||
}
|
||||
db
|
||||
});
|
||||
|
@ -240,7 +240,7 @@ async fn check_cmd(cmd: &str, limiter: Limiter) -> String {
|
||||
}
|
||||
} else {
|
||||
unsafe {
|
||||
res = format!("{}\n", DOWNGRADE_THRESHOLD);
|
||||
res = format!("{DOWNGRADE_THRESHOLD}\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ impl RendezvousServer {
|
||||
#[tokio::main(flavor = "multi_thread")]
|
||||
pub async fn start(port: i32, serial: i32, key: &str, rmem: usize) -> ResultType<()> {
|
||||
let (key, sk) = Self::get_server_sk(key);
|
||||
let addr = format!("0.0.0.0:{}", port);
|
||||
let addr = format!("0.0.0.0:{port}");
|
||||
let nat_port = port - 1;
|
||||
let ws_port = port + 2;
|
||||
let pm = PeerMap::new().await?;
|
||||
|
17
src/utils.rs
17
src/utils.rs
@ -20,7 +20,7 @@ Available Commands:
|
||||
}
|
||||
|
||||
fn error_then_help(msg: &str) {
|
||||
println!("ERROR: {}\n", msg);
|
||||
println!("ERROR: {msg}\n");
|
||||
print_help();
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ fn validate_keypair(pk: &str, sk: &str) -> ResultType<()> {
|
||||
|
||||
fn doctor_tcp(address: std::net::IpAddr, port: &str, desc: &str) {
|
||||
let start = std::time::Instant::now();
|
||||
let conn = format!("{}:{}", address, port);
|
||||
let conn = format!("{address}:{port}");
|
||||
if let Ok(_stream) = TcpStream::connect(conn.as_str()) {
|
||||
let elapsed = std::time::Instant::now().duration_since(start);
|
||||
println!(
|
||||
@ -84,12 +84,12 @@ fn doctor_tcp(address: std::net::IpAddr, port: &str, desc: &str) {
|
||||
elapsed.as_millis()
|
||||
);
|
||||
} else {
|
||||
println!("TCP Port {} ({}): ERROR", port, desc);
|
||||
println!("TCP Port {port} ({desc}): ERROR");
|
||||
}
|
||||
}
|
||||
|
||||
fn doctor_ip(server_ip_address: std::net::IpAddr, server_address: Option<&str>) {
|
||||
println!("\nChecking IP address: {}", server_ip_address);
|
||||
println!("\nChecking IP address: {server_ip_address}");
|
||||
println!("Is IPV4: {}", server_ip_address.is_ipv4());
|
||||
println!("Is IPV6: {}", server_ip_address.is_ipv6());
|
||||
|
||||
@ -98,11 +98,10 @@ fn doctor_ip(server_ip_address: std::net::IpAddr, server_address: Option<&str>)
|
||||
let reverse = lookup_addr(&server_ip_address).unwrap();
|
||||
if let Some(server_address) = server_address {
|
||||
if reverse == server_address {
|
||||
println!("Reverse DNS lookup: '{}' MATCHES server address", reverse);
|
||||
println!("Reverse DNS lookup: '{reverse}' MATCHES server address");
|
||||
} else {
|
||||
println!(
|
||||
"Reverse DNS lookup: '{}' DOESN'T MATCH server address '{}'",
|
||||
reverse, server_address
|
||||
"Reverse DNS lookup: '{reverse}' DOESN'T MATCH server address '{server_address}'"
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -124,7 +123,7 @@ fn doctor(server_address_unclean: &str) {
|
||||
let server_address3 = server_address_unclean.trim();
|
||||
let server_address2 = server_address3.to_lowercase();
|
||||
let server_address = server_address2.as_str();
|
||||
println!("Checking server: {}\n", server_address);
|
||||
println!("Checking server: {server_address}\n");
|
||||
if let Ok(server_ipaddr) = server_address.parse::<IpAddr>() {
|
||||
// user requested an ip address
|
||||
doctor_ip(server_ipaddr, None);
|
||||
@ -155,7 +154,7 @@ fn main() {
|
||||
}
|
||||
let res = validate_keypair(args[2].as_str(), args[3].as_str());
|
||||
if let Err(e) = res {
|
||||
println!("{}", e);
|
||||
println!("{e}");
|
||||
process::exit(0x0001);
|
||||
}
|
||||
println!("Key pair is VALID");
|
||||
|
Loading…
Reference in New Issue
Block a user