mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-06-23 00:34:48 +03:00
Compare commits
12 Commits
peer-versi
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
133e1ae81d | ||
|
|
6fb7e24746 | ||
|
|
d1f41180e3 | ||
|
|
497a1a081a | ||
|
|
5342b475ae | ||
|
|
a42592ab05 | ||
|
|
d68df35409 | ||
|
|
c2f6e172bb | ||
|
|
32b6683cda | ||
|
|
62b22e1764 | ||
|
|
72c86c0d83 | ||
|
|
82766cdc87 |
28
.github/workflows/release.yml
vendored
28
.github/workflows/release.yml
vendored
@@ -30,11 +30,19 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cargo build --release
|
cargo build --release
|
||||||
cp target/release/lan-mouse lan-mouse-linux-x86_64
|
cp target/release/lan-mouse lan-mouse-linux-x86_64
|
||||||
|
- name: Install cargo bundle
|
||||||
|
run: cargo install cargo-bundle
|
||||||
|
- name: Bundle
|
||||||
|
run: |
|
||||||
|
cargo bundle --release
|
||||||
- name: Upload build artifact
|
- name: Upload build artifact
|
||||||
uses: actions/upload-artifact@v6
|
uses: actions/upload-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: lan-mouse-linux-x86_64
|
name: lan-mouse-linux-x86_64
|
||||||
path: lan-mouse-linux-x86_64
|
path: |
|
||||||
|
lan-mouse-linux-x86_64
|
||||||
|
target/release/bundle/deb/lan-mouse_*.deb
|
||||||
|
target/release/bundle/appimage/lan-mouse_*.AppImage
|
||||||
|
|
||||||
linux-arm64-release-build:
|
linux-arm64-release-build:
|
||||||
runs-on: ubuntu-22.04-arm
|
runs-on: ubuntu-22.04-arm
|
||||||
@@ -49,11 +57,19 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cargo build --release
|
cargo build --release
|
||||||
cp target/release/lan-mouse lan-mouse-linux-arm64
|
cp target/release/lan-mouse lan-mouse-linux-arm64
|
||||||
|
- name: Install cargo bundle
|
||||||
|
run: cargo install cargo-bundle
|
||||||
|
- name: Bundle
|
||||||
|
run: |
|
||||||
|
cargo bundle --release
|
||||||
- name: Upload build artifact
|
- name: Upload build artifact
|
||||||
uses: actions/upload-artifact@v6
|
uses: actions/upload-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: lan-mouse-linux-arm64
|
name: lan-mouse-linux-arm64
|
||||||
path: lan-mouse-linux-arm64
|
path: |
|
||||||
|
lan-mouse-linux-arm64
|
||||||
|
target/release/bundle/deb/lan-mouse_*.deb
|
||||||
|
target/release/bundle/appimage/lan-mouse_*.AppImage
|
||||||
|
|
||||||
windows-release-build:
|
windows-release-build:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
@@ -188,7 +204,11 @@ jobs:
|
|||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
files: |
|
files: |
|
||||||
lan-mouse-linux-x86_64/lan-mouse-linux-x86_64
|
lan-mouse-linux-x86_64/lan-mouse-linux-x86_64
|
||||||
|
lan-mouse-linux-x86_64/target/release/bundle/deb/lan-mouse_*.deb
|
||||||
|
lan-mouse-linux-x86_64/target/release/bundle/appimage/lan-mouse_*.AppImage
|
||||||
lan-mouse-linux-arm64/lan-mouse-linux-arm64
|
lan-mouse-linux-arm64/lan-mouse-linux-arm64
|
||||||
|
lan-mouse-linux-arm64/target/release/bundle/deb/lan-mouse_*.deb
|
||||||
|
lan-mouse-linux-arm64/target/release/bundle/appimage/lan-mouse_*.AppImage
|
||||||
lan-mouse-macos-intel/lan-mouse-macos-intel.zip
|
lan-mouse-macos-intel/lan-mouse-macos-intel.zip
|
||||||
lan-mouse-macos-arm64/lan-mouse-macos-arm64.zip
|
lan-mouse-macos-arm64/lan-mouse-macos-arm64.zip
|
||||||
lan-mouse-windows-x86_64/lan-mouse-windows-x86_64.zip
|
lan-mouse-windows-x86_64/lan-mouse-windows-x86_64.zip
|
||||||
@@ -201,7 +221,11 @@ jobs:
|
|||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
files: |
|
files: |
|
||||||
lan-mouse-linux-x86_64/lan-mouse-linux-x86_64
|
lan-mouse-linux-x86_64/lan-mouse-linux-x86_64
|
||||||
|
lan-mouse-linux-x86_64/target/release/bundle/deb/lan-mouse_*.deb
|
||||||
|
lan-mouse-linux-x86_64/target/release/bundle/appimage/lan-mouse_*.AppImage
|
||||||
lan-mouse-linux-arm64/lan-mouse-linux-arm64
|
lan-mouse-linux-arm64/lan-mouse-linux-arm64
|
||||||
|
lan-mouse-linux-arm64/target/release/bundle/deb/lan-mouse_*.deb
|
||||||
|
lan-mouse-linux-arm64/target/release/bundle/appimage/lan-mouse_*.AppImage
|
||||||
lan-mouse-macos-intel/lan-mouse-macos-intel.zip
|
lan-mouse-macos-intel/lan-mouse-macos-intel.zip
|
||||||
lan-mouse-macos-arm64/lan-mouse-macos-arm64.zip
|
lan-mouse-macos-arm64/lan-mouse-macos-arm64.zip
|
||||||
lan-mouse-windows-x86_64/lan-mouse-windows-x86_64.zip
|
lan-mouse-windows-x86_64/lan-mouse-windows-x86_64.zip
|
||||||
|
|||||||
256
Cargo.lock
generated
256
Cargo.lock
generated
@@ -549,30 +549,6 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "critical-section"
|
|
||||||
version = "1.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crossbeam-channel"
|
|
||||||
version = "0.5.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2"
|
|
||||||
dependencies = [
|
|
||||||
"crossbeam-utils",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crossbeam-epoch"
|
|
||||||
version = "0.9.18"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
|
|
||||||
dependencies = [
|
|
||||||
"crossbeam-utils",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-utils"
|
name = "crossbeam-utils"
|
||||||
version = "0.8.21"
|
version = "0.8.21"
|
||||||
@@ -586,7 +562,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76"
|
checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"generic-array",
|
"generic-array",
|
||||||
"rand_core 0.6.4",
|
"rand_core",
|
||||||
"subtle",
|
"subtle",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
]
|
]
|
||||||
@@ -598,7 +574,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
|
checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"generic-array",
|
"generic-array",
|
||||||
"rand_core 0.6.4",
|
"rand_core",
|
||||||
"typenum",
|
"typenum",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -735,7 +711,7 @@ dependencies = [
|
|||||||
"hkdf",
|
"hkdf",
|
||||||
"pem-rfc7468",
|
"pem-rfc7468",
|
||||||
"pkcs8",
|
"pkcs8",
|
||||||
"rand_core 0.6.4",
|
"rand_core",
|
||||||
"sec1",
|
"sec1",
|
||||||
"subtle",
|
"subtle",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
@@ -747,18 +723,6 @@ version = "1.1.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099"
|
checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "enum-as-inner"
|
|
||||||
version = "0.6.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc"
|
|
||||||
dependencies = [
|
|
||||||
"heck",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "enumflags2"
|
name = "enumflags2"
|
||||||
version = "0.7.12"
|
version = "0.7.12"
|
||||||
@@ -852,7 +816,7 @@ version = "0.13.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393"
|
checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rand_core 0.6.4",
|
"rand_core",
|
||||||
"subtle",
|
"subtle",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1281,7 +1245,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"
|
checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ff",
|
"ff",
|
||||||
"rand_core 0.6.4",
|
"rand_core",
|
||||||
"subtle",
|
"subtle",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1395,52 +1359,6 @@ version = "0.4.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hickory-proto"
|
|
||||||
version = "0.25.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f8a6fe56c0038198998a6f217ca4e7ef3a5e51f46163bd6dd60b5c71ca6c6502"
|
|
||||||
dependencies = [
|
|
||||||
"async-trait",
|
|
||||||
"cfg-if",
|
|
||||||
"data-encoding",
|
|
||||||
"enum-as-inner",
|
|
||||||
"futures-channel",
|
|
||||||
"futures-io",
|
|
||||||
"futures-util",
|
|
||||||
"idna",
|
|
||||||
"ipnet",
|
|
||||||
"once_cell",
|
|
||||||
"rand 0.9.2",
|
|
||||||
"ring",
|
|
||||||
"thiserror 2.0.18",
|
|
||||||
"tinyvec",
|
|
||||||
"tokio",
|
|
||||||
"tracing",
|
|
||||||
"url",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hickory-resolver"
|
|
||||||
version = "0.25.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dc62a9a99b0bfb44d2ab95a7208ac952d31060efc16241c87eaf36406fecf87a"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"futures-util",
|
|
||||||
"hickory-proto",
|
|
||||||
"ipconfig",
|
|
||||||
"moka",
|
|
||||||
"once_cell",
|
|
||||||
"parking_lot",
|
|
||||||
"rand 0.9.2",
|
|
||||||
"resolv-conf",
|
|
||||||
"smallvec",
|
|
||||||
"thiserror 2.0.18",
|
|
||||||
"tokio",
|
|
||||||
"tracing",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hkdf"
|
name = "hkdf"
|
||||||
version = "0.12.4"
|
version = "0.12.4"
|
||||||
@@ -1713,19 +1631,6 @@ dependencies = [
|
|||||||
"thiserror 2.0.18",
|
"thiserror 2.0.18",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ipconfig"
|
|
||||||
version = "0.3.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4d40460c0ce33d6ce4b0630ad68ff63d6661961c48b6dba35e5a4d81cfb48222"
|
|
||||||
dependencies = [
|
|
||||||
"socket2",
|
|
||||||
"widestring",
|
|
||||||
"windows-registry",
|
|
||||||
"windows-result 0.4.1",
|
|
||||||
"windows-sys 0.61.2",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ipnet"
|
name = "ipnet"
|
||||||
version = "2.12.0"
|
version = "2.12.0"
|
||||||
@@ -1845,7 +1750,6 @@ dependencies = [
|
|||||||
"clap",
|
"clap",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"futures",
|
"futures",
|
||||||
"hickory-resolver",
|
|
||||||
"input-capture",
|
"input-capture",
|
||||||
"input-emulation",
|
"input-emulation",
|
||||||
"input-event",
|
"input-event",
|
||||||
@@ -1994,12 +1898,6 @@ dependencies = [
|
|||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "linux-raw-sys"
|
|
||||||
version = "0.4.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linux-raw-sys"
|
name = "linux-raw-sys"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
@@ -2096,23 +1994,6 @@ dependencies = [
|
|||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "moka"
|
|
||||||
version = "0.12.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "957228ad12042ee839f93c8f257b62b4c0ab5eaae1d4fa60de53b27c9d7c5046"
|
|
||||||
dependencies = [
|
|
||||||
"crossbeam-channel",
|
|
||||||
"crossbeam-epoch",
|
|
||||||
"crossbeam-utils",
|
|
||||||
"equivalent",
|
|
||||||
"parking_lot",
|
|
||||||
"portable-atomic",
|
|
||||||
"smallvec",
|
|
||||||
"tagptr",
|
|
||||||
"uuid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nix"
|
name = "nix"
|
||||||
version = "0.26.4"
|
version = "0.26.4"
|
||||||
@@ -2242,10 +2123,6 @@ name = "once_cell"
|
|||||||
version = "1.21.4"
|
version = "1.21.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
||||||
dependencies = [
|
|
||||||
"critical-section",
|
|
||||||
"portable-atomic",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell_polyfill"
|
name = "once_cell_polyfill"
|
||||||
@@ -2530,18 +2407,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"rand_chacha 0.3.1",
|
"rand_chacha",
|
||||||
"rand_core 0.6.4",
|
"rand_core",
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand"
|
|
||||||
version = "0.9.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
|
|
||||||
dependencies = [
|
|
||||||
"rand_chacha 0.9.0",
|
|
||||||
"rand_core 0.9.5",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2551,17 +2418,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ppv-lite86",
|
"ppv-lite86",
|
||||||
"rand_core 0.6.4",
|
"rand_core",
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand_chacha"
|
|
||||||
version = "0.9.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
|
|
||||||
dependencies = [
|
|
||||||
"ppv-lite86",
|
|
||||||
"rand_core 0.9.5",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2573,15 +2430,6 @@ dependencies = [
|
|||||||
"getrandom 0.2.17",
|
"getrandom 0.2.17",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand_core"
|
|
||||||
version = "0.9.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
|
|
||||||
dependencies = [
|
|
||||||
"getrandom 0.3.4",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rcgen"
|
name = "rcgen"
|
||||||
version = "0.13.2"
|
version = "0.13.2"
|
||||||
@@ -2635,21 +2483,17 @@ checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reis"
|
name = "reis"
|
||||||
version = "0.5.0"
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "00939c5c526a1b4054ef8d9d96b3f92227f08ca355965e986741b556eda6d289"
|
checksum = "81f3fedd2777cde52c1be5e572efbec485eac7b801c47820eda388d4f13b9c4b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures",
|
"enumflags2",
|
||||||
"rustix 0.38.44",
|
"futures-util",
|
||||||
|
"log",
|
||||||
|
"rustix",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "resolv-conf"
|
|
||||||
version = "0.7.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1e061d1b48cb8d38042de4ae0a7a6401009d6143dc80d2e2d6f31f0bdd6470c7"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rfc6979"
|
name = "rfc6979"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
@@ -2692,19 +2536,6 @@ dependencies = [
|
|||||||
"nom",
|
"nom",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustix"
|
|
||||||
version = "0.38.44"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 2.11.0",
|
|
||||||
"errno",
|
|
||||||
"libc",
|
|
||||||
"linux-raw-sys 0.4.15",
|
|
||||||
"windows-sys 0.59.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustix"
|
name = "rustix"
|
||||||
version = "1.1.4"
|
version = "1.1.4"
|
||||||
@@ -2714,7 +2545,7 @@ dependencies = [
|
|||||||
"bitflags 2.11.0",
|
"bitflags 2.11.0",
|
||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys 0.12.1",
|
"linux-raw-sys",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2929,7 +2760,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
|
checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"digest",
|
"digest",
|
||||||
"rand_core 0.6.4",
|
"rand_core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3017,12 +2848,6 @@ dependencies = [
|
|||||||
"version-compare",
|
"version-compare",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tagptr"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "target-lexicon"
|
name = "target-lexicon"
|
||||||
version = "0.13.3"
|
version = "0.13.3"
|
||||||
@@ -3038,7 +2863,7 @@ dependencies = [
|
|||||||
"fastrand",
|
"fastrand",
|
||||||
"getrandom 0.4.2",
|
"getrandom 0.4.2",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustix 1.1.4",
|
"rustix",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3125,21 +2950,6 @@ dependencies = [
|
|||||||
"zerovec",
|
"zerovec",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tinyvec"
|
|
||||||
version = "1.11.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3"
|
|
||||||
dependencies = [
|
|
||||||
"tinyvec_macros",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tinyvec_macros"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.51.1"
|
version = "1.51.1"
|
||||||
@@ -3417,7 +3227,6 @@ version = "1.23.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5ac8b6f42ead25368cf5b098aeb3dc8a1a2c05a3eee8a9a1a68c640edbfc79d9"
|
checksum = "5ac8b6f42ead25368cf5b098aeb3dc8a1a2c05a3eee8a9a1a68c640edbfc79d9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.4.2",
|
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"serde_core",
|
"serde_core",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
@@ -3562,7 +3371,7 @@ checksum = "2857dd20b54e916ec7253b3d6b4d5c4d7d4ca2c33c2e11c6c76a99bd8744755d"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"downcast-rs",
|
"downcast-rs",
|
||||||
"rustix 1.1.4",
|
"rustix",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"wayland-sys",
|
"wayland-sys",
|
||||||
]
|
]
|
||||||
@@ -3574,7 +3383,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "645c7c96bb74690c3189b5c9cb4ca1627062bb23693a4fad9d8c3de958260144"
|
checksum = "645c7c96bb74690c3189b5c9cb4ca1627062bb23693a4fad9d8c3de958260144"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.11.0",
|
"bitflags 2.11.0",
|
||||||
"rustix 1.1.4",
|
"rustix",
|
||||||
"wayland-backend",
|
"wayland-backend",
|
||||||
"wayland-scanner",
|
"wayland-scanner",
|
||||||
]
|
]
|
||||||
@@ -3658,8 +3467,8 @@ dependencies = [
|
|||||||
"p384",
|
"p384",
|
||||||
"pem",
|
"pem",
|
||||||
"portable-atomic",
|
"portable-atomic",
|
||||||
"rand 0.8.5",
|
"rand",
|
||||||
"rand_core 0.6.4",
|
"rand_core",
|
||||||
"rcgen",
|
"rcgen",
|
||||||
"ring",
|
"ring",
|
||||||
"rustls",
|
"rustls",
|
||||||
@@ -3690,18 +3499,12 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"nix",
|
"nix",
|
||||||
"portable-atomic",
|
"portable-atomic",
|
||||||
"rand 0.8.5",
|
"rand",
|
||||||
"thiserror 1.0.69",
|
"thiserror 1.0.69",
|
||||||
"tokio",
|
"tokio",
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "widestring"
|
|
||||||
version = "1.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
version = "0.3.9"
|
version = "0.3.9"
|
||||||
@@ -3836,17 +3639,6 @@ dependencies = [
|
|||||||
"windows-link 0.1.3",
|
"windows-link 0.1.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-registry"
|
|
||||||
version = "0.6.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"
|
|
||||||
dependencies = [
|
|
||||||
"windows-link 0.2.1",
|
|
||||||
"windows-result 0.4.1",
|
|
||||||
"windows-strings 0.5.1",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-result"
|
name = "windows-result"
|
||||||
version = "0.3.4"
|
version = "0.3.4"
|
||||||
@@ -4186,7 +3978,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277"
|
checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"curve25519-dalek",
|
"curve25519-dalek",
|
||||||
"rand_core 0.6.4",
|
"rand_core",
|
||||||
"serde",
|
"serde",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
]
|
]
|
||||||
@@ -4256,7 +4048,7 @@ dependencies = [
|
|||||||
"hex",
|
"hex",
|
||||||
"libc",
|
"libc",
|
||||||
"ordered-stream",
|
"ordered-stream",
|
||||||
"rustix 1.1.4",
|
"rustix",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_repr",
|
"serde_repr",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ lan-mouse-ipc = { path = "lan-mouse-ipc", version = "0.3.0" }
|
|||||||
lan-mouse-proto = { path = "lan-mouse-proto", version = "0.3.0" }
|
lan-mouse-proto = { path = "lan-mouse-proto", version = "0.3.0" }
|
||||||
shadow-rs = { version = "1.2.0", features = ["metadata"] }
|
shadow-rs = { version = "1.2.0", features = ["metadata"] }
|
||||||
|
|
||||||
hickory-resolver = "0.25.2"
|
|
||||||
toml = "0.8"
|
toml = "0.8"
|
||||||
toml_edit = { version = "0.22", features = ["serde"] }
|
toml_edit = { version = "0.22", features = ["serde"] }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
@@ -94,7 +93,8 @@ rdp_emulation = ["input-emulation/remote_desktop_portal"]
|
|||||||
|
|
||||||
[package.metadata.bundle]
|
[package.metadata.bundle]
|
||||||
name = "Lan Mouse"
|
name = "Lan Mouse"
|
||||||
icon = ["target/icon.icns"]
|
icon = ["target/icon.icns", "lan-mouse-gtk/resources/de.feschber.LanMouse.svg"]
|
||||||
identifier = "de.feschber.LanMouse"
|
identifier = "de.feschber.LanMouse"
|
||||||
|
deb_depends = [ "libadwaita-1-0" ]
|
||||||
osx_info_plist_exts = ["build-aux/macos-lsui-element.plist"]
|
osx_info_plist_exts = ["build-aux/macos-lsui-element.plist"]
|
||||||
resources = ["target/menubar-template.png"]
|
resources = ["target/menubar-template.png"]
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ ashpd = { version = "0.13.9", default-features = false, features = [
|
|||||||
"input_capture",
|
"input_capture",
|
||||||
"tokio",
|
"tokio",
|
||||||
], optional = true }
|
], optional = true }
|
||||||
reis = { version = "0.5.0", features = ["tokio"], optional = true }
|
reis = { version = "0.7.0", features = ["tokio"], optional = true }
|
||||||
|
|
||||||
[target.'cfg(target_os="macos")'.dependencies]
|
[target.'cfg(target_os="macos")'.dependencies]
|
||||||
core-graphics = { version = "0.25.0", features = ["highsierra"] }
|
core-graphics = { version = "0.25.0", features = ["highsierra"] }
|
||||||
|
|||||||
@@ -413,7 +413,15 @@ async fn do_capture_session(
|
|||||||
};
|
};
|
||||||
|
|
||||||
// find client corresponding to barrier
|
// find client corresponding to barrier
|
||||||
let pos = *pos_for_barrier_id.get(&barrier_id).expect("invalid barrier id");
|
let pos = match pos_for_barrier_id.get(&barrier_id) {
|
||||||
|
Some(id) => *id,
|
||||||
|
None => {
|
||||||
|
log::warn!("INVALID BARRIER ID: Id {barrier_id} does not exist!");
|
||||||
|
let id = find_corresponding_client(&barriers, activated.cursor_position().expect("no cursor position reported by compositor"));
|
||||||
|
let pos = *pos_for_barrier_id.get(&id).expect("invalid barrier id");
|
||||||
|
pos
|
||||||
|
},
|
||||||
|
};
|
||||||
current_pos.replace(Some(pos));
|
current_pos.replace(Some(pos));
|
||||||
|
|
||||||
// client entered => send event
|
// client entered => send event
|
||||||
@@ -529,15 +537,6 @@ fn distance_to_line(line: ((f32, f32), (f32, f32)), p: (f32, f32)) -> f32 {
|
|||||||
distance
|
distance
|
||||||
}
|
}
|
||||||
|
|
||||||
static ALL_CAPABILITIES: &[DeviceCapability] = &[
|
|
||||||
DeviceCapability::Pointer,
|
|
||||||
DeviceCapability::PointerAbsolute,
|
|
||||||
DeviceCapability::Keyboard,
|
|
||||||
DeviceCapability::Touch,
|
|
||||||
DeviceCapability::Scroll,
|
|
||||||
DeviceCapability::Button,
|
|
||||||
];
|
|
||||||
|
|
||||||
async fn handle_ei_event(
|
async fn handle_ei_event(
|
||||||
ei_event: EiEvent,
|
ei_event: EiEvent,
|
||||||
current_client: Option<Position>,
|
current_client: Option<Position>,
|
||||||
@@ -545,9 +544,15 @@ async fn handle_ei_event(
|
|||||||
event_tx: &Sender<(Position, CaptureEvent)>,
|
event_tx: &Sender<(Position, CaptureEvent)>,
|
||||||
release_session: &Notify,
|
release_session: &Notify,
|
||||||
) -> Result<(), CaptureError> {
|
) -> Result<(), CaptureError> {
|
||||||
|
let all_capabilities = DeviceCapability::Pointer
|
||||||
|
| DeviceCapability::PointerAbsolute
|
||||||
|
| DeviceCapability::Keyboard
|
||||||
|
| DeviceCapability::Touch
|
||||||
|
| DeviceCapability::Scroll
|
||||||
|
| DeviceCapability::Button;
|
||||||
match ei_event {
|
match ei_event {
|
||||||
EiEvent::SeatAdded(s) => {
|
EiEvent::SeatAdded(s) => {
|
||||||
s.seat.bind_capabilities(ALL_CAPABILITIES);
|
s.seat.bind_capabilities(all_capabilities);
|
||||||
context.flush().map_err(|e| io::Error::new(e.kind(), e))?;
|
context.flush().map_err(|e| io::Error::new(e.kind(), e))?;
|
||||||
}
|
}
|
||||||
EiEvent::SeatRemoved(_) | /* EiEvent::DeviceAdded(_) | */ EiEvent::DeviceRemoved(_) => {
|
EiEvent::SeatRemoved(_) | /* EiEvent::DeviceAdded(_) | */ EiEvent::DeviceRemoved(_) => {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ ashpd = { version = "0.13.9", default-features = false, features = [
|
|||||||
"screencast",
|
"screencast",
|
||||||
"tokio",
|
"tokio",
|
||||||
], optional = true }
|
], optional = true }
|
||||||
reis = { version = "0.5.0", features = ["tokio"], optional = true }
|
reis = { version = "0.7.0", features = ["tokio"], optional = true }
|
||||||
|
|
||||||
[target.'cfg(target_os="macos")'.dependencies]
|
[target.'cfg(target_os="macos")'.dependencies]
|
||||||
bitflags = "2.6.0"
|
bitflags = "2.6.0"
|
||||||
|
|||||||
@@ -291,14 +291,12 @@ async fn ei_event_handler(
|
|||||||
) -> Result<(), EmulationError> {
|
) -> Result<(), EmulationError> {
|
||||||
loop {
|
loop {
|
||||||
let event = events.next().await.ok_or(EmulationError::EndOfStream)??;
|
let event = events.next().await.ok_or(EmulationError::EndOfStream)??;
|
||||||
const CAPABILITIES: &[DeviceCapability] = &[
|
let capabilities = DeviceCapability::Pointer
|
||||||
DeviceCapability::Pointer,
|
| DeviceCapability::PointerAbsolute
|
||||||
DeviceCapability::PointerAbsolute,
|
| DeviceCapability::Keyboard
|
||||||
DeviceCapability::Keyboard,
|
| DeviceCapability::Touch
|
||||||
DeviceCapability::Touch,
|
| DeviceCapability::Scroll
|
||||||
DeviceCapability::Scroll,
|
| DeviceCapability::Button;
|
||||||
DeviceCapability::Button,
|
|
||||||
];
|
|
||||||
log::debug!("{event:?}");
|
log::debug!("{event:?}");
|
||||||
match event {
|
match event {
|
||||||
EiEvent::Disconnected(e) => {
|
EiEvent::Disconnected(e) => {
|
||||||
@@ -306,7 +304,7 @@ async fn ei_event_handler(
|
|||||||
return Err(EmulationError::EndOfStream);
|
return Err(EmulationError::EndOfStream);
|
||||||
}
|
}
|
||||||
EiEvent::SeatAdded(e) => {
|
EiEvent::SeatAdded(e) => {
|
||||||
e.seat().bind_capabilities(CAPABILITIES);
|
e.seat().bind_capabilities(capabilities);
|
||||||
}
|
}
|
||||||
EiEvent::SeatRemoved(e) => {
|
EiEvent::SeatRemoved(e) => {
|
||||||
log::debug!("seat removed: {:?}", e.seat());
|
log::debug!("seat removed: {:?}", e.seat());
|
||||||
@@ -314,7 +312,6 @@ async fn ei_event_handler(
|
|||||||
EiEvent::DeviceAdded(e) => {
|
EiEvent::DeviceAdded(e) => {
|
||||||
let device_type = e.device().device_type();
|
let device_type = e.device().device_type();
|
||||||
log::debug!("device added: {device_type:?}");
|
log::debug!("device added: {device_type:?}");
|
||||||
e.device().device();
|
|
||||||
let device = e.device();
|
let device = e.device();
|
||||||
if let Some(pointer) = e.device().interface::<Pointer>() {
|
if let Some(pointer) = e.device().interface::<Pointer>() {
|
||||||
devices
|
devices
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ serde = { version = "1.0", features = ["derive"] }
|
|||||||
thiserror = "2.0.0"
|
thiserror = "2.0.0"
|
||||||
|
|
||||||
[target.'cfg(all(unix, not(target_os="macos")))'.dependencies]
|
[target.'cfg(all(unix, not(target_os="macos")))'.dependencies]
|
||||||
reis = { version = "0.5.0", optional = true }
|
reis = { version = "0.7.0", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["libei"]
|
default = ["libei"]
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
<file compressed="true" preprocess="xml-stripblanks">fingerprint_window.ui</file>
|
<file compressed="true" preprocess="xml-stripblanks">fingerprint_window.ui</file>
|
||||||
<file compressed="true" preprocess="xml-stripblanks">client_row.ui</file>
|
<file compressed="true" preprocess="xml-stripblanks">client_row.ui</file>
|
||||||
<file compressed="true" preprocess="xml-stripblanks">key_row.ui</file>
|
<file compressed="true" preprocess="xml-stripblanks">key_row.ui</file>
|
||||||
|
<file compressed="true">style.css</file>
|
||||||
</gresource>
|
</gresource>
|
||||||
<gresource prefix="/de/feschber/LanMouse/icons">
|
<gresource prefix="/de/feschber/LanMouse/icons">
|
||||||
<file compressed="true" preprocess="xml-stripblanks">de.feschber.LanMouse.svg</file>
|
<file compressed="true" preprocess="xml-stripblanks">de.feschber.LanMouse.svg</file>
|
||||||
|
|||||||
12
lan-mouse-gtk/resources/style.css
Normal file
12
lan-mouse-gtk/resources/style.css
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
.peer-match > box > list .subtitle {
|
||||||
|
color: @success_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.peer-mismatch > box > list .subtitle {
|
||||||
|
font-weight: bold;
|
||||||
|
color: @warning_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.peer-unknown > box > list .subtitle {
|
||||||
|
color: @warning_color;
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@ impl ClientObject {
|
|||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
)
|
)
|
||||||
.property("resolving", state.resolving)
|
.property("resolving", state.resolving)
|
||||||
|
.property("peer-commit", peer_commit_to_string(state.peer_commit))
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,6 +35,14 @@ impl ClientObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Render the 8-byte ASCII commit hash carried in
|
||||||
|
/// [`lan_mouse_ipc::ClientState::peer_commit`] as a `String`. `None`
|
||||||
|
/// in → `None` out (peer hasn't sent a Hello yet, or speaks an older
|
||||||
|
/// proto).
|
||||||
|
pub fn peer_commit_to_string(commit: Option<[u8; 8]>) -> Option<String> {
|
||||||
|
commit.and_then(|c| std::str::from_utf8(&c).ok().map(str::to_string))
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Default, Clone)]
|
#[derive(Default, Clone)]
|
||||||
pub struct ClientData {
|
pub struct ClientData {
|
||||||
pub handle: ClientHandle,
|
pub handle: ClientHandle,
|
||||||
@@ -43,4 +52,5 @@ pub struct ClientData {
|
|||||||
pub position: String,
|
pub position: String,
|
||||||
pub resolving: bool,
|
pub resolving: bool,
|
||||||
pub ips: Vec<String>,
|
pub ips: Vec<String>,
|
||||||
|
pub peer_commit: Option<String>,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ pub struct ClientObject {
|
|||||||
#[property(name = "position", get, set, type = String, member = position)]
|
#[property(name = "position", get, set, type = String, member = position)]
|
||||||
#[property(name = "resolving", get, set, type = bool, member = resolving)]
|
#[property(name = "resolving", get, set, type = bool, member = resolving)]
|
||||||
#[property(name = "ips", get, set, type = Vec<String>, member = ips)]
|
#[property(name = "ips", get, set, type = Vec<String>, member = ips)]
|
||||||
|
#[property(name = "peer-commit", get, set, type = Option<String>, member = peer_commit)]
|
||||||
pub data: RefCell<ClientData>,
|
pub data: RefCell<ClientData>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,6 +123,12 @@ impl ClientRow {
|
|||||||
bindings.push(position_binding);
|
bindings.push(position_binding);
|
||||||
bindings.push(resolve_binding);
|
bindings.push(resolve_binding);
|
||||||
bindings.push(ip_binding);
|
bindings.push(ip_binding);
|
||||||
|
|
||||||
|
// Render the initial collapsed subtitle from whatever
|
||||||
|
// peer_commit the ClientObject was created with. Subsequent
|
||||||
|
// changes are pushed by `Window::update_client_state` calling
|
||||||
|
// `refresh_version_status` after writing the new property.
|
||||||
|
self.refresh_version_status();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unbind(&self) {
|
pub fn unbind(&self) {
|
||||||
@@ -150,4 +156,40 @@ impl ClientRow {
|
|||||||
pub fn set_dns_state(&self, resolved: bool) {
|
pub fn set_dns_state(&self, resolved: bool) {
|
||||||
self.imp().set_dns_state(resolved);
|
self.imp().set_dns_state(resolved);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Recompute the collapsed subtitle (Pango markup) based on the
|
||||||
|
/// current `peer-commit` property and the local build's commit.
|
||||||
|
/// Soft-warn semantics: a missing or mismatched peer commit
|
||||||
|
/// surfaces as orange text but never blocks traffic. Called by
|
||||||
|
/// the window after `update_client_state` writes the new
|
||||||
|
/// `peer-commit`. The dns-status icon is left to its existing
|
||||||
|
/// `set_dns_state` handler so the two indicators don't fight
|
||||||
|
/// for the same CSS class.
|
||||||
|
pub fn refresh_version_status(&self) {
|
||||||
|
let peer: Option<String> = self
|
||||||
|
.imp()
|
||||||
|
.client_object
|
||||||
|
.borrow()
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|co| co.property::<Option<String>>("peer-commit"));
|
||||||
|
let local = crate::local_commit_str();
|
||||||
|
let markup = match peer.as_deref() {
|
||||||
|
None => format!("Peer version: unknown · Ours: {local}"),
|
||||||
|
Some(p) if p == local.as_str() => {
|
||||||
|
format!("Peer version: {p} · matched")
|
||||||
|
}
|
||||||
|
Some(p) => {
|
||||||
|
format!("Peer version: {p} · Ours: {local}")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
self.remove_css_class("peer-mismatch");
|
||||||
|
self.remove_css_class("peer-match");
|
||||||
|
self.remove_css_class("peer-unknown");
|
||||||
|
match peer.as_deref() {
|
||||||
|
Some(p) if p == local.as_str() => self.add_css_class("peer-match"),
|
||||||
|
Some(_) => self.add_css_class("peer-mismatch"),
|
||||||
|
None => self.add_css_class("peer-unknown"),
|
||||||
|
};
|
||||||
|
self.set_subtitle(&markup);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,10 +10,28 @@ mod macos_privacy;
|
|||||||
mod macos_status_item;
|
mod macos_status_item;
|
||||||
mod window;
|
mod window;
|
||||||
|
|
||||||
use std::{env, process, str};
|
use std::{env, process, str, sync::OnceLock};
|
||||||
|
|
||||||
|
use gtk::CssProvider;
|
||||||
use window::Window;
|
use window::Window;
|
||||||
|
|
||||||
|
/// Local build's commit hash, set once by [`run`] before the GTK
|
||||||
|
/// main loop starts. Read by per-row UI to compare against each
|
||||||
|
/// peer's [`lan_mouse_ipc::ClientState::peer_commit`] for the
|
||||||
|
/// soft-warn version-mismatch indicator.
|
||||||
|
pub(crate) static LOCAL_COMMIT: OnceLock<[u8; 8]> = OnceLock::new();
|
||||||
|
|
||||||
|
/// Convenience: returns the local commit as an 8-char ASCII string,
|
||||||
|
/// or a placeholder if unset (which would indicate a programmer
|
||||||
|
/// error since [`run`] always sets it).
|
||||||
|
pub(crate) fn local_commit_str() -> String {
|
||||||
|
LOCAL_COMMIT
|
||||||
|
.get()
|
||||||
|
.and_then(|c| std::str::from_utf8(c).ok())
|
||||||
|
.unwrap_or("????????")
|
||||||
|
.to_string()
|
||||||
|
}
|
||||||
|
|
||||||
use lan_mouse_ipc::FrontendEvent;
|
use lan_mouse_ipc::FrontendEvent;
|
||||||
|
|
||||||
use adw::Application;
|
use adw::Application;
|
||||||
@@ -31,8 +49,12 @@ pub enum GtkError {
|
|||||||
NonZeroExitCode(i32),
|
NonZeroExitCode(i32),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run() -> Result<(), GtkError> {
|
pub fn run(local_commit: [u8; 8]) -> Result<(), GtkError> {
|
||||||
log::debug!("running gtk frontend");
|
log::debug!("running gtk frontend");
|
||||||
|
LOCAL_COMMIT
|
||||||
|
.set(local_commit)
|
||||||
|
.expect("local_commit set once");
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
let ret = std::thread::Builder::new()
|
let ret = std::thread::Builder::new()
|
||||||
.stack_size(8 * 1024 * 1024) // https://gitlab.gnome.org/GNOME/gtk/-/commit/52dbb3f372b2c3ea339e879689c1de535ba2c2c3 -> caused crash on windows
|
.stack_size(8 * 1024 * 1024) // https://gitlab.gnome.org/GNOME/gtk/-/commit/52dbb3f372b2c3ea339e879689c1de535ba2c2c3 -> caused crash on windows
|
||||||
@@ -64,6 +86,7 @@ fn gtk_main() -> glib::ExitCode {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
app.connect_startup(|app| {
|
app.connect_startup(|app| {
|
||||||
|
load_css();
|
||||||
load_icons();
|
load_icons();
|
||||||
setup_actions(app);
|
setup_actions(app);
|
||||||
setup_menu(app);
|
setup_menu(app);
|
||||||
@@ -132,6 +155,16 @@ fn configure_macos_bundle_environment() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn load_css() {
|
||||||
|
let provider = CssProvider::default();
|
||||||
|
provider.load_from_resource("de/feschber/LanMouse/style.css");
|
||||||
|
gtk::style_context_add_provider_for_display(
|
||||||
|
&Display::default().expect("Could not connect to a display"),
|
||||||
|
&provider,
|
||||||
|
gtk::STYLE_PROVIDER_PRIORITY_APPLICATION,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
fn load_icons() {
|
fn load_icons() {
|
||||||
let display = &Display::default().expect("Could not connect to a display.");
|
let display = &Display::default().expect("Could not connect to a display.");
|
||||||
let icon_theme = IconTheme::for_display(display);
|
let icon_theme = IconTheme::for_display(display);
|
||||||
|
|||||||
@@ -365,6 +365,13 @@ impl Window {
|
|||||||
.map(|ip| ip.to_string())
|
.map(|ip| ip.to_string())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
client_object.set_ips(ips);
|
client_object.set_ips(ips);
|
||||||
|
|
||||||
|
/* peer build version (drives the version-match indicator) */
|
||||||
|
client_object.set_property(
|
||||||
|
"peer-commit",
|
||||||
|
crate::client_object::peer_commit_to_string(state.peer_commit),
|
||||||
|
);
|
||||||
|
row.refresh_version_status();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn client_object_for_handle(&self, handle: ClientHandle) -> Option<ClientObject> {
|
fn client_object_for_handle(&self, handle: ClientHandle) -> Option<ClientObject> {
|
||||||
|
|||||||
@@ -176,6 +176,12 @@ pub struct ClientState {
|
|||||||
pub has_pressed_keys: bool,
|
pub has_pressed_keys: bool,
|
||||||
/// dns resolving in progress
|
/// dns resolving in progress
|
||||||
pub resolving: bool,
|
pub resolving: bool,
|
||||||
|
/// Peer's build short commit hash from the [`Hello`] proto
|
||||||
|
/// event. `None` means we haven't received a Hello yet — either
|
||||||
|
/// the connection is fresh, or the peer is on an older build
|
||||||
|
/// that predates the Hello event. The frontend uses this to
|
||||||
|
/// soft-warn on version mismatch.
|
||||||
|
pub peer_commit: Option<[u8; 8]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
|||||||
@@ -63,6 +63,15 @@ pub enum ProtoEvent {
|
|||||||
Ping,
|
Ping,
|
||||||
/// Response to [`ProtoEvent::Ping`], true if emulation is enabled / available
|
/// Response to [`ProtoEvent::Ping`], true if emulation is enabled / available
|
||||||
Pong(bool),
|
Pong(bool),
|
||||||
|
/// Build identification for the sending peer. Sent by the
|
||||||
|
/// connect side once after the connection authenticates, and
|
||||||
|
/// echoed back by the listen side in reply, so each end can
|
||||||
|
/// display the peer's build hash and warn (soft) on mismatch.
|
||||||
|
/// `commit` is the 8-byte ASCII short commit hash from
|
||||||
|
/// `shadow_rs`'s `SHORT_COMMIT`. Old peers that don't
|
||||||
|
/// recognize the event type silently skip it per the
|
||||||
|
/// forward-compat handling in the receive loop.
|
||||||
|
Hello { commit: [u8; 8] },
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for ProtoEvent {
|
impl Display for ProtoEvent {
|
||||||
@@ -80,6 +89,10 @@ impl Display for ProtoEvent {
|
|||||||
if *alive { "alive" } else { "not available" }
|
if *alive { "alive" } else { "not available" }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
ProtoEvent::Hello { commit } => {
|
||||||
|
let s = std::str::from_utf8(commit).unwrap_or("????????");
|
||||||
|
write!(f, "Hello({s})")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,6 +111,7 @@ pub enum EventType {
|
|||||||
Enter,
|
Enter,
|
||||||
Leave,
|
Leave,
|
||||||
Ack,
|
Ack,
|
||||||
|
Hello,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ProtoEvent {
|
impl ProtoEvent {
|
||||||
@@ -120,6 +134,7 @@ impl ProtoEvent {
|
|||||||
ProtoEvent::Enter(_) => EventType::Enter,
|
ProtoEvent::Enter(_) => EventType::Enter,
|
||||||
ProtoEvent::Leave(_) => EventType::Leave,
|
ProtoEvent::Leave(_) => EventType::Leave,
|
||||||
ProtoEvent::Ack(_) => EventType::Ack,
|
ProtoEvent::Ack(_) => EventType::Ack,
|
||||||
|
ProtoEvent::Hello { .. } => EventType::Hello,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,6 +189,13 @@ impl TryFrom<[u8; MAX_EVENT_SIZE]> for ProtoEvent {
|
|||||||
EventType::Enter => Ok(Self::Enter(decode_u8(&mut buf)?.try_into()?)),
|
EventType::Enter => Ok(Self::Enter(decode_u8(&mut buf)?.try_into()?)),
|
||||||
EventType::Leave => Ok(Self::Leave(decode_u32(&mut buf)?)),
|
EventType::Leave => Ok(Self::Leave(decode_u32(&mut buf)?)),
|
||||||
EventType::Ack => Ok(Self::Ack(decode_u32(&mut buf)?)),
|
EventType::Ack => Ok(Self::Ack(decode_u32(&mut buf)?)),
|
||||||
|
EventType::Hello => {
|
||||||
|
let mut commit = [0u8; 8];
|
||||||
|
for b in commit.iter_mut() {
|
||||||
|
*b = decode_u8(&mut buf)?;
|
||||||
|
}
|
||||||
|
Ok(Self::Hello { commit })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -238,6 +260,11 @@ impl From<ProtoEvent> for ([u8; MAX_EVENT_SIZE], usize) {
|
|||||||
ProtoEvent::Enter(pos) => encode_u8(buf, len, pos as u8),
|
ProtoEvent::Enter(pos) => encode_u8(buf, len, pos as u8),
|
||||||
ProtoEvent::Leave(serial) => encode_u32(buf, len, serial),
|
ProtoEvent::Leave(serial) => encode_u32(buf, len, serial),
|
||||||
ProtoEvent::Ack(serial) => encode_u32(buf, len, serial),
|
ProtoEvent::Ack(serial) => encode_u32(buf, len, serial),
|
||||||
|
ProtoEvent::Hello { commit } => {
|
||||||
|
for b in commit.iter() {
|
||||||
|
encode_u8(buf, len, *b);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(buf, len)
|
(buf, len)
|
||||||
|
|||||||
@@ -282,6 +282,12 @@ impl ClientManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn set_peer_commit(&self, handle: ClientHandle, commit: Option<[u8; 8]>) {
|
||||||
|
if let Some((_, s)) = self.clients.borrow_mut().get_mut(handle as usize) {
|
||||||
|
s.peer_commit = commit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn active_addr(&self, handle: ClientHandle) -> Option<SocketAddr> {
|
pub(crate) fn active_addr(&self, handle: ClientHandle) -> Option<SocketAddr> {
|
||||||
self.clients
|
self.clients
|
||||||
.borrow()
|
.borrow()
|
||||||
|
|||||||
@@ -28,6 +28,18 @@ use shadow_rs::shadow;
|
|||||||
|
|
||||||
shadow!(build);
|
shadow!(build);
|
||||||
|
|
||||||
|
/// Local build's 8-byte ASCII short commit hash, suitable for use
|
||||||
|
/// in [`lan_mouse_proto::ProtoEvent::Hello`]. Pads with `'?'` if
|
||||||
|
/// shadow_rs returns an unexpected length so the field is always
|
||||||
|
/// well-formed on the wire.
|
||||||
|
pub fn local_commit() -> [u8; 8] {
|
||||||
|
let bytes = build::SHORT_COMMIT.as_bytes();
|
||||||
|
let mut out = [b'?'; 8];
|
||||||
|
let n = bytes.len().min(8);
|
||||||
|
out[..n].copy_from_slice(&bytes[..n]);
|
||||||
|
out
|
||||||
|
}
|
||||||
|
|
||||||
const CONFIG_FILE_NAME: &str = "config.toml";
|
const CONFIG_FILE_NAME: &str = "config.toml";
|
||||||
const CERT_FILE_NAME: &str = "lan-mouse.pem";
|
const CERT_FILE_NAME: &str = "lan-mouse.pem";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use crate::client::ClientManager;
|
use crate::client::ClientManager;
|
||||||
|
use crate::config::local_commit;
|
||||||
use lan_mouse_ipc::{ClientHandle, DEFAULT_PORT};
|
use lan_mouse_ipc::{ClientHandle, DEFAULT_PORT};
|
||||||
use lan_mouse_proto::{MAX_EVENT_SIZE, ProtoEvent};
|
use lan_mouse_proto::{MAX_EVENT_SIZE, ProtoEvent};
|
||||||
use local_channel::mpsc::{Receiver, Sender, channel};
|
use local_channel::mpsc::{Receiver, Sender, channel};
|
||||||
@@ -197,6 +198,19 @@ async fn connect_to_handle(
|
|||||||
conns.lock().await.insert(addr, conn.clone());
|
conns.lock().await.insert(addr, conn.clone());
|
||||||
connecting.lock().await.remove(&handle);
|
connecting.lock().await.remove(&handle);
|
||||||
|
|
||||||
|
// Best-effort version handshake. Send our commit hash once
|
||||||
|
// immediately after the DTLS handshake; the listen side
|
||||||
|
// mirrors a Hello back so the receive loop can populate
|
||||||
|
// `peer_commit`. Old peers will silently skip this event
|
||||||
|
// per the forward-compat handler in [`receive_loop`].
|
||||||
|
let (buf, len) = ProtoEvent::Hello {
|
||||||
|
commit: local_commit(),
|
||||||
|
}
|
||||||
|
.into();
|
||||||
|
if let Err(e) = conn.send(&buf[..len]).await {
|
||||||
|
log::debug!("hello send to {addr} failed: {e}");
|
||||||
|
}
|
||||||
|
|
||||||
// poll connection for active
|
// poll connection for active
|
||||||
spawn_local(ping_pong(addr, conn.clone(), ping_response.clone()));
|
spawn_local(ping_pong(addr, conn.clone(), ping_response.clone()));
|
||||||
|
|
||||||
@@ -255,16 +269,26 @@ async fn receive_loop(
|
|||||||
) {
|
) {
|
||||||
let mut buf = [0u8; MAX_EVENT_SIZE];
|
let mut buf = [0u8; MAX_EVENT_SIZE];
|
||||||
while conn.recv(&mut buf).await.is_ok() {
|
while conn.recv(&mut buf).await.is_ok() {
|
||||||
if let Ok(event) = buf.try_into() {
|
match buf.try_into() {
|
||||||
log::trace!("{addr} <==<==<== {event}");
|
Ok(event) => {
|
||||||
match event {
|
log::trace!("{addr} <==<==<== {event}");
|
||||||
ProtoEvent::Pong(b) => {
|
match event {
|
||||||
client_manager.set_active_addr(handle, Some(addr));
|
ProtoEvent::Pong(b) => {
|
||||||
client_manager.set_alive(handle, b);
|
client_manager.set_active_addr(handle, Some(addr));
|
||||||
ping_response.borrow_mut().insert(addr);
|
client_manager.set_alive(handle, b);
|
||||||
|
ping_response.borrow_mut().insert(addr);
|
||||||
|
}
|
||||||
|
ProtoEvent::Hello { commit } => {
|
||||||
|
client_manager.set_peer_commit(handle, Some(commit));
|
||||||
|
}
|
||||||
|
event => tx.send((handle, event)).expect("channel closed"),
|
||||||
}
|
}
|
||||||
event => tx.send((handle, event)).expect("channel closed"),
|
|
||||||
}
|
}
|
||||||
|
// Skip undecodable datagrams without dropping the
|
||||||
|
// connection. Each DTLS recv is one framed message, so
|
||||||
|
// skipping is safe and keeps us forward-compatible with
|
||||||
|
// peers that send event types we don't yet know about.
|
||||||
|
Err(e) => log::debug!("ignoring undecodable event from {addr}: {e}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log::warn!("recv error");
|
log::warn!("recv error");
|
||||||
@@ -280,6 +304,7 @@ async fn disconnect(
|
|||||||
log::warn!("client ({handle}) @ {addr} connection closed");
|
log::warn!("client ({handle}) @ {addr} connection closed");
|
||||||
conns.lock().await.remove(&addr);
|
conns.lock().await.remove(&addr);
|
||||||
client_manager.set_active_addr(handle, None);
|
client_manager.set_active_addr(handle, None);
|
||||||
|
client_manager.set_peer_commit(handle, None);
|
||||||
let active: Vec<SocketAddr> = conns.lock().await.keys().copied().collect();
|
let active: Vec<SocketAddr> = conns.lock().await.keys().copied().collect();
|
||||||
log::info!("active connections: {active:?}");
|
log::info!("active connections: {active:?}");
|
||||||
}
|
}
|
||||||
|
|||||||
32
src/dns.rs
32
src/dns.rs
@@ -1,9 +1,9 @@
|
|||||||
use std::{collections::HashMap, net::IpAddr};
|
use std::{collections::HashMap, io, net::IpAddr};
|
||||||
|
|
||||||
use local_channel::mpsc::{Receiver, Sender, channel};
|
use local_channel::mpsc::{Receiver, Sender, channel};
|
||||||
|
use tokio::net::lookup_host;
|
||||||
use tokio::task::{JoinHandle, spawn_local};
|
use tokio::task::{JoinHandle, spawn_local};
|
||||||
|
|
||||||
use hickory_resolver::{ResolveError, TokioResolver};
|
|
||||||
use tokio_util::sync::CancellationToken;
|
use tokio_util::sync::CancellationToken;
|
||||||
|
|
||||||
use lan_mouse_ipc::ClientHandle;
|
use lan_mouse_ipc::ClientHandle;
|
||||||
@@ -22,11 +22,10 @@ struct DnsRequest {
|
|||||||
|
|
||||||
pub(crate) enum DnsEvent {
|
pub(crate) enum DnsEvent {
|
||||||
Resolving(ClientHandle),
|
Resolving(ClientHandle),
|
||||||
Resolved(ClientHandle, String, Result<Vec<IpAddr>, ResolveError>),
|
Resolved(ClientHandle, String, io::Result<Vec<IpAddr>>),
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DnsTask {
|
struct DnsTask {
|
||||||
resolver: TokioResolver,
|
|
||||||
request_rx: Receiver<DnsRequest>,
|
request_rx: Receiver<DnsRequest>,
|
||||||
event_tx: Sender<DnsEvent>,
|
event_tx: Sender<DnsEvent>,
|
||||||
cancellation_token: CancellationToken,
|
cancellation_token: CancellationToken,
|
||||||
@@ -34,14 +33,12 @@ struct DnsTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl DnsResolver {
|
impl DnsResolver {
|
||||||
pub(crate) fn new() -> Result<Self, ResolveError> {
|
pub(crate) fn new() -> io::Result<Self> {
|
||||||
let resolver = TokioResolver::builder_tokio()?.build();
|
|
||||||
let (request_tx, request_rx) = channel();
|
let (request_tx, request_rx) = channel();
|
||||||
let (event_tx, event_rx) = channel();
|
let (event_tx, event_rx) = channel();
|
||||||
let cancellation_token = CancellationToken::new();
|
let cancellation_token = CancellationToken::new();
|
||||||
let dns_task = DnsTask {
|
let dns_task = DnsTask {
|
||||||
active_tasks: Default::default(),
|
active_tasks: Default::default(),
|
||||||
resolver,
|
|
||||||
request_rx,
|
request_rx,
|
||||||
event_tx,
|
event_tx,
|
||||||
cancellation_token: cancellation_token.clone(),
|
cancellation_token: cancellation_token.clone(),
|
||||||
@@ -97,15 +94,13 @@ impl DnsTask {
|
|||||||
|
|
||||||
/* spawn task for dns request */
|
/* spawn task for dns request */
|
||||||
let event_tx = self.event_tx.clone();
|
let event_tx = self.event_tx.clone();
|
||||||
let resolver = self.resolver.clone();
|
|
||||||
let cancellation_token = self.cancellation_token.clone();
|
let cancellation_token = self.cancellation_token.clone();
|
||||||
|
|
||||||
let task = tokio::task::spawn_local(async move {
|
let task = tokio::task::spawn_local(async move {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
ips = resolver.lookup_ip(&hostname) => {
|
result = resolve_hostname(&hostname) => {
|
||||||
let ips = ips.map(|ips| ips.iter().collect::<Vec<_>>());
|
|
||||||
event_tx
|
event_tx
|
||||||
.send(DnsEvent::Resolved(handle, hostname, ips))
|
.send(DnsEvent::Resolved(handle, hostname, result))
|
||||||
.expect("channel closed");
|
.expect("channel closed");
|
||||||
}
|
}
|
||||||
_ = cancellation_token.cancelled() => {},
|
_ = cancellation_token.cancelled() => {},
|
||||||
@@ -115,3 +110,18 @@ impl DnsTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Resolve `hostname` via the operating system's full name-resolution
|
||||||
|
/// stack (`getaddrinfo` on Unix, GetAddrInfoEx on Windows). This walks
|
||||||
|
/// `/etc/nsswitch.conf` on Linux — picking up mDNS via Avahi, /etc/hosts,
|
||||||
|
/// and DNS — and uses Bonjour for `.local` names on macOS. Pure-DNS
|
||||||
|
/// resolvers like hickory miss all of those, which is why a Bonjour
|
||||||
|
/// hostname (e.g. `JKMBP-M4-Max.local`) wouldn't resolve before.
|
||||||
|
///
|
||||||
|
/// Port `0` is a placeholder — `lookup_host` requires `host:port` but we
|
||||||
|
/// only care about the IPs at this stage; the actual port is appended at
|
||||||
|
/// connection time.
|
||||||
|
async fn resolve_hostname(hostname: &str) -> io::Result<Vec<IpAddr>> {
|
||||||
|
let addrs = lookup_host((hostname, 0)).await?;
|
||||||
|
Ok(addrs.map(|sa| sa.ip()).collect())
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
use crate::config::local_commit;
|
||||||
use crate::listen::{LanMouseListener, ListenEvent, ListenerCreationError};
|
use crate::listen::{LanMouseListener, ListenEvent, ListenerCreationError};
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use input_emulation::{EmulationHandle, InputEmulation, InputEmulationError};
|
use input_emulation::{EmulationHandle, InputEmulation, InputEmulationError};
|
||||||
@@ -52,6 +53,17 @@ pub(crate) enum EmulationEvent {
|
|||||||
EmulationEnabled,
|
EmulationEnabled,
|
||||||
/// capture should be released
|
/// capture should be released
|
||||||
ReleaseNotify,
|
ReleaseNotify,
|
||||||
|
/// peer sent us a Hello with its build commit hash. Used to
|
||||||
|
/// populate `client_manager.peer_commit` from the listen side
|
||||||
|
/// too — without this, peer-version visibility silently fails
|
||||||
|
/// whenever the outgoing connection in the *other* direction is
|
||||||
|
/// broken (one-way setups, asymmetric NAT, peer's TCP listener
|
||||||
|
/// down). The connect-side path stays as the primary source;
|
||||||
|
/// this is the defensive fallback.
|
||||||
|
PeerHello {
|
||||||
|
addr: SocketAddr,
|
||||||
|
commit: [u8; 8],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
enum EmulationRequest {
|
enum EmulationRequest {
|
||||||
@@ -150,6 +162,21 @@ impl ListenTask {
|
|||||||
}
|
}
|
||||||
ProtoEvent::Input(event) => self.emulation_proxy.consume(event, addr),
|
ProtoEvent::Input(event) => self.emulation_proxy.consume(event, addr),
|
||||||
ProtoEvent::Ping => self.listener.reply(addr, ProtoEvent::Pong(self.emulation_proxy.emulation_active.get())).await,
|
ProtoEvent::Ping => self.listener.reply(addr, ProtoEvent::Pong(self.emulation_proxy.emulation_active.get())).await,
|
||||||
|
// Peer's version handshake. Echo our own
|
||||||
|
// commit back so the peer's connect-side
|
||||||
|
// receive_loop populates its `peer_commit`,
|
||||||
|
// AND publish a PeerHello upward so our
|
||||||
|
// service can populate ours from the listen
|
||||||
|
// side too — the connect side is the primary
|
||||||
|
// path, but if the outbound direction is
|
||||||
|
// broken (one-way setup, NAT, peer's TCP
|
||||||
|
// listener down) the version display would
|
||||||
|
// otherwise silently say "unknown" while
|
||||||
|
// the peer is in fact happily talking to us.
|
||||||
|
ProtoEvent::Hello { commit } => {
|
||||||
|
self.listener.reply(addr, ProtoEvent::Hello { commit: local_commit() }).await;
|
||||||
|
self.event_tx.send(EmulationEvent::PeerHello { addr, commit }).expect("channel closed");
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -259,8 +259,16 @@ async fn read_loop(
|
|||||||
.send(ListenEvent::Msg { event, addr })
|
.send(ListenEvent::Msg { event, addr })
|
||||||
.expect("channel closed"),
|
.expect("channel closed"),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log::warn!("error receiving event: {e}");
|
// Skip the malformed/unknown datagram and keep
|
||||||
break;
|
// listening. Each DTLS recv returns one full
|
||||||
|
// datagram, so a parse error here can't desync a
|
||||||
|
// stream; the next call gets a fresh, framed
|
||||||
|
// message. This makes the protocol forward-
|
||||||
|
// compatible: a peer running a newer Lan Mouse
|
||||||
|
// version can introduce additional event types
|
||||||
|
// and old peers will simply ignore them rather
|
||||||
|
// than dropping the connection.
|
||||||
|
log::debug!("ignoring undecodable event from {addr}: {e}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ fn run() -> Result<(), LanMouseError> {
|
|||||||
#[cfg(feature = "gtk")]
|
#[cfg(feature = "gtk")]
|
||||||
{
|
{
|
||||||
let mut service = start_service()?;
|
let mut service = start_service()?;
|
||||||
let res = lan_mouse_gtk::run();
|
let res = lan_mouse_gtk::run(config::local_commit());
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
{
|
{
|
||||||
// on unix we give the service a chance to terminate gracefully
|
// on unix we give the service a chance to terminate gracefully
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ use crate::{
|
|||||||
listen::{LanMouseListener, ListenerCreationError},
|
listen::{LanMouseListener, ListenerCreationError},
|
||||||
};
|
};
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use hickory_resolver::ResolveError;
|
|
||||||
use lan_mouse_ipc::{
|
use lan_mouse_ipc::{
|
||||||
AsyncFrontendListener, ClientHandle, FrontendEvent, FrontendRequest, IpcError,
|
AsyncFrontendListener, ClientHandle, FrontendEvent, FrontendRequest, IpcError,
|
||||||
IpcListenerCreationError, Position, Status,
|
IpcListenerCreationError, Position, Status,
|
||||||
@@ -26,8 +25,6 @@ use tokio::{process::Command, signal, sync::Notify};
|
|||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum ServiceError {
|
pub enum ServiceError {
|
||||||
#[error(transparent)]
|
|
||||||
Dns(#[from] ResolveError),
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
IpcListen(#[from] IpcListenerCreationError),
|
IpcListen(#[from] IpcListenerCreationError),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
@@ -319,6 +316,17 @@ impl Service {
|
|||||||
EmulationEvent::Connected { addr, fingerprint } => {
|
EmulationEvent::Connected { addr, fingerprint } => {
|
||||||
self.notify_frontend(FrontendEvent::DeviceConnected { addr, fingerprint });
|
self.notify_frontend(FrontendEvent::DeviceConnected { addr, fingerprint });
|
||||||
}
|
}
|
||||||
|
EmulationEvent::PeerHello { addr, commit } => {
|
||||||
|
// Map the peer's source addr back to its client handle
|
||||||
|
// and stamp the commit. Skip if we don't have an
|
||||||
|
// outgoing client configured for this peer (incoming-
|
||||||
|
// only setup) — there's nowhere to display the version
|
||||||
|
// in that case anyway.
|
||||||
|
if let Some(handle) = self.client_manager.get_client(addr) {
|
||||||
|
self.client_manager.set_peer_commit(handle, Some(commit));
|
||||||
|
self.broadcast_client(handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user