From 439f42f7cd4c1069db364a56bfdb0e32ececff04 Mon Sep 17 00:00:00 2001 From: timzaak Date: Mon, 16 Oct 2023 00:11:43 +0800 Subject: [PATCH 01/14] add web rtc relay --- relay/.gitignore | 8 + relay/Cargo.lock | 2766 ++++++++++++++++++++++++++++++++++ relay/Cargo.toml | 12 + relay/README.md | 14 + relay/src/main.rs | 5 + relay/tun_server_config.toml | 85 ++ 6 files changed, 2890 insertions(+) create mode 100644 relay/.gitignore create mode 100644 relay/Cargo.lock create mode 100644 relay/Cargo.toml create mode 100644 relay/README.md create mode 100644 relay/src/main.rs create mode 100644 relay/tun_server_config.toml diff --git a/relay/.gitignore b/relay/.gitignore new file mode 100644 index 0000000..d06748c --- /dev/null +++ b/relay/.gitignore @@ -0,0 +1,8 @@ +/target +.idea +*dist* +*node_modules* +/workflow +build/ +.DS_Store +turn_server.dev.toml \ No newline at end of file diff --git a/relay/Cargo.lock b/relay/Cargo.lock new file mode 100644 index 0000000..a8490fd --- /dev/null +++ b/relay/Cargo.lock @@ -0,0 +1,2766 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + +[[package]] +name = "aes" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "aes-gcm" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + +[[package]] +name = "anstream" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" + +[[package]] +name = "anstyle-parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", +] + +[[package]] +name = "anyhow" +version = "1.0.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" + +[[package]] +name = "asn1-rs" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6fd5ddaf0351dff5b8da21b2fb4ff8e08ddd02857f0bf69c47639106c0fff0" +dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror", + "time", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "synstructure", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "async-trait" +version = "0.1.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "axum" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" +dependencies = [ + "async-trait", + "axum-core", + "bitflags 1.3.2", + "bytes", + "futures-util", + "http", + "http-body", + "hyper", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "mime", + "rustversion", + "tower-layer", + "tower-service", +] + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-padding" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" + +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher", +] + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + +[[package]] +name = "ccm" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae3c82e4355234767756212c570e29833699ab63e6ffd161887314cc5b43847" +dependencies = [ + "aead", + "cipher", + "ctr", + "subtle", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clap" +version = "4.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "clap_lex" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + +[[package]] +name = "colored" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" +dependencies = [ + "is-terminal", + "lazy_static", + "windows-sys 0.48.0", +] + +[[package]] +name = "const-oid" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + +[[package]] +name = "cpufeatures" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" + +[[package]] +name = "crypto-bigint" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "rand_core", + "typenum", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "fiat-crypto", + "platforms", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "data-encoding" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" + +[[package]] +name = "der" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "der-parser" +version = "8.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbd676fbbab537128ef0278adb5576cf363cff6aa22a7b24effe97347cfab61e" +dependencies = [ + "asn1-rs", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", +] + +[[package]] +name = "deranged" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "displaydoc" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "ecdsa" +version = "0.16.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "elliptic-curve" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d97ca172ae9dc9f9b779a6e3a65d308f2af74e5b8c921299075bdb4a0370e914" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pem-rfc7468", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "faster-stun" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "081c8654f23c96b078da09c24d741e92ee0ca0ec745e39c15d611835f369e9ac" +dependencies = [ + "anyhow", + "bytes", + "crc", + "hmac", + "md-5", + "num_enum", + "sha-1", +] + +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0870c84016d4b481be5c9f323c24f65e31e901ae618f0e80f4308fb00de1d2d" + +[[package]] +name = "fnv" +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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "ghash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" +dependencies = [ + "opaque-debug", + "polyval", +] + +[[package]] +name = "gimli" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "h2" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 1.9.3", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + +[[package]] +name = "hkdf" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "http-range-header" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.4.9", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +dependencies = [ + "equivalent", + "hashbrown 0.14.1", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "block-padding", + "generic-array", +] + +[[package]] +name = "ipnet" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" + +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "js-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +dependencies = [ + "wasm-bindgen", +] + +[[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.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" + +[[package]] +name = "libmimalloc-sys" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3979b5c37ece694f1f5e51e7ecc871fdb0f517ed04ee45f88d15d6d553cb9664" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" + +[[package]] +name = "lock_api" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mimalloc" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa01922b5ea280a911e323e4d2fd24b7fe5cc4042e0d2cda3c40775cdc4bdc9c" +dependencies = [ + "libmimalloc-sys", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + +[[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.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset", + "pin-utils", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "num_threads" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" +dependencies = [ + "libc", +] + +[[package]] +name = "object" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +dependencies = [ + "memchr", +] + +[[package]] +name = "oid-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" +dependencies = [ + "asn1-rs", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "openssl" +version = "0.10.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +dependencies = [ + "bitflags 2.4.0", + "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 2.0.38", +] + +[[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.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "p384" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "pem" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3163d2912b7c3b52d651a055f2c7eec9ba5cd22d26ef75b8dd3a59980b185923" +dependencies = [ + "base64", + "serde", +] + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + +[[package]] +name = "pin-project" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + +[[package]] +name = "platforms" +version = "3.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4503fa043bf02cee09a9582e9554b4c6403b2ef55e4612e96561d294419429f8" + +[[package]] +name = "polyval" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "primeorder" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c2fcef82c0ec6eefcc179b978446c399b3cdf73c392c35604e399eee6df1ee3" +dependencies = [ + "elliptic-curve", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rcgen" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52c4f3084aa3bc7dfbba4eff4fab2a54db4324965d8872ab933565e6fbd83bc6" +dependencies = [ + "pem", + "ring", + "time", + "yasna", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "relay" +version = "0.0.1" +dependencies = [ + "tokio", + "turn-server", + "webrtc-dtls", +] + +[[package]] +name = "reqwest" +version = "0.11.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "system-configuration", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom", +] + +[[package]] +name = "rustix" +version = "0.38.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed" +dependencies = [ + "bitflags 2.4.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustls" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +dependencies = [ + "log", + "ring", + "rustls-webpki", + "sct", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "schannel" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[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 = "semver" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" + +[[package]] +name = "serde" +version = "1.0.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "serde_json" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4beec8bce849d58d06238cb50db2e1c417cfeafa4c63f692b15c82b7c80f8335" +dependencies = [ + "itoa", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha-1" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + +[[package]] +name = "signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "simple_logger" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2230cd5c29b815c9b699fb610b49a5ed65588f3509d9f0108be3a885da629333" +dependencies = [ + "colored", + "log", + "time", + "windows-sys 0.42.0", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" + +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "socket2" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spki" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "unicode-xid", +] + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "thiserror" +version = "1.0.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "time" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +dependencies = [ + "deranged", + "itoa", + "libc", + "num_threads", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +dependencies = [ + "time-core", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2 0.5.4", + "tokio-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-macros" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "toml" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.0.2", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" +dependencies = [ + "bitflags 2.4.0", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-range-header", + "pin-project-lite", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2ef2af84856a50c1d430afce2fdded0a4ec7eda868db86409b4543df0797f9" +dependencies = [ + "log", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "turn-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f36e250fcc8d235f09ec5826ab11426b2ea6f338d2e76f92e07460ecf5f2dc5" +dependencies = [ + "anyhow", + "async-trait", + "bytes", + "faster-stun", + "parking_lot", + "rand", +] + +[[package]] +name = "turn-server" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d093252b4f28686a5cefbed9c64d80122eda6d0fa15c59b90457c25cb3e9b3cb" +dependencies = [ + "anyhow", + "async-trait", + "axum", + "bitvec", + "bytes", + "clap", + "faster-stun", + "http", + "log", + "mimalloc", + "num_cpus", + "reqwest", + "serde", + "serde_json", + "simple_logger", + "tokio", + "toml", + "tower", + "tower-http", + "turn-rs", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.38", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" + +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webrtc-dtls" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b140b953f986e97828aa33ec6318186b05d862bee689efbc57af04a243e832" +dependencies = [ + "aes", + "aes-gcm", + "async-trait", + "bincode", + "byteorder", + "cbc", + "ccm", + "der-parser", + "hkdf", + "hmac", + "log", + "p256", + "p384", + "rand", + "rand_core", + "rcgen", + "ring", + "rustls", + "sec1", + "serde", + "sha1", + "sha2", + "subtle", + "thiserror", + "tokio", + "webrtc-util", + "x25519-dalek", + "x509-parser", +] + +[[package]] +name = "webrtc-util" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1adc96bee68417e1f4d19dd7698124a7f859db55ae2fd3eedbbb7e732f614735" +dependencies = [ + "async-trait", + "bitflags 1.3.2", + "bytes", + "cc", + "ipnet", + "lazy_static", + "libc", + "log", + "nix", + "rand", + "thiserror", + "tokio", + "winapi", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +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-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[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_aarch64_gnullvm" +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_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_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_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_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_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_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 = "winnow" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "x25519-dalek" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb66477291e7e8d2b0ff1bcb900bf29489a9692816d79874bea351e7a8b6de96" +dependencies = [ + "curve25519-dalek", + "rand_core", + "serde", + "zeroize", +] + +[[package]] +name = "x509-parser" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7069fba5b66b9193bd2c5d3d4ff12b839118f6bcbef5328efafafb5395cf63da" +dependencies = [ + "asn1-rs", + "data-encoding", + "der-parser", + "lazy_static", + "nom", + "oid-registry", + "rusticata-macros", + "thiserror", + "time", +] + +[[package]] +name = "yasna" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" +dependencies = [ + "time", +] + +[[package]] +name = "zeroize" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] diff --git a/relay/Cargo.toml b/relay/Cargo.toml new file mode 100644 index 0000000..df0545d --- /dev/null +++ b/relay/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "relay" +version = "0.0.1" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +tokio = { version = "1.32", features = ["macros", "rt-multi-thread", "net", "rt"] } +clap = "4.4" +[dev-dependencies] +webrtc-dtls = "0.8.0" diff --git a/relay/README.md b/relay/README.md new file mode 100644 index 0000000..39612c7 --- /dev/null +++ b/relay/README.md @@ -0,0 +1,14 @@ +test turn-rs and webrtc + + + +turn-server commit: 5ee052e8168ddad7a1c92c83c2cdc49c7a266885 +```shell + +#docker run -v $(pwd)/tun_server_config.toml:/etc/turn_server/config.toml quasipaa/turn-server + +## idea config +run --package turn-server --bin turn-server -- --config=$turn_server_config.toml + +``` +WebRTC 内容: https://github.com/timzaak/blog/issues/94 \ No newline at end of file diff --git a/relay/src/main.rs b/relay/src/main.rs new file mode 100644 index 0000000..3eea9c6 --- /dev/null +++ b/relay/src/main.rs @@ -0,0 +1,5 @@ + +#[tokio::main] +fn main() { + +} diff --git a/relay/tun_server_config.toml b/relay/tun_server_config.toml new file mode 100644 index 0000000..1fa8bde --- /dev/null +++ b/relay/tun_server_config.toml @@ -0,0 +1,85 @@ +[turn] +# turn server realm +# +# specify the domain where the server is located. +# for a single node, this configuration is fixed, +# but each node can be configured as a different domain. +# this is a good idea to divide the nodes by namespace. +realm = "localhost" + +# turn server listen interfaces +# +# The address and port to which the UDP Server is bound. Multiple +# addresses can be bound at the same time. The binding address supports +# ipv4 and ipv6. +[[turn.interfaces]] +transport = "udp" +bind = "127.0.0.1:3478" +# external address +# +# specify the node external address and port. +# for the case of exposing the service to the outside, +# you need to manually specify the server external IP +# address and service listening port. +external = "127.0.0.1:3478" + +[[turn.interfaces]] +transport = "tcp" +bind = "127.0.0.1:3478" +external = "127.0.0.1:3478" + +[controller] +# controller bind +# +# This option specifies the http server binding address used to control +# the turn server. +# +# Warn: This http server does not contain any means of authentication, +# and sensitive information and dangerous operations can be obtained +# through this service, please do not expose it directly to an unsafe +# environment. +listen = "127.0.0.1:3000" + +# Set the value of the Access-Control-Allow-Origin header. +# +# Access-Control-Allow-Origin is a header request that states whether the +# response is shared with requesting code. +allow_origin = "*" + +[hooks] +# hooks bind uri +# +# This option is used to specify the http address of the hooks service. +# +# Warn: This http server does not contain any means of authentication, +# and sensitive information and dangerous operations can be obtained +# through this service, please do not expose it directly to an unsafe +# environment. +bind = "http://127.0.0.1:8080" + +# list of events followed by hooks +sub_events = [ + "allocated", + "binding", + "channel_bind", + "create_permission", + "refresh", + "abort" +] + +[log] +# log level +# +# An enum representing the available verbosity levels of the logger. +level = "info" + +# static user password +# +# This option can be used to specify the +# static identity authentication information used by the turn server for +# verification. Note: this is a high-priority authentication method, turn +# The server will try to use static authentication first, and then use +# external control service authentication. +[auth] +user1 = "test" +user2 = "test" From d8984c8b5f4c4ece2c53357459e5bad78b9c6c23 Mon Sep 17 00:00:00 2001 From: timzaak Date: Tue, 17 Oct 2023 00:05:52 +0800 Subject: [PATCH 02/14] bak --- relay/Cargo.lock | 1402 +++++++++++++++------------------------------ relay/Cargo.toml | 6 +- relay/src/main.rs | 140 ++++- 3 files changed, 597 insertions(+), 951 deletions(-) diff --git a/relay/Cargo.lock b/relay/Cargo.lock index a8490fd..d06cc1b 100644 --- a/relay/Cargo.lock +++ b/relay/Cargo.lock @@ -52,6 +52,15 @@ dependencies = [ "subtle", ] +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + [[package]] name = "anstream" version = "0.6.4" @@ -87,7 +96,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -97,7 +106,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -106,6 +115,12 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +[[package]] +name = "arc-swap" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" + [[package]] name = "asn1-rs" version = "0.5.2" @@ -157,59 +172,16 @@ dependencies = [ ] [[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "axum" -version = "0.6.20" +name = "atomic-waker" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" -dependencies = [ - "async-trait", - "axum-core", - "bitflags 1.3.2", - "bytes", - "futures-util", - "http", - "http-body", - "hyper", - "itoa", - "matchit", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "rustversion", - "serde", - "serde_json", - "serde_path_to_error", - "serde_urlencoded", - "sync_wrapper", - "tokio", - "tower", - "tower-layer", - "tower-service", -] +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] -name = "axum-core" -version = "0.3.4" +name = "autocfg" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" -dependencies = [ - "async-trait", - "bytes", - "futures-util", - "http", - "http-body", - "mime", - "rustversion", - "tower-layer", - "tower-service", -] +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" @@ -259,24 +231,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "bitflags" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" - -[[package]] -name = "bitvec" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - [[package]] name = "block-buffer" version = "0.10.4" @@ -366,7 +320,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" dependencies = [ "clap_builder", - "clap_derive", ] [[package]] @@ -381,18 +334,6 @@ dependencies = [ "strsim", ] -[[package]] -name = "clap_derive" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.38", -] - [[package]] name = "clap_lex" version = "0.5.1" @@ -405,39 +346,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" -[[package]] -name = "colored" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" -dependencies = [ - "is-terminal", - "lazy_static", - "windows-sys 0.48.0", -] - [[package]] name = "const-oid" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" -[[package]] -name = "core-foundation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" - [[package]] name = "cpufeatures" version = "0.2.9" @@ -619,52 +533,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "encoding_rs" -version = "0.8.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" -dependencies = [ - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "faster-stun" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "081c8654f23c96b078da09c24d741e92ee0ca0ec745e39c15d611835f369e9ac" -dependencies = [ - "anyhow", - "bytes", - "crc", - "hmac", - "md-5", - "num_enum", - "sha-1", -] - -[[package]] -name = "fastrand" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" - [[package]] name = "ff" version = "0.13.0" @@ -681,27 +549,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0870c84016d4b481be5c9f323c24f65e31e901ae618f0e80f4308fb00de1d2d" -[[package]] -name = "fnv" -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.0" @@ -712,10 +559,19 @@ dependencies = [ ] [[package]] -name = "funty" -version = "2.0.0" +name = "futures" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] [[package]] name = "futures-channel" @@ -724,6 +580,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -732,6 +589,34 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +[[package]] +name = "futures-executor" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-macro" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "futures-sink" version = "0.3.28" @@ -750,10 +635,16 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ + "futures-channel", "futures-core", + "futures-io", + "futures-macro", + "futures-sink", "futures-task", + "memchr", "pin-project-lite", "pin-utils", + "slab", ] [[package]] @@ -805,49 +696,18 @@ dependencies = [ "subtle", ] -[[package]] -name = "h2" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap 1.9.3", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "hermit-abi" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + [[package]] name = "hkdf" version = "0.12.3" @@ -866,83 +726,6 @@ dependencies = [ "digest", ] -[[package]] -name = "http" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" -dependencies = [ - "bytes", - "http", - "pin-project-lite", -] - -[[package]] -name = "http-range-header" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" - -[[package]] -name = "httparse" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" - -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - -[[package]] -name = "hyper" -version = "0.14.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2 0.4.9", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-native-tls", -] - [[package]] name = "idna" version = "0.4.0" @@ -953,26 +736,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "indexmap" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" -dependencies = [ - "equivalent", - "hashbrown 0.14.1", -] - [[package]] name = "inout" version = "0.1.3" @@ -984,21 +747,29 @@ dependencies = [ ] [[package]] -name = "ipnet" -version = "2.8.0" +name = "interceptor" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" +checksum = "5927883184e6a819b22d5e4f5f7bc7ca134fde9b2026fbddd8d95249746ba21e" +dependencies = [ + "async-trait", + "bytes", + "log", + "rand", + "rtcp", + "rtp", + "thiserror", + "tokio", + "waitgroup", + "webrtc-srtp", + "webrtc-util", +] [[package]] -name = "is-terminal" -version = "0.4.9" +name = "ipnet" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi", - "rustix", - "windows-sys 0.48.0", -] +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "itoa" @@ -1028,29 +799,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] -name = "libmimalloc-sys" -version = "0.1.35" +name = "lock_api" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3979b5c37ece694f1f5e51e7ecc871fdb0f517ed04ee45f88d15d6d553cb9664" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" - -[[package]] -name = "lock_api" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" -dependencies = [ - "autocfg", - "scopeguard", + "autocfg", + "scopeguard", ] [[package]] @@ -1059,12 +814,6 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" -[[package]] -name = "matchit" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" - [[package]] name = "md-5" version = "0.10.6" @@ -1090,21 +839,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "mimalloc" -version = "0.1.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa01922b5ea280a911e323e4d2fd24b7fe5cc4042e0d2cda3c40775cdc4bdc9c" -dependencies = [ - "libmimalloc-sys", -] - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - [[package]] name = "minimal-lexical" version = "0.2.1" @@ -1128,25 +862,7 @@ checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", "wasi", - "windows-sys 0.48.0", -] - -[[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", + "windows-sys", ] [[package]] @@ -1155,7 +871,7 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cfg-if", "libc", "memoffset", @@ -1172,6 +888,16 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-bigint" version = "0.4.4" @@ -1212,36 +938,6 @@ dependencies = [ "libc", ] -[[package]] -name = "num_enum" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.38", -] - -[[package]] -name = "num_threads" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" -dependencies = [ - "libc", -] - [[package]] name = "object" version = "0.32.1" @@ -1273,48 +969,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] -name = "openssl" -version = "0.10.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" -dependencies = [ - "bitflags 2.4.0", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" +name = "overload" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.38", -] - -[[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.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "p256" @@ -1388,26 +1046,6 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" -[[package]] -name = "pin-project" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.38", -] - [[package]] name = "pin-project-lite" version = "0.2.13" @@ -1430,12 +1068,6 @@ dependencies = [ "spki", ] -[[package]] -name = "pkg-config" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" - [[package]] name = "platforms" version = "3.1.2" @@ -1475,16 +1107,6 @@ dependencies = [ "elliptic-curve", ] -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit", -] - [[package]] name = "proc-macro2" version = "1.0.69" @@ -1503,12 +1125,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - [[package]] name = "rand" version = "0.8.5" @@ -1548,6 +1164,7 @@ dependencies = [ "pem", "ring", "time", + "x509-parser", "yasna", ] @@ -1557,54 +1174,48 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] -name = "relay" -version = "0.0.1" +name = "regex" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaac441002f822bc9705a681810a4dd2963094b9ca0ddc41cb963a4c189189ea" dependencies = [ - "tokio", - "turn-server", - "webrtc-dtls", + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", ] [[package]] -name = "reqwest" -version = "0.11.22" +name = "regex-automata" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +checksum = "5011c7e263a695dc8ca064cddb722af1be54e517a280b12a5356f98366899e5d" dependencies = [ - "base64", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-tls", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "serde", - "serde_json", - "serde_urlencoded", - "system-configuration", + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "relay" +version = "0.0.1" +dependencies = [ + "anyhow", + "clap", "tokio", - "tokio-native-tls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", + "tracing", + "tracing-subscriber", + "webrtc", ] [[package]] @@ -1632,6 +1243,30 @@ dependencies = [ "winapi", ] +[[package]] +name = "rtcp" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3677908cadfbecb4cc1da9a56a32524fae4ebdfa7c2ea93886e1b1e846488cb9" +dependencies = [ + "bytes", + "thiserror", + "webrtc-util", +] + +[[package]] +name = "rtp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e60482acbe8afb31edf6b1413103b7bca7a65004c423b3c3993749a083994fbe" +dependencies = [ + "bytes", + "rand", + "serde", + "thiserror", + "webrtc-util", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -1656,19 +1291,6 @@ dependencies = [ "nom", ] -[[package]] -name = "rustix" -version = "0.38.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed" -dependencies = [ - "bitflags 2.4.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", -] - [[package]] name = "rustls" version = "0.21.7" @@ -1691,27 +1313,12 @@ dependencies = [ "untrusted", ] -[[package]] -name = "rustversion" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" - [[package]] name = "ryu" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" -[[package]] -name = "schannel" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" -dependencies = [ - "windows-sys 0.48.0", -] - [[package]] name = "scopeguard" version = "1.2.0" @@ -1728,6 +1335,18 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sdp" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4653054c30ebce63658762eb0d64e27673868a95564474811ae6c220cf767640" +dependencies = [ + "rand", + "substring", + "thiserror", + "url", +] + [[package]] name = "sec1" version = "0.7.3" @@ -1742,29 +1361,6 @@ dependencies = [ "zeroize", ] -[[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 = "semver" version = "1.0.20" @@ -1802,48 +1398,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_path_to_error" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4beec8bce849d58d06238cb50db2e1c417cfeafa4c63f692b15c82b7c80f8335" -dependencies = [ - "itoa", - "serde", -] - -[[package]] -name = "serde_spanned" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha-1" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - [[package]] name = "sha1" version = "0.10.6" @@ -1866,6 +1420,15 @@ dependencies = [ "digest", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -1885,18 +1448,6 @@ dependencies = [ "rand_core", ] -[[package]] -name = "simple_logger" -version = "4.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2230cd5c29b815c9b699fb610b49a5ed65588f3509d9f0108be3a885da629333" -dependencies = [ - "colored", - "log", - "time", - "windows-sys 0.42.0", -] - [[package]] name = "slab" version = "0.4.9" @@ -1913,13 +1464,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] -name = "socket2" -version = "0.4.9" +name = "smol_str" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c" dependencies = [ - "libc", - "winapi", + "serde", ] [[package]] @@ -1929,7 +1479,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -1955,11 +1505,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] -name = "subtle" -version = "2.5.0" +name = "stun" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" - +checksum = "7beb1624a3ea34778d58d30e2b8606b4d29fe65e87c4d50b87ed30afd5c3830c" +dependencies = [ + "base64", + "crc", + "lazy_static", + "md-5", + "rand", + "ring", + "subtle", + "thiserror", + "tokio", + "url", + "webrtc-util", +] + +[[package]] +name = "substring" +version = "1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ee6433ecef213b2e72f587ef64a2f5943e7cd16fbd82dbe8bc07486c534c86" +dependencies = [ + "autocfg", +] + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + [[package]] name = "syn" version = "1.0.109" @@ -1982,12 +1560,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - [[package]] name = "synstructure" version = "0.12.6" @@ -2000,46 +1572,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - -[[package]] -name = "tempfile" -version = "3.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall", - "rustix", - "windows-sys 0.48.0", -] - [[package]] name = "thiserror" version = "1.0.49" @@ -2060,6 +1592,16 @@ dependencies = [ "syn 2.0.38", ] +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + [[package]] name = "time" version = "0.3.30" @@ -2068,8 +1610,6 @@ checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ "deranged", "itoa", - "libc", - "num_threads", "powerfmt", "serde", "time-core", @@ -2120,9 +1660,9 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.4", + "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -2137,118 +1677,25 @@ dependencies = [ ] [[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - -[[package]] -name = "toml" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap 2.0.2", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tokio", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-http" -version = "0.4.4" +name = "tracing" +version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" +checksum = "ee2ef2af84856a50c1d430afce2fdded0a4ec7eda868db86409b4543df0797f9" dependencies = [ - "bitflags 2.4.0", - "bytes", - "futures-core", - "futures-util", - "http", - "http-body", - "http-range-header", "pin-project-lite", - "tower-layer", - "tower-service", + "tracing-attributes", + "tracing-core", ] [[package]] -name = "tower-layer" -version = "0.3.2" +name = "tracing-attributes" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" - -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2ef2af84856a50c1d430afce2fdded0a4ec7eda868db86409b4543df0797f9" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ - "log", - "pin-project-lite", - "tracing-core", + "proc-macro2", + "quote", + "syn 2.0.38", ] [[package]] @@ -2258,54 +1705,51 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", + "valuable", ] [[package]] -name = "try-lock" -version = "0.2.4" +name = "tracing-log" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] [[package]] -name = "turn-rs" -version = "1.2.1" +name = "tracing-subscriber" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f36e250fcc8d235f09ec5826ab11426b2ea6f338d2e76f92e07460ecf5f2dc5" +checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" dependencies = [ - "anyhow", - "async-trait", - "bytes", - "faster-stun", - "parking_lot", - "rand", + "nu-ansi-term", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", ] [[package]] -name = "turn-server" -version = "1.2.0" +name = "turn" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d093252b4f28686a5cefbed9c64d80122eda6d0fa15c59b90457c25cb3e9b3cb" +checksum = "58f4fcb97da0426e8146fe0e9b78cc13120161087256198701d12d9df77f7701" dependencies = [ - "anyhow", "async-trait", - "axum", - "bitvec", - "bytes", - "clap", - "faster-stun", - "http", + "base64", + "futures", "log", - "mimalloc", - "num_cpus", - "reqwest", - "serde", - "serde_json", - "simple_logger", + "md-5", + "rand", + "ring", + "stun", + "thiserror", "tokio", - "toml", - "tower", - "tower-http", - "turn-rs", + "webrtc-util", ] [[package]] @@ -2375,10 +1819,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] -name = "vcpkg" -version = "0.2.15" +name = "uuid" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +dependencies = [ + "getrandom", +] + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "version_check" @@ -2387,12 +1840,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] -name = "want" -version = "0.3.1" +name = "waitgroup" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +checksum = "d1f50000a783467e6c0200f9d10642f4bc424e39efc1b770203e88b488f79292" dependencies = [ - "try-lock", + "atomic-waker", ] [[package]] @@ -2426,18 +1879,6 @@ dependencies = [ "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "wasm-bindgen-macro" version = "0.2.87" @@ -2477,6 +1918,63 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webrtc" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91e7cf018f7185552bf6a5dd839f4ed9827aea33b746763c9a215f84a0d0b34" +dependencies = [ + "arc-swap", + "async-trait", + "bytes", + "cfg-if", + "hex", + "interceptor", + "lazy_static", + "log", + "rand", + "rcgen", + "regex", + "ring", + "rtcp", + "rtp", + "rustls", + "sdp", + "serde", + "serde_json", + "sha2", + "smol_str", + "stun", + "thiserror", + "time", + "tokio", + "turn", + "url", + "waitgroup", + "webrtc-data", + "webrtc-dtls", + "webrtc-ice", + "webrtc-mdns", + "webrtc-media", + "webrtc-sctp", + "webrtc-srtp", + "webrtc-util", +] + +[[package]] +name = "webrtc-data" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a45d2461d0e0bf93f181e30eb0b40df32b8bf3efb89c53cebb1990e603e2067d" +dependencies = [ + "bytes", + "log", + "thiserror", + "tokio", + "webrtc-sctp", + "webrtc-util", +] + [[package]] name = "webrtc-dtls" version = "0.8.0" @@ -2513,6 +2011,96 @@ dependencies = [ "x509-parser", ] +[[package]] +name = "webrtc-ice" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66eb4b85646f1c52225779db3e1e7e873dede6db68cc9be080b648f1713083a3" +dependencies = [ + "arc-swap", + "async-trait", + "crc", + "log", + "rand", + "serde", + "serde_json", + "stun", + "thiserror", + "tokio", + "turn", + "url", + "uuid", + "waitgroup", + "webrtc-mdns", + "webrtc-util", +] + +[[package]] +name = "webrtc-mdns" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bebbd40e7f8b630a0f1a74783dbfff1edfc0ccaae891c4689891156a8c4d8c" +dependencies = [ + "log", + "socket2", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-media" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfde3c7b9450b67d466bb2f02c6d9ff9514d33535eb9994942afd1f828839d1" +dependencies = [ + "byteorder", + "bytes", + "rand", + "rtp", + "thiserror", +] + +[[package]] +name = "webrtc-sctp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1af6116b7f9703560c3ad0b32f67220b171bb1b59633b03563db8404d0e482ea" +dependencies = [ + "arc-swap", + "async-trait", + "bytes", + "crc", + "log", + "rand", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-srtp" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1db1f36c1c81e4b1e531c0b9678ba0c93809e196ce62122d87259bb71c03b9f" +dependencies = [ + "aead", + "aes", + "aes-gcm", + "byteorder", + "bytes", + "ctr", + "hmac", + "log", + "rtcp", + "rtp", + "sha1", + "subtle", + "thiserror", + "tokio", + "webrtc-util", +] + [[package]] name = "webrtc-util" version = "0.8.0" @@ -2520,7 +2108,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1adc96bee68417e1f4d19dd7698124a7f859db55ae2fd3eedbbb7e732f614735" dependencies = [ "async-trait", - "bitflags 1.3.2", + "bitflags", "bytes", "cc", "ipnet", @@ -2556,21 +2144,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -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-sys" version = "0.48.0" @@ -2586,127 +2159,57 @@ 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", + "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]] -name = "windows_aarch64_gnullvm" -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_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_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_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_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_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_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 = "winnow" -version = "0.5.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" -dependencies = [ - "memchr", -] - -[[package]] -name = "winreg" -version = "0.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - [[package]] name = "x25519-dalek" version = "2.0.0" @@ -2731,6 +2234,7 @@ dependencies = [ "lazy_static", "nom", "oid-registry", + "ring", "rusticata-macros", "thiserror", "time", diff --git a/relay/Cargo.toml b/relay/Cargo.toml index df0545d..ab1ea4c 100644 --- a/relay/Cargo.toml +++ b/relay/Cargo.toml @@ -8,5 +8,9 @@ edition = "2021" [dependencies] tokio = { version = "1.32", features = ["macros", "rt-multi-thread", "net", "rt"] } clap = "4.4" + +tracing-subscriber = "0.3.17" +tracing = "0.1.39" +webrtc = "0.9.0" +anyhow = "1" [dev-dependencies] -webrtc-dtls = "0.8.0" diff --git a/relay/src/main.rs b/relay/src/main.rs index 3eea9c6..09db2d0 100644 --- a/relay/src/main.rs +++ b/relay/src/main.rs @@ -1,5 +1,143 @@ +use std::sync::Arc; +use anyhow::anyhow; +use tracing_subscriber; + +use webrtc::api::media_engine::MediaEngine; +use webrtc::api::APIBuilder; +use webrtc::api::interceptor_registry::{configure_nack, configure_rtcp_reports}; +use webrtc::ice_transport::ice_server::RTCIceServer; +use webrtc::interceptor::registry::Registry; +use webrtc::peer_connection::configuration::RTCConfiguration; +use webrtc::peer_connection::RTCPeerConnection; #[tokio::main] -fn main() { +async fn main() -> anyhow::Result<()>{ + tracing_subscriber::fmt::init(); + //let answer_connection = answer().await?; + + let offer_connection = offer().await?; + let offer = offer_connection.create_offer(None).await?; + tracing::info!("Offer: {offer:?}"); + offer_connection.set_local_description(offer.clone()).await?; + + //answer_connection.set_remote_description(offer).await?; + //let answer = answer_connection.create_answer(None).await?; + //answer_connection.set_local_description(answer.clone()).await?; + //offer_connection.set_remote_description(answer).await?; + + tokio::signal::ctrl_c().await?; + Ok(()) +} + +async fn answer() -> anyhow::Result> { + let config = RTCConfiguration { + ice_servers: vec![RTCIceServer { + urls: vec!["stun:stun.l.google.com:19302".to_owned()], + ..Default::default() + }], + ..Default::default() + }; + let mut m = MediaEngine::default(); + let mut registry = Registry::new(); + //register_default_interceptors(registry, &mut m); + registry = configure_nack(registry, &mut m); + registry = configure_rtcp_reports(registry); + let api = APIBuilder::new() + .with_media_engine(m) + .with_interceptor_registry(registry) + .build(); + + let peer_connection = Arc::new(api.new_peer_connection(config).await?); + let w_pc = Arc::downgrade(&peer_connection); + peer_connection.on_ice_candidate(Box::new(move |c|{ + let w_pc2 = w_pc.clone(); + Box::pin(async move { + if let Some(c) = c { + if let Some(w_pc) = w_pc2.upgrade() { + let remote_description = w_pc.remote_description().await; + tracing::info!("answer on ice connection: {remote_description:?}") + } + } + }) + })); + + + peer_connection.on_peer_connection_state_change(Box::new(move |s|{ + tracing::info!("Answer Peer Connection State has changed: {s}"); + Box::pin(async { }) + })); + + peer_connection.on_data_channel(Box::new(move |d| { + let d_label = d.label().to_owned(); + let d_id = d.id(); + tracing::info!("New DataChannel {d_label} {d_id}"); + Box::pin(async move { + let d2 = Arc::clone(&d); + let d_label2 = d_label.clone(); + let d_id2 = d_id; + d.on_open(Box::new(move|| { + tracing::info!("Data channel '{d_label2}'-'{d_id2}' open. Random messages will now be sent to any connected DataChannels every 5 seconds"); + Box::pin(async { }) + })); + d.on_message(Box::new(move |msg|{ + tracing::info!("anwser receive data label: {d_label}:"); + Box::pin(async { }) + })); + }) + })); + + + + Ok(peer_connection) +} +async fn offer() -> anyhow::Result>{ + + let config = RTCConfiguration { + ice_servers: vec![RTCIceServer { + urls: vec!["stun:stun.l.google.com:19302".to_owned()], + ..Default::default() + }], + ..Default::default() + }; + let mut m = MediaEngine::default(); + let mut registry = Registry::new(); + //register_default_interceptors(registry, &mut m); + registry = configure_nack(registry, &mut m); + registry = configure_rtcp_reports(registry); + let api = APIBuilder::new() + .with_media_engine(m) + .with_interceptor_registry(registry) + .build(); + + let peer_connection = Arc::new(api.new_peer_connection(config).await?); + let w_pc = Arc::downgrade(&peer_connection); + peer_connection.on_ice_candidate(Box::new(move |c|{ + let w_pc2 = w_pc.clone(); + Box::pin(async move { + if let Some(c) = c { + if let Some(w_pc) = w_pc2.upgrade() { + let remote_description = w_pc.remote_description().await; + tracing::info!(" on ice connection: {remote_description:?}") + } + } + }) + })); + + + peer_connection.on_peer_connection_state_change(Box::new(move |s|{ + println!("Peer Connection State has changed: {s}"); + + Box::pin(async { }) + })); + + let data_channel = peer_connection.create_data_channel("data",None).await?; + //let dc = Arc::downgrade(&data_channel); + data_channel.on_open(Box::new(move || { + tracing::info!(" DataChannel Open"); + Box::pin(async { + //data_channel.send_text("".to_owned()).await?; + }) + })); + Ok(peer_connection) } From 7e5ed9cb63970f0e9a890cede599ae9970a3e8b3 Mon Sep 17 00:00:00 2001 From: timzaak Date: Wed, 18 Oct 2023 00:07:37 +0800 Subject: [PATCH 03/14] make it run --- relay/src/main.rs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/relay/src/main.rs b/relay/src/main.rs index 09db2d0..b947090 100644 --- a/relay/src/main.rs +++ b/relay/src/main.rs @@ -13,17 +13,24 @@ use webrtc::peer_connection::RTCPeerConnection; #[tokio::main] async fn main() -> anyhow::Result<()>{ tracing_subscriber::fmt::init(); - //let answer_connection = answer().await?; + let answer_connection = answer().await?; let offer_connection = offer().await?; let offer = offer_connection.create_offer(None).await?; tracing::info!("Offer: {offer:?}"); offer_connection.set_local_description(offer.clone()).await?; - //answer_connection.set_remote_description(offer).await?; - //let answer = answer_connection.create_answer(None).await?; - //answer_connection.set_local_description(answer.clone()).await?; - //offer_connection.set_remote_description(answer).await?; + answer_connection.set_remote_description(offer).await?; + let mut gather_complete= answer_connection.gathering_complete_promise().await; + let answer = answer_connection.create_answer(None).await?; + answer_connection.set_local_description(answer.clone()).await?; + + let _ = gather_complete.recv().await; + + tracing::info!("answer collect Session Description finish"); + let answer_local_description = answer_connection.local_description().await.unwrap(); + offer_connection.set_remote_description(answer_local_description).await?; + tokio::signal::ctrl_c().await?; Ok(()) @@ -37,6 +44,7 @@ async fn answer() -> anyhow::Result> { }], ..Default::default() }; + //let config = RTCConfiguration::default(); let mut m = MediaEngine::default(); let mut registry = Registry::new(); //register_default_interceptors(registry, &mut m); @@ -99,6 +107,8 @@ async fn offer() -> anyhow::Result>{ }], ..Default::default() }; + + //let config = RTCConfiguration::default(); let mut m = MediaEngine::default(); let mut registry = Registry::new(); //register_default_interceptors(registry, &mut m); From feabd220f3a2d2d18a304895c09d73e3d7bcdbd9 Mon Sep 17 00:00:00 2001 From: timzaak Date: Sun, 22 Oct 2023 21:05:30 +0800 Subject: [PATCH 04/14] fix it --- relay/README.md | 7 +- relay/src/main.rs | 64 ++++++++++++++++--- ...er_config.toml => turn_server_config.toml} | 57 +++++++++-------- 3 files changed, 89 insertions(+), 39 deletions(-) rename relay/{tun_server_config.toml => turn_server_config.toml} (69%) diff --git a/relay/README.md b/relay/README.md index 39612c7..92e0c5c 100644 --- a/relay/README.md +++ b/relay/README.md @@ -11,4 +11,9 @@ turn-server commit: 5ee052e8168ddad7a1c92c83c2cdc49c7a266885 run --package turn-server --bin turn-server -- --config=$turn_server_config.toml ``` -WebRTC 内容: https://github.com/timzaak/blog/issues/94 \ No newline at end of file +WebRTC 内容: https://github.com/timzaak/blog/issues/94 + +### Turn Server Run +```shell +./turn-server --config=~/turn_config.toml +``` \ No newline at end of file diff --git a/relay/src/main.rs b/relay/src/main.rs index b947090..706d96f 100644 --- a/relay/src/main.rs +++ b/relay/src/main.rs @@ -1,15 +1,19 @@ use std::sync::Arc; +use std::time::Duration; use anyhow::anyhow; use tracing_subscriber; use webrtc::api::media_engine::MediaEngine; use webrtc::api::APIBuilder; use webrtc::api::interceptor_registry::{configure_nack, configure_rtcp_reports}; +use webrtc::ice_transport::ice_credential_type::RTCIceCredentialType; use webrtc::ice_transport::ice_server::RTCIceServer; use webrtc::interceptor::registry::Registry; use webrtc::peer_connection::configuration::RTCConfiguration; +use webrtc::peer_connection::policy::ice_transport_policy::RTCIceTransportPolicy; use webrtc::peer_connection::RTCPeerConnection; +const TURN_SERVER:&str = "turn:113.31.103.71:13478"; #[tokio::main] async fn main() -> anyhow::Result<()>{ tracing_subscriber::fmt::init(); @@ -29,22 +33,40 @@ async fn main() -> anyhow::Result<()>{ tracing::info!("answer collect Session Description finish"); let answer_local_description = answer_connection.local_description().await.unwrap(); - offer_connection.set_remote_description(answer_local_description).await?; + //tracing::info!("answer description: {answer_local_description:?}"); + + //let mut gather_complete = offer_connection.gathering_complete_promise().await; + //let _ = gather_complete.recv().await; + offer_connection.set_remote_description(answer_local_description).await?; tokio::signal::ctrl_c().await?; Ok(()) } async fn answer() -> anyhow::Result> { + // let config = RTCConfiguration { + // ice_servers: vec![RTCIceServer { + // urls: vec!["stun:stun.l.google.com:19302".to_owned()], + // ..Default::default() + // }], + // ..Default::default() + // }; + //let config = RTCConfiguration::default(); + let config = RTCConfiguration { ice_servers: vec![RTCIceServer { - urls: vec!["stun:stun.l.google.com:19302".to_owned()], - ..Default::default() + urls: vec![TURN_SERVER.to_owned()], + username: "answer".to_owned(), + credential: "test".to_owned(), + + credential_type: RTCIceCredentialType::Password, }], + ice_transport_policy: RTCIceTransportPolicy::Relay, + peer_identity: "offer".to_owned(), + //peer_identity: "answer".to_owned(), ..Default::default() }; - //let config = RTCConfiguration::default(); let mut m = MediaEngine::default(); let mut registry = Registry::new(); //register_default_interceptors(registry, &mut m); @@ -88,7 +110,8 @@ async fn answer() -> anyhow::Result> { Box::pin(async { }) })); d.on_message(Box::new(move |msg|{ - tracing::info!("anwser receive data label: {d_label}:"); + let msg_str = String::from_utf8(msg.data.to_vec()).unwrap(); + tracing::info!("anwser receive data label: {d_label}, data: {msg_str}"); Box::pin(async { }) })); }) @@ -100,11 +123,23 @@ async fn answer() -> anyhow::Result> { } async fn offer() -> anyhow::Result>{ + // let config = RTCConfiguration { + // ice_servers: vec![RTCIceServer { + // urls: vec!["stun:stun.l.google.com:19302".to_owned()], + // ..Default::default() + // }], + // ..Default::default() + // }; let config = RTCConfiguration { ice_servers: vec![RTCIceServer { - urls: vec!["stun:stun.l.google.com:19302".to_owned()], - ..Default::default() + urls: vec![TURN_SERVER.to_owned()], + username: "offer".to_owned(), + credential: "test".to_owned(), + credential_type: RTCIceCredentialType::Password, }], + ice_transport_policy: RTCIceTransportPolicy::Relay, + peer_identity: "answer".to_owned(), + //peer_identity: "offer".to_owned(), ..Default::default() }; @@ -142,11 +177,20 @@ async fn offer() -> anyhow::Result>{ let data_channel = peer_connection.create_data_channel("data",None).await?; - //let dc = Arc::downgrade(&data_channel); + let dc = Arc::downgrade(&data_channel); data_channel.on_open(Box::new(move || { + //let data_channel = data_channel.clone(); tracing::info!(" DataChannel Open"); - Box::pin(async { - //data_channel.send_text("".to_owned()).await?; + Box::pin(async move{ + loop { + if let Some(data_channel) = dc.upgrade() { + data_channel.send_text("1".to_owned()).await; + tokio::time::sleep(Duration::from_secs(5)).await; + } else { + break; + } + } + // }) })); Ok(peer_connection) diff --git a/relay/tun_server_config.toml b/relay/turn_server_config.toml similarity index 69% rename from relay/tun_server_config.toml rename to relay/turn_server_config.toml index 1fa8bde..752688c 100644 --- a/relay/tun_server_config.toml +++ b/relay/turn_server_config.toml @@ -5,7 +5,7 @@ # for a single node, this configuration is fixed, # but each node can be configured as a different domain. # this is a good idea to divide the nodes by namespace. -realm = "localhost" +realm = "fornet" # turn server listen interfaces # @@ -14,19 +14,19 @@ realm = "localhost" # ipv4 and ipv6. [[turn.interfaces]] transport = "udp" -bind = "127.0.0.1:3478" +bind = "0.0.0.0:13478" # external address # # specify the node external address and port. # for the case of exposing the service to the outside, # you need to manually specify the server external IP # address and service listening port. -external = "127.0.0.1:3478" +external = "113.31.103.71:13478" -[[turn.interfaces]] -transport = "tcp" -bind = "127.0.0.1:3478" -external = "127.0.0.1:3478" +#[[turn.interfaces]] +#transport = "tcp" +#bind = "127.0.0.1:3478" +#external = "127.0.0.1:3478" [controller] # controller bind @@ -46,26 +46,26 @@ listen = "127.0.0.1:3000" # response is shared with requesting code. allow_origin = "*" -[hooks] -# hooks bind uri -# -# This option is used to specify the http address of the hooks service. +#[hooks] +## hooks bind uri +## +## This option is used to specify the http address of the hooks service. +## +## Warn: This http server does not contain any means of authentication, +## and sensitive information and dangerous operations can be obtained +## through this service, please do not expose it directly to an unsafe +## environment. +#bind = "http://127.0.0.1:8080" # -# Warn: This http server does not contain any means of authentication, -# and sensitive information and dangerous operations can be obtained -# through this service, please do not expose it directly to an unsafe -# environment. -bind = "http://127.0.0.1:8080" - -# list of events followed by hooks -sub_events = [ - "allocated", - "binding", - "channel_bind", - "create_permission", - "refresh", - "abort" -] +## list of events followed by hooks +#sub_events = [ +# "allocated", +# "binding", +# "channel_bind", +# "create_permission", +# "refresh", +# "abort" +#] [log] # log level @@ -81,5 +81,6 @@ level = "info" # The server will try to use static authentication first, and then use # external control service authentication. [auth] -user1 = "test" -user2 = "test" +answer = "test" +offer = "test" +user = "pass" From 29a73f803fbbad939611a94de71920d879b0fdda Mon Sep 17 00:00:00 2001 From: timzaak Date: Sun, 22 Oct 2023 22:01:35 +0800 Subject: [PATCH 05/14] bak it --- relay/src/main.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/relay/src/main.rs b/relay/src/main.rs index 706d96f..ca9cc80 100644 --- a/relay/src/main.rs +++ b/relay/src/main.rs @@ -20,9 +20,17 @@ async fn main() -> anyhow::Result<()>{ let answer_connection = answer().await?; let offer_connection = offer().await?; + + let offer = offer_connection.create_offer(None).await?; - tracing::info!("Offer: {offer:?}"); offer_connection.set_local_description(offer.clone()).await?; + let mut gather_complete = offer_connection.gathering_complete_promise().await; + let _ = gather_complete.recv().await; + + + + let offer = offer_connection.local_description().await.unwrap(); + tracing::info!("Offer: {offer:?}"); answer_connection.set_remote_description(offer).await?; let mut gather_complete= answer_connection.gathering_complete_promise().await; @@ -35,8 +43,6 @@ async fn main() -> anyhow::Result<()>{ let answer_local_description = answer_connection.local_description().await.unwrap(); //tracing::info!("answer description: {answer_local_description:?}"); - //let mut gather_complete = offer_connection.gathering_complete_promise().await; - //let _ = gather_complete.recv().await; offer_connection.set_remote_description(answer_local_description).await?; @@ -63,8 +69,7 @@ async fn answer() -> anyhow::Result> { credential_type: RTCIceCredentialType::Password, }], ice_transport_policy: RTCIceTransportPolicy::Relay, - peer_identity: "offer".to_owned(), - //peer_identity: "answer".to_owned(), + //peer_identity: "offer".to_owned(), ..Default::default() }; let mut m = MediaEngine::default(); @@ -138,8 +143,8 @@ async fn offer() -> anyhow::Result>{ credential_type: RTCIceCredentialType::Password, }], ice_transport_policy: RTCIceTransportPolicy::Relay, - peer_identity: "answer".to_owned(), - //peer_identity: "offer".to_owned(), + + //peer_identity: "answer".to_owned(), ..Default::default() }; From 3f75435eb73e882fb4543b2fb5e30190d2f30de7 Mon Sep 17 00:00:00 2001 From: timzaak Date: Sun, 22 Oct 2023 22:47:14 +0800 Subject: [PATCH 06/14] bak it --- relay/src/main.rs | 13 ++++++++++++- relay/turn_server_config.toml | 10 ++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/relay/src/main.rs b/relay/src/main.rs index ca9cc80..76d56ad 100644 --- a/relay/src/main.rs +++ b/relay/src/main.rs @@ -14,6 +14,7 @@ use webrtc::peer_connection::policy::ice_transport_policy::RTCIceTransportPolicy use webrtc::peer_connection::RTCPeerConnection; const TURN_SERVER:&str = "turn:113.31.103.71:13478"; +const SELF_TURN_SERVER:&str = "turn:192.168.31.37:3478"; #[tokio::main] async fn main() -> anyhow::Result<()>{ tracing_subscriber::fmt::init(); @@ -65,6 +66,11 @@ async fn answer() -> anyhow::Result> { urls: vec![TURN_SERVER.to_owned()], username: "answer".to_owned(), credential: "test".to_owned(), + credential_type: RTCIceCredentialType::Password, + }, RTCIceServer { + urls: vec![SELF_TURN_SERVER.to_owned()], + username: "answer".to_owned(), + credential: "test".to_owned(), credential_type: RTCIceCredentialType::Password, }], @@ -116,7 +122,7 @@ async fn answer() -> anyhow::Result> { })); d.on_message(Box::new(move |msg|{ let msg_str = String::from_utf8(msg.data.to_vec()).unwrap(); - tracing::info!("anwser receive data label: {d_label}, data: {msg_str}"); + tracing::info!("answer receive data label: {d_label}, data: {msg_str}"); Box::pin(async { }) })); }) @@ -141,6 +147,11 @@ async fn offer() -> anyhow::Result>{ username: "offer".to_owned(), credential: "test".to_owned(), credential_type: RTCIceCredentialType::Password, + },RTCIceServer { + urls: vec![SELF_TURN_SERVER.to_owned()], + username: "offer".to_owned(), + credential: "test".to_owned(), + credential_type: RTCIceCredentialType::Password, }], ice_transport_policy: RTCIceTransportPolicy::Relay, diff --git a/relay/turn_server_config.toml b/relay/turn_server_config.toml index 752688c..b0a416a 100644 --- a/relay/turn_server_config.toml +++ b/relay/turn_server_config.toml @@ -5,8 +5,8 @@ # for a single node, this configuration is fixed, # but each node can be configured as a different domain. # this is a good idea to divide the nodes by namespace. -realm = "fornet" - +#realm = "fornet" +realm = "localhost" # turn server listen interfaces # # The address and port to which the UDP Server is bound. Multiple @@ -14,14 +14,16 @@ realm = "fornet" # ipv4 and ipv6. [[turn.interfaces]] transport = "udp" -bind = "0.0.0.0:13478" +#bind = "0.0.0.0:13478" +bind = "0.0.0.0:3478" # external address # # specify the node external address and port. # for the case of exposing the service to the outside, # you need to manually specify the server external IP # address and service listening port. -external = "113.31.103.71:13478" +#external = "113.31.103.71:13478" +external = "192.168.31.37:3478" #[[turn.interfaces]] #transport = "tcp" From 346164f775900e0294cd303375a06e0ec72ab4bc Mon Sep 17 00:00:00 2001 From: timzaak Date: Mon, 23 Oct 2023 00:41:01 +0800 Subject: [PATCH 07/14] bak reconnect --- relay/Cargo.lock | 2 + relay/Cargo.toml | 2 + relay/src/main.rs | 212 ++----------------------------------- relay/src/reconnect.rs | 231 +++++++++++++++++++++++++++++++++++++++++ relay/src/simple.rs | 212 +++++++++++++++++++++++++++++++++++++ 5 files changed, 454 insertions(+), 205 deletions(-) create mode 100644 relay/src/reconnect.rs create mode 100644 relay/src/simple.rs diff --git a/relay/Cargo.lock b/relay/Cargo.lock index d06cc1b..2eff881 100644 --- a/relay/Cargo.lock +++ b/relay/Cargo.lock @@ -1212,6 +1212,8 @@ version = "0.0.1" dependencies = [ "anyhow", "clap", + "serde", + "serde_json", "tokio", "tracing", "tracing-subscriber", diff --git a/relay/Cargo.toml b/relay/Cargo.toml index ab1ea4c..2614c9c 100644 --- a/relay/Cargo.toml +++ b/relay/Cargo.toml @@ -13,4 +13,6 @@ tracing-subscriber = "0.3.17" tracing = "0.1.39" webrtc = "0.9.0" anyhow = "1" +serde = "1" +serde_json = "1" [dev-dependencies] diff --git a/relay/src/main.rs b/relay/src/main.rs index 76d56ad..68cd356 100644 --- a/relay/src/main.rs +++ b/relay/src/main.rs @@ -1,213 +1,15 @@ -use std::sync::Arc; -use std::time::Duration; -use anyhow::anyhow; use tracing_subscriber; +mod simple; +mod reconnect; + + -use webrtc::api::media_engine::MediaEngine; -use webrtc::api::APIBuilder; -use webrtc::api::interceptor_registry::{configure_nack, configure_rtcp_reports}; -use webrtc::ice_transport::ice_credential_type::RTCIceCredentialType; -use webrtc::ice_transport::ice_server::RTCIceServer; -use webrtc::interceptor::registry::Registry; -use webrtc::peer_connection::configuration::RTCConfiguration; -use webrtc::peer_connection::policy::ice_transport_policy::RTCIceTransportPolicy; -use webrtc::peer_connection::RTCPeerConnection; -const TURN_SERVER:&str = "turn:113.31.103.71:13478"; -const SELF_TURN_SERVER:&str = "turn:192.168.31.37:3478"; #[tokio::main] async fn main() -> anyhow::Result<()>{ tracing_subscriber::fmt::init(); - let answer_connection = answer().await?; - - let offer_connection = offer().await?; - - - let offer = offer_connection.create_offer(None).await?; - offer_connection.set_local_description(offer.clone()).await?; - let mut gather_complete = offer_connection.gathering_complete_promise().await; - let _ = gather_complete.recv().await; - - - - let offer = offer_connection.local_description().await.unwrap(); - tracing::info!("Offer: {offer:?}"); - - answer_connection.set_remote_description(offer).await?; - let mut gather_complete= answer_connection.gathering_complete_promise().await; - let answer = answer_connection.create_answer(None).await?; - answer_connection.set_local_description(answer.clone()).await?; - - let _ = gather_complete.recv().await; - - tracing::info!("answer collect Session Description finish"); - let answer_local_description = answer_connection.local_description().await.unwrap(); - //tracing::info!("answer description: {answer_local_description:?}"); - - - offer_connection.set_remote_description(answer_local_description).await?; - + //simple::simple().await.unwrap(); + reconnect::reconnect().await.unwrap(); tokio::signal::ctrl_c().await?; Ok(()) -} - -async fn answer() -> anyhow::Result> { - // let config = RTCConfiguration { - // ice_servers: vec![RTCIceServer { - // urls: vec!["stun:stun.l.google.com:19302".to_owned()], - // ..Default::default() - // }], - // ..Default::default() - // }; - //let config = RTCConfiguration::default(); - - let config = RTCConfiguration { - ice_servers: vec![RTCIceServer { - urls: vec![TURN_SERVER.to_owned()], - username: "answer".to_owned(), - credential: "test".to_owned(), - credential_type: RTCIceCredentialType::Password, - }, RTCIceServer { - urls: vec![SELF_TURN_SERVER.to_owned()], - username: "answer".to_owned(), - credential: "test".to_owned(), - - credential_type: RTCIceCredentialType::Password, - }], - ice_transport_policy: RTCIceTransportPolicy::Relay, - //peer_identity: "offer".to_owned(), - ..Default::default() - }; - let mut m = MediaEngine::default(); - let mut registry = Registry::new(); - //register_default_interceptors(registry, &mut m); - registry = configure_nack(registry, &mut m); - registry = configure_rtcp_reports(registry); - let api = APIBuilder::new() - .with_media_engine(m) - .with_interceptor_registry(registry) - .build(); - - let peer_connection = Arc::new(api.new_peer_connection(config).await?); - let w_pc = Arc::downgrade(&peer_connection); - peer_connection.on_ice_candidate(Box::new(move |c|{ - let w_pc2 = w_pc.clone(); - Box::pin(async move { - if let Some(c) = c { - if let Some(w_pc) = w_pc2.upgrade() { - let remote_description = w_pc.remote_description().await; - tracing::info!("answer on ice connection: {remote_description:?}") - } - } - }) - })); - - - peer_connection.on_peer_connection_state_change(Box::new(move |s|{ - tracing::info!("Answer Peer Connection State has changed: {s}"); - Box::pin(async { }) - })); - - peer_connection.on_data_channel(Box::new(move |d| { - let d_label = d.label().to_owned(); - let d_id = d.id(); - tracing::info!("New DataChannel {d_label} {d_id}"); - Box::pin(async move { - let d2 = Arc::clone(&d); - let d_label2 = d_label.clone(); - let d_id2 = d_id; - d.on_open(Box::new(move|| { - tracing::info!("Data channel '{d_label2}'-'{d_id2}' open. Random messages will now be sent to any connected DataChannels every 5 seconds"); - Box::pin(async { }) - })); - d.on_message(Box::new(move |msg|{ - let msg_str = String::from_utf8(msg.data.to_vec()).unwrap(); - tracing::info!("answer receive data label: {d_label}, data: {msg_str}"); - Box::pin(async { }) - })); - }) - })); - - - - Ok(peer_connection) -} -async fn offer() -> anyhow::Result>{ - - // let config = RTCConfiguration { - // ice_servers: vec![RTCIceServer { - // urls: vec!["stun:stun.l.google.com:19302".to_owned()], - // ..Default::default() - // }], - // ..Default::default() - // }; - let config = RTCConfiguration { - ice_servers: vec![RTCIceServer { - urls: vec![TURN_SERVER.to_owned()], - username: "offer".to_owned(), - credential: "test".to_owned(), - credential_type: RTCIceCredentialType::Password, - },RTCIceServer { - urls: vec![SELF_TURN_SERVER.to_owned()], - username: "offer".to_owned(), - credential: "test".to_owned(), - credential_type: RTCIceCredentialType::Password, - }], - ice_transport_policy: RTCIceTransportPolicy::Relay, - - //peer_identity: "answer".to_owned(), - ..Default::default() - }; - - //let config = RTCConfiguration::default(); - let mut m = MediaEngine::default(); - let mut registry = Registry::new(); - //register_default_interceptors(registry, &mut m); - registry = configure_nack(registry, &mut m); - registry = configure_rtcp_reports(registry); - let api = APIBuilder::new() - .with_media_engine(m) - .with_interceptor_registry(registry) - .build(); - - let peer_connection = Arc::new(api.new_peer_connection(config).await?); - let w_pc = Arc::downgrade(&peer_connection); - peer_connection.on_ice_candidate(Box::new(move |c|{ - let w_pc2 = w_pc.clone(); - Box::pin(async move { - if let Some(c) = c { - if let Some(w_pc) = w_pc2.upgrade() { - let remote_description = w_pc.remote_description().await; - tracing::info!(" on ice connection: {remote_description:?}") - } - } - }) - })); - - - peer_connection.on_peer_connection_state_change(Box::new(move |s|{ - println!("Peer Connection State has changed: {s}"); - - Box::pin(async { }) - })); - - let data_channel = peer_connection.create_data_channel("data",None).await?; - - let dc = Arc::downgrade(&data_channel); - data_channel.on_open(Box::new(move || { - //let data_channel = data_channel.clone(); - tracing::info!(" DataChannel Open"); - Box::pin(async move{ - loop { - if let Some(data_channel) = dc.upgrade() { - data_channel.send_text("1".to_owned()).await; - tokio::time::sleep(Duration::from_secs(5)).await; - } else { - break; - } - } - // - }) - })); - Ok(peer_connection) -} +} \ No newline at end of file diff --git a/relay/src/reconnect.rs b/relay/src/reconnect.rs new file mode 100644 index 0000000..3c627d7 --- /dev/null +++ b/relay/src/reconnect.rs @@ -0,0 +1,231 @@ +use std::sync::Arc; +use std::time::Duration; +use tokio::sync::mpsc::Sender; + +use webrtc::api::media_engine::MediaEngine; +use webrtc::api::APIBuilder; +use webrtc::api::interceptor_registry::{configure_nack, configure_rtcp_reports}; +use webrtc::ice_transport::ice_candidate::{RTCIceCandidate, RTCIceCandidateInit}; +use webrtc::ice_transport::ice_credential_type::RTCIceCredentialType; +use webrtc::ice_transport::ice_server::RTCIceServer; +use webrtc::interceptor::registry::Registry; +use webrtc::peer_connection::configuration::RTCConfiguration; +use webrtc::peer_connection::policy::ice_transport_policy::RTCIceTransportPolicy; +use webrtc::peer_connection::RTCPeerConnection; +use webrtc::peer_connection::sdp::session_description::RTCSessionDescription; + +const TURN_SERVER:&str = "turn:113.31.103.71:13478"; +const SELF_TURN_SERVER:&str = "turn:192.168.31.37:3478"; + + + + +pub async fn reconnect() -> anyhow::Result<()>{ + let (offer_sender, mut offer_receiver) = tokio::sync::mpsc::channel::(10); + let (answer_sender, mut answer_receiver) = tokio::sync::mpsc::channel::(10); + + + let answer_connection = answer(answer_sender).await?; + let offer_connection = offer(offer_sender).await?; + + let a_c = answer_connection.clone(); + let o_c = offer_connection.clone(); + + tokio::spawn(async move { + while let Some(candidate) = offer_receiver.recv().await { + tracing::info!("offer candidate: {candidate:?}"); + let _ = a_c.add_ice_candidate( candidate.to_json().unwrap()).await; + } + }); + + tokio::spawn(async move { + while let Some(candidate) = answer_receiver.recv().await { + tracing::info!("answer candidate: {candidate:?}"); + let _ = o_c.add_ice_candidate( candidate.to_json().unwrap()).await; + } + }); + + let offer = offer_connection.create_offer(None).await?; + offer_connection.set_local_description(offer.clone()).await?; + + // let mut gather_complete = offer_connection.gathering_complete_promise().await; + // let _ = gather_complete.recv().await; + // let offer = offer_connection.local_description().await.unwrap(); + + tracing::info!("Offer: {offer:?}"); + + answer_connection.set_remote_description(offer).await?; + + + + let answer = answer_connection.create_answer(None).await?; + answer_connection.set_local_description(answer.clone()).await?; + + // let mut gather_complete= answer_connection.gathering_complete_promise().await; + // let _ = gather_complete.recv().await; + // let answer = answer_connection.local_description().await.unwrap(); + // tracing::info!("answer collect Session Description finish"); + + + offer_connection.set_remote_description(answer).await?; + Ok(()) +} +async fn answer(sender: Sender) -> anyhow::Result> { + // let config = RTCConfiguration { + // ice_servers: vec![RTCIceServer { + // urls: vec!["stun:stun.l.google.com:19302".to_owned()], + // ..Default::default() + // }], + // ..Default::default() + // }; + //let config = RTCConfiguration::default(); + + let config = RTCConfiguration { + ice_servers: vec![RTCIceServer { + urls: vec![TURN_SERVER.to_owned()], + username: "answer".to_owned(), + credential: "test".to_owned(), + credential_type: RTCIceCredentialType::Password, + }, /*RTCIceServer { + urls: vec![SELF_TURN_SERVER.to_owned()], + username: "answer".to_owned(), + credential: "test".to_owned(), + + credential_type: RTCIceCredentialType::Password, + }*/], + ice_transport_policy: RTCIceTransportPolicy::Relay, + //peer_identity: "offer".to_owned(), + ..Default::default() + }; + let mut m = MediaEngine::default(); + let mut registry = Registry::new(); + //register_default_interceptors(registry, &mut m); + registry = configure_nack(registry, &mut m); + registry = configure_rtcp_reports(registry); + let api = APIBuilder::new() + .with_media_engine(m) + .with_interceptor_registry(registry) + .build(); + + let peer_connection = Arc::new(api.new_peer_connection(config).await?); + let w_pc = Arc::downgrade(&peer_connection); + let sender = Arc::new(sender); + peer_connection.on_ice_candidate(Box::new(move |c|{ + let w_pc2 = w_pc.clone(); + + let sender = sender.clone(); + Box::pin(async move { + if let Some(c) = c { + let _ = sender.send(c).await; + } + }) + })); + + + peer_connection.on_peer_connection_state_change(Box::new(move |s|{ + tracing::info!("Answer Peer Connection State has changed: {s}"); + Box::pin(async { }) + })); + + peer_connection.on_data_channel(Box::new(move |d| { + let d_label = d.label().to_owned(); + let d_id = d.id(); + tracing::info!("New DataChannel {d_label} {d_id}"); + Box::pin(async move { + let d2 = Arc::clone(&d); + let d_label2 = d_label.clone(); + let d_id2 = d_id; + d.on_open(Box::new(move|| { + tracing::info!("Data channel '{d_label2}'-'{d_id2}' open. Random messages will now be sent to any connected DataChannels every 5 seconds"); + Box::pin(async { }) + })); + d.on_message(Box::new(move |msg|{ + let msg_str = String::from_utf8(msg.data.to_vec()).unwrap(); + tracing::info!("answer receive data label: {d_label}, data: {msg_str}"); + Box::pin(async { }) + })); + }) + })); + + + + Ok(peer_connection) +} +async fn offer(sender: Sender) -> anyhow::Result>{ + //let (sender, receiver) = tokio::sync::mpsc::channel::(10); + // let config = RTCConfiguration { + // ice_servers: vec![RTCIceServer { + // urls: vec!["stun:stun.l.google.com:19302".to_owned()], + // ..Default::default() + // }], + // ..Default::default() + // }; + let config = RTCConfiguration { + ice_servers: vec![RTCIceServer { + urls: vec![TURN_SERVER.to_owned()], + username: "offer".to_owned(), + credential: "test".to_owned(), + credential_type: RTCIceCredentialType::Password, + }, /*RTCIceServer { + urls: vec![SELF_TURN_SERVER.to_owned()], + username: "offer".to_owned(), + credential: "test".to_owned(), + credential_type: RTCIceCredentialType::Password, + }*/], + ice_transport_policy: RTCIceTransportPolicy::Relay, + + //peer_identity: "answer".to_owned(), + ..Default::default() + }; + + //let config = RTCConfiguration::default(); + let mut m = MediaEngine::default(); + let mut registry = Registry::new(); + //register_default_interceptors(registry, &mut m); + registry = configure_nack(registry, &mut m); + registry = configure_rtcp_reports(registry); + let api = APIBuilder::new() + .with_media_engine(m) + .with_interceptor_registry(registry) + .build(); + + let peer_connection = Arc::new(api.new_peer_connection(config).await?); + let w_pc = Arc::downgrade(&peer_connection); + let sender = Arc::new(sender); + peer_connection.on_ice_candidate(Box::new(move |c|{ + let w_pc2 = w_pc.clone(); + let sender = sender.clone(); + Box::pin(async move { + if let Some(c) = c { + let _ = sender.send(c).await; + } + }) + })); + + + peer_connection.on_peer_connection_state_change(Box::new(move |s|{ + println!("Peer Connection State has changed: {s}"); + + Box::pin(async { }) + })); + + let data_channel = peer_connection.create_data_channel("data",None).await?; + + let dc = Arc::downgrade(&data_channel); + data_channel.on_open(Box::new(move || { + //let data_channel = data_channel.clone(); + tracing::info!(" DataChannel Open"); + Box::pin(async move{ + loop { + if let Some(data_channel) = dc.upgrade() { + data_channel.send_text("1".to_owned()).await; + tokio::time::sleep(Duration::from_secs(5)).await; + } else { + break; + } + } + // + }) + })); + Ok(peer_connection) +} diff --git a/relay/src/simple.rs b/relay/src/simple.rs new file mode 100644 index 0000000..ba8f929 --- /dev/null +++ b/relay/src/simple.rs @@ -0,0 +1,212 @@ +use std::sync::Arc; +use std::time::Duration; + +use webrtc::api::media_engine::MediaEngine; +use webrtc::api::APIBuilder; +use webrtc::api::interceptor_registry::{configure_nack, configure_rtcp_reports}; +use webrtc::ice_transport::ice_credential_type::RTCIceCredentialType; +use webrtc::ice_transport::ice_server::RTCIceServer; +use webrtc::interceptor::registry::Registry; +use webrtc::peer_connection::configuration::RTCConfiguration; +use webrtc::peer_connection::policy::ice_transport_policy::RTCIceTransportPolicy; +use webrtc::peer_connection::RTCPeerConnection; + +const TURN_SERVER: &str = "turn:113.31.103.71:13478"; +const SELF_TURN_SERVER: &str = "turn:192.168.31.37:3478"; + + +pub async fn simple() -> anyhow::Result<()> { + let answer_connection = answer().await?; + let offer_connection = offer().await?; + let offer = offer_connection.create_offer(None).await?; + offer_connection.set_local_description(offer.clone()).await?; + let mut gather_complete = offer_connection.gathering_complete_promise().await; + let _ = gather_complete.recv().await; + + + let offer = offer_connection.local_description().await.unwrap(); + tracing::info!("Offer: {offer:?}"); + + answer_connection.set_remote_description(offer).await?; + + + let answer = answer_connection.create_answer(None).await?; + answer_connection.set_local_description(answer.clone()).await?; + let mut gather_complete = answer_connection.gathering_complete_promise().await; + + let _ = gather_complete.recv().await; + + tracing::info!("answer collect Session Description finish"); + let answer_local_description = answer_connection.local_description().await.unwrap(); + //tracing::info!("answer description: {answer_local_description:?}"); + + + offer_connection.set_remote_description(answer_local_description).await?; + Ok(()) +} + +async fn answer() -> anyhow::Result> { + // let config = RTCConfiguration { + // ice_servers: vec![RTCIceServer { + // urls: vec!["stun:stun.l.google.com:19302".to_owned()], + // ..Default::default() + // }], + // ..Default::default() + // }; + //let config = RTCConfiguration::default(); + + let config = RTCConfiguration { + ice_servers: vec![ + RTCIceServer { + urls: vec![TURN_SERVER.to_owned()], + username: "answer".to_owned(), + credential: "test".to_owned(), + credential_type: RTCIceCredentialType::Password, + }, + RTCIceServer { + urls: vec![SELF_TURN_SERVER.to_owned()], + username: "answer".to_owned(), + credential: "test".to_owned(), + credential_type: RTCIceCredentialType::Password, + }, + ], + ice_transport_policy: RTCIceTransportPolicy::Relay, + //peer_identity: "offer".to_owned(), + ..Default::default() + }; + let mut m = MediaEngine::default(); + let mut registry = Registry::new(); + //register_default_interceptors(registry, &mut m); + registry = configure_nack(registry, &mut m); + registry = configure_rtcp_reports(registry); + let api = APIBuilder::new() + .with_media_engine(m) + .with_interceptor_registry(registry) + .build(); + + let peer_connection = Arc::new(api.new_peer_connection(config).await?); + let w_pc = Arc::downgrade(&peer_connection); + peer_connection.on_ice_candidate(Box::new(move |c| { + let w_pc2 = w_pc.clone(); + Box::pin(async move { + if let Some(c) = c { + if let Some(w_pc) = w_pc2.upgrade() { + let remote_description = w_pc.remote_description().await; + tracing::info!("answer on ice connection: {remote_description:?}") + } + } + }) + })); + + + peer_connection.on_peer_connection_state_change(Box::new(move |s| { + tracing::info!("Answer Peer Connection State has changed: {s}"); + Box::pin(async {}) + })); + + peer_connection.on_data_channel(Box::new(move |d| { + let d_label = d.label().to_owned(); + let d_id = d.id(); + tracing::info!("New DataChannel {d_label} {d_id}"); + Box::pin(async move { + let d2 = Arc::clone(&d); + let d_label2 = d_label.clone(); + let d_id2 = d_id; + d.on_open(Box::new(move || { + tracing::info!("Data channel '{d_label2}'-'{d_id2}' open. Random messages will now be sent to any connected DataChannels every 5 seconds"); + Box::pin(async {}) + })); + d.on_message(Box::new(move |msg| { + let msg_str = String::from_utf8(msg.data.to_vec()).unwrap(); + tracing::info!("answer receive data label: {d_label}, data: {msg_str}"); + Box::pin(async {}) + })); + }) + })); + + + Ok(peer_connection) +} + +async fn offer() -> anyhow::Result> { + + // let config = RTCConfiguration { + // ice_servers: vec![RTCIceServer { + // urls: vec!["stun:stun.l.google.com:19302".to_owned()], + // ..Default::default() + // }], + // ..Default::default() + // }; + let config = RTCConfiguration { + ice_servers: vec![ + RTCIceServer { + urls: vec![TURN_SERVER.to_owned()], + username: "offer".to_owned(), + credential: "test".to_owned(), + credential_type: RTCIceCredentialType::Password, + }, + RTCIceServer { + urls: vec![SELF_TURN_SERVER.to_owned()], + username: "offer".to_owned(), + credential: "test".to_owned(), + credential_type: RTCIceCredentialType::Password, + } + ], + ice_transport_policy: RTCIceTransportPolicy::Relay, + + //peer_identity: "answer".to_owned(), + ..Default::default() + }; + + //let config = RTCConfiguration::default(); + let mut m = MediaEngine::default(); + let mut registry = Registry::new(); + //register_default_interceptors(registry, &mut m); + registry = configure_nack(registry, &mut m); + registry = configure_rtcp_reports(registry); + let api = APIBuilder::new() + .with_media_engine(m) + .with_interceptor_registry(registry) + .build(); + + let peer_connection = Arc::new(api.new_peer_connection(config).await?); + let w_pc = Arc::downgrade(&peer_connection); + peer_connection.on_ice_candidate(Box::new(move |c| { + let w_pc2 = w_pc.clone(); + Box::pin(async move { + if let Some(c) = c { + if let Some(w_pc) = w_pc2.upgrade() { + let remote_description = w_pc.remote_description().await; + tracing::info!(" on ice connection: {remote_description:?}") + } + } + }) + })); + + + peer_connection.on_peer_connection_state_change(Box::new(move |s| { + println!("Peer Connection State has changed: {s}"); + + Box::pin(async {}) + })); + + let data_channel = peer_connection.create_data_channel("data", None).await?; + + let dc = Arc::downgrade(&data_channel); + data_channel.on_open(Box::new(move || { + //let data_channel = data_channel.clone(); + tracing::info!(" DataChannel Open"); + Box::pin(async move { + loop { + if let Some(data_channel) = dc.upgrade() { + data_channel.send_text("1".to_owned()).await; + tokio::time::sleep(Duration::from_secs(5)).await; + } else { + break; + } + } + // + }) + })); + Ok(peer_connection) +} From c72989bbe3037babbfd9418ae2e36d0b023c849c Mon Sep 17 00:00:00 2001 From: timzaak Date: Mon, 23 Oct 2023 23:43:49 +0800 Subject: [PATCH 08/14] add reconnection --- relay/Cargo.lock | 2 - relay/Cargo.toml | 4 +- relay/src/reconnect.rs | 145 +++++++++++++++++++++++------------------ relay/src/simple.rs | 3 +- 4 files changed, 85 insertions(+), 69 deletions(-) diff --git a/relay/Cargo.lock b/relay/Cargo.lock index 2eff881..d06cc1b 100644 --- a/relay/Cargo.lock +++ b/relay/Cargo.lock @@ -1212,8 +1212,6 @@ version = "0.0.1" dependencies = [ "anyhow", "clap", - "serde", - "serde_json", "tokio", "tracing", "tracing-subscriber", diff --git a/relay/Cargo.toml b/relay/Cargo.toml index 2614c9c..50e1624 100644 --- a/relay/Cargo.toml +++ b/relay/Cargo.toml @@ -13,6 +13,6 @@ tracing-subscriber = "0.3.17" tracing = "0.1.39" webrtc = "0.9.0" anyhow = "1" -serde = "1" -serde_json = "1" +#serde = "1" +#serde_json = "1" [dev-dependencies] diff --git a/relay/src/reconnect.rs b/relay/src/reconnect.rs index 3c627d7..963a905 100644 --- a/relay/src/reconnect.rs +++ b/relay/src/reconnect.rs @@ -10,23 +10,51 @@ use webrtc::ice_transport::ice_credential_type::RTCIceCredentialType; use webrtc::ice_transport::ice_server::RTCIceServer; use webrtc::interceptor::registry::Registry; use webrtc::peer_connection::configuration::RTCConfiguration; +use webrtc::peer_connection::offer_answer_options::RTCOfferOptions; +use webrtc::peer_connection::peer_connection_state::RTCPeerConnectionState; use webrtc::peer_connection::policy::ice_transport_policy::RTCIceTransportPolicy; use webrtc::peer_connection::RTCPeerConnection; -use webrtc::peer_connection::sdp::session_description::RTCSessionDescription; -const TURN_SERVER:&str = "turn:113.31.103.71:13478"; -const SELF_TURN_SERVER:&str = "turn:192.168.31.37:3478"; +const TURN_SERVER: &str = "turn:113.31.103.71:13478"; +const SELF_TURN_SERVER: &str = "turn:192.168.31.37:3478"; +fn get_relay_config(user_name:String) -> RTCConfiguration { + RTCConfiguration { + ice_servers: vec![RTCIceServer { + urls: vec![TURN_SERVER.to_owned()], + username: user_name.clone(), + credential: "test".to_owned(), + credential_type: RTCIceCredentialType::Password, + }, RTCIceServer { + urls: vec![SELF_TURN_SERVER.to_owned()], + username: user_name.clone(), + credential: "test".to_owned(), + + credential_type: RTCIceCredentialType::Password, + }], + ice_transport_policy: RTCIceTransportPolicy::Relay, +//peer_identity: "offer".to_owned(), + ..Default::default() + } +} + +fn get_default_config() -> RTCConfiguration { + return RTCConfiguration { + ..Default::default() + }; +} -pub async fn reconnect() -> anyhow::Result<()>{ +pub async fn reconnect() -> anyhow::Result<()> { let (offer_sender, mut offer_receiver) = tokio::sync::mpsc::channel::(10); let (answer_sender, mut answer_receiver) = tokio::sync::mpsc::channel::(10); + let (offer_close_sender, mut offer_close_receiver) = tokio::sync::mpsc::channel::<()>(5); + let (answer_close_sender, mut answer_close_receiver) = tokio::sync::mpsc::channel::<()>(5); - let answer_connection = answer(answer_sender).await?; - let offer_connection = offer(offer_sender).await?; + let answer_connection = answer(answer_sender, answer_close_sender).await?; + let offer_connection = offer(offer_sender, offer_close_sender).await?; let a_c = answer_connection.clone(); let o_c = offer_connection.clone(); @@ -34,15 +62,17 @@ pub async fn reconnect() -> anyhow::Result<()>{ tokio::spawn(async move { while let Some(candidate) = offer_receiver.recv().await { tracing::info!("offer candidate: {candidate:?}"); - let _ = a_c.add_ice_candidate( candidate.to_json().unwrap()).await; + let _ = a_c.add_ice_candidate(candidate.to_json().unwrap()).await; } + tracing::info!("offer listen candidate finish"); }); tokio::spawn(async move { while let Some(candidate) = answer_receiver.recv().await { tracing::info!("answer candidate: {candidate:?}"); - let _ = o_c.add_ice_candidate( candidate.to_json().unwrap()).await; + let _ = o_c.add_ice_candidate(candidate.to_json().unwrap()).await; } + tracing::info!("answer listen candidate finish"); }); let offer = offer_connection.create_offer(None).await?; @@ -57,7 +87,6 @@ pub async fn reconnect() -> anyhow::Result<()>{ answer_connection.set_remote_description(offer).await?; - let answer = answer_connection.create_answer(None).await?; answer_connection.set_local_description(answer.clone()).await?; @@ -66,11 +95,25 @@ pub async fn reconnect() -> anyhow::Result<()>{ // let answer = answer_connection.local_description().await.unwrap(); // tracing::info!("answer collect Session Description finish"); - offer_connection.set_remote_description(answer).await?; + + tokio::spawn(async move { + while let Some(_) = offer_close_receiver.recv().await { + tokio::time::sleep(Duration::from_secs(2)).await; + let offer = offer_connection.create_offer(Some(RTCOfferOptions{ice_restart: true, ..Default::default()})).await.unwrap(); + offer_connection.set_local_description(offer.clone()).await.unwrap(); + let _ = answer_connection.set_remote_description(offer).await; + + let answer = answer_connection.create_answer(None).await.unwrap(); + answer_connection.set_local_description(answer.clone()).await.unwrap(); + let _ = offer_connection.set_remote_description(answer).await; + } + }); + Ok(()) } -async fn answer(sender: Sender) -> anyhow::Result> { + +async fn answer(sender: Sender, close_sender: Sender<()>) -> anyhow::Result> { // let config = RTCConfiguration { // ice_servers: vec![RTCIceServer { // urls: vec!["stun:stun.l.google.com:19302".to_owned()], @@ -80,23 +123,7 @@ async fn answer(sender: Sender) -> anyhow::Result) -> anyhow::Result) -> anyhow::Result) -> anyhow::Result) -> anyhow::Result>{ + +async fn offer(sender: Sender, close_sender: Sender<()>) -> anyhow::Result> { //let (sender, receiver) = tokio::sync::mpsc::channel::(10); // let config = RTCConfiguration { // ice_servers: vec![RTCIceServer { @@ -160,23 +189,7 @@ async fn offer(sender: Sender) -> anyhow::Result) -> anyhow::Result) -> anyhow::Result anyhow::Result> { peer_connection.on_peer_connection_state_change(Box::new(move |s| { - tracing::info!("Answer Peer Connection State has changed: {s}"); + tracing::info!("answer peer connection State has changed: {s}"); + Box::pin(async {}) })); From 32dd493a8027220d9f626a721fd328d5bf0d653f Mon Sep 17 00:00:00 2001 From: timzaak Date: Tue, 24 Oct 2023 23:29:00 +0800 Subject: [PATCH 09/14] add stun example --- relay/src/main.rs | 4 +- relay/src/reconnect.rs | 2 +- relay/src/simple_stun.rs | 190 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 194 insertions(+), 2 deletions(-) create mode 100644 relay/src/simple_stun.rs diff --git a/relay/src/main.rs b/relay/src/main.rs index 68cd356..70042f5 100644 --- a/relay/src/main.rs +++ b/relay/src/main.rs @@ -1,6 +1,7 @@ use tracing_subscriber; mod simple; mod reconnect; +mod simple_stun; @@ -9,7 +10,8 @@ mod reconnect; async fn main() -> anyhow::Result<()>{ tracing_subscriber::fmt::init(); //simple::simple().await.unwrap(); - reconnect::reconnect().await.unwrap(); + simple_stun::simple_stun().await.unwrap(); + //reconnect::reconnect().await.unwrap(); tokio::signal::ctrl_c().await?; Ok(()) } \ No newline at end of file diff --git a/relay/src/reconnect.rs b/relay/src/reconnect.rs index 963a905..b1813e4 100644 --- a/relay/src/reconnect.rs +++ b/relay/src/reconnect.rs @@ -5,7 +5,7 @@ use tokio::sync::mpsc::Sender; use webrtc::api::media_engine::MediaEngine; use webrtc::api::APIBuilder; use webrtc::api::interceptor_registry::{configure_nack, configure_rtcp_reports}; -use webrtc::ice_transport::ice_candidate::{RTCIceCandidate, RTCIceCandidateInit}; +use webrtc::ice_transport::ice_candidate::RTCIceCandidate; use webrtc::ice_transport::ice_credential_type::RTCIceCredentialType; use webrtc::ice_transport::ice_server::RTCIceServer; use webrtc::interceptor::registry::Registry; diff --git a/relay/src/simple_stun.rs b/relay/src/simple_stun.rs new file mode 100644 index 0000000..7b4c379 --- /dev/null +++ b/relay/src/simple_stun.rs @@ -0,0 +1,190 @@ +use std::sync::Arc; +use std::time::Duration; + +use webrtc::api::media_engine::MediaEngine; +use webrtc::api::APIBuilder; +use webrtc::api::interceptor_registry::{configure_nack, configure_rtcp_reports}; +use webrtc::ice_transport::ice_server::RTCIceServer; +use webrtc::interceptor::registry::Registry; +use webrtc::peer_connection::configuration::RTCConfiguration; +use webrtc::peer_connection::RTCPeerConnection; + +const STUN_SERVER: &str = "stun:google.de:3478"; +const SELF_STUN_SERVER: &str = "stun:192.168.31.37:3478"; + +fn get_config() -> RTCConfiguration{ + return RTCConfiguration { + ice_servers: vec![ + RTCIceServer { + urls: vec![STUN_SERVER.to_owned()], + ..Default::default() + }, + RTCIceServer { + urls: vec![SELF_STUN_SERVER.to_owned()], + ..Default::default() + } + ], + + ..Default::default() + }; +} + +pub async fn simple_stun() -> anyhow::Result<()> { + let answer_connection = answer().await?; + let offer_connection = offer().await?; + let offer = offer_connection.create_offer(None).await?; + offer_connection.set_local_description(offer.clone()).await?; + let mut gather_complete = offer_connection.gathering_complete_promise().await; + let _ = gather_complete.recv().await; + + + let offer = offer_connection.local_description().await.unwrap(); + tracing::info!("Offer: {offer:?}"); + + answer_connection.set_remote_description(offer).await?; + + + let answer = answer_connection.create_answer(None).await?; + answer_connection.set_local_description(answer.clone()).await?; + let mut gather_complete = answer_connection.gathering_complete_promise().await; + + let _ = gather_complete.recv().await; + + tracing::info!("answer collect Session Description finish"); + let answer_local_description = answer_connection.local_description().await.unwrap(); + //tracing::info!("answer description: {answer_local_description:?}"); + + + offer_connection.set_remote_description(answer_local_description).await?; + Ok(()) +} + +async fn answer() -> anyhow::Result> { + // let config = RTCConfiguration { + // ice_servers: vec![RTCIceServer { + // urls: vec!["stun:stun.l.google.com:19302".to_owned()], + // ..Default::default() + // }], + // ..Default::default() + // }; + //let config = RTCConfiguration::default(); + + + let mut m = MediaEngine::default(); + let mut registry = Registry::new(); + //register_default_interceptors(registry, &mut m); + registry = configure_nack(registry, &mut m); + registry = configure_rtcp_reports(registry); + let api = APIBuilder::new() + .with_media_engine(m) + .with_interceptor_registry(registry) + .build(); + + let peer_connection = Arc::new(api.new_peer_connection(get_config()).await?); + let w_pc = Arc::downgrade(&peer_connection); + peer_connection.on_ice_candidate(Box::new(move |c| { + let w_pc2 = w_pc.clone(); + Box::pin(async move { + if let Some(c) = c { + if let Some(w_pc) = w_pc2.upgrade() { + let remote_description = w_pc.remote_description().await; + tracing::info!("answer on ice connection: {remote_description:?}") + } + } + }) + })); + + + peer_connection.on_peer_connection_state_change(Box::new(move |s| { + tracing::info!("answer peer connection State has changed: {s}"); + + Box::pin(async {}) + })); + + peer_connection.on_data_channel(Box::new(move |d| { + let d_label = d.label().to_owned(); + let d_id = d.id(); + tracing::info!("New DataChannel {d_label} {d_id}"); + Box::pin(async move { + let d2 = Arc::clone(&d); + let d_label2 = d_label.clone(); + let d_id2 = d_id; + d.on_open(Box::new(move || { + tracing::info!("Data channel '{d_label2}'-'{d_id2}' open. Random messages will now be sent to any connected DataChannels every 5 seconds"); + Box::pin(async {}) + })); + d.on_message(Box::new(move |msg| { + let msg_str = String::from_utf8(msg.data.to_vec()).unwrap(); + tracing::info!("answer receive data label: {d_label}, data: {msg_str}"); + Box::pin(async {}) + })); + }) + })); + + + Ok(peer_connection) +} + +async fn offer() -> anyhow::Result> { + + // let config = RTCConfiguration { + // ice_servers: vec![RTCIceServer { + // urls: vec!["stun:stun.l.google.com:19302".to_owned()], + // ..Default::default() + // }], + // ..Default::default() + // }; + + + //let config = RTCConfiguration::default(); + let mut m = MediaEngine::default(); + let mut registry = Registry::new(); + //register_default_interceptors(registry, &mut m); + registry = configure_nack(registry, &mut m); + registry = configure_rtcp_reports(registry); + let api = APIBuilder::new() + .with_media_engine(m) + .with_interceptor_registry(registry) + .build(); + + let peer_connection = Arc::new(api.new_peer_connection(get_config()).await?); + let w_pc = Arc::downgrade(&peer_connection); + peer_connection.on_ice_candidate(Box::new(move |c| { + let w_pc2 = w_pc.clone(); + Box::pin(async move { + if let Some(c) = c { + if let Some(w_pc) = w_pc2.upgrade() { + let remote_description = w_pc.remote_description().await; + tracing::info!(" on ice connection: {remote_description:?}") + } + } + }) + })); + + + peer_connection.on_peer_connection_state_change(Box::new(move |s| { + println!("Peer Connection State has changed: {s}"); + + Box::pin(async {}) + })); + + let data_channel = peer_connection.create_data_channel("data", None).await?; + + let dc = Arc::downgrade(&data_channel); + data_channel.on_open(Box::new(move || { + //let data_channel = data_channel.clone(); + tracing::info!(" DataChannel Open"); + Box::pin(async move { + loop { + if let Some(data_channel) = dc.upgrade() { + data_channel.send_text("1".to_owned()).await; + tokio::time::sleep(Duration::from_secs(5)).await; + } else { + break; + } + } + // + }) + })); + Ok(peer_connection) +} From b92db5a7b654542c1e36125d2e6c3d9292c2e3fc Mon Sep 17 00:00:00 2001 From: timzaak Date: Fri, 27 Oct 2023 00:24:43 +0800 Subject: [PATCH 10/14] add simple ice api --- relay/Cargo.lock | 2 + relay/Cargo.toml | 3 + relay/src/main.rs | 6 +- relay/src/simple_ice_api.rs | 112 ++++++++++++++++++++++++++++++++++++ 4 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 relay/src/simple_ice_api.rs diff --git a/relay/Cargo.lock b/relay/Cargo.lock index d06cc1b..a7e63a4 100644 --- a/relay/Cargo.lock +++ b/relay/Cargo.lock @@ -1216,6 +1216,8 @@ dependencies = [ "tracing", "tracing-subscriber", "webrtc", + "webrtc-ice", + "webrtc-util", ] [[package]] diff --git a/relay/Cargo.toml b/relay/Cargo.toml index 50e1624..ae35929 100644 --- a/relay/Cargo.toml +++ b/relay/Cargo.toml @@ -12,6 +12,9 @@ clap = "4.4" tracing-subscriber = "0.3.17" tracing = "0.1.39" webrtc = "0.9.0" + +webrtc-ice = "0.10.0" +webrtc-util = "0.8.0" anyhow = "1" #serde = "1" #serde_json = "1" diff --git a/relay/src/main.rs b/relay/src/main.rs index 70042f5..1ccc26b 100644 --- a/relay/src/main.rs +++ b/relay/src/main.rs @@ -3,6 +3,8 @@ mod simple; mod reconnect; mod simple_stun; +mod simple_ice_api; + @@ -10,8 +12,10 @@ mod simple_stun; async fn main() -> anyhow::Result<()>{ tracing_subscriber::fmt::init(); //simple::simple().await.unwrap(); - simple_stun::simple_stun().await.unwrap(); + //simple_stun::simple_stun().await.unwrap(); //reconnect::reconnect().await.unwrap(); + + simple_ice_api::simple_ice_api().await.unwrap(); tokio::signal::ctrl_c().await?; Ok(()) } \ No newline at end of file diff --git a/relay/src/simple_ice_api.rs b/relay/src/simple_ice_api.rs new file mode 100644 index 0000000..f77e7c0 --- /dev/null +++ b/relay/src/simple_ice_api.rs @@ -0,0 +1,112 @@ +use std::sync::Arc; +use std::time::Duration; + +use webrtc_ice::agent::Agent; +use webrtc_ice::agent::agent_config::AgentConfig; +use webrtc_ice::candidate::Candidate; +use webrtc_ice::candidate::candidate_base::unmarshal_candidate; +use webrtc_ice::network_type::NetworkType; +use webrtc_ice::udp_network::UDPNetwork; +use webrtc_ice::url::Url; +use webrtc_util::Conn; + +//const TURN_SERVER: &str = "turn:113.31.103.71:13478"; +const SELF_TURN_SERVER: &str = "turn:192.168.31.37:3478"; + + +pub async fn simple_ice_api() -> anyhow::Result<()> { + let answer = create_agent().await?; + let offer = create_agent().await?; + //offer.gather_candidates()?; + //answer.gather_candidates()?; + + + let _offer = offer.clone(); + answer.on_candidate(Box::new(move |c|{ + let offer = _offer.clone(); + Box::pin(async move{ + if let Some(c) = c { + let c = c.marshal(); + tracing::info!("answer candidate: {c}"); + let c: Arc = Arc::new(unmarshal_candidate(&c).unwrap()); + offer.add_remote_candidate(&c); + } + }) + })); + + let _answer = answer.clone(); + offer.on_candidate(Box::new(move |c|{ + let answer = _answer.clone(); + Box::pin(async move{ + if let Some(c) = c { + let c = c.marshal(); + tracing::info!("offer candidate: {c}"); + let c: Arc = Arc::new(unmarshal_candidate(&c).unwrap()); + answer.add_remote_candidate(&c); + } + }) + })); + + + + let offer_credentials = offer.get_local_user_credentials().await; + let answer_credentials = answer.get_local_user_credentials().await; + + + + + offer.gather_candidates()?; + answer.gather_candidates()?; + + + + tokio::spawn(async move { + let (_cancel_tx1, cancel_rx1) = tokio::sync::mpsc::channel::<()>(1); + match answer.accept(cancel_rx1, offer_credentials.0, offer_credentials.1).await { + Ok(answer_conn) => { + let mut buf = vec![0u8; 1600]; + while let Ok(n) = answer_conn.recv(&mut buf).await { + tracing::info!("Received: '{}'", std::str::from_utf8(&buf[..n]).unwrap()); + } + } + Err(e) => { + tracing::warn!("answer error:{e}"); + } + } + + }); + + tokio::spawn(async move{ + let (_cancel_tx2, cancel_rx2) = tokio::sync::mpsc::channel::<()>(1); + tokio::time::sleep(Duration::from_secs(2)).await; + match offer.dial(cancel_rx2, answer_credentials.0, answer_credentials.1).await { + Ok(offer_conn) => { + loop { + let _ = offer_conn.send(b"123").await; + tokio::time::sleep(Duration::from_secs(5)).await; + } + } + Err(e) => tracing::warn!("offer error:{e}") + }; + + + }); + + Ok(()) +} + +async fn create_agent() -> anyhow::Result>{ + let config = AgentConfig { + urls: vec![Url::parse_url(SELF_TURN_SERVER).unwrap()], + udp_network: UDPNetwork::Ephemeral(Default::default()), + network_types: vec![NetworkType::Udp4], + ..Default::default() + }; + let ice_agent = Arc::new(Agent::new(config).await?); + ice_agent.on_connection_state_change(Box::new(move |c| { + println!("ICE Connection State has changed: {c}"); + Box::pin(async move {}) + })); + + return Ok(ice_agent); +} From abd1c0dbb35c12bd0469b849c936370290bbc2a3 Mon Sep 17 00:00:00 2001 From: timzaak Date: Fri, 27 Oct 2023 21:24:17 +0800 Subject: [PATCH 11/14] update backend version --- backend/build.sbt | 3 ++- third/web-sugar | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/build.sbt b/backend/build.sbt index 9ea6ccf..c0a7ff9 100644 --- a/backend/build.sbt +++ b/backend/build.sbt @@ -1,4 +1,4 @@ -val scala3Version = "3.3.0" +val scala3Version = "3.3.1" maintainer := "timzaak" @@ -26,6 +26,7 @@ lazy val app = project libraryDependencies ++= Seq( "org.eclipse.jetty" % "jetty-webapp" % "11.0.15" % "container;compile", + "org.postgresql" % "postgresql" % "42.6.0", "org.bouncycastle" % "bcprov-jdk18on" % "1.72", // for x25519, "org.scalameta" %% "munit" % "0.7.29" % Test ) diff --git a/third/web-sugar b/third/web-sugar index 29360c5..7fc18d7 160000 --- a/third/web-sugar +++ b/third/web-sugar @@ -1 +1 @@ -Subproject commit 29360c5b4c82a2cd78b9efc19dc13fd78331b150 +Subproject commit 7fc18d7965d7214b5c540eec7760e09ee0fdd61c From eb9705af2a518f2d3118b095f79558112488f53e Mon Sep 17 00:00:00 2001 From: timzaak Date: Sat, 28 Oct 2023 22:36:37 +0800 Subject: [PATCH 12/14] bak --- protobuf/config.proto | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/protobuf/config.proto b/protobuf/config.proto index 4f8ae2d..23cb5a9 100644 --- a/protobuf/config.proto +++ b/protobuf/config.proto @@ -8,30 +8,29 @@ option java_package = "com.timzaak.fornet.protobuf"; enum Protocol { Protocol_TCP = 0; - Protocol_UDP = 1; + Protocol_UDP = 1; //webrtc-rs only support udp } message Interface { optional string name = 1; - repeated string address = 2; - int32 listen_port = 3; + repeated string address = 2; //ip + int32 listen_port = 3; // wirguard port, webrtc does not need it // optional string private_key = 4; // this is no needed now, we may support it in future version repeated string dns = 5; optional uint32 mtu = 6; optional string pre_up = 7; - optional string post_up = 8; + optional string post_up = 8; // wireguard relay need it optional string pre_down = 9; - optional string post_down = 10; + optional string post_down = 10; // wireguard relay need it Protocol protocol = 11; } message Peer { - optional string endpoint = 1; - repeated string allowed_ip = 2; - string public_key = 3; - uint32 persistence_keep_alive = 4; - // This is for tcp - repeated string address = 5; + optional string endpoint = 1; // wireguard relay + repeated string allowed_ip = 2; // ACL, but now wireguard normal node does not support this + string public_key = 3; + uint32 persistence_keep_alive = 4; // wireguard param, can used for webrtc + repeated string address = 5; // ip, should be contained by allowed_ip? } From ceb4ba26b694f4d32b129b446b9fcb549e2cfe8b Mon Sep 17 00:00:00 2001 From: timzaak Date: Mon, 30 Oct 2023 22:18:09 +0800 Subject: [PATCH 13/14] bak --- relay/src/main.rs | 5 +- relay/src/simple_tcp.rs | 206 ++++++++++++++++++++++++++++++++++ relay/turn_server_config.toml | 1 + 3 files changed, 211 insertions(+), 1 deletion(-) create mode 100644 relay/src/simple_tcp.rs diff --git a/relay/src/main.rs b/relay/src/main.rs index 1ccc26b..0567273 100644 --- a/relay/src/main.rs +++ b/relay/src/main.rs @@ -5,6 +5,8 @@ mod simple_stun; mod simple_ice_api; +mod simple_tcp; + @@ -15,7 +17,8 @@ async fn main() -> anyhow::Result<()>{ //simple_stun::simple_stun().await.unwrap(); //reconnect::reconnect().await.unwrap(); - simple_ice_api::simple_ice_api().await.unwrap(); + //simple_ice_api::simple_ice_api().await.unwrap(); + simple_tcp::simple_tcp().await.unwrap(); tokio::signal::ctrl_c().await?; Ok(()) } \ No newline at end of file diff --git a/relay/src/simple_tcp.rs b/relay/src/simple_tcp.rs new file mode 100644 index 0000000..7575d82 --- /dev/null +++ b/relay/src/simple_tcp.rs @@ -0,0 +1,206 @@ +use std::sync::Arc; +use std::time::Duration; + +use webrtc::api::media_engine::MediaEngine; +use webrtc::api::APIBuilder; +use webrtc::api::interceptor_registry::{configure_nack, configure_rtcp_reports}; +use webrtc::ice_transport::ice_credential_type::RTCIceCredentialType; +use webrtc::ice_transport::ice_server::RTCIceServer; +use webrtc::interceptor::registry::Registry; +use webrtc::peer_connection::configuration::RTCConfiguration; +use webrtc::peer_connection::policy::ice_transport_policy::RTCIceTransportPolicy; +use webrtc::peer_connection::RTCPeerConnection; + +//const TURN_SERVER: &str = "turn:113.31.103.71:13478"; +const SELF_TURN_SERVER: &str = "turn:192.168.31.37:3478?transport=tcp"; + + +//Attention: webrtc-rs now does not support +/*TODO: case url.proto == ProtoType::UDP && url.scheme == SchemeType::TURNS{ + case a.proxyDialer != nil && url.Proto == ProtoTypeTCP && (url.Scheme == SchemeTypeTURN || url.Scheme == SchemeTypeTURNS): + case url.Proto == ProtoTypeTCP && url.Scheme == SchemeTypeTURN: + case url.Proto == ProtoTypeTCP && url.Scheme == SchemeTypeTURNS:*/ +pub async fn simple_tcp() -> anyhow::Result<()> { + let answer_connection = answer().await?; + let offer_connection = offer().await?; + let offer = offer_connection.create_offer(None).await?; + offer_connection.set_local_description(offer.clone()).await?; + let mut gather_complete = offer_connection.gathering_complete_promise().await; + let _ = gather_complete.recv().await; + + + let offer = offer_connection.local_description().await.unwrap(); + tracing::info!("Offer: {offer:?}"); + + answer_connection.set_remote_description(offer).await?; + + + let answer = answer_connection.create_answer(None).await?; + answer_connection.set_local_description(answer.clone()).await?; + let mut gather_complete = answer_connection.gathering_complete_promise().await; + + let _ = gather_complete.recv().await; + + tracing::info!("answer collect Session Description finish"); + let answer_local_description = answer_connection.local_description().await.unwrap(); + //tracing::info!("answer description: {answer_local_description:?}"); + + + offer_connection.set_remote_description(answer_local_description).await?; + Ok(()) +} + +async fn answer() -> anyhow::Result> { + // let config = RTCConfiguration { + // ice_servers: vec![RTCIceServer { + // urls: vec!["stun:stun.l.google.com:19302".to_owned()], + // ..Default::default() + // }], + // ..Default::default() + // }; + //let config = RTCConfiguration::default(); + + let config = RTCConfiguration { + ice_servers: vec![ + RTCIceServer { + urls: vec![SELF_TURN_SERVER.to_owned()], + username: "answer".to_owned(), + credential: "test".to_owned(), + credential_type: RTCIceCredentialType::Password, + }, + ], + ice_transport_policy: RTCIceTransportPolicy::Relay, + //peer_identity: "offer".to_owned(), + ..Default::default() + }; + let mut m = MediaEngine::default(); + let mut registry = Registry::new(); + //register_default_interceptors(registry, &mut m); + registry = configure_nack(registry, &mut m); + registry = configure_rtcp_reports(registry); + let api = APIBuilder::new() + .with_media_engine(m) + .with_interceptor_registry(registry) + .build(); + + let peer_connection = Arc::new(api.new_peer_connection(config).await?); + let w_pc = Arc::downgrade(&peer_connection); + peer_connection.on_ice_candidate(Box::new(move |c| { + let w_pc2 = w_pc.clone(); + Box::pin(async move { + if let Some(c) = c { + if let Some(w_pc) = w_pc2.upgrade() { + let remote_description = w_pc.remote_description().await; + tracing::info!("answer on ice connection: {remote_description:?}") + } + } + }) + })); + + + peer_connection.on_peer_connection_state_change(Box::new(move |s| { + tracing::info!("answer peer connection State has changed: {s}"); + + Box::pin(async {}) + })); + + peer_connection.on_data_channel(Box::new(move |d| { + let d_label = d.label().to_owned(); + let d_id = d.id(); + tracing::info!("New DataChannel {d_label} {d_id}"); + Box::pin(async move { + let d2 = Arc::clone(&d); + let d_label2 = d_label.clone(); + let d_id2 = d_id; + d.on_open(Box::new(move || { + tracing::info!("Data channel '{d_label2}'-'{d_id2}' open. Random messages will now be sent to any connected DataChannels every 5 seconds"); + Box::pin(async {}) + })); + d.on_message(Box::new(move |msg| { + let msg_str = String::from_utf8(msg.data.to_vec()).unwrap(); + tracing::info!("answer receive data label: {d_label}, data: {msg_str}"); + Box::pin(async {}) + })); + }) + })); + + + Ok(peer_connection) +} + +async fn offer() -> anyhow::Result> { + + // let config = RTCConfiguration { + // ice_servers: vec![RTCIceServer { + // urls: vec!["stun:stun.l.google.com:19302".to_owned()], + // ..Default::default() + // }], + // ..Default::default() + // }; + let config = RTCConfiguration { + ice_servers: vec![ + RTCIceServer { + urls: vec![SELF_TURN_SERVER.to_owned()], + username: "offer".to_owned(), + credential: "test".to_owned(), + credential_type: RTCIceCredentialType::Password, + } + ], + ice_transport_policy: RTCIceTransportPolicy::Relay, + + //peer_identity: "answer".to_owned(), + ..Default::default() + }; + + //let config = RTCConfiguration::default(); + let mut m = MediaEngine::default(); + let mut registry = Registry::new(); + //register_default_interceptors(registry, &mut m); + registry = configure_nack(registry, &mut m); + registry = configure_rtcp_reports(registry); + let api = APIBuilder::new() + .with_media_engine(m) + .with_interceptor_registry(registry) + .build(); + + let peer_connection = Arc::new(api.new_peer_connection(config).await?); + let w_pc = Arc::downgrade(&peer_connection); + peer_connection.on_ice_candidate(Box::new(move |c| { + let w_pc2 = w_pc.clone(); + Box::pin(async move { + if let Some(c) = c { + if let Some(w_pc) = w_pc2.upgrade() { + let remote_description = w_pc.remote_description().await; + tracing::info!(" on ice connection: {remote_description:?}") + } + } + }) + })); + + + peer_connection.on_peer_connection_state_change(Box::new(move |s| { + println!("Peer Connection State has changed: {s}"); + + Box::pin(async {}) + })); + + let data_channel = peer_connection.create_data_channel("data", None).await?; + + let dc = Arc::downgrade(&data_channel); + data_channel.on_open(Box::new(move || { + //let data_channel = data_channel.clone(); + tracing::info!(" DataChannel Open"); + Box::pin(async move { + loop { + if let Some(data_channel) = dc.upgrade() { + data_channel.send_text("1".to_owned()).await; + tokio::time::sleep(Duration::from_secs(5)).await; + } else { + break; + } + } + // + }) + })); + Ok(peer_connection) +} diff --git a/relay/turn_server_config.toml b/relay/turn_server_config.toml index b0a416a..49fe080 100644 --- a/relay/turn_server_config.toml +++ b/relay/turn_server_config.toml @@ -14,6 +14,7 @@ realm = "localhost" # ipv4 and ipv6. [[turn.interfaces]] transport = "udp" +#transport = "tcp" #bind = "0.0.0.0:13478" bind = "0.0.0.0:3478" # external address From 883e8883d19c3b91d7ce6cf24c95d6b0d2937e64 Mon Sep 17 00:00:00 2001 From: timzaak Date: Fri, 17 Nov 2023 22:05:30 +0800 Subject: [PATCH 14/14] release V0.1.1 --- client/Cargo.lock | 2 +- client/bin/Cargo.toml | 2 +- third/simple-windows-tun | 2 +- third/web-sugar | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/Cargo.lock b/client/Cargo.lock index 0f7f2e8..6d90d9a 100644 --- a/client/Cargo.lock +++ b/client/Cargo.lock @@ -844,7 +844,7 @@ dependencies = [ [[package]] name = "fornet" -version = "0.1.0" +version = "0.1.1" dependencies = [ "anyhow", "cfg-if", diff --git a/client/bin/Cargo.toml b/client/bin/Cargo.toml index 1094db0..d4c0b33 100644 --- a/client/bin/Cargo.toml +++ b/client/bin/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fornet" -version = "0.1.0" +version = "0.1.1" edition = "2021" [[bin]] diff --git a/third/simple-windows-tun b/third/simple-windows-tun index 4c8e97b..a6b0f6b 160000 --- a/third/simple-windows-tun +++ b/third/simple-windows-tun @@ -1 +1 @@ -Subproject commit 4c8e97b260a58a76bb77da6cd7d88ea5b0894fc4 +Subproject commit a6b0f6b3703370052908adedd7ea205c69a33bc8 diff --git a/third/web-sugar b/third/web-sugar index 7fc18d7..b22519d 160000 --- a/third/web-sugar +++ b/third/web-sugar @@ -1 +1 @@ -Subproject commit 7fc18d7965d7214b5c540eec7760e09ee0fdd61c +Subproject commit b22519dacda311aa584f4dc42470f0ad9112b4ee