mirror of
https://gitlab.com/futo-org/fcast.git
synced 2025-06-24 21:25:23 +00:00
Removal of encryption.,
This commit is contained in:
parent
9599c1931e
commit
a991b353a6
16 changed files with 24 additions and 980 deletions
378
clients/terminal/Cargo.lock
generated
378
clients/terminal/Cargo.lock
generated
|
@ -31,12 +31,6 @@ version = "1.3.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.10.4"
|
||||
|
@ -58,15 +52,6 @@ version = "1.5.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
|
@ -86,7 +71,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"bitflags 1.3.2",
|
||||
"bitflags",
|
||||
"clap_lex",
|
||||
"indexmap",
|
||||
"strsim",
|
||||
|
@ -103,22 +88,6 @@ dependencies = [
|
|||
"os_str_bytes",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.11"
|
||||
|
@ -145,7 +114,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "bbcf33c2a618cbe41ee43ae6e9f2e48368cd9f9db2896f10167d8d762679f639"
|
||||
dependencies = [
|
||||
"nix",
|
||||
"windows-sys 0.45.0",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -164,30 +133,12 @@ dependencies = [
|
|||
"crypto-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
|
||||
|
||||
[[package]]
|
||||
name = "fcast"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"ctrlc",
|
||||
"native-tls",
|
||||
"openssl",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tiny_http",
|
||||
|
@ -201,21 +152,6 @@ version = "1.0.7"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
|
||||
dependencies = [
|
||||
"foreign-types-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types-shared"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.2.1"
|
||||
|
@ -310,110 +246,30 @@ version = "1.0.6"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.150"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.4.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||
|
||||
[[package]]
|
||||
name = "native-tls"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"log",
|
||||
"openssl",
|
||||
"openssl-probe",
|
||||
"openssl-sys",
|
||||
"schannel",
|
||||
"security-framework",
|
||||
"security-framework-sys",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.26.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bitflags",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b8419dc8cc6d866deb801274bba2e6f8f6108c1bb7fcc10ee5ab864931dbb45"
|
||||
dependencies = [
|
||||
"bitflags 2.4.1",
|
||||
"cfg-if",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"openssl-macros",
|
||||
"openssl-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-macros"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-probe"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.97"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "os_str_bytes"
|
||||
version = "6.5.0"
|
||||
|
@ -426,12 +282,6 @@ version = "2.3.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.17"
|
||||
|
@ -486,66 +336,12 @@ dependencies = [
|
|||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316"
|
||||
dependencies = [
|
||||
"bitflags 2.4.1",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
|
||||
|
||||
[[package]]
|
||||
name = "schannel"
|
||||
version = "0.1.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534"
|
||||
dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework"
|
||||
version = "2.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"core-foundation",
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
"security-framework-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework-sys"
|
||||
version = "2.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.193"
|
||||
|
@ -611,19 +407,6 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fastrand",
|
||||
"redox_syscall",
|
||||
"rustix",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.2.0"
|
||||
|
@ -698,7 +481,6 @@ dependencies = [
|
|||
"http",
|
||||
"httparse",
|
||||
"log",
|
||||
"native-tls",
|
||||
"rand",
|
||||
"sha1",
|
||||
"thiserror",
|
||||
|
@ -750,12 +532,6 @@ version = "0.7.6"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
|
@ -805,25 +581,7 @@ version = "0.45.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
|
||||
dependencies = [
|
||||
"windows-targets 0.42.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.0",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -832,43 +590,13 @@ version = "0.42.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.42.2",
|
||||
"windows_aarch64_msvc 0.42.2",
|
||||
"windows_i686_gnu 0.42.2",
|
||||
"windows_i686_msvc 0.42.2",
|
||||
"windows_x86_64_gnu 0.42.2",
|
||||
"windows_x86_64_gnullvm 0.42.2",
|
||||
"windows_x86_64_msvc 0.42.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.48.5",
|
||||
"windows_aarch64_msvc 0.48.5",
|
||||
"windows_i686_gnu 0.48.5",
|
||||
"windows_i686_msvc 0.48.5",
|
||||
"windows_x86_64_gnu 0.48.5",
|
||||
"windows_x86_64_gnullvm 0.48.5",
|
||||
"windows_x86_64_msvc 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.52.0",
|
||||
"windows_aarch64_msvc 0.52.0",
|
||||
"windows_i686_gnu 0.52.0",
|
||||
"windows_i686_msvc 0.52.0",
|
||||
"windows_x86_64_gnu 0.52.0",
|
||||
"windows_x86_64_gnullvm 0.52.0",
|
||||
"windows_x86_64_msvc 0.52.0",
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -877,122 +605,38 @@ version = "0.42.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
|
||||
|
|
|
@ -10,8 +10,6 @@ clap = "3"
|
|||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
ctrlc = "3.1.9"
|
||||
tungstenite = { version = "0.21.0", features = ["native-tls"] }
|
||||
tungstenite = { version = "0.21.0" }
|
||||
url = "2.5.0"
|
||||
tiny_http = "0.12.0"
|
||||
openssl = "0.10.61"
|
||||
native-tls = "0.2.11"
|
||||
|
|
|
@ -3,9 +3,7 @@ mod fcastsession;
|
|||
mod transport;
|
||||
|
||||
use clap::{App, Arg, SubCommand};
|
||||
use native_tls::{TlsConnector, Protocol};
|
||||
use tiny_http::{Server, Response, ListenAddr, Header};
|
||||
use tungstenite::Connector;
|
||||
use tungstenite::stream::MaybeTlsStream;
|
||||
use url::Url;
|
||||
use std::net::IpAddr;
|
||||
|
@ -39,13 +37,6 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
|
|||
.required(false)
|
||||
.default_value("tcp")
|
||||
.takes_value(true))
|
||||
.arg(Arg::with_name("encrypted")
|
||||
.short('e')
|
||||
.long("encrypted")
|
||||
.value_name("Encrypted")
|
||||
.help("Use encryption")
|
||||
.required(false)
|
||||
.takes_value(false))
|
||||
.arg(Arg::with_name("host")
|
||||
.short('h')
|
||||
.long("host")
|
||||
|
@ -154,38 +145,24 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
let connection_type = matches.value_of("connection_type").unwrap_or("tcp");
|
||||
|
||||
let encrypted = matches.is_present("encrypted");
|
||||
let port = match matches.value_of("port") {
|
||||
Some(s) => s,
|
||||
_ => match (connection_type, encrypted) {
|
||||
("tcp", false) => "46899",
|
||||
("tcp", true) => "46897",
|
||||
("ws", false) => "46898",
|
||||
("ws", true) => "46896",
|
||||
_ => match connection_type {
|
||||
"tcp" => "46899",
|
||||
"ws" => "46898",
|
||||
_ => return Err("Unknown connection type, cannot automatically determine port.".into())
|
||||
}
|
||||
};
|
||||
|
||||
let local_ip: Option<IpAddr>;
|
||||
let mut session = match (connection_type, encrypted) {
|
||||
("tcp", false) => {
|
||||
let mut session = match connection_type {
|
||||
"tcp" => {
|
||||
println!("Connecting via TCP to host={} port={}...", host, port);
|
||||
let stream = TcpStream::connect(format!("{}:{}", host, port))?;
|
||||
local_ip = Some(stream.local_addr()?.ip());
|
||||
FCastSession::new(stream)
|
||||
},
|
||||
("tcp", true) => {
|
||||
println!("Connecting via TCP TLS to host={} port={}...", host, port);
|
||||
let mut builder = TlsConnector::builder();
|
||||
builder.min_protocol_version(Some(Protocol::Tlsv12));
|
||||
builder.danger_accept_invalid_certs(true);
|
||||
let connector = builder.build()?;
|
||||
let stream = TcpStream::connect(format!("{}:{}", host, port))?;
|
||||
let tls_stream = connector.connect(host, stream)?;
|
||||
local_ip = Some(tls_stream.get_ref().local_addr()?.ip());
|
||||
FCastSession::new(tls_stream)
|
||||
},
|
||||
("ws", false) => {
|
||||
"ws" => {
|
||||
println!("Connecting via WebSocket to host={} port={}...", host, port);
|
||||
let url = Url::parse(format!("ws://{}:{}", host, port).as_str())?;
|
||||
let (stream, _) = tungstenite::connect(url)?;
|
||||
|
@ -194,28 +171,8 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
|
|||
_ => return Err("Established connection type is not plain.".into())
|
||||
};
|
||||
FCastSession::new(stream)
|
||||
},
|
||||
("ws", true) => {
|
||||
println!("Connecting via WebSocket to host={} port={}...", host, port);
|
||||
let mut builder = TlsConnector::builder();
|
||||
builder.min_protocol_version(Some(Protocol::Tlsv12));
|
||||
builder.danger_accept_invalid_certs(true);
|
||||
let connector = builder.build()?;
|
||||
|
||||
let url = Url::parse(&format!("wss://{}:{}", host, port))?;
|
||||
let stream = TcpStream::connect(format!("{}:{}", host, port))?;
|
||||
let connector = Some(Connector::NativeTls(connector.into()));
|
||||
let (socket, _) = tungstenite::client_tls_with_config(url, stream, None, connector)?;
|
||||
|
||||
local_ip = match socket.get_ref() {
|
||||
MaybeTlsStream::NativeTls(ref stream) => Some(stream.get_ref().local_addr()?.ip()),
|
||||
_ => return Err("Expected TLS stream".into()),
|
||||
};
|
||||
|
||||
FCastSession::new(socket)
|
||||
|
||||
},
|
||||
_ => return Err("Invalid connection type or encryption flag.".into()),
|
||||
}
|
||||
_ => return Err("Invalid connection type.".into()),
|
||||
};
|
||||
|
||||
println!("Connection established.");
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use std::io::{Read, Write};
|
||||
use std::net::TcpStream;
|
||||
use native_tls::TlsStream;
|
||||
use tungstenite::Message;
|
||||
use tungstenite::protocol::WebSocket;
|
||||
|
||||
|
@ -55,18 +54,3 @@ impl<T: Read + Write> Transport for WebSocket<T> {
|
|||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl Transport for TlsStream<TcpStream> {
|
||||
fn transport_read(&mut self, buf: &mut [u8]) -> Result<usize, std::io::Error> {
|
||||
self.read(buf)
|
||||
}
|
||||
|
||||
fn transport_write(&mut self, buf: &[u8]) -> Result<(), std::io::Error> {
|
||||
self.write_all(buf)
|
||||
}
|
||||
|
||||
fn transport_shutdown(&mut self) -> Result<(), std::io::Error> {
|
||||
self.shutdown().map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))
|
||||
}
|
||||
}
|
|
@ -89,8 +89,6 @@ dependencies {
|
|||
implementation "com.squareup.okhttp3:okhttp:4.11.0"
|
||||
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
||||
implementation 'org.java-websocket:Java-WebSocket:1.5.4'
|
||||
implementation 'org.bouncycastle:bcpkix-jdk18on:1.77'
|
||||
implementation 'org.bouncycastle:bcprov-jdk18on:1.77'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.futo.fcast.receiver
|
||||
|
||||
import SslKeyManager
|
||||
import WebSocketListenerService
|
||||
import android.app.*
|
||||
import android.content.Context
|
||||
|
@ -12,14 +11,11 @@ import android.util.Log
|
|||
import android.widget.Toast
|
||||
import androidx.core.app.NotificationCompat
|
||||
import kotlinx.coroutines.*
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider
|
||||
import java.security.Security
|
||||
|
||||
class NetworkService : Service() {
|
||||
private var _discoveryService: DiscoveryService? = null
|
||||
private var _stopped = false
|
||||
private var _tcpListenerService: TcpListenerService? = null
|
||||
private var _tlsListenerService: TlsListenerService? = null
|
||||
private var _webSocketListenerService: WebSocketListenerService? = null
|
||||
private var _scope: CoroutineScope? = null
|
||||
|
||||
|
@ -110,11 +106,6 @@ class NetworkService : Service() {
|
|||
start()
|
||||
}
|
||||
|
||||
val sslKeyManager = SslKeyManager("fcast_receiver")
|
||||
_tlsListenerService = TlsListenerService(this) { onNewSession(it) }.apply {
|
||||
start(sslKeyManager)
|
||||
}
|
||||
|
||||
Log.i(TAG, "Started NetworkService")
|
||||
Toast.makeText(this, "Started FCast service", Toast.LENGTH_LONG).show()
|
||||
|
||||
|
@ -144,9 +135,6 @@ class NetworkService : Service() {
|
|||
_tcpListenerService?.stop()
|
||||
_tcpListenerService = null
|
||||
|
||||
_tlsListenerService?.stop()
|
||||
_tlsListenerService = null
|
||||
|
||||
try {
|
||||
_webSocketListenerService?.stop()
|
||||
} catch (e: Throwable) {
|
||||
|
@ -197,7 +185,6 @@ class NetworkService : Service() {
|
|||
|
||||
_tcpListenerService?.forEachSession(sender)
|
||||
_webSocketListenerService?.forEachSession(sender)
|
||||
_tlsListenerService?.forEachSession(sender)
|
||||
}
|
||||
|
||||
fun sendPlaybackError(error: String) {
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
import android.security.keystore.KeyGenParameterSpec
|
||||
import android.security.keystore.KeyProperties
|
||||
import org.bouncycastle.asn1.x500.X500Name
|
||||
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo
|
||||
import org.bouncycastle.cert.X509v3CertificateBuilder
|
||||
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider
|
||||
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder
|
||||
import java.io.FileInputStream
|
||||
import java.math.BigInteger
|
||||
import java.security.KeyPairGenerator
|
||||
import java.security.KeyStore
|
||||
import java.security.PrivateKey
|
||||
import java.security.PublicKey
|
||||
import java.util.Calendar
|
||||
import javax.net.ssl.KeyManagerFactory
|
||||
import javax.net.ssl.SSLContext
|
||||
import javax.net.ssl.SSLServerSocketFactory
|
||||
import java.security.cert.X509Certificate
|
||||
import javax.net.ssl.TrustManagerFactory
|
||||
|
||||
class SslKeyManager(private val alias: String) {
|
||||
|
||||
fun getSslServerSocketFactory(): SSLServerSocketFactory {
|
||||
val keyStore = KeyStore.getInstance("AndroidKeyStore").apply { load(null) }
|
||||
//if (!keyStore.containsAlias(alias)) {
|
||||
generateKeyPairAndCertificate(keyStore)
|
||||
//}
|
||||
|
||||
val trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()).apply {
|
||||
init(keyStore)
|
||||
}
|
||||
|
||||
val keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()).apply {
|
||||
init(keyStore, null)
|
||||
}
|
||||
|
||||
val sslContext = SSLContext.getInstance("TLS").apply {
|
||||
init(keyManagerFactory.keyManagers, trustManagerFactory.trustManagers, null)
|
||||
}
|
||||
|
||||
return sslContext.serverSocketFactory
|
||||
}
|
||||
|
||||
private fun generateKeyPairAndCertificate(keyStore: KeyStore) {
|
||||
val keyPairGenerator = KeyPairGenerator.getInstance("RSA", "AndroidKeyStore")
|
||||
val parameterSpec = KeyGenParameterSpec
|
||||
.Builder(alias, KeyProperties.PURPOSE_ENCRYPT or KeyProperties.PURPOSE_DECRYPT or KeyProperties.PURPOSE_SIGN or KeyProperties.PURPOSE_VERIFY)
|
||||
//.setBlockModes(KeyProperties.BLOCK_MODE_ECB)
|
||||
.setDigests(KeyProperties.DIGEST_SHA256, KeyProperties.DIGEST_SHA512)
|
||||
.setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_RSA_PKCS1)
|
||||
.setSignaturePaddings(KeyProperties.SIGNATURE_PADDING_RSA_PKCS1)
|
||||
.build()
|
||||
|
||||
keyPairGenerator.initialize(parameterSpec)
|
||||
|
||||
val keyPair = keyPairGenerator.generateKeyPair()
|
||||
val privateKey = keyPair.private
|
||||
val publicKey = keyPair.public
|
||||
val cert = generateSelfSignedCertificate(privateKey, publicKey)
|
||||
keyStore.setKeyEntry(alias, privateKey, null, arrayOf(cert))
|
||||
}
|
||||
|
||||
private fun generateSelfSignedCertificate(privateKey: PrivateKey, publicKey: PublicKey): X509Certificate {
|
||||
val start = Calendar.getInstance().time
|
||||
val end = Calendar.getInstance().apply { add(Calendar.YEAR, 1000) }.time
|
||||
|
||||
val certInfo = X509v3CertificateBuilder(
|
||||
X500Name("CN=FCastReceiver"),
|
||||
BigInteger.ONE,
|
||||
start,
|
||||
end,
|
||||
X500Name("CN=FCastReceiver"),
|
||||
SubjectPublicKeyInfo.getInstance(publicKey.encoded)
|
||||
)
|
||||
|
||||
val signer = JcaContentSignerBuilder("SHA256withRSA").build(privateKey)
|
||||
return JcaX509CertificateConverter().getCertificate(certInfo.build(signer))
|
||||
}
|
||||
}
|
|
@ -1,134 +0,0 @@
|
|||
package com.futo.fcast.receiver
|
||||
|
||||
import SslKeyManager
|
||||
import android.util.Log
|
||||
import java.io.BufferedInputStream
|
||||
import java.net.Socket
|
||||
import java.security.KeyStore
|
||||
import java.security.cert.Certificate
|
||||
import javax.net.ssl.KeyManagerFactory
|
||||
import javax.net.ssl.SSLContext
|
||||
import javax.net.ssl.SSLServerSocket
|
||||
import javax.net.ssl.TrustManagerFactory
|
||||
|
||||
class TlsListenerService(private val _networkService: NetworkService, private val _onNewSession: (session: FCastSession) -> Unit) {
|
||||
private var _serverSocket: SSLServerSocket? = null
|
||||
private var _stopped: Boolean = false
|
||||
private var _listenThread: Thread? = null
|
||||
private var _clientThreads: ArrayList<Thread> = arrayListOf()
|
||||
private var _sessions: ArrayList<FCastSession> = arrayListOf()
|
||||
|
||||
fun start(sslKeyManager: SslKeyManager) {
|
||||
Log.i(TAG, "Starting TlsListenerService")
|
||||
|
||||
val serverSocketFactory = sslKeyManager.getSslServerSocketFactory()
|
||||
_serverSocket = (serverSocketFactory.createServerSocket(PORT) as SSLServerSocket)
|
||||
|
||||
_listenThread = Thread {
|
||||
Log.i(TAG, "Starting TLS listener")
|
||||
|
||||
try {
|
||||
listenForIncomingConnections()
|
||||
} catch (e: Throwable) {
|
||||
Log.e(TAG, "Stopped TLS listening for connections due to an unexpected error", e)
|
||||
}
|
||||
}
|
||||
|
||||
_listenThread?.start()
|
||||
|
||||
Log.i(TAG, "Started TlsListenerService")
|
||||
}
|
||||
|
||||
fun stop() {
|
||||
Log.i(TAG, "Stopping TlsListenerService")
|
||||
|
||||
_stopped = true
|
||||
|
||||
_serverSocket?.close()
|
||||
_serverSocket = null
|
||||
|
||||
_listenThread?.join()
|
||||
_listenThread = null
|
||||
|
||||
synchronized(_clientThreads) {
|
||||
_clientThreads.clear()
|
||||
}
|
||||
|
||||
Log.i(TAG, "Stopped TlsListenerService")
|
||||
}
|
||||
|
||||
fun forEachSession(handler: (FCastSession) -> Unit) {
|
||||
synchronized(_sessions) {
|
||||
for (session in _sessions) {
|
||||
handler(session)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun listenForIncomingConnections() {
|
||||
Log.i(TAG, "Started TLS listening for incoming connections")
|
||||
|
||||
while (!_stopped) {
|
||||
val clientSocket = _serverSocket?.accept() ?: break
|
||||
|
||||
val clientThread = Thread {
|
||||
try {
|
||||
handleClientConnection(clientSocket)
|
||||
} catch (e: Throwable) {
|
||||
Log.e(TAG, "Failed handle TLS client connection due to an error", e)
|
||||
}
|
||||
}
|
||||
|
||||
synchronized(_clientThreads) {
|
||||
_clientThreads.add(clientThread)
|
||||
}
|
||||
|
||||
clientThread.start()
|
||||
}
|
||||
|
||||
Log.i(TAG, "Stopped TLS listening for incoming connections")
|
||||
}
|
||||
|
||||
private fun handleClientConnection(socket: Socket) {
|
||||
Log.i(TAG, "New TLS connection received from ${socket.remoteSocketAddress}")
|
||||
|
||||
val session = FCastSession(socket.getOutputStream(), socket.remoteSocketAddress, _networkService)
|
||||
synchronized(_sessions) {
|
||||
_sessions.add(session)
|
||||
}
|
||||
_onNewSession(session)
|
||||
|
||||
Log.i(TAG, "Waiting for data from ${socket.remoteSocketAddress}")
|
||||
|
||||
val bufferSize = 4096
|
||||
val buffer = ByteArray(bufferSize)
|
||||
val inputStream = BufferedInputStream(socket.getInputStream())
|
||||
|
||||
var bytesRead: Int
|
||||
while (!_stopped) {
|
||||
bytesRead = inputStream.read(buffer, 0, bufferSize)
|
||||
if (bytesRead == -1) {
|
||||
break
|
||||
}
|
||||
|
||||
session.processBytes(buffer, bytesRead)
|
||||
}
|
||||
|
||||
socket.close()
|
||||
|
||||
synchronized(_sessions) {
|
||||
_sessions.remove(session)
|
||||
}
|
||||
|
||||
synchronized(_clientThreads) {
|
||||
_clientThreads.remove(Thread.currentThread())
|
||||
}
|
||||
|
||||
Log.i(TAG, "Disconnected ${socket.remoteSocketAddress}")
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "TlsListenerService"
|
||||
const val PORT = 46897
|
||||
}
|
||||
}
|
15
receivers/electron/package-lock.json
generated
15
receivers/electron/package-lock.json
generated
|
@ -11,9 +11,7 @@
|
|||
"dependencies": {
|
||||
"bufferutil": "^4.0.8",
|
||||
"https": "^1.0.0",
|
||||
"node-forge": "^1.3.1",
|
||||
"qrcode": "^1.5.3",
|
||||
"tls": "^0.0.1",
|
||||
"ws": "^8.14.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -4309,14 +4307,6 @@
|
|||
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/node-forge": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
||||
"integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==",
|
||||
"engines": {
|
||||
"node": ">= 6.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-gyp-build": {
|
||||
"version": "4.7.1",
|
||||
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.7.1.tgz",
|
||||
|
@ -5158,11 +5148,6 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/tls": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/tls/-/tls-0.0.1.tgz",
|
||||
"integrity": "sha512-GzHpG+hwupY8VMR6rYsnAhTHqT/97zT45PG8WD5eTT1lq+dFE0nN+1PYpsoBcHJgSmTz5ceK2Cv88IkPmIPOtQ=="
|
||||
},
|
||||
"node_modules/tmpl": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
|
||||
|
|
|
@ -28,9 +28,7 @@
|
|||
"dependencies": {
|
||||
"bufferutil": "^4.0.8",
|
||||
"https": "^1.0.0",
|
||||
"node-forge": "^1.3.1",
|
||||
"qrcode": "^1.5.3",
|
||||
"tls": "^0.0.1",
|
||||
"ws": "^8.14.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,7 @@ const os = require('os');
|
|||
|
||||
export class DiscoveryService {
|
||||
private serviceTcp: any;
|
||||
private serviceTls: any;
|
||||
private serviceWs: any;
|
||||
private serviceWss: any;
|
||||
|
||||
private static getComputerName() {
|
||||
switch (process.platform) {
|
||||
|
@ -23,7 +21,7 @@ export class DiscoveryService {
|
|||
}
|
||||
|
||||
start() {
|
||||
if (this.serviceTcp || this.serviceTls || this.serviceWs || this.serviceWss) {
|
||||
if (this.serviceTcp || this.serviceWs) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -32,12 +30,8 @@ export class DiscoveryService {
|
|||
|
||||
this.serviceTcp = mdns.createAdvertisement(mdns.tcp('_fcast'), 46899, { name: name });
|
||||
this.serviceTcp.start();
|
||||
this.serviceTls = mdns.createAdvertisement(mdns.tcp('_fcast-tls'), 46897, { name: name });
|
||||
this.serviceTls.start();
|
||||
this.serviceWs = mdns.createAdvertisement(mdns.tcp('_fcast-ws'), 46898, { name: name });
|
||||
this.serviceWs.start();
|
||||
this.serviceWss = mdns.createAdvertisement(mdns.tcp('_fcast-wss'), 46896, { name: name });
|
||||
this.serviceWss.start();
|
||||
}
|
||||
|
||||
stop() {
|
||||
|
@ -46,19 +40,9 @@ export class DiscoveryService {
|
|||
this.serviceTcp = null;
|
||||
}
|
||||
|
||||
if (this.serviceTls) {
|
||||
this.serviceTls.stop();
|
||||
this.serviceTls = null;
|
||||
}
|
||||
|
||||
if (this.serviceWs) {
|
||||
this.serviceWs.stop();
|
||||
this.serviceWs = null;
|
||||
}
|
||||
|
||||
if (this.serviceWss) {
|
||||
this.serviceWss.stop();
|
||||
this.serviceWss = null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,10 +7,6 @@ import { Updater } from './Updater';
|
|||
import { WebSocketListenerService } from './WebSocketListenerService';
|
||||
import * as os from 'os';
|
||||
import { Opcode } from './FCastSession';
|
||||
import fs = require('fs');
|
||||
import forge = require('node-forge');
|
||||
import { TlsListenerService } from './TlsTcpListenerService';
|
||||
import { WebSocketSecureListenerService } from './WebSocketSecureListenerService';
|
||||
|
||||
export default class Main {
|
||||
static shouldOpenMainWindow = true;
|
||||
|
@ -19,8 +15,6 @@ export default class Main {
|
|||
static application: Electron.App;
|
||||
static tcpListenerService: TcpListenerService;
|
||||
static webSocketListenerService: WebSocketListenerService;
|
||||
static tlsListenerService: TlsListenerService;
|
||||
static webSocketSecureListenerService: WebSocketSecureListenerService;
|
||||
static discoveryService: DiscoveryService;
|
||||
static tray: Tray;
|
||||
static key: string = null;
|
||||
|
@ -108,10 +102,8 @@ export default class Main {
|
|||
|
||||
Main.tcpListenerService = new TcpListenerService();
|
||||
Main.webSocketListenerService = new WebSocketListenerService();
|
||||
Main.tlsListenerService = new TlsListenerService(Main.key, Main.cert);
|
||||
Main.webSocketSecureListenerService = new WebSocketSecureListenerService(Main.key, Main.cert);
|
||||
|
||||
const listeners = [Main.tcpListenerService, Main.webSocketListenerService, Main.tlsListenerService, Main.webSocketSecureListenerService];
|
||||
const listeners = [Main.tcpListenerService, Main.webSocketListenerService];
|
||||
listeners.forEach(l => {
|
||||
l.emitter.on("play", (message) => {
|
||||
if (Main.playerWindow == null) {
|
||||
|
@ -234,50 +226,6 @@ export default class Main {
|
|||
}
|
||||
|
||||
static main(app: Electron.App) {
|
||||
if (!fs.existsSync('./cert.pem') || !fs.existsSync('./key.pem')) {
|
||||
try {
|
||||
const keys = forge.pki.rsa.generateKeyPair(2048);
|
||||
|
||||
const cert = forge.pki.createCertificate();
|
||||
cert.publicKey = keys.publicKey;
|
||||
cert.validity.notBefore = new Date();
|
||||
cert.validity.notAfter = new Date(9999, 11, 31);
|
||||
cert.sign(keys.privateKey);
|
||||
|
||||
const pemCert = forge.pki.certificateToPem(cert);
|
||||
const pemKey = forge.pki.privateKeyToPem(keys.privateKey);
|
||||
fs.writeFileSync('./cert.pem', pemCert);
|
||||
fs.writeFileSync('./key.pem', pemKey);
|
||||
} catch {
|
||||
console.error("Failed to generate key pair.");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Main.key = fs.readFileSync('./key.pem', 'utf8');
|
||||
Main.cert = fs.readFileSync('./cert.pem', 'utf8');
|
||||
} catch (e) {
|
||||
console.error("Failed to load key pair.", e);
|
||||
|
||||
dialog.showMessageBox({
|
||||
type: 'error',
|
||||
title: 'Failed to initialize crypto',
|
||||
message: `The application failed to start properly '${JSON.stringify(e)}'.`,
|
||||
buttons: ['Restart', 'Close'],
|
||||
defaultId: 0,
|
||||
cancelId: 1
|
||||
}).then((p) => {
|
||||
if (p.response === 0) {
|
||||
app.relaunch();
|
||||
app.exit(0);
|
||||
} else {
|
||||
app.exit(0);
|
||||
}
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Main.application = app;
|
||||
const argv = process.argv;
|
||||
if (argv.includes('--no-main-window')) {
|
||||
|
|
|
@ -1,105 +0,0 @@
|
|||
import tls = require('tls');
|
||||
import { FCastSession, Opcode } from './FCastSession';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import { dialog } from 'electron';
|
||||
import Main from './Main';
|
||||
|
||||
export class TlsListenerService {
|
||||
public static PORT = 46897;
|
||||
|
||||
emitter = new EventEmitter();
|
||||
|
||||
private server: tls.Server;
|
||||
private sessions: FCastSession[] = [];
|
||||
|
||||
constructor(private key: string, private cert: string) {}
|
||||
|
||||
start() {
|
||||
if (this.server != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const options: tls.TlsOptions = {key: this.key, cert: this.cert};
|
||||
this.server = tls.createServer(options).listen(TlsListenerService.PORT)
|
||||
.on("secureConnection", this.handleConnection.bind(this))
|
||||
.on("error", this.handleServerError.bind(this));
|
||||
}
|
||||
|
||||
stop() {
|
||||
if (this.server == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const server = this.server;
|
||||
this.server = null;
|
||||
|
||||
server.close();
|
||||
}
|
||||
|
||||
send(opcode: number, message = null) {
|
||||
this.sessions.forEach(session => {
|
||||
try {
|
||||
session.send(opcode, message);
|
||||
} catch (e) {
|
||||
console.warn("Failed to send error.", e);
|
||||
session.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private async handleServerError(err: NodeJS.ErrnoException) {
|
||||
console.error("Server error:", err);
|
||||
|
||||
const restartPrompt = await dialog.showMessageBox({
|
||||
type: 'error',
|
||||
title: 'Failed to start',
|
||||
message: 'The application failed to start properly.',
|
||||
buttons: ['Restart', 'Close'],
|
||||
defaultId: 0,
|
||||
cancelId: 1
|
||||
});
|
||||
|
||||
if (restartPrompt.response === 0) {
|
||||
Main.application.relaunch();
|
||||
Main.application.exit(0);
|
||||
} else {
|
||||
Main.application.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
private handleConnection(socket: tls.TLSSocket) {
|
||||
console.log(`new secure connection from ${socket.remoteAddress}:${socket.remotePort}`);
|
||||
|
||||
const session = new FCastSession(socket, (data) => socket.write(data));
|
||||
session.bindEvents(this.emitter);
|
||||
this.sessions.push(session);
|
||||
|
||||
socket.on("error", (err) => {
|
||||
console.warn(`Error from ${socket.remoteAddress}:${socket.remotePort}.`, err);
|
||||
socket.destroy();
|
||||
});
|
||||
|
||||
socket.on("data", buffer => {
|
||||
try {
|
||||
session.processBytes(buffer);
|
||||
} catch (e) {
|
||||
console.warn(`Error while handling packet from ${socket.remoteAddress}:${socket.remotePort}.`, e);
|
||||
socket.end();
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("close", () => {
|
||||
const index = this.sessions.indexOf(session);
|
||||
if (index != -1) {
|
||||
this.sessions.splice(index, 1);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
console.log('Sending version');
|
||||
session.send(Opcode.Version, {version: 2});
|
||||
} catch (e) {
|
||||
console.log('Failed to send version');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,118 +0,0 @@
|
|||
import { FCastSession, Opcode } from './FCastSession';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import { dialog } from 'electron';
|
||||
import Main from './Main';
|
||||
import { WebSocket, WebSocketServer } from 'ws';
|
||||
import * as https from 'https';
|
||||
|
||||
export class WebSocketSecureListenerService {
|
||||
public static PORT = 46896;
|
||||
|
||||
emitter = new EventEmitter();
|
||||
|
||||
private server: WebSocketServer;
|
||||
private sessions: FCastSession[] = [];
|
||||
private httpsServer: https.Server;
|
||||
|
||||
constructor(private key: string, private cert: string) {}
|
||||
|
||||
start() {
|
||||
if (this.server != null || this.httpsServer != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.httpsServer = https.createServer({key: this.key, cert: this.cert});
|
||||
this.httpsServer.listen(WebSocketSecureListenerService.PORT);
|
||||
|
||||
this.server = new WebSocketServer({server: this.httpsServer})
|
||||
.on("connection", this.handleConnection.bind(this))
|
||||
.on("error", this.handleServerError.bind(this));
|
||||
}
|
||||
|
||||
stop() {
|
||||
if (this.server != null) {
|
||||
const server = this.server;
|
||||
this.server = null;
|
||||
server.close();
|
||||
}
|
||||
|
||||
if (this.httpsServer != null) {
|
||||
const httpsServer = this.httpsServer;
|
||||
this.httpsServer = null;
|
||||
httpsServer.close();
|
||||
}
|
||||
}
|
||||
|
||||
send(opcode: number, message = null) {
|
||||
this.sessions.forEach(session => {
|
||||
try {
|
||||
session.send(opcode, message);
|
||||
} catch (e) {
|
||||
console.warn("Failed to send error.", e);
|
||||
session.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private async handleServerError(err: NodeJS.ErrnoException) {
|
||||
console.error("Server error:", err);
|
||||
|
||||
const restartPrompt = await dialog.showMessageBox({
|
||||
type: 'error',
|
||||
title: 'Failed to start',
|
||||
message: 'The application failed to start properly.',
|
||||
buttons: ['Restart', 'Close'],
|
||||
defaultId: 0,
|
||||
cancelId: 1
|
||||
});
|
||||
|
||||
if (restartPrompt.response === 0) {
|
||||
Main.application.relaunch();
|
||||
Main.application.exit(0);
|
||||
} else {
|
||||
Main.application.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
private handleConnection(socket: WebSocket) {
|
||||
console.log('New WebSocketSecure connection');
|
||||
|
||||
const session = new FCastSession(socket, (data) => socket.send(data));
|
||||
session.bindEvents(this.emitter);
|
||||
this.sessions.push(session);
|
||||
|
||||
socket.on("error", (err) => {
|
||||
console.warn(`Error.`, err);
|
||||
session.close();
|
||||
});
|
||||
|
||||
socket.on('message', data => {
|
||||
try {
|
||||
if (data instanceof Buffer) {
|
||||
session.processBytes(data);
|
||||
} else {
|
||||
console.warn("Received unhandled string message", data);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(`Error while handling packet.`, e);
|
||||
session.close();
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("close", () => {
|
||||
console.log('WebSocketSecure connection closed');
|
||||
|
||||
const index = this.sessions.indexOf(session);
|
||||
if (index != -1) {
|
||||
this.sessions.splice(index, 1);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
console.log('Sending version');
|
||||
session.send(Opcode.Version, {version: 2});
|
||||
} catch (e) {
|
||||
console.log('Failed to send version');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,7 +22,7 @@
|
|||
<div id="manual-connection-info">Manual connection information</div>
|
||||
<div>
|
||||
<div id="ips">IPs</div><br />
|
||||
<div>Port<br>46899 (TCP), 46898 (WS), 46897 (TLS), 46896 (WSS)</div>
|
||||
<div>Port<br>46899 (TCP), 46898 (WS)</div>
|
||||
</div>
|
||||
<div id="automatic-discovery">Automatic discovery is available via mDNS</div>
|
||||
<div id="qr-code"></div>
|
||||
|
|
|
@ -24,8 +24,6 @@ window.electronAPI.onDeviceInfo((_event, value) => {
|
|||
services: [
|
||||
{ port: 46899, type: 0 }, //TCP
|
||||
{ port: 46898, type: 1 }, //WS
|
||||
{ port: 46897, type: 2 }, //TCP-TLS
|
||||
{ port: 46896, type: 3 } //WSS
|
||||
]
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue