From fda1e5e231ae64b6a60c441a089aedc3f7cb75f4 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Mon, 14 Jun 2021 18:27:09 +0800 Subject: [PATCH 01/29] https://github.com/rustdesk/rustdesk/issues/58 --- libs/hbb_common/src/config.rs | 10 +++++----- src/ui.rs | 27 ++++++++++++++++++++++++--- src/ui/index.tis | 15 ++++++++++++++- 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index 72eee9309..409a97439 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -646,7 +646,7 @@ impl PeerConfig { Config::path(path).with_extension("toml") } - pub fn peers() -> Vec<(String, SystemTime, PeerInfoSerde)> { + pub fn peers() -> Vec<(String, SystemTime, PeerConfig)> { if let Ok(peers) = Config::path(PEERS).read_dir() { if let Ok(peers) = peers .map(|res| res.map(|e| e.path())) @@ -667,13 +667,13 @@ impl PeerConfig { .map(|p| p.to_str().unwrap_or("")) .unwrap_or("") .to_owned(); - let info = PeerConfig::load(&id).info; - if info.platform.is_empty() { + let c = PeerConfig::load(&id); + if c.info.platform.is_empty() { fs::remove_file(&p).ok(); } - (id, t, info) + (id, t, c) }) - .filter(|p| !p.2.platform.is_empty()) + .filter(|p| !p.2.info.platform.is_empty()) .collect(); peers.sort_unstable_by(|a, b| b.1.cmp(&a.1)); return peers; diff --git a/src/ui.rs b/src/ui.rs index 4f4506d00..f4d6253c9 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -266,6 +266,21 @@ impl UI { } } + fn get_peer_option(&self, id: String, name: String) -> String { + let c = PeerConfig::load(&id); + c.options.get(&name).unwrap_or(&"".to_owned()).to_owned() + } + + fn set_peer_option(&self, id: String, name: String, value: String) { + let mut c = PeerConfig::load(&id); + if value.is_empty() { + c.options.remove(&name); + } else { + c.options.insert(name, value); + } + c.store(&id); + } + fn get_options(&self) -> Value { let mut m = Value::map(); for (k, v) in self.2.lock().unwrap().iter() { @@ -364,9 +379,13 @@ impl UI { .map(|p| { let values = vec![ p.0.clone(), - p.2.username.clone(), - p.2.hostname.clone(), - p.2.platform.clone(), + p.2.info.username.clone(), + p.2.info.hostname.clone(), + p.2.info.platform.clone(), + p.2.options + .get("alias") + .unwrap_or(&"".to_owned()) + .to_owned(), ]; Value::from_iter(values) }) @@ -535,6 +554,8 @@ impl sciter::EventHandler for UI { fn fix_login_wayland(); fn get_options(); fn get_option(String); + fn get_peer_option(String, String); + fn set_peer_option(String, String, String); fn test_if_valid_server(String); fn get_sound_inputs(); fn set_options(Value); diff --git a/src/ui/index.tis b/src/ui/index.tis index 1af803470..ae965ddf9 100644 --- a/src/ui/index.tis +++ b/src/ui/index.tis @@ -64,13 +64,14 @@ class RecentSessions: Reactor.Component { var username = s[1]; var hostname = s[2]; var platform = s[3]; + var alias = s[4]; return
{platformSvg(platform, "white")}
{username}@{hostname}
-
{formatId(id)}
+
{alias ? alias : formatId(id)}
{svg_menu}
; @@ -109,6 +110,17 @@ event click $(menu#remote-context li) (evt, me) { createNewConnect(id, "rdp"); } else if (action == "tunnel") { createNewConnect(id, "port-forward"); + } else if (action == "rename") { + var old_name = handler.get_peer_option(id, "alias"); + handler.msgbox("custom-rename", "Rename", "
\ +
\ +
\ + ", function(res=null) { + if (!res) return; + var name = (res.name || "").trim(); + if (name != old_name) handler.set_peer_option(id, "alias", name); + self.select('#' + id).select('#alias').text = name || id; + }); } } @@ -318,6 +330,7 @@ class App: Reactor.Component
  • Transfer File
  • TCP Tunneling
  • RDP
  • +
  • Rename
  • Remove
  • {is_win &&
  • Create Desktop Shortcut
  • } From 51903ede3d95a29078f5924d26d5820ac992841d Mon Sep 17 00:00:00 2001 From: rustdesk Date: Tue, 15 Jun 2021 11:21:10 +0800 Subject: [PATCH 02/29] rs-ny.rustdesk.com --- libs/hbb_common/src/config.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index 409a97439..09c7cb931 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -17,7 +17,7 @@ pub const BIND_INTERFACE: &str = "0.0.0.0"; pub const RENDEZVOUS_TIMEOUT: u64 = 12_000; pub const CONNECT_TIMEOUT: u64 = 18_000; pub const COMPRESS_LEVEL: i32 = 3; -const SERIAL: i32 = 0; +const SERIAL: i32 = 1; // 128x128 #[cfg(target_os = "macos")] // 128x128 on 160x160 canvas, then shrink to 128, mac looks better with padding pub const ICON: &str = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAAyVBMVEUAAAAAcf8Acf8Acf8Acv8Acf8Acf8Acf8Acf8AcP8Acf8Ab/8AcP8Acf////8AaP/z+f/o8v/k7v/5/v/T5f8AYP/u9v/X6f+hx/+Kuv95pP8Aef/B1/+TwP9xoP8BdP/g6P+Irv9ZmP8Bgf/E3f98q/9sn/+01f+Es/9nm/9Jif8hhv8off/M4P+syP+avP86iP/c7f+xy/9yqf9Om/9hk/9Rjv+60P99tv9fpf88lv8yjf8Tgf8deP+kvP8BiP8NeP8hkP80gP8oj2VLAAAADXRSTlMA7o7qLvnaxZ1FOxYPjH9HWgAABHJJREFUeNrtm+tW4jAQgBfwuu7MtIUWsOUiCCioIIgLiqvr+z/UHq/LJKVkmwTcc/r9E2nzlU4mSTP9lpGRkZGR8VX5cZjfL+yCEXYL+/nDH//U/Pd8DgyTy39Xbv7oIAcWyB0cqbW/sweW2NtRaj8H1sgpGOwUIAH7Bkd7YJW9dXFwAJY5WNP/cmCZQnJvzIN18on5LwfWySXlxEPYAIcad8D6PdiHDbCfIFCADVBIENiFDbCbIACKPPXrZ+cP8E6/0znvP4EymgIEravIRcTxu8HxNSJ60a8W0AYECKrlAN+YwAthCd9wm1Ug6wKzIn5SgRduXfwkqDasCjx0XFzi9PV6zwNcIuhcWBOg+ikySq8C9UD4dEKWBCoOcspvAuLHTo9sCDQiFPHotRM48j8G5gVur1FdAN2uaYEuiz7xFsgEJ2RUoMUakXuBTHHoGxQYOBhHjeUBAefEnMAowFhaLBOKuOemBBbxLRQrH2PBCgMvNCPQGMeevTb9zLrPxz2Mo+QbEaijzPUcOOHMQZkKGRAIPem39+bypREMPTkQW/oCfk866zAkiIFG4yIKRE/aAnfiSd0WrORY6pFdXQEqi9mvAQm0RIOSnoCcZ8vJoz3diCnjRk+g8VP4/fuQDJ2Lxr6WwG0gXs9aTpDzW0vgDBlVUpixR8gYk44AD8FrUKHr8JQJGgIDnoDqoALxmWPQSi9AVVzm8gKUuEPGr/QCvptwJkbSYT/TC4S8C96DGjTj86aHtAI0x2WaBIq0eSYYpRa4EsdWVVwWu9O0Aj6f6dyBMnwEraeOgSYu0wZlauzA47QCbT7DgAQSE+hZWoEBF/BBmWOewNMK3BsSqKUW4MGcWqCSVmDkbvkXGKQOwg6PAUO9oL3xXhA20yaiCjuwYygRVQlUOTWTCf2SuNJTxeFjgaHByGuAIvd8ItdPLTDhS7IuqEE1YSKVOgbayLhSFQhMzYh8hwfBs1r7c505YVIQYEdNoKwxK06MJiyrpUFHiF0NAfCQUVHoiRclIXJIR6C2fqG37pBHvcWpgwzvAtYwkR5UGV2e42UISdBJETl3mg8ouo54Rcnti1/vaT+iuUQBt500Cgo4U10BeHSkk57FB0JjWkKRMWgLUA0lLodtImAQdaMiiri3+gIAPZQoutHNsgKF1aaDMhMyIdBf8Th+Bh8MTjGWCpl5Wv43tDmnF+IUVMrcZgRoiAxhtrloYizNkZaAnF5leglbNhj0wYCAbCDvGb0mP4nib7O7ZlcYQ2m1gPtIZgVgGNNMeaVAaWR+57TrqgtUnm3sHQ+kYeE6fufUubG1ez50FXbPnWgBlgSABmN3TTcsRl2yWkHRrwbiunvk/W2+Mg1hPZplPDeXRbZzStFH15s1QIVd3UImP5z/bHpeeQLvRJ7XLFUffQIlCvqlXETQbgN9/rlYABGosv+Vi9m2Xs639YLGrZd0br+odetlvdsvbN56abfd4vbCzv9Q3v/ygoOV21A4OPpfXvH4Ai+5ZGRkZGRkbJA/t/I0QMzoMiEAAAAASUVORK5CYII= @@ -48,6 +48,7 @@ const CHARS: &'static [char] = &[ ]; pub const RENDEZVOUS_SERVERS: &'static [&'static str] = &[ + "rs-ny.rustdesk.com", "rs-sg.rustdesk.com", "rs-cn.rustdesk.com", ]; From b0f3ec40ce6631e7762888f1ccab878254d9d09e Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Thu, 17 Jun 2021 11:41:07 +0800 Subject: [PATCH 03/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f31a96d05..b7285f3bd 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Chat with us: [Discord](https://discord.gg/nDceKgxnkV) [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) -An open-source remote desktop client software, written in Rust. Works out of the box, no configuration required. Great alternative to TeamViewer and AnyDesk! You have full control of your data, with no concerns about security. You can use our rendezvous/relay server, [set up your own](https://rustdesk.com/blog/id-relay-set/), or [write your own rendezvous/relay server](https://github.com/rustdesk/rustdesk-server-demo). +Yet another remote desktop client software, written in Rust. Works out of the box, no configuration required. Great alternative to TeamViewer and AnyDesk! You have full control of your data, with no concerns about security. You can use our rendezvous/relay server, [set up your own](https://rustdesk.com/blog/id-relay-set/), or [write your own rendezvous/relay server](https://github.com/rustdesk/rustdesk-server-demo). RustDesk welcomes contribution from everyone. See [`CONTRIBUTING.md`](CONTRIBUTING.md) for help getting started. From 562b0c79dda06105f051827889999cd211b377da Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Thu, 17 Jun 2021 11:41:21 +0800 Subject: [PATCH 04/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b7285f3bd..bc91aed82 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Chat with us: [Discord](https://discord.gg/nDceKgxnkV) [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) -Yet another remote desktop client software, written in Rust. Works out of the box, no configuration required. Great alternative to TeamViewer and AnyDesk! You have full control of your data, with no concerns about security. You can use our rendezvous/relay server, [set up your own](https://rustdesk.com/blog/id-relay-set/), or [write your own rendezvous/relay server](https://github.com/rustdesk/rustdesk-server-demo). +Yet another remote desktop software, written in Rust. Works out of the box, no configuration required. Great alternative to TeamViewer and AnyDesk! You have full control of your data, with no concerns about security. You can use our rendezvous/relay server, [set up your own](https://rustdesk.com/blog/id-relay-set/), or [write your own rendezvous/relay server](https://github.com/rustdesk/rustdesk-server-demo). RustDesk welcomes contribution from everyone. See [`CONTRIBUTING.md`](CONTRIBUTING.md) for help getting started. From 7daeddf560482b2f4c4c8e3e3ed4566e3a36998f Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Thu, 17 Jun 2021 12:55:11 +0800 Subject: [PATCH 05/29] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index bc91aed82..959dcbaf5 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,12 @@ RustDesk welcomes contribution from everyone. See [`CONTRIBUTING.md`](CONTRIBUT [**BINARY DOWNLOAD**](https://github.com/rustdesk/rustdesk/releases) +## Free Public Servers +Below are the servers you are using for free, it may change along the time. If you are not close to one of these, your network may be slow. +- Seoul, AWS lightsail, 1 VCPU/0.5G RAM +- Singapore, Vultr, 1 VCPU/1G RAM +- Virginia, AWS EC2, 4 VCPUs/32G RAM, donated by [tensorsurgical.com](tensorsurgical.com) + ## Dependencies Desktop versions use [sciter](https://sciter.com/) for GUI, please download sciter dynamic library yourself. From ec294451e335d85221d53468a4f26377c1c4da4d Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Thu, 17 Jun 2021 12:55:34 +0800 Subject: [PATCH 06/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 959dcbaf5..dc2803dc5 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ RustDesk welcomes contribution from everyone. See [`CONTRIBUTING.md`](CONTRIBUT Below are the servers you are using for free, it may change along the time. If you are not close to one of these, your network may be slow. - Seoul, AWS lightsail, 1 VCPU/0.5G RAM - Singapore, Vultr, 1 VCPU/1G RAM -- Virginia, AWS EC2, 4 VCPUs/32G RAM, donated by [tensorsurgical.com](tensorsurgical.com) +- Virginia, AWS EC2, 4 VCPUs/32G RAM, donated by [tensorsurgical.com](https://tensorsurgical.com) ## Dependencies From 142eebc9e24baedd39a2d5c13453f1beb9cb4810 Mon Sep 17 00:00:00 2001 From: mtoohey31 Date: Sat, 19 Jun 2021 14:35:40 -0400 Subject: [PATCH 07/29] https://github.com/rustdesk/rustdesk/issues/87 --- src/platform/linux.rs | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/platform/linux.rs b/src/platform/linux.rs index 9fbddb826..8ebd62f7f 100644 --- a/src/platform/linux.rs +++ b/src/platform/linux.rs @@ -353,11 +353,44 @@ fn get_display_server_of_session(session: &str) -> String { if let Ok(output) = std::process::Command::new("loginctl") .args(vec!["show-session", "-p", "Type", session]) .output() + // Check session type of the session { - String::from_utf8_lossy(&output.stdout) + let display_server = String::from_utf8_lossy(&output.stdout) .replace("Type=", "") .trim_end() - .into() + .into(); + if display_server == "tty" { + // If the type is tty... + if let Ok(output) = std::process::Command::new("loginctl") + .args(vec!["show-session", "-p", "TTY", session]) + .output() + // Get the tty number + { + let tty: String = String::from_utf8_lossy(&output.stdout) + .replace("TTY=", "") + .trim_end() + .into(); + if let Ok(Some(xorg_results)) = + run_cmds(format!("ps -e | grep \"{}.\\\\+Xorg\"", tty)) + // And check if Xorg is running on that tty + { + if xorg_results.trim_end().to_string() != "" { + // If it is, manually return "x11", otherwise return tty + "x11".to_owned() + } else { + display_server + } + } else { + // If any of these commands fail just fall back to the display server + display_server + } + } else { + display_server + } + } else { + // If the session is not a tty, then just return the type as usual + display_server + } } else { "".to_owned() } From c3b6dabcc854020f6de1d1f157b5af64fce79c51 Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Sun, 20 Jun 2021 15:46:24 +0800 Subject: [PATCH 08/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dc2803dc5..e638d2466 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # RustDesk | Your Remote Desktop Software -Chat with us: [Discord](https://discord.gg/nDceKgxnkV) +Chat with us: [Discord](https://discord.gg/nDceKgxnkV) | [Reddit](https://www.reddit.com/r/rustdesk) [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) From 6862406e68a172e882ae829a49284ca2f0e2c188 Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Sun, 20 Jun 2021 16:02:35 +0800 Subject: [PATCH 09/29] Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index e638d2466..c5c9973e5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,11 @@ # RustDesk | Your Remote Desktop Software +

    + Servers • + Build • + Structure • + Snapshot
    + [中文] [Deutsche] +

    Chat with us: [Discord](https://discord.gg/nDceKgxnkV) | [Reddit](https://www.reddit.com/r/rustdesk) From 9383e4ecbbf91cb7baf716afe7e37e86756fdc83 Mon Sep 17 00:00:00 2001 From: mtoohey31 Date: Sun, 20 Jun 2021 11:27:57 -0400 Subject: [PATCH 10/29] Support builds via Docker --- Dockerfile | 20 ++++++++++++++++++++ README.md | 42 ++++++++++++++++++++++++++++++++++++------ entrypoint | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 Dockerfile create mode 100755 entrypoint diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..42399adde --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM debian + +WORKDIR / +RUN apt update -y && apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake unzip zip sudo + +RUN git clone https://github.com/microsoft/vcpkg --branch 2020.11-1 +RUN /vcpkg/bootstrap-vcpkg.sh -disableMetrics +RUN /vcpkg/vcpkg --disable-metrics install libvpx libyuv opus + +RUN groupadd -r user && useradd -r -g user user --home /home/user && mkdir -p /home/user && chown user /home/user +WORKDIR /home/user +RUN wget https://github.com/c-smile/sciter-sdk/raw/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.lnx/x64/libsciter-gtk.so +USER user +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh +RUN chmod +x rustup.sh +RUN ./rustup.sh -y + +USER root +COPY ./entrypoint / +ENTRYPOINT ["/entrypoint"] diff --git a/README.md b/README.md index c5c9973e5..a457ff70f 100644 --- a/README.md +++ b/README.md @@ -44,22 +44,22 @@ Desktop versions use [sciter](https://sciter.com/) for GUI, please download scit ## How to build on Linux ### Ubuntu 18 (Debian 10) -``` +```sh sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake ``` ### Fedora 28 (CentOS 8) -``` +```sh sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-devel libxdo-devel libXfixes-devel pulseaudio-libs-devel cmake alsa-lib-devel ``` ### Arch (Manjaro) -``` +```sh sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio ``` ### Install vcpkg -``` +```sh git clone https://github.com/microsoft/vcpkg --branch 2020.11-1 vcpkg/bootstrap-vcpkg.sh export VCPKG_ROOT=$HOME/vcpkg @@ -67,7 +67,7 @@ vcpkg/vcpkg install libvpx libyuv opus ``` ### Fix libvpx (For Fedora) -``` +```sh cd vcpkg/buildtrees/libvpx/src cd * ./configure @@ -79,7 +79,7 @@ cd ``` ### Build -``` +```sh curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source $HOME/.cargo/env git clone https://github.com/rustdesk/rustdesk @@ -90,6 +90,36 @@ mv libsciter-gtk.so target/debug cargo run ``` +## How to build with Docker + +Begin by cloning the repository and building the docker container: + +```sh +git clone https://github.com/rustdesk/rustdesk +cd rustdesk +docker build -t "rustdesk-builder" . +``` + +Then, each time you need to build the application, run the following command: + +```sh +docker run --rm -it -v $PWD:/home/user/rustdesk -v rustdesk-git-cache:/home/user/.cargo/git -v rustdesk-registry-cache:/home/user/.cargo/registry -e PUID="$(id -u)" -e PGID="$(id -g)" rustdesk-builder +``` + +Note that the first build may take longer before dependencies are cached, subsequent builds will be faster. Additionally, if you need to specify different arguments to the build command, you may do so at the end of the command in the `` position. For instance, if you wanted to build an optimized release version, you would run the command above followed by `---release`. The resulting executable will be available in the target folder on your system, and can be run with: + +```sh +target/debug/rustdesk +``` + +Or, if you're running a release executable: + +```sh +target/release/rustdesk +``` + +Please ensure that you are running these commands from the root of the RustDesk repository, otherwise the application may be unable to find the required resources. Also note that other cargo subcommands such as `install` or `run` are not currently supported via this method as they would install or run the program inside the container instead of the host. + ### Change Wayland to X11 (Xorg) RustDesk does not support Wayland. Check [this](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) to configuring Xorg as the default GNOME session. diff --git a/entrypoint b/entrypoint new file mode 100755 index 000000000..75b9efd18 --- /dev/null +++ b/entrypoint @@ -0,0 +1,42 @@ +#!/bin/sh + +if [ "$(id -u)" != "${PUID:-1000}" ] || [ "$(id -g)" != "${PGID:-1000}" ]; then + usermod -o -u "${PUID:-1000}" user + groupmod -o -g "${PGID:-1000}" user + chown -R user /home/user + sudo -u user /entrypoint $@ + exit 0 +fi + +cd $HOME/rustdesk +. $HOME/.cargo/env + +argv=$@ + +while test $# -gt 0; do + case "$1" in + --release) + mkdir -p target/release + test -f target/release/libsciter-gtk.so || cp $HOME/libsciter-gtk.so target/release/ + release=1 + shift + ;; + --target) + shift + if test $# -gt 0; then + rustup target add $1 + shift + fi + ;; + *) + shift + ;; + esac +done + +if [ -z $release ]; then + mkdir -p target/debug + test -f target/debug/libsciter-gtk.so || cp $HOME/libsciter-gtk.so target/debug/ +fi + +VCPKG_ROOT=/vcpkg cargo build $argv From 9d5cfb04ac51d4cc96c49f88825a5bb8dca9cca3 Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Mon, 21 Jun 2021 12:18:28 +0800 Subject: [PATCH 11/29] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a457ff70f..9a79bf3ba 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@

    ServersBuild • + DockerStructureSnapshot
    [中文] [Deutsche] From 2159423431867459dd4d0db561b7a0e78a78e1f0 Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Mon, 21 Jun 2021 12:18:56 +0800 Subject: [PATCH 12/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9a79bf3ba..770d082e9 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@

    ServersBuild • - Docker • + DockerStructureSnapshot
    [中文] [Deutsche] From c8465f9a5d692c2e25ca1951749c70895ee45234 Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Mon, 21 Jun 2021 12:19:13 +0800 Subject: [PATCH 13/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 770d082e9..eb1cd6271 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@

    ServersBuild • - Docker • + DockerStructureSnapshot
    [中文] [Deutsche] From a4a09d5bfc780ce5b18b86f99268e37bcf890269 Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Mon, 21 Jun 2021 12:44:34 +0800 Subject: [PATCH 14/29] Create README-ZH.md --- README-ZH.md | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 README-ZH.md diff --git a/README-ZH.md b/README-ZH.md new file mode 100644 index 000000000..b810f6042 --- /dev/null +++ b/README-ZH.md @@ -0,0 +1,150 @@ +# RustDesk | Your Remote Desktop Software +

    + 服务器 • + 编译 • + Docker • + 结构 • + 截图
    +

    + +Chat with us: [知乎](https://www.zhihu.com/people/rustdesk) | [Discord](https://discord.gg/nDceKgxnkV) | [Reddit](https://www.reddit.com/r/rustdesk) + +[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) + +远程桌面软件,开箱即用,无需任何配置,替代TeamViewer和AnyDesk。您完全掌控数据,不用担心安全问题。您可以使用我们的注册/中继服务器, +或者[自己设置](https://rustdesk.com/blog/id-relay-set/), +亦或者[开发您的版本](https://github.com/rustdesk/rustdesk-server-demo)。 + +欢迎大家贡献代码, 请看 [`CONTRIBUTING.md`](CONTRIBUTING.md). + +[**可执行程序下载**](https://github.com/rustdesk/rustdesk/releases) + +## 免费公共服务器 +以下是您免费使用的服务器,它可能会随着时间的推移而变化。如果您不靠近其中之一,您的网络可能会很慢。 +- 首尔, AWS lightsail, 1 VCPU/0.5G RAM +- 新加坡, Vultr, 1 VCPU/1G RAM +- 美国佛吉利亚, AWS EC2, 4 VCPUs/32G RAM, 由[tensorsurgical.com](https://tensorsurgical.com)赞助 + +## 依赖 + +桌面版本界面使用[sciter](https://sciter.com/), 请自行下载。 + +[Windows](https://github.com/c-smile/sciter-sdk/blob/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.win/x64/sciter.dll) | +[Linux](https://github.com/c-smile/sciter-sdk/raw/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.lnx/x64/libsciter-gtk.so) | +[macOS](https://github.com/c-smile/sciter-sdk/raw/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.osx/sciter-osx-64.dylib) + +## 基本构建步骤 +* 请准备好Rust开发环境和C++编译环境 + +* 安装[vcpkg](https://github.com/microsoft/vcpkg), 正确设置`VCPKG_ROOT`环境变量 + + - Windows: vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static + - Linux/Osx: vcpkg install libvpx libyuv opus + +* 运行 `cargo run` + +## 在Linux上编译 + +### Ubuntu 18 (Debian 10) +```sh +sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake +``` + +### Fedora 28 (CentOS 8) +```sh +sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-devel libxdo-devel libXfixes-devel pulseaudio-libs-devel cmake alsa-lib-devel +``` + +### Arch (Manjaro) +```sh +sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio +``` + +### 安装vcpkg +```sh +git clone https://github.com/microsoft/vcpkg --branch 2020.11-1 +vcpkg/bootstrap-vcpkg.sh +export VCPKG_ROOT=$HOME/vcpkg +vcpkg/vcpkg install libvpx libyuv opus +``` + +### 修复libvpx (For Fedora) +```sh +cd vcpkg/buildtrees/libvpx/src +cd * +./configure +sed -i 's/CFLAGS+=-I/CFLAGS+=-fPIC -I/g' Makefile +sed -i 's/CXXFLAGS+=-I/CXXFLAGS+=-fPIC -I/g' Makefile +make +cp libvpx.a $HOME/vcpkg/installed/x64-linux/lib/ +cd +``` + +### 构建 +```sh +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +source $HOME/.cargo/env +git clone https://github.com/rustdesk/rustdesk +cd rustdesk +mkdir -p target/debug +wget https://github.com/c-smile/sciter-sdk/raw/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.lnx/x64/libsciter-gtk.so +mv libsciter-gtk.so target/debug +cargo run +``` + +## 使用Docker编译 + +首先克隆存储库并构建 docker 容器: + +```sh +git clone https://github.com/rustdesk/rustdesk +cd rustdesk +docker build -t "rustdesk-builder" . +``` + +然后,每次需要构建应用程序时,运行以下命令: + +```sh +docker run --rm -it -v $PWD:/home/user/rustdesk -v rustdesk-git-cache:/home/user/.cargo/git -v rustdesk-registry-cache:/home/user/.cargo/registry -e PUID="$(id -u)" -e PGID="$(id -g)" rustdesk-builder +``` + + +请注意,第一次构建可能需要比较长的时间,因为需要缓存依赖项,后续构建会更快。此外,如果您需要为构建命令指定不同的参数, +您可以在命令末尾的 `` 位置执行此操作。例如,如果你想构建一个优化的发布版本,你可以在命令后跟 `---release`。 +将在target下产生可执行程序,请通过以下方式运行调试版本: +```sh +target/debug/rustdesk +``` + +或者运行发布版本: + +```sh +target/release/rustdesk +``` + +请确保您从 RustDesk 存储库的根目录运行这些命令,否则应用程序可能无法找到所需的资源。另请注意,此方法当前不支持其他`Cargo`子命令, +例如 `install` 或 `run`,因为运行在容器里,而不是宿主机上。 + +### 把Wayland修改成X11 (Xorg) +RustDesk暂时不支持Wayland,不过正在积极开发中. +请查看[this](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/)配置X11. + +## 文件结构 + +- **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)**: 视频编解码, 配置, tcp/udp封装, protobuf, 文件传输相关文件系统操作函数, 以及一些其他实用函数 +- **[libs/scrap](https://github.com/rustdesk/rustdesk/tree/master/libs/scrap)**: 截屏 +- **[libs/enigo](https://github.com/rustdesk/rustdesk/tree/master/libs/enigo)**: 平台相关的鼠标键盘输入 +- **[src/ui](https://github.com/rustdesk/rustdesk/tree/master/src/ui)**: GUI +- **[src/server](https://github.com/rustdesk/rustdesk/tree/master/src/server)**: 被控端服务,audio/clipboard/input/video服务, 已经连接实现 +- **[src/client.rs](https://github.com/rustdesk/rustdesk/tree/master/src/client.rs)**: 控制端 +- **[src/rendezvous_mediator.rs](https://github.com/rustdesk/rustdesk/tree/master/src/rendezvous_mediator.rs)**: 与[rustdesk-server](https://github.com/rustdesk/rustdesk-server)保持UDP通讯, 等待远程连接(通过打洞直连或者中继) +- **[src/platform](https://github.com/rustdesk/rustdesk/tree/master/src/platform)**: 平台服务相关代码 + +## 截图 +![image](https://user-images.githubusercontent.com/71636191/113112362-ae4deb80-923b-11eb-957d-ff88daad4f06.png) + +![image](https://user-images.githubusercontent.com/71636191/113112619-f705a480-923b-11eb-911d-97e984ef52b6.png) + +![image](https://user-images.githubusercontent.com/71636191/113112857-3fbd5d80-923c-11eb-9836-768325faf906.png) + +![image](https://user-images.githubusercontent.com/71636191/113112990-65e2fd80-923c-11eb-840e-349b4d6e340d.png) From 7b4d5bc70412c7488fc3de81c5786bfcc2156827 Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Mon, 21 Jun 2021 12:49:05 +0800 Subject: [PATCH 15/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eb1cd6271..425e3a209 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ DockerStructureSnapshot
    - [中文] [Deutsche] + [中文] | [Deutsche] | [日本語] | [Русский] | [Português]

    Chat with us: [Discord](https://discord.gg/nDceKgxnkV) | [Reddit](https://www.reddit.com/r/rustdesk) From 7cc5d138a0daecf23a69bc523b9b004867d57c88 Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Mon, 21 Jun 2021 12:55:34 +0800 Subject: [PATCH 16/29] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 425e3a209..f9ef349e3 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ DockerStructureSnapshot
    - [中文] | [Deutsche] | [日本語] | [Русский] | [Português] + [中文] | [Deutsche] | [日本語] | [Русский] | [Português]
    + We need your help to translate this README to your native language

    Chat with us: [Discord](https://discord.gg/nDceKgxnkV) | [Reddit](https://www.reddit.com/r/rustdesk) From 8ef831ee5cadf6d8acbcabab9ecaf4cd7aca828f Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Mon, 21 Jun 2021 16:27:16 +0800 Subject: [PATCH 17/29] Add files via upload --- README-ES.md | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 README-ES.md diff --git a/README-ES.md b/README-ES.md new file mode 100644 index 000000000..1d975e55a --- /dev/null +++ b/README-ES.md @@ -0,0 +1,145 @@ +# RustDesk | Your Remote Desktop Software +

    + Servers • + Build • + Docker • + Structure • + Snapshot
    + [中文] | [Deutsche] | [日本語] | [Русский] | [Português]
    + Necesitamos tu ayuda para traducir este README a tu idioma +

    + +Chat with us: [Discord](https://discord.gg/nDceKgxnkV) | [Reddit](https://www.reddit.com/r/rustdesk) + +[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) + +Otro software de escritorio remoto, escrito en Rust. Funciona de forma inmediata, sin necesidad de configuración. Gran alternativa a TeamViewer o AnyDesk. Tienes el control total de sus datos, sin preocupaciones sobre la seguridad. Puedes utilizar nuestro servidor de rendezvous/relay, [set up your own](https://rustdesk.com/blog/id-relay-set/), o [escribir tu propio servidor rendezvous/relay](https://github.com/rustdesk/rustdesk-server-demo). + +RustDesk agradece la contribución de todo el mundo. Ve [`CONTRIBUTING.md`](CONTRIBUTING.md) para ayuda inicial. + +[**DESCARGA DE BINARIOS**](https://github.com/rustdesk/rustdesk/releases) + +## Servidores gratis de uso público +A continuación se muestran los servidores que está utilizando de forma gratuita, puede cambiar en algún momento. Si no estás cerca de uno de ellos, tu red puede ser lenta. +- Seoul, AWS lightsail, 1 VCPU/0.5G RAM +- Singapore, Vultr, 1 VCPU/1G RAM +- Virginia, AWS EC2, 4 VCPUs/32G RAM, donated by [tensorsurgical.com](https://tensorsurgical.com) + +## Dependencies + +La versión Desktop usa [sciter](https://sciter.com/) para GUI, por favor bajate la librería sciter tu mismo.. + +[Windows](https://github.com/c-smile/sciter-sdk/blob/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.win/x64/sciter.dll) | +[Linux](https://github.com/c-smile/sciter-sdk/raw/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.lnx/x64/libsciter-gtk.so) | +[macOS](https://github.com/c-smile/sciter-sdk/raw/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.osx/sciter-osx-64.dylib) + +## Pasos para compilar desde el inicio +* Prepara el entono de desarrollode Rust y el entorno de compilación de C++ y Rust. + +* Instala [vcpkg](https://github.com/microsoft/vcpkg), y configura la variable de entono `VCPKG_ROOT` correctamente. + + - Windows: vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static + - Linux/Osx: vcpkg install libvpx libyuv opus + +* run `cargo run` + +## Como compilar en linux + +### Ubuntu 18 (Debian 10) +```sh +sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake +``` + +### Fedora 28 (CentOS 8) +```sh +sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-devel libxdo-devel libXfixes-devel pulseaudio-libs-devel cmake alsa-lib-devel +``` + +### Arch (Manjaro) +```sh +sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio +``` + +### Install vcpkg +```sh +git clone https://github.com/microsoft/vcpkg --branch 2020.11-1 +vcpkg/bootstrap-vcpkg.sh +export VCPKG_ROOT=$HOME/vcpkg +vcpkg/vcpkg install libvpx libyuv opus +``` + +### Soluciona libvpx (For Fedora) +```sh +cd vcpkg/buildtrees/libvpx/src +cd * +./configure +sed -i 's/CFLAGS+=-I/CFLAGS+=-fPIC -I/g' Makefile +sed -i 's/CXXFLAGS+=-I/CXXFLAGS+=-fPIC -I/g' Makefile +make +cp libvpx.a $HOME/vcpkg/installed/x64-linux/lib/ +cd +``` + +### Compila +```sh +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +source $HOME/.cargo/env +git clone https://github.com/rustdesk/rustdesk +cd rustdesk +mkdir -p target/debug +wget https://github.com/c-smile/sciter-sdk/raw/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.lnx/x64/libsciter-gtk.so +mv libsciter-gtk.so target/debug +cargo run +``` + +## Como compilar con Docker + +Empieza clonando el repositorio y compilando el contenedor de docker: + +```sh +git clone https://github.com/rustdesk/rustdesk +cd rustdesk +docker build -t "rustdesk-builder" . +``` +Entonces, cada vez que necesites compilar una modificación, ejecuta el siguiente comando: + +```sh +docker run --rm -it -v $PWD:/home/user/rustdesk -v rustdesk-git-cache:/home/user/.cargo/git -v rustdesk-registry-cache:/home/user/.cargo/registry -e PUID="$(id -u)" -e PGID="$(id -g)" rustdesk-builder +``` + +Ten en cuenta que la primera compilación puede tardar más tiempo antes de que las dependencias se almacenen en la caché, las siguientes compilaciones serán más rápidas. Además, si necesitas especificar diferentes argumentos a la orden de compilación, puede hacerlo al final de la linea de comandos en el apartado``. Por ejemplo, si desea compilar una versión optimizada para publicación, deberá ejecutar el comando anterior seguido de `---release`. El ejecutable resultante estará disponible en la carpeta de destino en su sistema, y puede ser ejecutado con: + +```sh +target/debug/rustdesk +``` + +O si estas ejecutando una versión para su publicación: + +```sh +target/release/rustdesk +``` + +Por favor, asegurate de que estás ejecutando estos comandos desde la raíz del repositorio de RustDesk, de lo contrario la aplicación puede ser incapaz de encontrar los recursos necesarios. También hay que tener en cuenta que otros subcomandos de carga como `install` o `run` no estan actualmente soportados via este metodo y podrían requerir ser instalados dentro del contenedor y no en el host. + +### Cambia Wayland a X11 (Xorg) +RustDesk no soporta Wayland. Comprueba [aquí](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) para configurar Xorg en la sesión por defecto de GNOME. + +## Estructura de archivos + +- **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)**: video codec, configuración, tcp/udp wrapper, protobuf, fs funciones para transferencia de ficheros, y alguna función de utilidad. +- **[libs/scrap](https://github.com/rustdesk/rustdesk/tree/master/libs/scrap)**: captura de pantalla +- **[libs/enigo](https://github.com/rustdesk/rustdesk/tree/master/libs/enigo)**: control específico por cada plataforma para el teclado/ratón +- **[src/ui](https://github.com/rustdesk/rustdesk/tree/master/src/ui)**: GUI +- **[src/server](https://github.com/rustdesk/rustdesk/tree/master/src/server)**: sonido/portapapeles/entrada/servicios de video, y conexiones de red +- **[src/client.rs](https://github.com/rustdesk/rustdesk/tree/master/src/client.rs)**: iniciar una conexión "peer to peer" +- **[src/rendezvous_mediator.rs](https://github.com/rustdesk/rustdesk/tree/master/src/rendezvous_mediator.rs)**: Comunicación con [rustdesk-server](https://github.com/rustdesk/rustdesk-server), esperar la conexión remota directa ("TCP hole punching") o conexión indirecta ("relayed") +- **[src/platform](https://github.com/rustdesk/rustdesk/tree/master/src/platform)**: código específico de cada plataforma + +## Captura de pantalla +![image](https://user-images.githubusercontent.com/71636191/113112362-ae4deb80-923b-11eb-957d-ff88daad4f06.png) + +![image](https://user-images.githubusercontent.com/71636191/113112619-f705a480-923b-11eb-911d-97e984ef52b6.png) + +![image](https://user-images.githubusercontent.com/71636191/113112857-3fbd5d80-923c-11eb-9836-768325faf906.png) + +![image](https://user-images.githubusercontent.com/71636191/113112990-65e2fd80-923c-11eb-840e-349b4d6e340d.png) \ No newline at end of file From ba00e4daf23f6194a49b53e9e311c7ebdde6296a Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Mon, 21 Jun 2021 16:31:01 +0800 Subject: [PATCH 18/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f9ef349e3..2a589f9a2 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ DockerStructureSnapshot
    - [中文] | [Deutsche] | [日本語] | [Русский] | [Português]
    + [中文] | [Española] | [Deutsche] | [日本語] | [Русский] | [Português]
    We need your help to translate this README to your native language

    From 7e873f1c8b4ed522821577cf183bf12e14f82339 Mon Sep 17 00:00:00 2001 From: Geshi Date: Mon, 21 Jun 2021 10:56:43 +0200 Subject: [PATCH 19/29] Create SECURITY.md --- SECURITY.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..57c501eda --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,13 @@ +# Security Policy + +## Supported Versions + +| Version | Supported | +| ------- | ------------------ | +| 1.1.x | :white_check_mark: | +| 1.x | :white_check_mark: | +| Below 1.0 | :x: | + +## Reporting a Vulnerability + +Here we should write what to do in case of a security vulnerability From 592630fac4da27b27590ced0e010f00dd2f823dd Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Mon, 21 Jun 2021 18:29:01 +0800 Subject: [PATCH 20/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a589f9a2..cf73589f6 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ RustDesk welcomes contribution from everyone. See [`CONTRIBUTING.md`](CONTRIBUT Below are the servers you are using for free, it may change along the time. If you are not close to one of these, your network may be slow. - Seoul, AWS lightsail, 1 VCPU/0.5G RAM - Singapore, Vultr, 1 VCPU/1G RAM -- Virginia, AWS EC2, 4 VCPUs/32G RAM, donated by [tensorsurgical.com](https://tensorsurgical.com) +- Virginia, AWS EC2, 4 VCPUs/32G RAM, donated by [g9md.tv](https://g9md.tv) ## Dependencies From 87e161eddb514e7cd737722cddba7438f904a25a Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Mon, 21 Jun 2021 18:29:18 +0800 Subject: [PATCH 21/29] Update README-ZH.md --- README-ZH.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README-ZH.md b/README-ZH.md index b810f6042..a90a7c585 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -23,7 +23,7 @@ Chat with us: [知乎](https://www.zhihu.com/people/rustdesk) | [Discord](https: 以下是您免费使用的服务器,它可能会随着时间的推移而变化。如果您不靠近其中之一,您的网络可能会很慢。 - 首尔, AWS lightsail, 1 VCPU/0.5G RAM - 新加坡, Vultr, 1 VCPU/1G RAM -- 美国佛吉利亚, AWS EC2, 4 VCPUs/32G RAM, 由[tensorsurgical.com](https://tensorsurgical.com)赞助 +- 美国佛吉利亚, AWS EC2, 4 VCPUs/32G RAM, 由[g9md.tv](https://g9md.tv)赞助 ## 依赖 From 2ccbda2bb8496d7d8644581a8122f65752bd9f09 Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Mon, 21 Jun 2021 18:29:46 +0800 Subject: [PATCH 22/29] Update README-ES.md --- README-ES.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README-ES.md b/README-ES.md index 1d975e55a..6de158b4f 100644 --- a/README-ES.md +++ b/README-ES.md @@ -23,7 +23,7 @@ RustDesk agradece la contribución de todo el mundo. Ve [`CONTRIBUTING.md`](CON A continuación se muestran los servidores que está utilizando de forma gratuita, puede cambiar en algún momento. Si no estás cerca de uno de ellos, tu red puede ser lenta. - Seoul, AWS lightsail, 1 VCPU/0.5G RAM - Singapore, Vultr, 1 VCPU/1G RAM -- Virginia, AWS EC2, 4 VCPUs/32G RAM, donated by [tensorsurgical.com](https://tensorsurgical.com) +- Virginia, AWS EC2, 4 VCPUs/32G RAM, donated by [g9md.tv](https://g9md.tv) ## Dependencies @@ -142,4 +142,4 @@ RustDesk no soporta Wayland. Comprueba [aquí](https://docs.fedoraproject.org/en ![image](https://user-images.githubusercontent.com/71636191/113112857-3fbd5d80-923c-11eb-9836-768325faf906.png) -![image](https://user-images.githubusercontent.com/71636191/113112990-65e2fd80-923c-11eb-840e-349b4d6e340d.png) \ No newline at end of file +![image](https://user-images.githubusercontent.com/71636191/113112990-65e2fd80-923c-11eb-840e-349b4d6e340d.png) From da7e044f16c114600b282766d280dc92f626ae55 Mon Sep 17 00:00:00 2001 From: Geshi Date: Mon, 21 Jun 2021 16:16:37 +0200 Subject: [PATCH 23/29] Create README-FR.md --- README-FR.md | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 README-FR.md diff --git a/README-FR.md b/README-FR.md new file mode 100644 index 000000000..10b69e6ef --- /dev/null +++ b/README-FR.md @@ -0,0 +1,145 @@ +# RustDesk | Votre logiciel de bureau à distance +

    + Servers - + Build - + Docker - + Structure - + Snapshot
    . + [中文] | [Española] | [Deutsche] | [日本語] | [Русский] | [Português]
    + Nous avons besoin de votre aide pour traduire ce README dans votre langue maternelle. +

    + +Chattez avec nous : [Discord](https://discord.gg/nDceKgxnkV) | [Reddit](https://www.reddit.com/r/rustdesk) + +[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) + +Encore un autre logiciel de bureau à distance, écrit en Rust. Fonctionne directement, aucune configuration n'est nécessaire. Une excellente alternative à TeamViewer et AnyDesk ! Vous avez le contrôle total de vos données, sans aucun souci de sécurité. Vous pouvez utiliser notre serveur de rendez-vous/relais, [configurer le vôtre](https://rustdesk.com/blog/id-relay-set/), ou [écrire votre propre serveur de rendez-vous/relais](https://github.com/rustdesk/rustdesk-server-demo). + +RustDesk accueille les contributions de tout le monde. Voir [`CONTRIBUTING.md`](CONTRIBUTING.md) pour plus d'informations. + +[**TÉLÉCHARGEMENT BINAIRE**](https://github.com/rustdesk/rustdesk/releases) + +## Serveurs publics libres +Ci-dessous se trouvent les serveurs que vous utilisez gratuitement, cela peut changer au fil du temps. Si vous n'êtes pas proche de l'un d'entre eux, votre réseau peut être lent. +- Séoul, AWS lightsail, 1 VCPU/0.5G RAM +- Singapour, Vultr, 1 VCPU/1G RAM +- Virginie, AWS EC2, 4 VCPU/32G RAM, offert par [g9md.tv](https://g9md.tv) + +## Dépendances + +Les versions de bureau utilisent [sciter](https://sciter.com/) pour l'interface graphique, veuillez télécharger la bibliothèque dynamique sciter vous-même. + +[Windows](https://github.com/c-smile/sciter-sdk/blob/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.win/x64/sciter.dll) | +[Linux](https://github.com/c-smile/sciter-sdk/raw/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.lnx/x64/libsciter-gtk.so) +[macOS](https://github.com/c-smile/sciter-sdk/raw/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.osx/sciter-osx-64.dylib) + +## Étapes brutes de la compilation/build +* Préparez votre environnement de développement Rust et votre environnement de compilation C++. + +* Installez [vcpkg](https://github.com/microsoft/vcpkg), et définissez correctement la variable d'environnement `VCPKG_ROOT`. + + - Windows : vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static + - Linux/Osx : vcpkg install libvpx libyuv opus + +* Exécuter `cargo run` + +## Comment compiler/build sous Linux + +### Ubuntu 18 (Debian 10) +```sh +sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake +``` + +### Fedora 28 (CentOS 8) +```sh +sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-devel libxdo-devel libXfixes-devel pulseaudio-libs-devel cmake alsa-lib-devel +``` + +### Arch (Manjaro) +```sh +sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio +``` + +### Installer vcpkg +```sh +git clone https://github.com/microsoft/vcpkg --branch 2020.11-1 +vcpkg/bootstrap-vcpkg.sh +export VCPKG_ROOT=$HOME/vcpkg +vcpkg/vcpkg install libvpx libyuv opus +``` + +### Corriger libvpx (Pour Fedora) +```sh +cd vcpkg/buildtrees/libvpx/src +cd * +./configure +sed -i 's/CFLAGS+=-I/CFLAGS+=-fPIC -I/g' Makefile +sed -i 's/CXXFLAGS+=-I/CXXFLAGS+=-fPIC -I/g' Makefile +make +cp libvpx.a $HOME/vcpkg/installed/x64-linux/lib/ +cd +``` + +### Construire +```sh +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +source $HOME/.cargo/env +git clone https://github.com/rustdesk/rustdesk +cd rustdesk +mkdir -p cible/debug +wget https://github.com/c-smile/sciter-sdk/raw/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.lnx/x64/libsciter-gtk.so +mv libsciter-gtk.so target/debug +Exécution du cargo +``` + +## Comment construire avec Docker + +Commencez par cloner le dépôt et construire le conteneur Docker : + +```sh +git clone https://github.com/rustdesk/rustdesk +cd rustdesk +docker build -t "rustdesk-builder" . +``` + +Ensuite, chaque fois que vous devez build le logiciel, exécutez la commande suivante : + +```sh +docker run --rm -it -v $PWD:/home/user/rustdesk -v rustdesk-git-cache:/home/user/.cargo/git -v rustdesk-registry-cache:/home/user/.cargo/registry -e PUID="$(id -u)" -e PGID="$(id -g)" rustdesk-builder +``` + +Notez que le premier build peut prendre plus de temps avant que les dépendances ne soient mises en cache, les constructions suivantes seront plus rapides. De plus, si vous devez spécifier différents arguments à la commande de compilation, vous pouvez le faire à la fin de la commande dans la position ``. Par exemple, si vous voulez construire une version optimisée de la version release, vous devez exécuter la commande ci-dessus suivie de `---release`. L'exécutable résultant sera disponible dans le dossier cible sur votre système, et peut être lancé avec : + +```sh +target/debug/rustdesk +``` +Ou, si vous exécutez un exécutable provenant d'une release : + +```sh +target/release/rustdesk +``` + +Veuillez vous assurer que vous exécutez ces commandes à partir de la racine du référentiel RustDesk, sinon l'application ne pourra pas trouver les ressources requises. Notez également que les autres sous-commandes de cargo telles que `install` ou `run` ne sont pas actuellement supportées par cette méthode car elles installeraient ou exécuteraient le programme à l'intérieur du conteneur au lieu de l'hôte. + +### Changer Wayland en X11 (Xorg) +RustDesk ne supporte pas Wayland. Lisez [cela](https://docs.fedoraproject.org/en-US/quick-docs/configuring-xorg-as-default-gnome-session/) pour configurer Xorg comme la session GNOME par défaut. + +## Structure du projet + +- **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)** : codec vidéo, config, wrapper tcp/udp, protobuf, fonctions fs pour le transfert de fichiers, et quelques autres fonctions utilitaires. +- **[libs/scrap](https://github.com/rustdesk/rustdesk/tree/master/libs/scrap)** : capture d'écran +- **[libs/enigo](https://github.com/rustdesk/rustdesk/tree/master/libs/enigo)** : contrôle clavier/souris spécifique à la plate-forme +- **[src/ui](https://github.com/rustdesk/rustdesk/tree/master/src/ui)** : INTERFACE GRAPHIQUE +- **[src/server](https://github.com/rustdesk/rustdesk/tree/master/src/server)** : services audio/clipboard/input/vidéo, et connexions réseau +- **[src/client.rs](https://github.com/rustdesk/rustdesk/tree/master/src/client.rs)** : démarrer une connexion entre pairs +- **[src/rendezvous_mediator.rs](https://github.com/rustdesk/rustdesk/tree/master/src/rendezvous_mediator.rs)** : Communiquer avec [rustdesk-server](https://github.com/rustdesk/rustdesk-server), attendre une connexion distante directe (TCP hole punching) ou relayée. +- **[src/platform](https://github.com/rustdesk/rustdesk/tree/master/src/platform)** : code spécifique à la plateforme + +## Images +![image](https://user-images.githubusercontent.com/71636191/113112362-ae4deb80-923b-11eb-957d-ff88daad4f06.png) + +![image](https://user-images.githubusercontent.com/71636191/113112619-f705a480-923b-11eb-911d-97e984ef52b6.png) + +![image](https://user-images.githubusercontent.com/71636191/113112857-3fbd5d80-923c-11eb-9836-768325faf906.png) + +![image](https://user-images.githubusercontent.com/71636191/113112990-65e2fd80-923c-11eb-840e-349b4d6e340d.png) From fc3f76973d1b1e0e5c9ce1501eb343882603c650 Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Mon, 21 Jun 2021 23:32:07 +0800 Subject: [PATCH 24/29] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cf73589f6..c36b327da 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ DockerStructureSnapshot
    - [中文] | [Española] | [Deutsche] | [日本語] | [Русский] | [Português]
    + [中文] | [Española] | [français] | [Deutsche] | [日本語] | [Русский] | [Português]
    We need your help to translate this README to your native language

    @@ -31,7 +31,7 @@ Desktop versions use [sciter](https://sciter.com/) for GUI, please download scit [Windows](https://github.com/c-smile/sciter-sdk/blob/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.win/x64/sciter.dll) | [Linux](https://github.com/c-smile/sciter-sdk/raw/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.lnx/x64/libsciter-gtk.so) | -[macOS](https://github.com/c-smile/sciter-sdk/raw/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.osx/sciter-osx-64.dylib) +[MacOS](https://github.com/c-smile/sciter-sdk/raw/dc65744b66389cd5a0ff6bdb7c63a8b7b05a708b/bin.osx/sciter-osx-64.dylib) ## Raw steps to build * Prepare your Rust development env and C++ build env @@ -39,7 +39,7 @@ Desktop versions use [sciter](https://sciter.com/) for GUI, please download scit * Install [vcpkg](https://github.com/microsoft/vcpkg), and set `VCPKG_ROOT` env variable correctly - Windows: vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static - - Linux/Osx: vcpkg install libvpx libyuv opus + - Linux/MacOS: vcpkg install libvpx libyuv opus * run `cargo run` From be9f0a22a06eed72a6ea71dbbd951a3f1b0372ca Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Mon, 21 Jun 2021 23:32:52 +0800 Subject: [PATCH 25/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c36b327da..79b3e21d3 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ DockerStructureSnapshot
    - [中文] | [Española] | [français] | [Deutsche] | [日本語] | [Русский] | [Português]
    + [中文] | [Española] | [Français] | [Deutsche] | [日本語] | [Русский] | [Português]
    We need your help to translate this README to your native language

    From 5339b401044cd858f703c1635fe8749f31d4c50c Mon Sep 17 00:00:00 2001 From: rustdesk Date: Tue, 22 Jun 2021 11:34:07 +0800 Subject: [PATCH 26/29] ISSUE TEMPLATE --- .github/ISSUE_TEMPLATE/bug_report.md | 32 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 2 ++ .github/ISSUE_TEMPLATE/feature_request.md | 10 +++++++ .github/ISSUE_TEMPLATE/question.md | 10 +++++++ 4 files changed, 54 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/question.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..5ba29c8b6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,32 @@ +--- +name: Bug Report +about: Report a bug (English only, Please). +title: "" +labels: bug +assignees: '' + +--- + + + +**Describe the bug you encountered:** + +... + +**What did you expect to happen instead?** + +... + + +**How did you install `RustDesk`?** + + + +--- + +**RustDesk version and environment** + + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..b92c70cbb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,2 @@ +blank_issues_enabled: true + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..9e02f555b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,10 @@ +--- +name: Feature Request +about: Suggest an idea for this project ((English only, Please). +title: '' +labels: feature-request +assignees: '' + +--- + + diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 000000000..435b58e48 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,10 @@ +--- +name: Question +about: Ask a question about 'RustDesk' (English only, Please). +title: '' +labels: question +assignees: '' + +--- + + From 086d1f9124d1214f9ec8946d415352a00126080c Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Wed, 23 Jun 2021 00:40:08 +0800 Subject: [PATCH 27/29] Add files via upload --- logo-header.svg | 151 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 logo-header.svg diff --git a/logo-header.svg b/logo-header.svg new file mode 100644 index 000000000..dd1f2aef4 --- /dev/null +++ b/logo-header.svg @@ -0,0 +1,151 @@ + +image/svg+xml + + +RUSTDESKYour remote desktop From 25a83f6b4a916512d82b41f044e4c38d66da701b Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Wed, 23 Jun 2021 00:44:10 +0800 Subject: [PATCH 28/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 79b3e21d3..4975cfd1b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# RustDesk | Your Remote Desktop Software

    + RustDesk - Your remote desktop
    ServersBuildDocker • From dc3fcda2c925e87c5e2f69a73c7c49e9c185c72b Mon Sep 17 00:00:00 2001 From: rustdesk Date: Fri, 25 Jun 2021 19:42:51 +0800 Subject: [PATCH 29/29] tokio1, windows not test yet --- Cargo.lock | 113 ++++++++++++++++++------------ Cargo.toml | 2 +- libs/hbb_common/Cargo.toml | 10 +-- libs/hbb_common/src/config.rs | 2 +- libs/hbb_common/src/fs.rs | 2 +- libs/hbb_common/src/lib.rs | 35 ++------- libs/hbb_common/src/tcp.rs | 52 ++++++++------ libs/hbb_common/src/udp.rs | 28 ++++++-- libs/parity-tokio-ipc/Cargo.toml | 4 +- libs/parity-tokio-ipc/src/unix.rs | 17 ++--- libs/parity-tokio-ipc/src/win.rs | 15 ++-- libs/rust-sciter/Cargo.toml | 2 +- src/cli.rs | 2 +- src/common.rs | 6 +- src/ipc.rs | 10 +-- src/platform/windows.rs | 4 +- src/port_forward.rs | 4 +- src/server/audio_service.rs | 2 +- src/server/connection.rs | 3 +- src/server/input_service.rs | 2 +- src/ui.rs | 2 +- src/ui/cm.rs | 4 +- src/ui/remote.rs | 2 +- 23 files changed, 169 insertions(+), 154 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 069688c9d..e58bd980e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "addr2line" version = "0.14.1" @@ -1459,7 +1461,7 @@ name = "hbb_common" version = "0.1.0" dependencies = [ "anyhow", - "bytes 0.5.6", + "bytes 1.0.1", "confy", "directories-next", "dirs-next", @@ -1473,13 +1475,13 @@ dependencies = [ "protobuf", "protobuf-codegen-pure", "quinn", - "rand 0.7.3", + "rand 0.8.3", "serde 1.0.125", "serde_derive", "serde_json 1.0.64", "socket2", "sodiumoxide", - "tokio", + "tokio 1.7.1", "tokio-util", "toml", "winapi 0.3.9", @@ -1902,6 +1904,19 @@ dependencies = [ "winapi 0.2.8", ] +[[package]] +name = "mio" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" +dependencies = [ + "libc", + "log", + "miow 0.3.7", + "ntapi", + "winapi 0.3.9", +] + [[package]] name = "mio-named-pipes" version = "0.1.7" @@ -1909,22 +1924,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" dependencies = [ "log", - "mio", + "mio 0.6.23", "miow 0.3.7", "winapi 0.3.9", ] -[[package]] -name = "mio-uds" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" -dependencies = [ - "iovec", - "libc", - "mio", -] - [[package]] name = "miow" version = "0.2.2" @@ -2084,6 +2088,15 @@ dependencies = [ "version_check 0.9.3", ] +[[package]] +name = "ntapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "num-derive" version = "0.3.3" @@ -2276,8 +2289,8 @@ dependencies = [ "log", "mio-named-pipes", "miow 0.3.7", - "rand 0.7.3", - "tokio", + "rand 0.8.3", + "tokio 1.7.1", "winapi 0.3.9", ] @@ -2551,11 +2564,11 @@ dependencies = [ "err-derive 0.2.4", "futures", "libc", - "mio", + "mio 0.6.23", "quinn-proto", "rustls", "socket2", - "tokio", + "tokio 0.2.25", "tracing", "webpki", ] @@ -3532,28 +3545,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" dependencies = [ "bytes 0.5.6", - "fnv", - "futures-core", - "iovec", "lazy_static", + "mio 0.6.23", + "pin-project-lite 0.1.12", + "slab", +] + +[[package]] +name = "tokio" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fb2ed024293bb19f7a5dc54fe83bf86532a44c12a2bb8ba40d64a4509395ca2" +dependencies = [ + "autocfg 1.0.1", + "bytes 1.0.1", "libc", "memchr", - "mio", - "mio-named-pipes", - "mio-uds", + "mio 0.7.13", "num_cpus", - "pin-project-lite 0.1.12", + "once_cell", + "parking_lot 0.11.1", + "pin-project-lite 0.2.6", "signal-hook-registry", - "slab", "tokio-macros", "winapi 0.3.9", ] [[package]] name = "tokio-macros" -version = "0.2.6" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" +checksum = "c49e3df43841dafb86046472506755d8501c5615673955f6aa17181125d13c37" dependencies = [ "proc-macro2 1.0.26", "quote 1.0.9", @@ -3562,17 +3584,18 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.3.1" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +checksum = "1caa0b0c8d94a049db56b5acf8cba99dc0623aab1b26d5b5f5e2d945846b3592" dependencies = [ - "bytes 0.5.6", + "bytes 1.0.1", "futures-core", "futures-io", "futures-sink", "log", - "pin-project-lite 0.1.12", - "tokio", + "pin-project-lite 0.2.6", + "slab", + "tokio 1.7.1", ] [[package]] @@ -3956,9 +3979,13 @@ dependencies = [ [[package]] name = "whoami" -version = "0.9.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7884773ab69074615cb8f8425d0e53f11710786158704fca70f53e71b0e05504" +checksum = "4abacf325c958dfeaf1046931d37f2a901b6dfe0968ee965a29e94c6766b2af6" +dependencies = [ + "wasm-bindgen", + "web-sys", +] [[package]] name = "widestring" @@ -4151,18 +4178,18 @@ checksum = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71" [[package]] name = "zstd" -version = "0.5.4+zstd.1.4.7" +version = "0.9.0+zstd.1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69996ebdb1ba8b1517f61387a883857818a66c8a295f487b1ffd8fd9d2c82910" +checksum = "07749a5dc2cb6b36661290245e350f15ec3bbb304e493db54a1d354480522ccd" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "2.0.6+zstd.1.4.7" +version = "4.1.1+zstd.1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98aa931fb69ecee256d44589d19754e61851ae4769bf963b385119b1cc37a49e" +checksum = "c91c90f2c593b003603e5e0493c837088df4469da25aafff8bce42ba48caf079" dependencies = [ "libc", "zstd-sys", @@ -4170,12 +4197,10 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "1.4.18+zstd.1.4.7" +version = "1.6.1+zstd.1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1e6e8778706838f43f771d80d37787cb2fe06dafe89dd3aebaf6721b9eaec81" +checksum = "615120c7a2431d16cf1cf979e7fc31ba7a5b5e5707b29c8a99e5dbf8a8392a33" dependencies = [ "cc", - "glob", - "itertools", "libc", ] diff --git a/Cargo.toml b/Cargo.toml index e36af126e..5ad789a7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ cli = [] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -whoami = "0.9" +whoami = "1.1" scrap = { path = "libs/scrap" } hbb_common = { path = "libs/hbb_common" } enigo = { path = "libs/enigo" } diff --git a/libs/hbb_common/Cargo.toml b/libs/hbb_common/Cargo.toml index 5faff841a..13c6fb016 100644 --- a/libs/hbb_common/Cargo.toml +++ b/libs/hbb_common/Cargo.toml @@ -8,19 +8,19 @@ edition = "2018" [dependencies] protobuf = { version = "3.0.0-pre", git = "https://github.com/stepancheg/rust-protobuf" } -tokio = { version = "0.2", features = ["full"] } -tokio-util = { version = "0.3", features = ["full"] } +tokio = { version = "1.7", features = ["full"] } +tokio-util = { version = "0.6", features = ["full"] } futures = "0.3" -bytes = "0.5" +bytes = "1.0" log = "0.4" env_logger = "0.8" socket2 = { version = "0.3", features = ["reuseport"] } -zstd = "0.5" +zstd = "0.9" quinn = {version = "0.6", optional = true } anyhow = "1.0" futures-util = "0.3" directories-next = "2.0" -rand = "0.7" +rand = "0.8" serde_derive = "1.0" serde = "1.0" lazy_static = "1.4" diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index 09c7cb931..60a3ac5d6 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -548,7 +548,7 @@ impl Config { // to-do: how about if one ip register a lot of ids? let id = Self::get_id(); let mut rng = rand::thread_rng(); - let new_id = rng.gen_range(1_000_000_000, 2_000_000_000).to_string(); + let new_id = rng.gen_range(1_000_000_000..2_000_000_000).to_string(); Config::set_id(&new_id); log::info!("id updated from {} to {}", id, new_id); } diff --git a/libs/hbb_common/src/fs.rs b/libs/hbb_common/src/fs.rs index 1aad666ec..2a3a6c9f4 100644 --- a/libs/hbb_common/src/fs.rs +++ b/libs/hbb_common/src/fs.rs @@ -7,7 +7,7 @@ use crate::{ }; #[cfg(windows)] use std::os::windows::prelude::*; -use tokio::{fs::File, prelude::*}; +use tokio::{fs::File, io::*}; pub fn read_dir(path: &PathBuf, include_hidden: bool) -> ResultType { let mut dir = FileDirectory { diff --git a/libs/hbb_common/src/lib.rs b/libs/hbb_common/src/lib.rs index 4eb1db20d..91cc076d3 100644 --- a/libs/hbb_common/src/lib.rs +++ b/libs/hbb_common/src/lib.rs @@ -6,7 +6,6 @@ pub mod rendezvous_proto; pub use bytes; pub use futures; pub use protobuf; -use socket2::{Domain, Socket, Type}; use std::{ fs::File, io::{self, BufRead}, @@ -36,7 +35,7 @@ pub type Stream = tcp::FramedStream; #[inline] pub async fn sleep(sec: f32) { - tokio::time::delay_for(time::Duration::from_secs_f32(sec)).await; + tokio::time::sleep(time::Duration::from_secs_f32(sec)).await; } #[macro_export] @@ -61,30 +60,6 @@ pub fn timeout(ms: u64, future: T) -> tokio::time::Timeo tokio::time::timeout(std::time::Duration::from_millis(ms), future) } -fn new_socket(addr: SocketAddr, tcp: bool, reuse: bool) -> Result { - let stype = { - if tcp { - Type::stream() - } else { - Type::dgram() - } - }; - let socket = match addr { - SocketAddr::V4(..) => Socket::new(Domain::ipv4(), stype, None), - SocketAddr::V6(..) => Socket::new(Domain::ipv6(), stype, None), - }?; - if reuse { - // windows has no reuse_port, but it's reuse_address - // almost equals to unix's reuse_port + reuse_address, - // though may introduce nondeterministic bahavior - #[cfg(unix)] - socket.set_reuse_port(true)?; - socket.set_reuse_address(true)?; - } - socket.bind(&addr.into())?; - Ok(socket) -} - pub type ResultType = anyhow::Result; /// Certain router and firewalls scan the packet and if they @@ -100,10 +75,10 @@ impl AddrMangle { .duration_since(UNIX_EPOCH) .unwrap() .as_micros() as u32) as u128; - let ip = u32::from_ne_bytes(addr_v4.ip().octets()) as u128; + let ip = u32::from_le_bytes(addr_v4.ip().octets()) as u128; let port = addr.port() as u128; let v = ((ip + tm) << 49) | (tm << 17) | (port + (tm & 0xFFFF)); - let bytes = v.to_ne_bytes(); + let bytes = v.to_le_bytes(); let mut n_padding = 0; for i in bytes.iter().rev() { if i == &0u8 { @@ -123,9 +98,9 @@ impl AddrMangle { pub fn decode(bytes: &[u8]) -> SocketAddr { let mut padded = [0u8; 16]; padded[..bytes.len()].copy_from_slice(&bytes); - let number = u128::from_ne_bytes(padded); + let number = u128::from_le_bytes(padded); let tm = (number >> 17) & (u32::max_value() as u128); - let ip = (((number >> 49) - tm) as u32).to_ne_bytes(); + let ip = (((number >> 49) - tm) as u32).to_le_bytes(); let port = (number & 0xFFFFFF) - (tm & 0xFFFF); SocketAddr::V4(SocketAddrV4::new( Ipv4Addr::new(ip[0], ip[1], ip[2], ip[3]), diff --git a/libs/hbb_common/src/tcp.rs b/libs/hbb_common/src/tcp.rs index cc8432e24..a83ae36ab 100644 --- a/libs/hbb_common/src/tcp.rs +++ b/libs/hbb_common/src/tcp.rs @@ -1,16 +1,13 @@ use crate::{bail, bytes_codec::BytesCodec, ResultType}; use bytes::{BufMut, Bytes, BytesMut}; -use futures::SinkExt; +use futures::{SinkExt, StreamExt}; use protobuf::Message; use sodiumoxide::crypto::secretbox::{self, Key, Nonce}; use std::{ io::{Error, ErrorKind}, ops::{Deref, DerefMut}, }; -use tokio::{ - net::{TcpListener, TcpStream, ToSocketAddrs}, - stream::StreamExt, -}; +use tokio::net::{lookup_host, TcpListener, TcpSocket, TcpStream, ToSocketAddrs}; use tokio_util::codec::Framed; pub struct FramedStream(Framed, Option<(Key, u64, u64)>); @@ -29,25 +26,37 @@ impl DerefMut for FramedStream { } } +fn new_socket(addr: std::net::SocketAddr, reuse: bool) -> Result { + let socket = match addr { + std::net::SocketAddr::V4(..) => TcpSocket::new_v4()?, + std::net::SocketAddr::V6(..) => TcpSocket::new_v6()?, + }; + if reuse { + // windows has no reuse_port, but it's reuse_address + // almost equals to unix's reuse_port + reuse_address, + // though may introduce nondeterministic bahavior + #[cfg(unix)] + socket.set_reuseport(true)?; + socket.set_reuseaddr(true)?; + } + socket.bind(addr)?; + Ok(socket) +} + impl FramedStream { pub async fn new( remote_addr: T, local_addr: T2, ms_timeout: u64, ) -> ResultType { - for local_addr in local_addr.to_socket_addrs().await? { - for remote_addr in remote_addr.to_socket_addrs().await? { - if let Ok(stream) = super::timeout( + for local_addr in lookup_host(&local_addr).await? { + for remote_addr in lookup_host(&remote_addr).await? { + let stream = super::timeout( ms_timeout, - TcpStream::connect_std( - super::new_socket(local_addr, true, true)?.into_tcp_stream(), - &remote_addr, - ), + new_socket(local_addr, true)?.connect(remote_addr), ) - .await? - { - return Ok(Self(Framed::new(stream, BytesCodec::new()), None)); - } + .await??; + return Ok(Self(Framed::new(stream, BytesCodec::new()), None)); } } bail!("could not resolve to any address"); @@ -124,22 +133,21 @@ impl FramedStream { fn get_nonce(seqnum: u64) -> Nonce { let mut nonce = Nonce([0u8; secretbox::NONCEBYTES]); - nonce.0[..std::mem::size_of_val(&seqnum)].copy_from_slice(&seqnum.to_ne_bytes()); + nonce.0[..std::mem::size_of_val(&seqnum)].copy_from_slice(&seqnum.to_le_bytes()); nonce } } -const DEFAULT_BACKLOG: i32 = 128; +const DEFAULT_BACKLOG: u32 = 128; #[allow(clippy::never_loop)] pub async fn new_listener(addr: T, reuse: bool) -> ResultType { if !reuse { Ok(TcpListener::bind(addr).await?) } else { - for addr in addr.to_socket_addrs().await? { - let socket = super::new_socket(addr, true, true)?; - socket.listen(DEFAULT_BACKLOG)?; - return Ok(TcpListener::from_std(socket.into_tcp_listener())?); + for addr in lookup_host(&addr).await? { + let socket = new_socket(addr, true)?; + return Ok(socket.listen(DEFAULT_BACKLOG)?); } bail!("could not resolve to any address"); } diff --git a/libs/hbb_common/src/udp.rs b/libs/hbb_common/src/udp.rs index 0a60c7a56..c15e42209 100644 --- a/libs/hbb_common/src/udp.rs +++ b/libs/hbb_common/src/udp.rs @@ -1,13 +1,14 @@ use crate::{bail, ResultType}; use bytes::BytesMut; -use futures::SinkExt; +use futures::{SinkExt, StreamExt}; use protobuf::Message; +use socket2::{Domain, Socket, Type}; use std::{ io::Error, net::SocketAddr, ops::{Deref, DerefMut}, }; -use tokio::{net::ToSocketAddrs, net::UdpSocket, stream::StreamExt}; +use tokio::{net::ToSocketAddrs, net::UdpSocket}; use tokio_util::{codec::BytesCodec, udp::UdpFramed}; pub struct FramedSocket(UdpFramed); @@ -20,6 +21,23 @@ impl Deref for FramedSocket { } } +fn new_socket(addr: SocketAddr, reuse: bool) -> Result { + let socket = match addr { + SocketAddr::V4(..) => Socket::new(Domain::ipv4(), Type::dgram(), None), + SocketAddr::V6(..) => Socket::new(Domain::ipv6(), Type::dgram(), None), + }?; + if reuse { + // windows has no reuse_port, but it's reuse_address + // almost equals to unix's reuse_port + reuse_address, + // though may introduce nondeterministic bahavior + #[cfg(unix)] + socket.set_reuse_port(true)?; + socket.set_reuse_address(true)?; + } + socket.bind(&addr.into())?; + Ok(socket) +} + impl DerefMut for FramedSocket { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 @@ -33,10 +51,10 @@ impl FramedSocket { } #[allow(clippy::never_loop)] - pub async fn new_reuse(addr: T) -> ResultType { - for addr in addr.to_socket_addrs().await? { + pub async fn new_reuse(addr: T) -> ResultType { + for addr in addr.to_socket_addrs()? { return Ok(Self(UdpFramed::new( - UdpSocket::from_std(super::new_socket(addr, false, true)?.into_udp_socket())?, + UdpSocket::from_std(new_socket(addr, true)?.into_udp_socket())?, BytesCodec::new(), ))); } diff --git a/libs/parity-tokio-ipc/Cargo.toml b/libs/parity-tokio-ipc/Cargo.toml index 2993686f3..c197779a0 100644 --- a/libs/parity-tokio-ipc/Cargo.toml +++ b/libs/parity-tokio-ipc/Cargo.toml @@ -16,8 +16,8 @@ futures = "0.3" log = "0.4" mio-named-pipes = "0.1" miow = "0.3" -rand = "0.7" -tokio = { version = "0.2", features = ["io-driver", "io-util", "uds", "stream", "rt-core", "macros", "time"] } +rand = "0.8" +tokio = { version = "1.7", features = ["full"] } libc = "0.2" [target.'cfg(windows)'.dependencies] diff --git a/libs/parity-tokio-ipc/src/unix.rs b/libs/parity-tokio-ipc/src/unix.rs index b4b87399c..80cbdb137 100644 --- a/libs/parity-tokio-ipc/src/unix.rs +++ b/libs/parity-tokio-ipc/src/unix.rs @@ -1,12 +1,11 @@ use libc::chmod; use std::ffi::CString; use std::io::{self, Error}; -use tokio::prelude::*; +use tokio::io::*; use tokio::net::{UnixListener, UnixStream}; use std::path::Path; use std::pin::Pin; use std::task::{Context, Poll}; -use std::mem::MaybeUninit; /// Socket permissions and ownership on UNIX pub struct SecurityAttributes { @@ -127,15 +126,11 @@ impl Connection { } impl AsyncRead for Connection { - unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [MaybeUninit]) -> bool { - self.inner.prepare_uninitialized_buffer(buf) - } - fn poll_read( self: Pin<&mut Self>, ctx: &mut Context<'_>, - buf: &mut [u8], - ) -> Poll> { + buf: &mut tokio::io::ReadBuf<'_>, + ) -> Poll> { let this = Pin::into_inner(self); Pin::new(&mut this.inner).poll_read(ctx, buf) } @@ -146,17 +141,17 @@ impl AsyncWrite for Connection { self: Pin<&mut Self>, ctx: &mut Context<'_>, buf: &[u8], - ) -> Poll> { + ) -> Poll> { let this = Pin::into_inner(self); Pin::new(&mut this.inner).poll_write(ctx, buf) } - fn poll_flush(self: Pin<&mut Self>, ctx: &mut Context<'_>) -> Poll> { + fn poll_flush(self: Pin<&mut Self>, ctx: &mut Context<'_>) -> Poll> { let this = Pin::into_inner(self); Pin::new(&mut this.inner).poll_flush(ctx) } - fn poll_shutdown(self: Pin<&mut Self>, ctx: &mut Context<'_>) -> Poll> { + fn poll_shutdown(self: Pin<&mut Self>, ctx: &mut Context<'_>) -> Poll> { let this = Pin::into_inner(self); Pin::new(&mut this.inner).poll_shutdown(ctx) } diff --git a/libs/parity-tokio-ipc/src/win.rs b/libs/parity-tokio-ipc/src/win.rs index 02af778bd..20dbac071 100644 --- a/libs/parity-tokio-ipc/src/win.rs +++ b/libs/parity-tokio-ipc/src/win.rs @@ -15,7 +15,6 @@ use tokio::prelude::*; use std::pin::Pin; use std::task::{Context, Poll}; use std::path::Path; -use std::mem::MaybeUninit; use tokio::io::PollEvented; type NamedPipe = PollEvented; @@ -178,15 +177,11 @@ impl Connection { } impl AsyncRead for Connection { - unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [MaybeUninit]) -> bool { - self.inner.prepare_uninitialized_buffer(buf) - } - fn poll_read( self: Pin<&mut Self>, ctx: &mut Context<'_>, - buf: &mut [u8], - ) -> Poll> { + buf: &mut tokio::io::ReadBuf<'_>, + ) -> Poll> { let this = Pin::into_inner(self); Pin::new(&mut this.inner).poll_read(ctx, buf) } @@ -197,17 +192,17 @@ impl AsyncWrite for Connection { self: Pin<&mut Self>, ctx: &mut Context<'_>, buf: &[u8], - ) -> Poll> { + ) -> Poll> { let this = Pin::into_inner(self); Pin::new(&mut this.inner).poll_write(ctx, buf) } - fn poll_flush(self: Pin<&mut Self>, ctx: &mut Context<'_>) -> Poll> { + fn poll_flush(self: Pin<&mut Self>, ctx: &mut Context<'_>) -> Poll> { let this = Pin::into_inner(self); Pin::new(&mut this.inner).poll_flush(ctx) } - fn poll_shutdown(self: Pin<&mut Self>, ctx: &mut Context<'_>) -> Poll> { + fn poll_shutdown(self: Pin<&mut Self>, ctx: &mut Context<'_>) -> Poll> { let this = Pin::into_inner(self); Pin::new(&mut this.inner).poll_shutdown(ctx) } diff --git a/libs/rust-sciter/Cargo.toml b/libs/rust-sciter/Cargo.toml index 737df33b6..27eec9958 100644 --- a/libs/rust-sciter/Cargo.toml +++ b/libs/rust-sciter/Cargo.toml @@ -46,7 +46,7 @@ windowless = [] [dependencies] libc = "0.2" -lazy_static = "1.0" +lazy_static = "1.4" [target.x86_64-apple-darwin.dependencies] objc = "0.2" diff --git a/src/cli.rs b/src/cli.rs index d7070c6d6..1ce11878f 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -78,7 +78,7 @@ impl Interface for Session { } } -#[tokio::main(basic_scheduler)] +#[tokio::main(flavor = "current_thread")] pub async fn start_one_port_forward(id: String, port: i32, remote_host: String, remote_port: i32) { crate::common::test_rendezvous_server(); crate::common::test_nat_type(); diff --git a/src/common.rs b/src/common.rs index bed64ecaf..6005e3cca 100644 --- a/src/common.rs +++ b/src/common.rs @@ -156,7 +156,7 @@ pub fn test_nat_type() { }); } -#[tokio::main(basic_scheduler)] +#[tokio::main(flavor = "current_thread")] async fn test_nat_type_() -> ResultType { log::info!("Testing nat ..."); let start = std::time::Instant::now(); @@ -237,7 +237,7 @@ pub async fn get_nat_type(ms_timeout: u64) -> i32 { } #[cfg(any(target_os = "android", target_os = "ios", feature = "cli"))] -#[tokio::main(basic_scheduler)] +#[tokio::main(flavor = "current_thread")] async fn test_rendezvous_server_() { let servers = Config::get_rendezvous_servers(); hbb_common::config::ONLINE.lock().unwrap().clear(); @@ -345,7 +345,7 @@ pub fn check_software_update() { std::thread::spawn(move || allow_err!(_check_software_update())); } -#[tokio::main(basic_scheduler)] +#[tokio::main(flavor = "current_thread")] async fn _check_software_update() -> hbb_common::ResultType<()> { sleep(3.).await; let rendezvous_server = get_rendezvous_server(1_000).await; diff --git a/src/ipc.rs b/src/ipc.rs index 53596cfb0..895b8aae8 100644 --- a/src/ipc.rs +++ b/src/ipc.rs @@ -91,7 +91,7 @@ pub enum Data { Test, } -#[tokio::main(basic_scheduler)] +#[tokio::main(flavor = "current_thread")] pub async fn start(postfix: &str) -> ResultType<()> { let mut incoming = new_listener(postfix).await?; loop { @@ -336,7 +336,7 @@ impl Connection { } } -#[tokio::main(basic_scheduler)] +#[tokio::main(flavor = "current_thread")] async fn get_config(name: &str) -> ResultType> { get_config_async(name, 1_000).await } @@ -352,7 +352,7 @@ async fn get_config_async(name: &str, ms_timeout: u64) -> ResultType ResultType<()> { let mut c = connect(1000, "").await?; c.send_config(name, value).await?; @@ -409,7 +409,7 @@ async fn get_options_(ms_timeout: u64) -> ResultType> { } } -#[tokio::main(basic_scheduler)] +#[tokio::main(flavor = "current_thread")] pub async fn get_options() -> HashMap { get_options_(1000).await.unwrap_or(Config::get_options()) } @@ -432,7 +432,7 @@ pub fn set_option(key: &str, value: &str) { set_options(options).ok(); } -#[tokio::main(basic_scheduler)] +#[tokio::main(flavor = "current_thread")] pub async fn set_options(value: HashMap) -> ResultType<()> { Config::set_options(value.clone()); connect(1000, "") diff --git a/src/platform/windows.rs b/src/platform/windows.rs index 043c73321..28b68048a 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -386,7 +386,7 @@ extern "C" { fn BlockInput(v: BOOL) -> BOOL; } -#[tokio::main(basic_scheduler)] +#[tokio::main(flavor = "current_thread")] async fn run_service(_arguments: Vec) -> ResultType<()> { let event_handler = move |control_event| -> ServiceControlHandlerResult { log::info!("Got service control event: {:?}", control_event); @@ -546,7 +546,7 @@ pub fn run_as_user(arg: &str) -> ResultType> { Ok(None) } -#[tokio::main(basic_scheduler)] +#[tokio::main(flavor = "current_thread")] async fn send_close(postfix: &str) -> ResultType<()> { send_close_async(postfix).await } diff --git a/src/port_forward.rs b/src/port_forward.rs index c8950323e..e1e012f0c 100644 --- a/src/port_forward.rs +++ b/src/port_forward.rs @@ -2,12 +2,12 @@ use crate::client::*; use hbb_common::{ allow_err, bail, config::CONNECT_TIMEOUT, - futures::SinkExt, + futures::{SinkExt, StreamExt}, log, message_proto::*, protobuf::Message as _, tcp, timeout, - tokio::{self, net::TcpStream, stream::StreamExt, sync::mpsc}, + tokio::{self, net::TcpStream, sync::mpsc}, tokio_util::codec::{BytesCodec, Framed}, ResultType, Stream, }; diff --git a/src/server/audio_service.rs b/src/server/audio_service.rs index d77e0c633..a45757ff3 100644 --- a/src/server/audio_service.rs +++ b/src/server/audio_service.rs @@ -34,7 +34,7 @@ pub fn new() -> GenericService { #[cfg(target_os = "linux")] mod pa_impl { use super::*; - #[tokio::main(basic_scheduler)] + #[tokio::main(flavor = "current_thread")] pub async fn run(sp: GenericService) -> ResultType<()> { if let Ok(mut stream) = crate::ipc::connect(1000, "_pa").await { let mut encoder = diff --git a/src/server/connection.rs b/src/server/connection.rs index c2ab222d0..5565d5175 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -5,11 +5,10 @@ use crate::ipc; use hbb_common::{ config::Config, fs, - futures::SinkExt, + futures::{SinkExt, StreamExt}, sleep, timeout, tokio::{ net::TcpStream, - stream::StreamExt, sync::mpsc, time::{self, Duration, Instant, Interval}, }, diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 879a7dea3..56bb20626 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -518,7 +518,7 @@ fn handle_key_(evt: &KeyEvent) { } } -#[tokio::main(basic_scheduler)] +#[tokio::main(flavor = "current_thread")] async fn send_sas() -> ResultType<()> { let mut stream = crate::ipc::connect(1000, crate::POSTFIX_SERVICE).await?; timeout(1000, stream.send(&crate::ipc::Data::SAS)).await??; diff --git a/src/ui.rs b/src/ui.rs index f4d6253c9..2dbefe53d 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -595,7 +595,7 @@ pub fn check_zombie(childs: Childs) { // notice: avoiding create ipc connecton repeatly, // because windows named pipe has serious memory leak issue. -#[tokio::main(basic_scheduler)] +#[tokio::main(flavor = "current_thread")] async fn check_connect_status_( reconnect: bool, status: Arc>, diff --git a/src/ui/cm.rs b/src/ui/cm.rs index ed0a9288d..ceb5f0101 100644 --- a/src/ui/cm.rs +++ b/src/ui/cm.rs @@ -330,7 +330,7 @@ impl sciter::EventHandler for ConnectionManager { } } -#[tokio::main(basic_scheduler)] +#[tokio::main(flavor = "current_thread")] async fn start_ipc(cm: ConnectionManager) { match new_listener("_cm").await { Ok(mut incoming) => { @@ -387,7 +387,7 @@ async fn start_ipc(cm: ConnectionManager) { } #[cfg(target_os = "linux")] -#[tokio::main(basic_scheduler)] +#[tokio::main(flavor = "current_thread")] async fn start_pa() { use hbb_common::config::APP_NAME; use libpulse_binding as pulse; diff --git a/src/ui/remote.rs b/src/ui/remote.rs index b4dd201f1..572e6eabd 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -1019,7 +1019,7 @@ async fn start_one_port_forward( log::info!("port forward (:{}) exit", port); } -#[tokio::main(basic_scheduler)] +#[tokio::main(flavor = "current_thread")] async fn io_loop(handler: Handler) { let (sender, mut receiver) = mpsc::unbounded_channel::(); handler.write().unwrap().sender = Some(sender.clone());