From 926b879152e008c84eb4412f372b1c1b37a6e0c6 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Tue, 11 Feb 2020 14:04:56 +0200 Subject: [PATCH 01/21] wip --- Cargo.lock | 622 +++++++++++++------------ Cargo.toml | 4 +- Dockerfile | 2 + _dev/coturn/turnserver.conf | 2 +- config.toml | 18 + crates/coturn-telnet/CHANGELOG.md | 26 ++ crates/coturn-telnet/Cargo.toml | 27 ++ crates/coturn-telnet/LICENSE-APACHE.md | 194 ++++++++ crates/coturn-telnet/LICENSE-MIT.md | 25 + crates/coturn-telnet/README.md | 33 ++ crates/coturn-telnet/src/codec.rs | 292 ++++++++++++ crates/coturn-telnet/src/connection.rs | 186 ++++++++ crates/coturn-telnet/src/lib.rs | 8 + crates/coturn-telnet/src/pool.rs | 79 ++++ jason/demo/index.html | 14 +- jason/e2e-demo/js/index.js | 6 +- jason/src/lib.rs | 2 + jason/src/peer/media.rs | 8 +- proto/control-api/build.rs | 11 +- src/conf/turn.rs | 19 + src/lib.rs | 2 + src/media/ice_user.rs | 19 +- src/media/mod.rs | 2 +- src/signalling/participants.rs | 55 ++- src/signalling/room.rs | 4 +- src/turn/cli.rs | 73 +++ src/turn/mod.rs | 1 + src/turn/repo.rs | 52 +-- src/turn/service.rs | 288 ++++-------- 29 files changed, 1514 insertions(+), 560 deletions(-) create mode 100644 crates/coturn-telnet/CHANGELOG.md create mode 100644 crates/coturn-telnet/Cargo.toml create mode 100644 crates/coturn-telnet/LICENSE-APACHE.md create mode 100644 crates/coturn-telnet/LICENSE-MIT.md create mode 100644 crates/coturn-telnet/README.md create mode 100644 crates/coturn-telnet/src/codec.rs create mode 100644 crates/coturn-telnet/src/connection.rs create mode 100644 crates/coturn-telnet/src/lib.rs create mode 100644 crates/coturn-telnet/src/pool.rs create mode 100644 src/turn/cli.rs diff --git a/Cargo.lock b/Cargo.lock index f8e1148d4..a7d449dac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6,7 +6,7 @@ version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -27,11 +27,11 @@ dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "trust-dns-resolver 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -44,16 +44,16 @@ dependencies = [ "actix-rt 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "actix_derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-project 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "trust-dns-proto 0.18.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", "trust-dns-resolver 0.18.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -67,8 +67,8 @@ dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -77,11 +77,11 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -99,8 +99,8 @@ dependencies = [ "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "trust-dns-resolver 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -115,7 +115,7 @@ dependencies = [ "actix-utils 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "trust-dns-proto 0.18.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -160,23 +160,23 @@ dependencies = [ "hashbrown 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "indexmap 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "trust-dns-resolver 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -194,7 +194,7 @@ dependencies = [ "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "brotli2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "copyless 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -202,24 +202,24 @@ dependencies = [ "encoding_rs 0.8.22 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "indexmap 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-project 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -243,7 +243,7 @@ dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "string 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -256,7 +256,7 @@ dependencies = [ "bytestring 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -268,10 +268,10 @@ dependencies = [ "actix-threadpool 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "copyless 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -282,8 +282,8 @@ dependencies = [ "actix-macros 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "actix-threadpool 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "copyless 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -300,11 +300,11 @@ dependencies = [ "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-signal 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-signal 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -316,7 +316,7 @@ dependencies = [ "actix-rt 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "actix-service 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "actix-utils 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -331,8 +331,8 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -348,8 +348,8 @@ name = "actix-service" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-project 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -364,8 +364,8 @@ dependencies = [ "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -377,7 +377,7 @@ dependencies = [ "actix-rt 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "actix-server 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "actix-service 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -402,7 +402,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -421,7 +421,7 @@ dependencies = [ "actix-utils 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -436,8 +436,8 @@ dependencies = [ "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -449,11 +449,11 @@ dependencies = [ "actix-rt 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "actix-service 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-project 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -483,9 +483,9 @@ dependencies = [ "mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -509,18 +509,18 @@ dependencies = [ "actix-utils 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "actix-web-codegen 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "awc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "encoding_rs 0.8.22 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-project 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -535,9 +535,9 @@ dependencies = [ "actix-codec 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "actix-http 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "actix-web 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-project 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -595,7 +595,7 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -621,7 +621,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "arrayref" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -644,7 +644,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "async-trait" -version = "0.1.22" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -689,9 +689,9 @@ dependencies = [ "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -704,21 +704,21 @@ dependencies = [ "actix-rt 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "actix-service 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "backtrace" -version = "0.3.42" +version = "0.3.43" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", @@ -741,7 +741,7 @@ name = "base64" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -759,7 +759,7 @@ name = "blake2b_simd" version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayref 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -784,12 +784,12 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.1.2" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "byteorder" -version = "1.3.2" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -797,13 +797,13 @@ name = "bytes" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bytes" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -811,7 +811,7 @@ name = "bytestring" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -878,7 +878,7 @@ version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ascii 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -894,7 +894,7 @@ dependencies = [ "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "serde-hjson 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -936,6 +936,22 @@ name = "copyless" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "coturn-telnet" +version = "0.1.0-dev" +dependencies = [ + "async-trait 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "deadpool 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-test 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crc32fast" version = "1.2.0" @@ -1065,25 +1081,25 @@ name = "deadpool" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "async-trait 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", + "async-trait 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "config 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-queue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "deadpool-redis" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "async-trait 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", + "async-trait 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "config 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "deadpool 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "redis 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "redis 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1129,7 +1145,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1176,7 +1192,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1191,7 +1207,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "dtoa" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1233,7 +1249,7 @@ name = "failure" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1257,7 +1273,7 @@ dependencies = [ "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "miniz-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz_oxide 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1304,50 +1320,50 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-executor 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-executor 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-channel" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-core" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-executor" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-io" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-macro" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1358,26 +1374,26 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-task" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-util" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-macro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-macro 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1390,7 +1406,7 @@ name = "fxhash" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1445,16 +1461,16 @@ name = "h2" version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", - "indexmap 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "string 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1462,16 +1478,16 @@ name = "h2" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "indexmap 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1521,7 +1537,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1529,9 +1545,9 @@ name = "http" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1583,7 +1599,7 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.3.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1610,7 +1626,7 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1731,17 +1747,18 @@ dependencies = [ "actix-rt 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "actix-web 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "actix-web-actors 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "async-trait 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", + "async-trait 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "awc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "config 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "coturn-telnet 0.1.0-dev", "deadpool 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "deadpool-redis 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "deadpool-redis 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "derive_builder 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "dotenv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "grpcio 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "humantime-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1751,22 +1768,22 @@ dependencies = [ "mockall 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redis 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "redis 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)", "serial_test 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "serial_test_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-async 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-envlogger 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-scope 4.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-stdlog 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "smart-default 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1778,7 +1795,7 @@ dependencies = [ "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "medea-macro 0.2.0-dev", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1796,11 +1813,11 @@ dependencies = [ "protobuf 2.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-async 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-envlogger 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-scope 4.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-stdlog 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "slog-term 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-term 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1821,14 +1838,14 @@ dependencies = [ "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "downcast 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", "medea-client-api-proto 0.2.0-dev", "medea-macro 0.2.0-dev", "mockall 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "predicates-tree 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "tracerr 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-futures 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1883,7 +1900,7 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2118,7 +2135,7 @@ dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2134,15 +2151,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pin-project" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "pin-project-internal 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-internal 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pin-project-internal" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2179,7 +2196,7 @@ dependencies = [ "float-cmp 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "normalize-line-endings 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2446,19 +2463,19 @@ dependencies = [ [[package]] name = "redis" -version = "0.14.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "combine 3.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-executor 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "dtoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-executor 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2480,18 +2497,18 @@ dependencies = [ [[package]] name = "regex" -version = "1.3.3" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.13" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2606,7 +2623,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2622,10 +2639,10 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.44" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2643,8 +2660,8 @@ name = "serde_urlencoded" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "dtoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2654,7 +2671,7 @@ name = "serde_yaml" version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "dtoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2685,15 +2702,6 @@ name = "sha1" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "signal-hook" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "signal-hook-registry" version = "1.2.0" @@ -2715,12 +2723,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "slog-async" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2729,12 +2738,12 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-async 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-scope 4.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-stdlog 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "slog-term 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-term 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2744,7 +2753,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2782,14 +2791,14 @@ dependencies = [ [[package]] name = "slog-term" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2802,7 +2811,7 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2920,14 +2929,6 @@ dependencies = [ "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "thread_local" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "thread_local" version = "1.0.1" @@ -2956,12 +2957,12 @@ dependencies = [ [[package]] name = "tokio" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2971,40 +2972,41 @@ dependencies = [ "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-codec" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-current-thread" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-executor" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-io" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3012,12 +3014,22 @@ dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tokio-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tokio-reactor" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3025,30 +3037,30 @@ dependencies = [ "num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-sync 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-signal" -version = "0.2.7" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "signal-hook 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-sync" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3057,40 +3069,50 @@ dependencies = [ [[package]] name = "tokio-tcp" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-test" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-timer" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-udp" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3098,12 +3120,12 @@ name = "tokio-util" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3132,7 +3154,7 @@ name = "trust-dns-proto" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "enum-as-inner 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3142,12 +3164,12 @@ dependencies = [ "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-udp 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-udp 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3156,17 +3178,17 @@ name = "trust-dns-proto" version = "0.18.0-alpha.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "async-trait 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", + "async-trait 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "enum-as-inner 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3184,7 +3206,7 @@ dependencies = [ "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "trust-dns-proto 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3195,14 +3217,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "ipconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "trust-dns-proto 0.18.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3219,7 +3241,7 @@ name = "unicode-normalization" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3297,7 +3319,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-macro 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3306,7 +3328,7 @@ name = "wasm-bindgen-backend" version = "0.2.58" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bumpalo 3.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bumpalo 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3524,21 +3546,21 @@ dependencies = [ "checksum actix_derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b95aceadaf327f18f0df5962fedc1bde2f870566a0b9f65c89508a3b1f79334c" "checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" "checksum ahash 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "6f33b5018f120946c1dcf279194f238a9f146725593ead1c08fa47ff22b0b5d3" -"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" +"checksum aho-corasick 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" = "743ad5a418686aad3b87fd14c43badd828cf26e214a00f92a384291cf22e1811" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "7825f6833612eb2414095684fcf6c635becf3ce97fe48cf6421321e93bfbd53c" "checksum arc-swap 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d7b8a9123b8027467bce0099fe556c628a53c8d83df0507084c31e9ba2e39aff" -"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" +"checksum arrayref 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" "checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" "checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" "checksum ascii 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" -"checksum async-trait 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)" = "c8df72488e87761e772f14ae0c2480396810e51b2c2ade912f97f0f7e5b95e3c" +"checksum async-trait 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "750b1c38a1dfadd108da0f01c08f4cdc7ff1bb39b325f9c82cc972361780a6e1" "checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" "checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" "checksum awc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "5e995283278dd3bf0449e7534e77184adb1570c0de8b6a50bf7c9d01ad8db8c4" "checksum awc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d7601d4d1d7ef2335d6597a41b5fe069f6ab799b85f53565ab390e7b7065aac5" -"checksum backtrace 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)" = "b4b1549d804b6c73f4817df2ba073709e96e426f12987127c48e6745568c350b" +"checksum backtrace 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)" = "7f80256bc78f67e7df7e36d77366f636ed976895d91fe2ab9efa3973e8fe8c4f" "checksum backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" @@ -3546,10 +3568,10 @@ dependencies = [ "checksum blake2b_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a" "checksum brotli-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" "checksum brotli2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" -"checksum bumpalo 3.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5fb8038c1ddc0a5f73787b130f4cc75151e96ed33e417fde765eb5a81e3532f4" -"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" +"checksum bumpalo 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f359dc14ff8911330a51ef78022d376f25ed00248912803b58f00cb1c27f742" +"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -"checksum bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10004c15deb332055f7a4a208190aed362cf9a7c2f6ab70a305fba50e1105f38" +"checksum bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" "checksum bytestring 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "fc267467f58ef6cc8874064c62a0423eb0d099362c8a23edd1c6d044f46eead4" "checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" "checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" @@ -3579,7 +3601,7 @@ dependencies = [ "checksum darling_core 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" "checksum darling_macro 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" "checksum deadpool 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "38ce52b0b1ad88ed0b2be2bc3c65ad39dd1a5d9633b1a8a314fc017fbe0027d2" -"checksum deadpool-redis 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "061442c74bf11e8a19ddca0ea9bf46a2590f854df98e9830447601be097b8fe4" +"checksum deadpool-redis 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7655c3211e78315e7ee4b1ed8ce4a6fce0509deb4da8562dfb20d5fdfd4ad85c" "checksum derive_builder 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2658621297f2cf68762a6f7dc0bb7e1ff2cfd6583daef8ee0fed6f7ec468ec0" "checksum derive_builder_core 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2791ea3e372c8495c0bc2033991d76b512cd799d07491fbd6890124db9458bef" "checksum derive_more 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6d944ac6003ed268757ef1ee686753b57efc5fcf0ebe7b64c9fc81e7e32ff839" @@ -3591,7 +3613,7 @@ dependencies = [ "checksum dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d0a1279c96732bc6800ce6337b6a614697b0e74ae058dc03c62ebeb78b4d86" "checksum dotenv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" "checksum downcast 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4bb454f0228b18c7f4c3b0ebbee346ed9c52e7443b0999cd543ff3571205701d" -"checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e" +"checksum dtoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4358a9e11b9a09cf52383b451b49a169e8d797b68aa02301ff586d70d9661ea3" "checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" "checksum encoding_rs 0.8.22 (registry+https://github.com/rust-lang/crates.io-index)" = "cd8d03faa7fe0c1431609dfad7bbe827af30f82e1e2ae6f7ee4fca6bd764bc28" "checksum enum-as-inner 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3d58266c97445680766be408285e798d3401c6d4c378ec5552e78737e681e37d" @@ -3606,15 +3628,15 @@ dependencies = [ "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" -"checksum futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6f16056ecbb57525ff698bb955162d0cd03bee84e6241c27ff75c08d8ca5987" -"checksum futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fcae98ca17d102fd8a3603727b9259fcf7fa4239b603d2142926189bc8999b86" -"checksum futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "79564c427afefab1dfb3298535b21eda083ef7935b4f0ecbfcb121f0aec10866" -"checksum futures-executor 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e274736563f686a837a0568b478bdabfeaec2dca794b5649b04e2fe1627c231" -"checksum futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e676577d229e70952ab25f3945795ba5b16d63ca794ca9d2c860e5595d20b5ff" -"checksum futures-macro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "52e7c56c15537adb4f76d0b7a76ad131cb4d2f4f32d3b0bcabcbe1c7c5e87764" -"checksum futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "171be33efae63c2d59e6dbba34186fe0d6394fb378069a76dfd80fdcffd43c16" -"checksum futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0bae52d6b29cf440e298856fec3965ee6fa71b06aa7495178615953fd669e5f9" -"checksum futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d66274fb76985d3c62c886d1da7ac4c0903a8c9f754e8fe0f35a6a6cc39e76" +"checksum futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5c329ae8753502fb44ae4fc2b622fa2a94652c41e795143765ba0927f92ab780" +"checksum futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0c77d04ce8edd9cb903932b608268b3fffec4163dc053b3b402bf47eac1f1a8" +"checksum futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f25592f769825e89b92358db00d26f965761e094951ac44d3663ef25b7ac464a" +"checksum futures-executor 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f674f3e1bcb15b37284a90cedf55afdba482ab061c407a9c0ebbd0f3109741ba" +"checksum futures-io 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a638959aa96152c7a4cddf50fcb1e3fede0583b27157c26e67d6f99904090dc6" +"checksum futures-macro 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" +"checksum futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3466821b4bc114d95b087b850a724c6f83115e929bc88f1fa98a3304a944c8a6" +"checksum futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27" +"checksum futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "22766cf25d64306bedf0384da004d05c9974ab104fcc4528f1236181c18004c5" "checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" @@ -3636,10 +3658,10 @@ dependencies = [ "checksum ident_case 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" "checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" -"checksum indexmap 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b54058f0a6ff80b6803da8faf8997cde53872b38f4023728f6830b06cd3c0dc" +"checksum indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292" "checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" "checksum ipconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa79fa216fbe60834a9c0737d7fcd30425b32d1c58854663e24d4c4b328ed83f" -"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" +"checksum itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" "checksum js-sys 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)" = "7889c7c36282151f6bf465be4700359318aef36baa951462382eae49e9577cf9" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" @@ -3660,7 +3682,7 @@ dependencies = [ "checksum memory_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" "checksum mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" "checksum miniz-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9e3ae51cea1576ceba0dde3d484d30e6e5b86dee0b2d412fe3a16a15c98202" -"checksum miniz_oxide 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6f3f74f726ae935c3f514300cc6773a0c9492abc5e972d42ba0c0ebb88757625" +"checksum miniz_oxide 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aa679ff6578b1cddee93d7e82e263b94a575e0bfced07284eb0c037c1d2416a5" "checksum mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" "checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" @@ -3685,8 +3707,8 @@ dependencies = [ "checksum parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -"checksum pin-project 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "75fca1c4ff21f60ca2d37b80d72b63dab823a9d19d3cda3a81d18bc03f0ba8c5" -"checksum pin-project-internal 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6544cd4e4ecace61075a6ec78074beeef98d58aa9a3d07d053d993b2946a90d6" +"checksum pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7804a463a8d9572f13453c516a5faea534a2403d7ced2f0c7e100eeff072772c" +"checksum pin-project-internal 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "385322a45f2ecf3410c68d2a549a4a2685e8051d0f278e39743ff4e451cb9b3f" "checksum pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "237844750cfbb86f67afe27eee600dfbbcb6188d734139b534cbfbf4f96792ae" "checksum pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" "checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" @@ -3722,11 +3744,11 @@ dependencies = [ "checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redis 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d69c054daeca01bc1bee4af75b04dffa3458d6702cb7a74c2f38518c130fb624" +"checksum redis 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3eeb1fe3fc011cde97315f370bc88e4db3c23b08709a04915921e02b1d363b20" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" "checksum redox_users 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431" -"checksum regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b5508c1941e4e7cb19965abef075d35a9a8b5cdf0846f30b4050e9b55dc55e87" -"checksum regex-syntax 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e734e891f5b408a29efbf8309e656876276f49ab6a6ac208600b4419bd893d90" +"checksum regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "322cf97724bea3ee221b78fe25ac9c46114ebb51747ad5babd51a2fc6a8235a8" +"checksum regex-syntax 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b28dfe3fe9badec5dbf0a79a9cccad2cfc2ab5484bdb3e44cbd1ae8b3ba2be06" "checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" "checksum resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b263b4aa1b5de9ffc0054a2386f96992058bb6870aab516f8cdeb8a667d56dcb" "checksum rust-argon2 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017" @@ -3744,26 +3766,25 @@ dependencies = [ "checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" "checksum serde-hjson 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6a3a4e0ea8a88553209f6cc6cfe8724ecad22e1acf372793c27d995290fe74f8" "checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64" -"checksum serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)" = "48c575e0cc52bdd09b47f330f646cf59afc586e9c4e3ccd6fc1f625b8ea1dad7" +"checksum serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)" = "15913895b61e0be854afd32fd4163fcd2a3df34142cf2cb961b310ce694cbf90" "checksum serde_test 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "110b3dbdf8607ec493c22d5d947753282f3bae73c0f56d322af1e8c78e4c23d5" "checksum serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" "checksum serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)" = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35" "checksum serial_test 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f74862f16557830c73deefde614c906f8af0157e064b64f156e32a0b12d7114c" "checksum serial_test_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3c188479c8b700998829c168d7a4c21032660b0dd2ed87a0b166c85811750740" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" -"checksum signal-hook 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "7a9c17dd3ba2d36023a5c9472ecddeda07e27fd0b05436e8c1e0c8f178185652" "checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" "checksum slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1cc9c640a4adbfbcc11ffb95efe5aa7af7309e002adab54b185507dbf2377b99" -"checksum slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e544d16c6b230d84c866662fe55e31aacfca6ae71e6fc49ae9a311cb379bfc2f" +"checksum slog-async 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "78ca925b180da88ccc595cbe4a3d378d79cb49fe5906c2cbc2488eaf700913ee" "checksum slog-envlogger 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "906a1a0bc43fed692df4b82a5e2fbfc3733db8dad8bb514ab27a4f23ad04f5c0" "checksum slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc0d2aff1f8f325ef660d9a0eb6e6dcd20b30b3f581a5897f58bf42d061c37a" "checksum slog-scope 4.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c44c89dd8b0ae4537d1ae318353eaf7840b4869c536e31c41e963d1ea523ee6" "checksum slog-stdlog 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f1c469573d1e3f36f9eee66cd132206caf47b50c94b1f6c6e7b4d8235e9ecf01" "checksum slog-stdlog 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "be4d87903baf655da2d82bc3ac3f7ef43868c58bf712b3a661fda72009304c23" -"checksum slog-term 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "54b50e85b73c2bd42ceb97b6ded235576d405bd1e974242ccfe634fa269f6da7" +"checksum slog-term 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "124501187c410b6a46fe8a47a48435ae462fae4e02d03c558d358f40b17308cb" "checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" -"checksum smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44e59e0c9fa00817912ae6e4e6e3c4fe04455e75699d06eedc7d85917ed8e8f4" +"checksum smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc" "checksum smart-default 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" "checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85" "checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" @@ -3778,21 +3799,22 @@ dependencies = [ "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum term 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0863a3345e70f61d613eab32ee046ccd1bcc5f9105fe402c61fcd0c13eeb8b5" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" "checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum tokio 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "c1fc73332507b971a5010664991a441b5ee0de92017f5a0e8b00fd684573045b" -"checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" -"checksum tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "d16217cad7f1b840c5a97dfb3c43b0c871fef423a6e8d2118c604e843662a443" -"checksum tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ca6df436c42b0c3330a82d855d2ef017cd793090ad550a6bc2184f4b933532ab" -"checksum tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5090db468dad16e1a7a54c8c67280c5e4b544f3d3e018f0b913b400261f85926" -"checksum tokio-reactor 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "6732fe6b53c8d11178dcb77ac6d9682af27fc6d4cb87789449152e5377377146" -"checksum tokio-signal 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd6dc5276ea05ce379a16de90083ec80836440d5ef8a6a39545a3207373b8296" -"checksum tokio-sync 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "d06554cce1ae4a50f42fba8023918afa931413aded705b560e29600ccf7c6d76" -"checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" -"checksum tokio-timer 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1739638e364e558128461fc1ad84d997702c8e31c2e6b18fb99842268199e827" -"checksum tokio-udp 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f02298505547f73e60f568359ef0d016d5acd6e830ab9bc7c4a5b3403440121b" +"checksum tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8fdd17989496f49cdc57978c96f0c9fe5e4a58a8bddc6813c449a4624f6a030b" +"checksum tokio-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" +"checksum tokio-current-thread 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e" +"checksum tokio-executor 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" +"checksum tokio-io 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" +"checksum tokio-macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f4b1e7ed7d5d4c2af3d999904b0eebe76544897cdbfb2b9684bed2174ab20f7c" +"checksum tokio-reactor 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" +"checksum tokio-signal 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c34c6e548f101053321cba3da7cbb87a610b85555884c41b07da2eb91aff12" +"checksum tokio-sync 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" +"checksum tokio-tcp 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" +"checksum tokio-test 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "09cf9705471976fa5fc6817d3fbc9c4ff9696a6647af0e5c1870c81ca7445b05" +"checksum tokio-timer 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" +"checksum tokio-udp 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82" "checksum tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" "checksum toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" "checksum tracerr 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "64ee75bed80b548ecaede0ed297636fa16e05d7407aefdc64cb214ad3b8ebd53" diff --git a/Cargo.toml b/Cargo.toml index ac67ac4d8..31797e511 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ include = ["/src/", "/Cargo.*", "/CHANGELOG.md", "/LICENSE.md", "/README.md"] [workspace] members = [ "crates/medea-macro", + "crates/coturn-telnet", "jason", "mock/control-api", "proto/client-api", @@ -32,6 +33,7 @@ actix-web-actors = "2.0" async-trait = "0.1" chrono = "0.4" config = "0.10" +coturn-telnet = {path = "crates/coturn-telnet"} deadpool = "0.5" deadpool-redis = "0.5" derive_more = "0.99" @@ -45,7 +47,7 @@ medea-control-api-proto = { path = "proto/control-api" } medea-macro = { path = "crates/medea-macro" } protobuf = "2.7" rand = "0.7" -redis = "0.14" +redis = "0.15" rust-crypto = "0.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/Dockerfile b/Dockerfile index 24e4a87dc..644ca68d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,6 +26,7 @@ RUN apt-get update \ # Prepare Cargo workspace for building dependencies only. COPY crates/medea-macro/Cargo.toml /app/crates/medea-macro/ +COPY crates/coturn-telnet/Cargo.toml /app/crates/coturn-telnet/ COPY mock/control-api/Cargo.toml /app/mock/control-api/ COPY proto/client-api/Cargo.toml /app/proto/client-api/ COPY proto/control-api/Cargo.toml /app/proto/control-api/ @@ -38,6 +39,7 @@ COPY jason/Cargo.toml /app/jason/ COPY Cargo.toml Cargo.lock /app/ WORKDIR /app/ RUN mkdir -p crates/medea-macro/src/ && touch crates/medea-macro/src/lib.rs \ + && mkdir -p crates/coturn-telnet/src/ && touch crates/coturn-telnet/src/lib.rs \ && mkdir -p mock/control-api/src/ && touch mock/control-api/src/lib.rs \ && mkdir -p proto/client-api/src/ && touch proto/client-api/src/lib.rs \ && mkdir -p proto/control-api/src/ && touch proto/control-api/src/lib.rs \ diff --git a/_dev/coturn/turnserver.conf b/_dev/coturn/turnserver.conf index 699ac5315..47082fe91 100644 --- a/_dev/coturn/turnserver.conf +++ b/_dev/coturn/turnserver.conf @@ -1,8 +1,8 @@ lt-cred-mech fingerprint -no-cli no-tls no-dtls realm=medea redis-userdb="ip=127.0.0.1 port=6379 dbname=0 password=turn" user=USER:PASS +cli-password=turn diff --git a/config.toml b/config.toml index c45967be7..d4175eee1 100644 --- a/config.toml +++ b/config.toml @@ -125,6 +125,24 @@ # Default: # connection_timeout = "5s" +[turn.cli] +# Coturn server host. +# +# Env var: MEDEA_TURN__CLI__HOST +# Default: +# host = "127.0.0.1" + +# Port of Coturn's Redis database for client connections. +# +# Env var: MEDEA_TURN__CLI__PORT +# Default: +# port = 5766 + +# Port of Coturn's Redis database for client connections. +# +# Env var: MEDEA_TURN__CLI__PASS +# Default: +# pass = "turn" diff --git a/crates/coturn-telnet/CHANGELOG.md b/crates/coturn-telnet/CHANGELOG.md new file mode 100644 index 000000000..6421f07f6 --- /dev/null +++ b/crates/coturn-telnet/CHANGELOG.md @@ -0,0 +1,26 @@ +`coturn-telnet` changelog +======================= + +All user visible changes to this project will be documented in this file. This project uses [Semantic Versioning 2.0.0]. + + + + +## TBD [0.1.0] · 2019-??-?? +[0.1.0]: /../../tree/coturn-telnet-0.1.0/crates/coturn-telnet + +### Added + +- Asynchronous [Coturn] client. +- Connection pool. +- Requests: + - `ps [username]`, that prints sessions, with optional exact user match. + - `cs `, that forcefully cancels session. + + + + + + +[Semantic Versioning 2.0.0]: https://semver.org +[Coturn]: https://github.com/coturn/coturn diff --git a/crates/coturn-telnet/Cargo.toml b/crates/coturn-telnet/Cargo.toml new file mode 100644 index 000000000..03f768a3b --- /dev/null +++ b/crates/coturn-telnet/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "coturn-telnet" +version = "0.1.0-dev" +edition = "2018" +description = "Coturn TURN server telnet cli client" +authors = ["Instrumentisto Team "] +license = "MIT/Apache-2.0" +documentation = "https://docs.rs/coturn-telnet" +homepage = "https://github.com/instrumentisto/medea/tree/master/crates/coturn-telnet" +repository = "https://github.com/instrumentisto/medea/tree/master/crates/coturn-telnet" +readme = "README.md" +keywords = ["coturn", "telnet", "cli"] +categories = ["web-programming"] + +[dependencies] +async-trait = "0.1" +bytes = "0.5" +deadpool = "0.5" +derive_more = "0.99" +futures = "0.3" +lazy_static = "1.4" +regex = "1.3" +tokio = { version = "0.2", features = ["dns", "macros"] } +tokio-util = { version = "0.2", features = ["codec"] } + +[dev-dependencies] +tokio-test = "0.2" diff --git a/crates/coturn-telnet/LICENSE-APACHE.md b/crates/coturn-telnet/LICENSE-APACHE.md new file mode 100644 index 000000000..24e951b55 --- /dev/null +++ b/crates/coturn-telnet/LICENSE-APACHE.md @@ -0,0 +1,194 @@ +Apache License +============== + +_Version 2.0, January 2004_ +_<>_ + +### Terms and Conditions for use, reproduction, and distribution + +#### 1. Definitions + +“License” shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +“Licensor” shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +“Legal Entity” shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, “control” means **(i)** the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the +outstanding shares, or **(iii)** beneficial ownership of such entity. + +“You” (or “Your”) shall mean an individual or Legal Entity exercising +permissions granted by this License. + +“Source” form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +“Object” form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +“Work” shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +“Derivative Works” shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +“Contribution” shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +“submitted” means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as “Not a Contribution.” + +“Contributor” shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +#### 2. Grant of Copyright License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +#### 3. Grant of Patent License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have +made, use, offer to sell, sell, import, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +#### 4. Redistribution + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +* **(a)** You must give any other recipients of the Work or Derivative Works a copy of +this License; and +* **(b)** You must cause any modified files to carry prominent notices stating that You +changed the files; and +* **(c)** You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. + +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +#### 5. Submission of Contributions + +Unless You explicitly state otherwise, any Contribution intentionally submitted +for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the terms of +any separate license agreement you may have executed with Licensor regarding +such Contributions. + +#### 6. Trademarks + +This License does not grant permission to use the trade names, trademarks, +service marks, or product names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +#### 7. Disclaimer of Warranty + +Unless required by applicable law or agreed to in writing, Licensor provides the +Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +including, without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are +solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise of +permissions under this License. + +#### 8. Limitation of Liability + +In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License or +out of the use or inability to use the Work (including but not limited to +damages for loss of goodwill, work stoppage, computer failure or malfunction, or +any and all other commercial damages or losses), even if such Contributor has +been advised of the possibility of such damages. + +#### 9. Accepting Warranty or Additional Liability + +While redistributing the Work or Derivative Works thereof, You may choose to +offer, and charge a fee for, acceptance of support, warranty, indemnity, or +other liability obligations and/or rights consistent with this License. However, +in accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +_END OF TERMS AND CONDITIONS_ + +### APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets `[]` replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same “printed page” as the copyright notice for easier identification within +third-party archives. + + Copyright © 2019 Instrumentisto Team, https://github.com/instrumentisto + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/crates/coturn-telnet/LICENSE-MIT.md b/crates/coturn-telnet/LICENSE-MIT.md new file mode 100644 index 000000000..8852bcc25 --- /dev/null +++ b/crates/coturn-telnet/LICENSE-MIT.md @@ -0,0 +1,25 @@ +The MIT License (MIT) +===================== + +Copyright © 2019 Instrumentisto Team, https://github.com/instrumentisto + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/crates/coturn-telnet/README.md b/crates/coturn-telnet/README.md new file mode 100644 index 000000000..3411b4d2b --- /dev/null +++ b/crates/coturn-telnet/README.md @@ -0,0 +1,33 @@ +coturn-telnet +=========== + +[![Crates.io](https://img.shields.io/crates/v/coturn-telnet)](https://crates.io/crates/coturn-telnet) +![Crates.io license](https://img.shields.io/crates/l/coturn-telnet) + +[API Docs](https://docs.rs/coturn-telnet) | +[Changelog](https://github.com/instrumentisto/medea/blob/master/crates/coturn-telnet/CHANGELOG.md) + +[Coturn] telnet cli client implementation. + + + + +## License + +This project is licensed under either of + +- Apache License, Version 2.0, ([LICENSE-APACHE](https://github.com/instrumentisto/medea/blob/master/crates/coturn-telnet/LICENSE-APACHE.md) or http://www.apache.org/licenses/LICENSE-2.0) +- MIT license ([LICENSE-MIT](https://github.com/instrumentisto/medea/blob/master/crates/coturn-telnet/LICENSE-MIT.md) or http://opensource.org/licenses/MIT) + +at your option. + + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. + + + + + +[Coturn]: https://github.com/coturn/coturn diff --git a/crates/coturn-telnet/src/codec.rs b/crates/coturn-telnet/src/codec.rs new file mode 100644 index 000000000..2420d585f --- /dev/null +++ b/crates/coturn-telnet/src/codec.rs @@ -0,0 +1,292 @@ +//! Contains definitions for messages sent to [Coturn] server telnet interface +//! [`CoturnCliRequest`], messages received from Coturn server telnet interface: +//! [`CoturnCliResponse`]. [`CoturnCliCodec`] which encodes and decodes those +//! messages. +//! +//! [Coturn]: https://github.com/coturn/coturn + +use std::{ + convert::TryFrom, + io, + str::{from_utf8, Utf8Error}, +}; + +use bytes::{BufMut as _, Bytes, BytesMut}; +use regex::Regex; +use tokio_util::codec::{Decoder, Encoder}; + +// Cursor is received when telnet server has finished writing response and is +// ready to receive new requests. +static CURSOR: &str = "> "; + +// Received when telnet server awaits for password. +static NEED_PASS: &str = "Enter password: \r\n"; + +/// Received when telnet server did not recognized last command. +static UNKNOWN_COMMAND: &str = "Unknown command\r\n\r\n"; + +lazy_static::lazy_static! { + // Used to check is message can be parsed to CoturnCliResponse::Sessions. + static ref IS_SESSIONS_REGEX: Regex = + Regex::new(r#"Total sessions: \d"#).unwrap(); + + // Used to extract session ids from CoturnCliResponse::Sessions. + static ref EXTRACT_SESSIONS_REGEX: Regex = + Regex::new(r"\d\) id=(.*),").unwrap(); +} + +/// Messages that can be received from Coturn telnet server. +#[derive(Clone, Debug, PartialEq)] +pub enum CoturnCliResponse { + /// Current telnet connection requires authentication. Next message sent to + /// server should be [`CoturnCliRequest::Auth`]. + EnterPassword, + + /// Coturn server finished processing latest telnet request and is ready to + /// accept next. You should wait for this message after sending request + /// to make sure that request succeeded. + Ready, + + /// Answer to [`CoturnCliRequest::PrintSessions`], contains list of session + /// ids associated with username provided in + /// [`CoturnCliRequest::PrintSessions`] message. + Sessions(Vec), + + /// Coturn telnet server did not recognized last command. + UnknownCommand, +} + +/// Errors that can happen when parsing message received from Coturn via telnet +/// connection. +#[derive(Debug)] +pub enum CoturnResponseParseError { + /// Could not represent byte slice as `String`. + BadString(Utf8Error), + + /// Could not determine concrete response type. + CannotDetermineResponseType(String), + + /// Could not parse provided bytes to determined response type. + BadResponseFormat(String), +} + +impl TryFrom for CoturnCliResponse { + type Error = CoturnResponseParseError; + + fn try_from(mut msg: BytesMut) -> Result { + // delete cursor if message ends with it + if msg.ends_with(CURSOR.as_bytes()) { + msg.truncate(msg.len() - CURSOR.as_bytes().len()); + } + + let msg = + from_utf8(&msg).map_err(CoturnResponseParseError::BadString)?; + + if msg.is_empty() { + return Ok(CoturnCliResponse::Ready); + } + + if msg.ends_with(NEED_PASS) { + return Ok(CoturnCliResponse::EnterPassword); + } + + if msg.ends_with(UNKNOWN_COMMAND) { + return Ok(CoturnCliResponse::UnknownCommand); + } + + if IS_SESSIONS_REGEX.is_match(msg) { + let mut session_ids: Vec = Vec::new(); + for mat in EXTRACT_SESSIONS_REGEX.captures_iter(msg) { + if let Some(id) = mat.get(1) { + session_ids.push(id.as_str().to_owned()); + } else { + return Err(CoturnResponseParseError::BadResponseFormat( + msg.to_owned(), + )); + } + } + return Ok(CoturnCliResponse::Sessions(session_ids)); + } + + Err(CoturnResponseParseError::CannotDetermineResponseType( + msg.to_owned(), + )) + } +} + +/// Messages that can be sent to Coturn telnet client. +pub enum CoturnCliRequest { + /// Request to authenticate. Contains password. Should be sent when + /// [`CoturnCliResponse::EnterPassword`] is received. + Auth(Bytes), + + /// Get Coturn session ids by username. + PrintSessions(String), + + /// Close Coturn session by its id. + CloseSession(String), + + /// Ping + Ping, +} + +impl Into for CoturnCliRequest { + fn into(self) -> Bytes { + match self { + CoturnCliRequest::Auth(pass) => pass, + CoturnCliRequest::PrintSessions(username) => { + format!("ps {}", username).into() + } + CoturnCliRequest::CloseSession(session_id) => { + format!("cs {}", session_id).into() + } + CoturnCliRequest::Ping => "ping".into(), + } + } +} + +#[derive(Debug)] +pub enum CoturnCliCodecError { + IoError(io::Error), + CannotParseResponse(CoturnResponseParseError), +} + +impl From for CoturnCliCodecError { + fn from(err: io::Error) -> Self { + CoturnCliCodecError::IoError(err) + } +} + +impl From for CoturnCliCodecError { + fn from(err: CoturnResponseParseError) -> Self { + CoturnCliCodecError::CannotParseResponse(err) + } +} + +/// Adapter that encodes requests and decodes responses received from or sent to +/// [Coturn] server telnet interface. +/// +/// [Coturn]: https://github.com/coturn/coturn +#[derive(Default)] +pub struct CoturnCliCodec; + +impl Decoder for CoturnCliCodec { + type Error = CoturnCliCodecError; + type Item = CoturnCliResponse; + + fn decode( + &mut self, + src: &mut BytesMut, + ) -> Result, Self::Error> { + if src.ends_with(CURSOR.as_bytes()) { + let frame = CoturnCliResponse::try_from(src.split())?; + Ok(Some(frame)) + } else if src.ends_with(NEED_PASS.as_bytes()) { + src.clear(); + Ok(Some(CoturnCliResponse::EnterPassword)) + } else { + Ok(None) + } + } +} + +impl Encoder for CoturnCliCodec { + type Error = io::Error; + type Item = CoturnCliRequest; + + fn encode( + &mut self, + item: Self::Item, + dst: &mut BytesMut, + ) -> Result<(), Self::Error> { + let item: Bytes = item.into(); + dst.reserve(item.len()); + dst.put(item); + Ok(()) + } +} + +#[cfg(test)] +mod test { + + use bytes::BytesMut; + + use super::*; + + #[tokio::test] + async fn parse_greeting() { + let mut codec = CoturnCliCodec::default(); + let mut greeting: BytesMut = "TURN Server\r\nCoturn-4.5.1.1 'dan \ + Eider'\r\n\r\nType '?' for \ + help\r\nEnter password: \r\n" + .into(); + + assert_eq!( + codec.decode(&mut greeting).unwrap().unwrap(), + CoturnCliResponse::EnterPassword + ); + } + + #[tokio::test] + async fn parse_empty_sessions() { + let mut codec = CoturnCliCodec::default(); + let mut greeting = "\r\n Total sessions: 0\r\n\r\n> ".into(); + + match codec.decode(&mut greeting).unwrap().unwrap() { + CoturnCliResponse::Sessions(sessions) => { + assert!(sessions.is_empty()); + } + _ => unreachable!(), + } + } + + #[tokio::test] + async fn parse_sessions() { + let mut codec = CoturnCliCodec::default(); + let mut greeting = "\r\n 1) id=007000000000000001, user + :\r\n realm: medea\r\n started 49 secs ago\r\n + expiring in 551 secs\r\n client protocol UDP, relay protocol + UDP\r\n client addr 192.168.31.183:39514, server addr + 127.0.0.1:3478\r\n relay addr 127.0.0.1:55869\r\n + fingerprints enforced: OFF\r\n mobile: OFF\r\n usage: rp=6, + rb=480, sp=4, sb=440\r\n rate: r=0, s=0, total=0 (bytes per + sec)\r\n\r\n 2) id=010000000000000002, user :\r\n + realm: medea\r\n started 49 secs ago\r\n expiring in 551 + secs\r\n client protocol TCP, relay protocol UDP\r\n client + addr [::1]:33710, server addr [::1]:3478\r\n relay addr + [::1]:60216\r\n fingerprints enforced: OFF\r\n mobile: + OFF\r\n usage: rp=4, rb=348, sp=3, sb=336\r\n rate: r=0, + s=0, total=0 (bytes per sec)\r\n peers:\r\n ::1\r\n\r\n + 3) id=000000000000000001, user :\r\n realm: medea\r\n + started 49 secs ago\r\n expiring in 551 secs\r\n client + protocol UDP, relay protocol UDP\r\n client addr + 192.168.31.183:59996, server addr 127.0.0.1:3478\r\n relay addr + 127.0.0.1:54289\r\n fingerprints enforced: OFF\r\n mobile: + OFF\r\n usage: rp=5, rb=344, sp=4, sb=440\r\n rate: r=0, + s=0, total=0 (bytes per sec)\r\n\r\n 4) id=005000000000000001, + user :\r\n realm: medea\r\n started 49 secs + ago\r\n expiring in 551 secs\r\n client protocol TCP, relay + protocol UDP\r\n client addr [::1]:33712, server addr + [::1]:3478\r\n relay addr [::1]:52934\r\n fingerprints + enforced: OFF\r\n mobile: OFF\r\n usage: rp=12288, + rb=10012764, sp=12288, sb=10022892\r\n rate: r=222505, + s=222730, total=445235 (bytes per sec)\r\n peers:\r\n + ::1\r\n [::1]:62869\r\n\r\n Total sessions: 4\r\n\r\n> " + .into(); + + match codec.decode(&mut greeting).unwrap().unwrap() { + CoturnCliResponse::Sessions(sessions) => { + assert_eq!( + sessions, + vec![ + "007000000000000001", + "010000000000000002", + "000000000000000001", + "005000000000000001" + ] + ); + } + _ => unreachable!(), + } + } +} diff --git a/crates/coturn-telnet/src/connection.rs b/crates/coturn-telnet/src/connection.rs new file mode 100644 index 000000000..9ad42dc97 --- /dev/null +++ b/crates/coturn-telnet/src/connection.rs @@ -0,0 +1,186 @@ +//! Contains [`CoturnTelnetConnection`]. + +use std::io; + +use bytes::Bytes; +use futures::{SinkExt, StreamExt}; +use tokio::net::{TcpStream, ToSocketAddrs}; +use tokio_util::codec::Framed; + +use crate::codec::{ + CoturnCliCodec, CoturnCliCodecError, CoturnCliRequest, CoturnCliResponse, + CoturnResponseParseError, +}; + +#[derive(Debug, derive_more::Display, derive_more::From)] +pub enum CoturnTelnetError { + /// Underlying transport encountered [`io::Error`]. You should try + /// recreating [`CoturnTelnetClient`]. + #[display(fmt = "Underlying transport encountered IoError: {}", _0)] + IoError(io::Error), + /// Underlying stream exhausted. You should try recreating + /// [`CoturnTelnetClient`]. + #[display(fmt = "Disconnected from Coturn telnet server")] + Disconnected, + /// Unable to parse response from Coturn telnet server. This is + /// unrecoverable error. + #[display(fmt = "Unable to parse Coturn response: {:?}", _0)] + MessageParseError(CoturnResponseParseError), + /// Coturn answered with unexpected message. This is unrecoverable error. + #[display(fmt = "Unexpected response received {:?}", _0)] + UnexpectedMessage(CoturnCliResponse), + /// Authentication failed. This is unrecoverable error. + #[display(fmt = "Coturn server rejected provided password")] + WrongPassword, +} + +impl From for CoturnTelnetError { + fn from(err: CoturnCliCodecError) -> Self { + match err { + CoturnCliCodecError::IoError(err) => Self::from(err), + CoturnCliCodecError::CannotParseResponse(err) => Self::from(err), + } + } +} + +/// Asynchronous connection to remote [Coturn] server telnet interface. You can +/// use this directly, but it is recommended to use this with connection pool +/// from `crate::pool`, which takes care of connection life cycle. +/// +/// [Coturn]: https://github.com/coturn/coturn. +pub struct CoturnTelnetConnection(Framed); + +impl CoturnTelnetConnection { + /// Opens a telnet connection to a remote host using a `TcpStream` and + /// performs authentication. + pub async fn connect>( + addr: A, + pass: B, + ) -> Result { + let stream = TcpStream::connect(addr).await?; + let mut this = Self(Framed::new(stream, CoturnCliCodec::default())); + this.auth(pass.into()).await?; + + Ok(this) + } + + /// Returns session ids associated with provided username. + /// + /// 1. Sends [`CoturnTelnetClientError::PrintSessions`] with provided + /// username. + /// 2. Awaits for [`CoturnCliResponse::Sessions`]. + pub async fn print_sessions( + &mut self, + username: String, + ) -> Result, CoturnTelnetError> { + // Send `CoturnCliRequest::PrintSessions`. + self.0 + .send(CoturnCliRequest::PrintSessions(username)) + .await?; + + // Await for `CoturnCliResponse::Sessions`. + let response: CoturnCliResponse = self + .0 + .next() + .await + .ok_or_else(|| CoturnTelnetError::Disconnected)??; + match response { + CoturnCliResponse::Sessions(sessions) => Ok(sessions), + _ => Err(CoturnTelnetError::UnexpectedMessage(response)), + } + } + + /// Closes session on Coturn server destroying this session allocations and + /// channels. + /// + /// 1. Sends [`CoturnCliRequest::CloseSession`] with specified session id. + /// 2. Awaits for [`CoturnCliResponse::Ready`]. + pub async fn delete_session( + &mut self, + session_id: String, + ) -> Result<(), CoturnTelnetError> { + self.0 + .send(CoturnCliRequest::CloseSession(session_id)) + .await?; + + // Await for `CoturnCliResponse::Ready`. + let response: CoturnCliResponse = self + .0 + .next() + .await + .ok_or_else(|| CoturnTelnetError::Disconnected)??; + match response { + CoturnCliResponse::Ready => Ok(()), + _ => Err(CoturnTelnetError::UnexpectedMessage(response)), + } + } + + /// Closes sessions on Coturn server destroying provided sessions + /// allocations and channels. + /// + /// For each provided session id: + /// 1. Sends [`CoturnCliRequest::CloseSession`] with specified session id. + /// 2. Awaits for [`CoturnCliResponse::Ready`]. + pub async fn delete_sessions>( + &mut self, + session_ids: T, + ) -> Result<(), CoturnTelnetError> { + for session_id in session_ids { + self.delete_session(session_id).await?; + } + Ok(()) + } + + /// Authenticates [`CoturnTelnetClient`]. + /// + /// 1. Awaits for [`CoturnCliResponse::EnterPassword`]. + /// 2. Sends [`CoturnCliRequest::Auth`]. + /// 3. Awaits for [`CoturnCliResponse::Ready`]. + async fn auth(&mut self, pass: Bytes) -> Result<(), CoturnTelnetError> { + // Wait for `CoturnCliResponse::EnterPassword`; + let response = self + .0 + .next() + .await + .ok_or_else(|| CoturnTelnetError::Disconnected)??; + + if let CoturnCliResponse::EnterPassword = response { + } else { + return Err(CoturnTelnetError::UnexpectedMessage(response)); + }; + + // Send `CoturnCliRequest::Auth` with provided password. + self.0.send(CoturnCliRequest::Auth(pass)).await?; + + // Wait for `CoturnCliResponse::Ready`. + let response = self + .0 + .next() + .await + .ok_or_else(|| CoturnTelnetError::Disconnected)??; + match response { + CoturnCliResponse::EnterPassword => { + Err(CoturnTelnetError::WrongPassword) + } + CoturnCliResponse::Ready => Ok(()), + _ => Err(CoturnTelnetError::UnexpectedMessage(response)), + } + } + + /// Pings Coturn telnet server. + pub async fn ping(&mut self) -> Result<(), CoturnTelnetError> { + self.0.send(CoturnCliRequest::Ping).await?; + + let response: CoturnCliResponse = self + .0 + .next() + .await + .ok_or_else(|| CoturnTelnetError::Disconnected)??; + if let CoturnCliResponse::UnknownCommand = response { + } else { + return Err(CoturnTelnetError::UnexpectedMessage(response)); + }; + + Ok(()) + } +} diff --git a/crates/coturn-telnet/src/lib.rs b/crates/coturn-telnet/src/lib.rs new file mode 100644 index 000000000..321641c49 --- /dev/null +++ b/crates/coturn-telnet/src/lib.rs @@ -0,0 +1,8 @@ +#![allow(clippy::module_name_repetitions)] + +mod codec; +mod connection; +mod pool; + +pub use connection::{CoturnTelnetConnection, CoturnTelnetError}; +pub use pool::{Connection, Manager, Pool, PoolError}; diff --git a/crates/coturn-telnet/src/pool.rs b/crates/coturn-telnet/src/pool.rs new file mode 100644 index 000000000..5a7795d9b --- /dev/null +++ b/crates/coturn-telnet/src/pool.rs @@ -0,0 +1,79 @@ +//! Deadpool simple async pool for [`CoturnTelnetConnection`]'s. +//! +//! You should not need to use `deadpool` directly. Use the `Pool` type +//! provided by this crate instead. +//! +//! # Example +//! +//! ```rust +//! use coturn_telnet::{Manager, Pool}; +//! +//! let mgr = Manager::new((String::from("localhost", 5766)), "turn") +//! .unwrap(); +//! let pool = Pool::new(mgr, 16); +//! let mut conn = pool.get().await.unwrap(); +//! +//! conn.deref_mut() +//! .print_sessions(String::from("username")) +//! .await +//! .unwrap(); +//! ``` + +use async_trait::async_trait; +use bytes::Bytes; + +use crate::connection::{CoturnTelnetConnection, CoturnTelnetError}; + +/// A type alias for using [`deadpool::managed::Pool`] with +/// [`CoturnTelnetConnection`]. +pub type Pool = + deadpool::managed::Pool; + +/// A type alias for using [`deadpool::managed::PoolError`] with +/// [`CoturnTelnetConnection`]. +pub type PoolError = deadpool::managed::PoolError; + +/// A type alias for using [`deadpool::managed::Object`] with +/// [`CoturnTelnetConnection`]. +pub type Connection = + deadpool::managed::Object; + +type RecycleResult = deadpool::managed::RecycleResult; + +/// The manager for creating and recycling Coturn telnet connections +pub struct Manager { + addr: (String, u16), + pass: Bytes, +} + +impl Manager { + pub fn new>(addr: (String, u16), pass: P) -> Self { + Self { + addr, + pass: pass.into(), + } + } +} + +#[async_trait] +impl deadpool::managed::Manager + for Manager +{ + async fn create( + &self, + ) -> Result { + let connection = CoturnTelnetConnection::connect( + (self.addr.0.as_str(), self.addr.1), + self.pass.clone(), + ) + .await?; + Ok(connection) + } + + async fn recycle( + &self, + connection: &mut CoturnTelnetConnection, + ) -> RecycleResult { + connection.ping().await.map_err(From::from) + } +} diff --git a/jason/demo/index.html b/jason/demo/index.html index b73503ae1..0be70f5eb 100644 --- a/jason/demo/index.html +++ b/jason/demo/index.html @@ -17,6 +17,7 @@ let inited = false; const controlUrl = document.location.protocol + "//" + document.location.host + "/control-api/"; + var isForceRelay = false; async function createRoom(roomId) { try { @@ -40,7 +41,7 @@ publish: { kind: 'WebRtcPublishEndpoint', p2p: 'Always', - force_relay: false, + force_relay: isForceRelay, }, }; @@ -52,6 +53,7 @@ pipeline["play-" + memberId] = { kind: 'WebRtcPlayEndpoint', src: 'local://' + roomId + '/' + memberId + "/publish", + force_relay: isForceRelay, }; } @@ -73,6 +75,7 @@ data: { kind: 'WebRtcPlayEndpoint', src: 'local://' + roomId + '/' + memberId + '/publish', + force_relay: controlRoom.data.element.pipeline[id].pipeline.publish.force_relay, } }) } @@ -154,6 +157,7 @@ let audioSelect = document.getElementById('connect__select-device_audio'); let videoSelect = document.getElementById('connect__select-device_video'); let localVideo = document.getElementById('local-video__video'); + let isForceRelayCheckbox = document.getElementById("is_force_relay"); let joinCallerButton = document.getElementById('join__join'); let usernameInput = document.getElementById('join__username'); @@ -266,6 +270,9 @@ connectBtnsDiv.style.display = 'none'; controlBtns.style.display = 'block'; + isForceRelay = isForceRelayCheckbox.checked; + isForceRelayCheckbox.disabled = true; + try { let username = usernameInput.value; try { @@ -390,6 +397,11 @@ Closed +
+ + +
+ diff --git a/jason/e2e-demo/js/index.js b/jason/e2e-demo/js/index.js index 3e2a5b09f..6250d3663 100644 --- a/jason/e2e-demo/js/index.js +++ b/jason/e2e-demo/js/index.js @@ -49,7 +49,8 @@ async function createMember(roomId, memberId) { memberIds.push(memberId); pipeline["play-" + memberId] = { kind: 'WebRtcPlayEndpoint', - src: 'local://' + roomId + '/' + memberId + "/publish" + src: 'local://' + roomId + '/' + memberId + "/publish", + force_relay: false } } @@ -73,7 +74,8 @@ async function createMember(roomId, memberId) { url: controlUrl + roomId + "/" + id + '/' + 'play-' + memberId, data: { kind: 'WebRtcPlayEndpoint', - src: 'local://' + roomId + '/' + memberId + '/publish' + src: 'local://' + roomId + '/' + memberId + '/publish', + force_relay: false } }) } diff --git a/jason/src/lib.rs b/jason/src/lib.rs index 6dce1acde..f83a24a1b 100644 --- a/jason/src/lib.rs +++ b/jason/src/lib.rs @@ -7,6 +7,8 @@ #![allow(clippy::module_name_repetitions, clippy::must_use_candidate)] #![cfg_attr(not(feature = "mockable"), warn(missing_docs))] #![cfg_attr(feature = "mockable", allow(missing_docs))] +// TODO: REVERT ME BEFORE MERGE!!! +#![allow(clippy::missing_errors_doc)] #[macro_use] pub mod utils; diff --git a/jason/src/peer/media.rs b/jason/src/peer/media.rs index 2bc2feee6..209f207fb 100644 --- a/jason/src/peer/media.rs +++ b/jason/src/peer/media.rs @@ -139,8 +139,7 @@ impl MediaConnections { self.0 .borrow() .iter_senders_with_kind(TransceiverKind::Audio) - .skip_while(|s| s.is_track_enabled()) - .next() + .find(|s| !s.is_track_enabled()) .is_none() } @@ -150,8 +149,7 @@ impl MediaConnections { self.0 .borrow() .iter_senders_with_kind(TransceiverKind::Video) - .skip_while(|s| s.is_track_enabled()) - .next() + .find(|s| !s.is_track_enabled()) .is_none() } @@ -497,6 +495,6 @@ impl Receiver { if self.mid.is_none() && self.transceiver.is_some() { self.mid = self.transceiver.as_ref().unwrap().mid() } - self.mid.as_ref().map(String::as_str) + self.mid.as_deref() } } diff --git a/proto/control-api/build.rs b/proto/control-api/build.rs index e3a4ead07..cb9b1cb9c 100644 --- a/proto/control-api/build.rs +++ b/proto/control-api/build.rs @@ -66,17 +66,14 @@ mod grpc { /// Loads [`ProtoNames`] from [`GRPC_DIR`] directory. pub fn load() -> io::Result { let proto_names = fs::read_dir(GRPC_DIR)? - .into_iter() .collect::, _>>()? .into_iter() .map(|entry| entry.path()) .filter(|path| { - path.extension() - .map(|ext| { - path.is_file() - && ext.to_string_lossy() == Cow::from("proto") - }) - .unwrap_or(false) + path.extension().map_or(false, |ext| { + path.is_file() + && ext.to_string_lossy() == Cow::from("proto") + }) }) .filter_map(|path| { path.file_stem() diff --git a/src/conf/turn.rs b/src/conf/turn.rs index 836073c60..72e4d6089 100644 --- a/src/conf/turn.rs +++ b/src/conf/turn.rs @@ -15,6 +15,8 @@ use smart_default::SmartDefault; pub struct Turn { /// Database settings pub db: Db, + /// Coturn cli connection settings. + pub cli: CoturnCli, /// Host of STUN/TURN server. Defaults to `localhost`. #[default = "localhost"] pub host: Cow<'static, str>, @@ -69,6 +71,23 @@ pub struct Redis { pub connection_timeout: Duration, } +/// Setting of [coturn] server telnet interface. +/// +/// [coturn]: https://github.com/coturn/coturn +#[derive(Clone, Debug, Deserialize, Serialize, SmartDefault)] +#[serde(default)] +pub struct CoturnCli { + /// Coturn server IP address. Defaults to `127.0.0.1`. + #[default(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)))] + pub ip: IpAddr, + /// Coturn server port. Defaults to `5766`. + #[default = 5766] + pub port: u16, + /// Password for authorize on Coturn server telnet interface. + #[default(String::from("turn"))] + pub pass: String, +} + #[cfg(test)] mod spec { use std::{net::Ipv4Addr, time::Duration}; diff --git a/src/lib.rs b/src/lib.rs index e30354869..be1bc08b0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,6 +3,8 @@ // TODO: Remove `clippy::must_use_candidate` once the issue below is resolved: // https://github.com/rust-lang/rust-clippy/issues/4779 #![allow(clippy::module_name_repetitions, clippy::must_use_candidate)] +// TODO: REVERT ME BEFORE MERGE!!! +#![allow(clippy::missing_errors_doc)] #[macro_use] pub mod utils; diff --git a/src/media/ice_user.rs b/src/media/ice_user.rs index 6832c147a..94c7680dd 100644 --- a/src/media/ice_user.rs +++ b/src/media/ice_user.rs @@ -2,17 +2,22 @@ //! //! [coturn]: https://github.com/coturn/coturn +use derive_more::{AsRef, Display, From, Into}; use medea_client_api_proto::IceServer; use crate::api::control::RoomId; +#[derive(AsRef, Clone, Debug, Display, From, Into)] +#[as_ref(forward)] +pub struct IceUsername(String); + /// Credentials on Turn server. #[derive(Clone, Debug)] pub struct IceUser { /// Address of Turn server. address: String, /// Username for authorization. - user: String, + username: IceUsername, /// Password for authorization. pass: String, /// Non static users are meant to be saved and delete from some remote @@ -31,17 +36,17 @@ impl IceUser { ) -> Self { Self { address, - user: format!("{}_{}", room_id, name), + username: IceUsername::from(format!("{}_{}", room_id, name)), pass, is_static: false, } } /// Build new static [`IceUser`]. - pub fn new(address: String, user: String, pass: String) -> Self { + pub fn new(address: String, username: String, pass: String) -> Self { Self { address, - user, + username: IceUsername(username), pass, is_static: true, } @@ -61,7 +66,7 @@ impl IceUser { ]; let turn = IceServer { urls: turn_urls, - username: Some(self.user.clone()), + username: Some(self.username.0.clone()), credential: Some(self.pass.clone()), }; vec![stun, turn] @@ -71,8 +76,8 @@ impl IceUser { &self.address } - pub fn user(&self) -> &str { - &self.user + pub fn user(&self) -> &IceUsername { + &self.username } pub fn pass(&self) -> &str { diff --git a/src/media/mod.rs b/src/media/mod.rs index fb5ced46a..a362ee1f5 100644 --- a/src/media/mod.rs +++ b/src/media/mod.rs @@ -6,7 +6,7 @@ pub mod track; #[doc(inline)] pub use self::{ - ice_user::IceUser, + ice_user::{IceUser, IceUsername}, peer::{ New, Peer, PeerError, PeerStateMachine, WaitLocalHaveRemote, WaitLocalSdp, WaitRemoteSdp, diff --git a/src/signalling/participants.rs b/src/signalling/participants.rs index 6236a5959..0ca693e8c 100644 --- a/src/signalling/participants.rs +++ b/src/signalling/participants.rs @@ -243,22 +243,29 @@ impl ParticipantService { .map(move |_| Ok(member)), )) } else { + let turn_service = self.turn_service.clone(); + let cloned_member_id = member_id.clone(); + let room_id = self.room_id.clone(); Box::new( - wrap_future(self.turn_service.create( - member_id.clone(), - self.room_id.clone(), - UnreachablePolicy::ReturnErr, - )) - .map( - |result, room: &mut Room, _| match result { + wrap_future(async move { + turn_service + .create( + cloned_member_id, + room_id, + UnreachablePolicy::ReturnErr, + ) + .await + }) + .map(move |result, room: &mut Room, _| { + match result { Ok(ice_user) => { room.members.insert_connection(member_id, conn); member.replace_ice_user(ice_user); Ok(member) } Err(e) => Err(ParticipantServiceErr::from(e)), - }, - ), + } + }), ) } } @@ -328,8 +335,10 @@ impl ParticipantService { match self.get_member_by_id(&member_id) { None => future::ok(()).boxed_local(), Some(member) => { - if let Some(ice_user) = member.take_ice_user() { - self.turn_service.delete(vec![ice_user]) + if let Some(turn_user) = member.take_ice_user() { + let turn_service = self.turn_service.clone(); + async move { turn_service.delete(&[turn_user]).await } + .boxed_local() } else { future::ok(()).boxed_local() } @@ -363,16 +372,18 @@ impl ParticipantService { )); // deleting all IceUsers - let ice_users = self + let ice_users: Vec<_> = self .members .values() .filter_map(Member::take_ice_user) .collect(); - let delete_ice_users = self - .turn_service - .delete(ice_users) - .map_err(|err| error!("Error removing IceUsers {:?}", err)); + let turn_service = self.turn_service.clone(); + let delete_ice_users = async move { + if let Err(e) = turn_service.delete(ice_users.as_slice()).await { + error!("Error removing IceUser {:?}", e) + }; + }; future::join(close_rpc_connections, delete_ice_users) .map(|_| ()) @@ -402,12 +413,12 @@ impl ParticipantService { if let Some(member) = self.members.remove(member_id) { if let Some(ice_user) = member.take_ice_user() { - wrap_future::<_, Room>( - self.turn_service - .delete(vec![ice_user]) - .map_err(|e| error!("Error removing IceUser {:?}", e)) - .map(|_| ()), - ) + let turn_service = self.turn_service.clone(); + wrap_future::<_, Room>(async move { + if let Err(e) = turn_service.delete(&[ice_user]).await { + error!("Error removing IceUser {:?}", e) + } + }) .spawn(ctx); } } diff --git a/src/signalling/room.rs b/src/signalling/room.rs index 13c544d89..c26ff8125 100644 --- a/src/signalling/room.rs +++ b/src/signalling/room.rs @@ -248,7 +248,7 @@ impl Room { sdp_offer: None, tracks: sender.tracks(), ice_servers, - force_relay: sender.is_force_relayed(), + force_relay: true, }; self.peers.add_peer(sender); Ok(Box::new( @@ -812,7 +812,7 @@ impl CommandHandler for Room { sdp_offer: Some(sdp_offer), tracks: to_peer.tracks(), ice_servers, - force_relay: to_peer.is_force_relayed(), + force_relay: true, }; self.peers.add_peer(from_peer); diff --git a/src/turn/cli.rs b/src/turn/cli.rs new file mode 100644 index 000000000..9e3070964 --- /dev/null +++ b/src/turn/cli.rs @@ -0,0 +1,73 @@ +use std::{fmt, ops::DerefMut, time::Duration}; + +use coturn_telnet::{CoturnTelnetError, Manager, Pool, PoolError}; +use deadpool::managed::{PoolConfig, Timeouts}; +use derive_more::{Display, From}; +use failure::Fail; + +use crate::media::IceUser; + +#[derive(Display, Debug, Fail, From)] +pub enum CoturnCliError { + #[display(fmt = "Couldn't get connection from pool: {}", _0)] + PoolError(PoolError), + #[display(fmt = "Coturn telnet connection returned error: {}", _0)] + CliError(CoturnTelnetError), +} + +/// Abstraction over remote [Coturn] server telnet interface. +/// +/// This struct can be cloned and transferred across thread boundaries. +/// +/// [Coturn]: https://github.com/coturn/coturn +#[derive(Clone)] +pub struct CoturnTelnetClient { + pool: Pool, +} + +impl CoturnTelnetClient { + /// Creates new [`CoturnTelnetClient`]. + pub fn new( + addr: (String, u16), + pass: String, + ) -> Result { + let manager = Manager::new(addr, pass); + // TODO: to conf + let config = PoolConfig { + max_size: 16, + timeouts: Timeouts { + wait: Some(Duration::from_secs(5)), + create: Some(Duration::from_secs(5)), + recycle: Some(Duration::from_secs(5)), + }, + }; + Ok(Self { + pool: Pool::from_config(manager, config), + }) + } + + /// Forcefully closes provided [`IceUser`]s sessions on Coturn server. + pub async fn delete_sessions( + &self, + users: &[&IceUser], + ) -> Result<(), CoturnCliError> { + let mut connection = self.pool.get().await?; + for user in users { + let sessions = connection + .deref_mut() + .print_sessions(user.user().clone().into()) + .await?; + connection.deref_mut().delete_sessions(sessions).await?; + } + + Ok(()) + } +} + +impl fmt::Debug for CoturnTelnetClient { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("CoturnTelnetClient") + .field("pool", &self.pool.status()) + .finish() + } +} diff --git a/src/turn/mod.rs b/src/turn/mod.rs index 2200d2a6e..bbf887586 100644 --- a/src/turn/mod.rs +++ b/src/turn/mod.rs @@ -2,6 +2,7 @@ //! //! [TURN]: https://webrtcglossary.com/turn +pub mod cli; pub mod repo; pub mod service; diff --git a/src/turn/repo.rs b/src/turn/repo.rs index 68c7d8b8e..ba3dd3ebb 100644 --- a/src/turn/repo.rs +++ b/src/turn/repo.rs @@ -1,7 +1,7 @@ //! Abstraction over remote Redis database used to store Turn server //! credentials. -use std::{fmt, future::Future, time::Duration}; +use std::{fmt, time::Duration}; use crypto::{digest::Digest, md5::Md5}; use deadpool::managed::{PoolConfig, Timeouts}; @@ -21,8 +21,11 @@ pub enum TurnDatabaseErr { RedisError(RedisError), } -// Abstraction over remote Redis database used to store Turn server -// credentials. +/// Abstraction over remote Redis database used to store Turn server +/// credentials. +/// +/// This struct can be cloned and transferred across thread boundaries. +#[derive(Clone)] pub struct TurnDatabase { pool: Pool, } @@ -48,10 +51,7 @@ impl TurnDatabase { } /// Inserts provided [`IceUser`] into remote Redis database. - pub fn insert( - &mut self, - user: &IceUser, - ) -> impl Future> { + pub async fn insert(&self, user: &IceUser) -> Result<(), TurnDatabaseErr> { debug!("Store ICE user: {:?}", user); let key = format!("turn/realm/medea/user/{}/key", user.user()); @@ -61,34 +61,34 @@ impl TurnDatabase { hasher.input_str(&value); let result = hasher.result_str(); - let pool = self.pool.clone(); - async move { - let mut conn = pool.get().await?; - Ok(cmd("SET") - .arg(key) - .arg(result) - .query_async(&mut conn) - .await?) - } + let mut conn = self.pool.get().await?; + Ok(cmd("SET") + .arg(key) + .arg(result) + .query_async(&mut conn) + .await?) } /// Deletes batch of provided [`IceUser`]s. - pub fn remove( - &mut self, - users: &[IceUser], - ) -> impl Future> { + /// + /// No-op if empty batch is provided. + pub async fn remove( + &self, + users: &[&IceUser], + ) -> Result<(), TurnDatabaseErr> { debug!("Remove ICE users: {:?}", users); - let delete_keys: Vec<_> = users + if users.is_empty() { + return Ok(()); + } + + let keys: Vec<_> = users .iter() .map(|u| format!("turn/realm/medea/user/{}/key", u.user())) .collect(); - let pool = self.pool.clone(); - async move { - let mut conn = pool.get().await?; - Ok(cmd("DEL").arg(delete_keys).query_async(&mut conn).await?) - } + let mut conn = self.pool.get().await?; + Ok(cmd("DEL").arg(keys).query_async(&mut conn).await?) } } diff --git a/src/turn/service.rs b/src/turn/service.rs index 0c607bb96..38cb3d4f8 100644 --- a/src/turn/service.rs +++ b/src/turn/service.rs @@ -5,15 +5,9 @@ use std::{fmt, sync::Arc}; -use actix::{ - fut, Actor, ActorFuture, Addr, Context, Handler, MailboxError, Message, - ResponseFuture, WrapFuture as _, -}; +use async_trait::async_trait; use derive_more::{Display, From}; use failure::Fail; -use futures::future::{ - self, FutureExt as _, LocalBoxFuture, TryFutureExt as _, -}; use rand::{distributions::Alphanumeric, Rng}; use redis::ConnectionInfo; @@ -21,87 +15,22 @@ use crate::{ api::control::{MemberId, RoomId}, conf, media::IceUser, - turn::repo::{TurnDatabase, TurnDatabaseErr}, + turn::{ + cli::{CoturnCliError, CoturnTelnetClient}, + repo::{TurnDatabase, TurnDatabaseErr}, + }, }; static TURN_PASS_LEN: usize = 16; -/// Manages Turn server credentials. -pub trait TurnAuthService: fmt::Debug + Send + Sync { - /// Generates and registers Turn credentials. - fn create( - &self, - member_id: MemberId, - room_id: RoomId, - policy: UnreachablePolicy, - ) -> LocalBoxFuture<'static, Result>; - - /// Deletes batch of [`IceUser`]s. - fn delete( - &self, - users: Vec, - ) -> LocalBoxFuture<'static, Result<(), TurnServiceErr>>; -} - -impl TurnAuthService for Addr { - /// Sends [`CreateIceUser`] to [`Service`]. - fn create( - &self, - member_id: MemberId, - room_id: RoomId, - policy: UnreachablePolicy, - ) -> LocalBoxFuture<'static, Result> { - let creating = self.send(CreateIceUser { - member_id, - room_id, - policy, - }); - async { - match creating.await { - Ok(Ok(ice)) => Ok(ice), - Ok(Err(err)) => Err(err), - Err(err) => Err(err.into()), - } - } - .boxed_local() - } - - /// Sends `DeleteRoom` to [`Service`]. - fn delete( - &self, - users: Vec, - ) -> LocalBoxFuture<'static, Result<(), TurnServiceErr>> { - // leave only non static users - let users: Vec = - users.into_iter().filter(|u| !u.is_static()).collect(); - - if users.is_empty() { - future::ok(()).boxed_local() - } else { - let deleting = self.send(DeleteIceUsers(users)); - async { - match deleting.await { - Ok(Err(err)) => Err(err), - Err(err) => Err(err.into()), - _ => Ok(()), - } - } - .boxed_local() - } - } -} - -/// Ergonomic type alias for using [`ActorFuture`] for [`AuthService`]. -type ActFuture = Box>; - /// Error which can happen in [`TurnAuthService`]. #[derive(Display, Debug, Fail, From)] pub enum TurnServiceErr { #[display(fmt = "Error accessing TurnAuthRepo: {}", _0)] TurnAuthRepoErr(TurnDatabaseErr), - #[display(fmt = "Mailbox error when accessing TurnAuthRepo: {}", _0)] - MailboxErr(MailboxError), + #[display(fmt = "Error accessing TurnAuthRepo: {}", _0)] + CoturnCLiErr(CoturnCliError), #[display(fmt = "Timeout exceeded while trying to insert/delete IceUser")] #[from(ignore)] @@ -120,12 +49,29 @@ pub enum UnreachablePolicy { ReturnStatic, } +/// Manages Turn server credentials. +#[async_trait] +pub trait TurnAuthService: fmt::Debug + Send + Sync { + /// Generates and registers Turn credentials. + async fn create( + &self, + member_id: MemberId, + room_id: RoomId, + policy: UnreachablePolicy, + ) -> Result; + + /// Deletes batch of [`IceUser`]s. + async fn delete(&self, users: &[IceUser]) -> Result<(), TurnServiceErr>; +} + /// [`TurnAuthService`] implementation backed by Redis database. #[derive(Debug)] struct Service { /// Turn credentials repository. turn_db: TurnDatabase, + coturn_cli: CoturnTelnetClient, + /// TurnAuthRepo password. db_pass: String, @@ -137,9 +83,66 @@ struct Service { /// Turn server static user password. turn_password: String, +} + +impl Service { + /// Generates random alphanumeric string of specified length. + fn generate_pass(n: usize) -> String { + rand::thread_rng() + .sample_iter(&Alphanumeric) + .take(n) + .collect() + } - /// Lazy static [`ICEUser`]. - static_user: Option, + /// Returns [`IceUser`] with static credentials. + fn static_user(&self) -> IceUser { + IceUser::new( + self.turn_address.clone(), + self.turn_username.clone(), + self.turn_password.clone(), + ) + } +} + +#[async_trait] +impl TurnAuthService for Service { + /// Generates [`IceUser`] with saved Turn address, provided [`MemberId`] and + /// random password. Inserts created [`IceUser`] into [`TurnDatabase`]. + async fn create( + &self, + member_id: MemberId, + room_id: RoomId, + policy: UnreachablePolicy, + ) -> Result { + let ice_user = IceUser::build( + self.turn_address.clone(), + &room_id, + &member_id.0, + Self::generate_pass(TURN_PASS_LEN), + ); + + match self.turn_db.insert(&ice_user).await { + Ok(_) => Ok(ice_user), + Err(err) => match policy { + UnreachablePolicy::ReturnErr => Err(err.into()), + UnreachablePolicy::ReturnStatic => Ok(self.static_user()), + }, + } + } + + /// Deletes provided [`IceUser`]s from [`TurnDatabase`] and closes their + /// sessions on Coturn. + async fn delete(&self, users: &[IceUser]) -> Result<(), TurnServiceErr> { + if users.is_empty() { + return Ok(()); + } + + // leave only non static users + let users = users.iter().filter(|u| !u.is_static()).collect::>(); + self.turn_db.remove(users.as_slice()).await?; + self.coturn_cli.delete_sessions(users.as_slice()).await?; + Ok(()) + } } /// Create new instance [`TurnAuthService`]. @@ -162,101 +165,21 @@ pub fn new_turn_auth_service<'a>( }, )?; + let coturn_cli = CoturnTelnetClient::new( + (cf.cli.ip.to_string(), cf.cli.port), + cf.cli.pass.clone(), + )?; + let turn_service = Service { turn_db, + coturn_cli, db_pass: cf.db.redis.pass.clone(), turn_address: cf.addr(), turn_username: cf.user.clone(), turn_password: cf.pass.clone(), - static_user: None, }; - Ok(Arc::new(turn_service.start())) -} - -impl Service { - /// Generates random alphanumeric string of specified length. - fn generate_pass(n: usize) -> String { - rand::thread_rng() - .sample_iter(&Alphanumeric) - .take(n) - .collect() - } - - /// Returns [`ICEUser`] with static credentials. - fn static_user(&mut self) -> IceUser { - if self.static_user.is_none() { - self.static_user.replace(IceUser::new( - self.turn_address.clone(), - self.turn_username.clone(), - self.turn_password.clone(), - )); - }; - - self.static_user.clone().unwrap() - } -} - -impl Actor for Service { - type Context = Context; -} - -/// Creates credentials on Turn server for specified member. -#[derive(Debug, Message)] -#[rtype(result = "Result")] -struct CreateIceUser { - pub member_id: MemberId, - pub room_id: RoomId, - pub policy: UnreachablePolicy, -} - -impl Handler for Service { - type Result = ActFuture>; - - /// Generates [`IceUser`] with saved Turn address, provided [`MemberId`] and - /// random password. Inserts created [`IceUser`] into [`TurnDatabase`]. - fn handle( - &mut self, - msg: CreateIceUser, - _ctx: &mut Self::Context, - ) -> Self::Result { - let ice_user = IceUser::build( - self.turn_address.clone(), - &msg.room_id, - &msg.member_id.to_string(), - Self::generate_pass(TURN_PASS_LEN), - ); - - Box::new(self.turn_db.insert(&ice_user).into_actor(self).then( - move |result, this, _| match result { - Ok(_) => fut::ok(ice_user), - Err(err) => match msg.policy { - UnreachablePolicy::ReturnErr => fut::err(err.into()), - UnreachablePolicy::ReturnStatic => { - fut::ok(this.static_user()) - } - }, - }, - )) - } -} - -/// Deletes all users from given room in redis. -#[derive(Debug, Message)] -#[rtype(result = "Result<(), TurnServiceErr>")] -struct DeleteIceUsers(Vec); - -impl Handler for Service { - type Result = ResponseFuture>; - - /// Deletes all users with provided [`RoomId`] - fn handle( - &mut self, - msg: DeleteIceUsers, - _ctx: &mut Self::Context, - ) -> Self::Result { - self.turn_db.remove(&msg.0).err_into().boxed_local() - } + Ok(Arc::new(turn_service)) } #[cfg(test)] @@ -267,35 +190,30 @@ pub mod test { use super::*; - #[derive(Debug)] - struct TurnAuthServiceMock {} + #[derive(Clone, Copy, Debug)] + struct TurnAuthServiceMock; + #[async_trait] impl TurnAuthService for TurnAuthServiceMock { - fn create( + async fn create( &self, _: MemberId, _: RoomId, _: UnreachablePolicy, - ) -> LocalBoxFuture<'static, Result> { - async { - Ok(IceUser::new( - "5.5.5.5:1234".parse().unwrap(), - "username".into(), - "password".into(), - )) - } - .boxed_local() + ) -> Result { + Ok(IceUser::new( + "5.5.5.5:1234".parse().unwrap(), + "username".into(), + "password".into(), + )) } - fn delete( - &self, - _: Vec, - ) -> LocalBoxFuture<'static, Result<(), TurnServiceErr>> { - future::ok(()).boxed_local() + async fn delete(&self, _: &[IceUser]) -> Result<(), TurnServiceErr> { + Ok(()) } } pub fn new_turn_auth_service_mock() -> Arc { - Arc::new(TurnAuthServiceMock {}) + Arc::new(TurnAuthServiceMock) } } From 5332d558a48bebc0843f9228d631b46b47d33666 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Tue, 11 Feb 2020 09:51:26 +0200 Subject: [PATCH 02/21] refactor --- Cargo.lock | 256 ++++++++++++++----------- crates/coturn-telnet/src/connection.rs | 2 +- crates/coturn-telnet/src/pool.rs | 22 +-- jason/src/lib.rs | 2 - src/lib.rs | 2 - src/turn/cli.rs | 9 +- src/turn/service.rs | 2 +- 7 files changed, 163 insertions(+), 132 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ef64d72cd..f951d9c4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,7 +21,7 @@ dependencies = [ "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -40,8 +40,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -58,7 +58,7 @@ dependencies = [ "actix-utils 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "trust-dns-proto 0.18.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -73,7 +73,7 @@ dependencies = [ "actix-service 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "actix-web 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -98,9 +98,9 @@ dependencies = [ "encoding_rs 0.8.22 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-channel 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -115,7 +115,7 @@ dependencies = [ "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -151,7 +151,7 @@ dependencies = [ "actix-macros 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "actix-threadpool 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "copyless 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -164,7 +164,7 @@ dependencies = [ "actix-rt 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "actix-service 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "actix-utils 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -178,7 +178,7 @@ name = "actix-service" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-util 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -191,7 +191,7 @@ dependencies = [ "actix-rt 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "actix-server 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "actix-service 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -202,7 +202,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-channel 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -221,7 +221,7 @@ dependencies = [ "actix-utils 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -236,7 +236,7 @@ dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -263,7 +263,7 @@ dependencies = [ "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "encoding_rs 0.8.22 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", @@ -271,7 +271,7 @@ dependencies = [ "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -287,7 +287,7 @@ dependencies = [ "actix-http 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "actix-web 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -371,7 +371,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "async-stream-impl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -426,19 +426,19 @@ dependencies = [ "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "backtrace" -version = "0.3.43" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", @@ -461,7 +461,7 @@ name = "base64" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -504,12 +504,12 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.1.2" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "byteorder" -version = "1.3.2" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -581,7 +581,7 @@ version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ascii 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -597,7 +597,7 @@ dependencies = [ "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "serde-hjson 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -621,6 +621,22 @@ name = "copyless" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "coturn-telnet" +version = "0.1.0-dev" +dependencies = [ + "async-trait 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "deadpool 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-test 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crc32fast" version = "1.2.0" @@ -766,7 +782,7 @@ dependencies = [ "async-trait 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "config 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "deadpool 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "redis 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", @@ -897,7 +913,7 @@ name = "failure" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -972,50 +988,50 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-channel 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-executor 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-executor 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-channel" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-core" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-executor" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-io" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-macro" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1026,26 +1042,26 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-task" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-util" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-channel 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-macro 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-macro 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1058,7 +1074,7 @@ name = "fxhash" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1083,9 +1099,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1166,9 +1182,9 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-channel 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "http-body 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1352,13 +1368,14 @@ dependencies = [ "awc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "config 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "coturn-telnet 0.1.0-dev", "deadpool 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "deadpool-redis 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "derive_builder 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "dotenv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "humantime-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "medea-client-api-proto 0.2.0-dev", @@ -1369,7 +1386,7 @@ dependencies = [ "redis 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)", "serial_test 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "serial_test_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1394,7 +1411,7 @@ dependencies = [ "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "medea-macro 0.2.0-dev", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1437,14 +1454,14 @@ dependencies = [ "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "downcast 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", "medea-client-api-proto 0.2.0-dev", "medea-macro 0.2.0-dev", "mockall 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "predicates-tree 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "tracerr 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-futures 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1987,8 +2004,8 @@ dependencies = [ "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "combine 3.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "dtoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-executor 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-executor 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2157,7 +2174,7 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.46" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2271,7 +2288,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2472,7 +2489,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2482,17 +2499,38 @@ dependencies = [ "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tokio-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-test" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tokio-util" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2515,8 +2553,8 @@ dependencies = [ "async-trait 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "http-body 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2551,7 +2589,7 @@ name = "tower" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "tower-buffer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "tower-discover 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "tower-layer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2568,8 +2606,8 @@ name = "tower-balance" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2589,7 +2627,7 @@ name = "tower-buffer" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "tower-layer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2602,7 +2640,7 @@ name = "tower-discover" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2617,7 +2655,7 @@ name = "tower-limit" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "tower-layer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2629,7 +2667,7 @@ name = "tower-load" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2642,7 +2680,7 @@ name = "tower-load-shed" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "tower-layer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2662,8 +2700,8 @@ name = "tower-ready-cache" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2675,7 +2713,7 @@ name = "tower-retry" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "tower-layer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2703,8 +2741,8 @@ name = "tower-util" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2767,7 +2805,7 @@ dependencies = [ "async-trait 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "enum-as-inner 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2785,7 +2823,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "ipconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2891,7 +2929,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-macro 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2900,7 +2938,7 @@ name = "wasm-bindgen-backend" version = "0.2.58" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bumpalo 3.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bumpalo 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3125,7 +3163,7 @@ dependencies = [ "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" "checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" "checksum awc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d7601d4d1d7ef2335d6597a41b5fe069f6ab799b85f53565ab390e7b7065aac5" -"checksum backtrace 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)" = "7f80256bc78f67e7df7e36d77366f636ed976895d91fe2ab9efa3973e8fe8c4f" +"checksum backtrace 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e4036b9bf40f3cf16aba72a3d65e8a520fc4bafcdc7079aea8f848c58c5b5536" "checksum backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" @@ -3133,8 +3171,8 @@ dependencies = [ "checksum blake2b_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a" "checksum brotli-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" "checksum brotli2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" -"checksum bumpalo 3.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5fb8038c1ddc0a5f73787b130f4cc75151e96ed33e417fde765eb5a81e3532f4" -"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" +"checksum bumpalo 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f359dc14ff8911330a51ef78022d376f25ed00248912803b58f00cb1c27f742" +"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" "checksum bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" "checksum bytestring 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "fc267467f58ef6cc8874064c62a0423eb0d099362c8a23edd1c6d044f46eead4" "checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" @@ -3188,15 +3226,15 @@ dependencies = [ "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" -"checksum futures 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ad6636318d07abeb4656157ef1936c64485f066c7f9ce5d7c5b879fcb6dd5ccb" -"checksum futures-channel 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7264eb65b194d2fa6ec31b898ead7c332854bfa42521659226e72a585fca5b85" -"checksum futures-core 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b597b16aa1a19ce2dfde5128a7c656d75346b35601a640be2d9efd4e9c83609d" -"checksum futures-executor 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "46a5e593d77bee52393c7f3b16b8b413214096d3f7dc4f5f4c57dee01ad2bdaf" -"checksum futures-io 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3d429f824b5e5dbd45fc8e54e1005a37e1f8c6d570cd64d0b59b24d3a80b8b8e" -"checksum futures-macro 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d75b72904b78044e0091355fc49d29f48bff07a68a719a41cf059711e071b4" -"checksum futures-sink 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "04299e123547ea7c56f3e1b376703142f5fc0b6700433eed549e9d0b8a75a66c" -"checksum futures-task 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86f9ceab4bce46555ee608b1ec7c414d6b2e76e196ef46fa5a8d4815a8571398" -"checksum futures-util 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7d2f1296f7644d2cd908ebb2fa74645608e39f117c72bac251d40418c6d74c4f" +"checksum futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5c329ae8753502fb44ae4fc2b622fa2a94652c41e795143765ba0927f92ab780" +"checksum futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0c77d04ce8edd9cb903932b608268b3fffec4163dc053b3b402bf47eac1f1a8" +"checksum futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f25592f769825e89b92358db00d26f965761e094951ac44d3663ef25b7ac464a" +"checksum futures-executor 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f674f3e1bcb15b37284a90cedf55afdba482ab061c407a9c0ebbd0f3109741ba" +"checksum futures-io 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a638959aa96152c7a4cddf50fcb1e3fede0583b27157c26e67d6f99904090dc6" +"checksum futures-macro 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" +"checksum futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3466821b4bc114d95b087b850a724c6f83115e929bc88f1fa98a3304a944c8a6" +"checksum futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27" +"checksum futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "22766cf25d64306bedf0384da004d05c9974ab104fcc4528f1236181c18004c5" "checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" @@ -3312,7 +3350,7 @@ dependencies = [ "checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" "checksum serde-hjson 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6a3a4e0ea8a88553209f6cc6cfe8724ecad22e1acf372793c27d995290fe74f8" "checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64" -"checksum serde_json 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "21b01d7f0288608a01dca632cf1df859df6fd6ffa885300fc275ce2ba6221953" +"checksum serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)" = "15913895b61e0be854afd32fd4163fcd2a3df34142cf2cb961b310ce694cbf90" "checksum serde_test 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "110b3dbdf8607ec493c22d5d947753282f3bae73c0f56d322af1e8c78e4c23d5" "checksum serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" "checksum serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)" = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35" @@ -3348,6 +3386,8 @@ dependencies = [ "checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8fdd17989496f49cdc57978c96f0c9fe5e4a58a8bddc6813c449a4624f6a030b" +"checksum tokio-macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f4b1e7ed7d5d4c2af3d999904b0eebe76544897cdbfb2b9684bed2174ab20f7c" +"checksum tokio-test 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "09cf9705471976fa5fc6817d3fbc9c4ff9696a6647af0e5c1870c81ca7445b05" "checksum tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" "checksum toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" "checksum tonic 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08283643b1d483eb7f3fc77069e63b5cba3e4db93514b3d45470e67f123e4e48" diff --git a/crates/coturn-telnet/src/connection.rs b/crates/coturn-telnet/src/connection.rs index 9ad42dc97..fd2fa2a19 100644 --- a/crates/coturn-telnet/src/connection.rs +++ b/crates/coturn-telnet/src/connection.rs @@ -45,7 +45,7 @@ impl From for CoturnTelnetError { /// Asynchronous connection to remote [Coturn] server telnet interface. You can /// use this directly, but it is recommended to use this with connection pool -/// from `crate::pool`, which takes care of connection life cycle. +/// from [`crate::pool::Pool`], which takes care of connection life cycle. /// /// [Coturn]: https://github.com/coturn/coturn. pub struct CoturnTelnetConnection(Framed); diff --git a/crates/coturn-telnet/src/pool.rs b/crates/coturn-telnet/src/pool.rs index 5a7795d9b..8b7feeb09 100644 --- a/crates/coturn-telnet/src/pool.rs +++ b/crates/coturn-telnet/src/pool.rs @@ -21,26 +21,26 @@ use async_trait::async_trait; use bytes::Bytes; +use deadpool::managed; use crate::connection::{CoturnTelnetConnection, CoturnTelnetError}; -/// A type alias for using [`deadpool::managed::Pool`] with +/// A type alias for using `deadpool::managed::Pool` with /// [`CoturnTelnetConnection`]. -pub type Pool = - deadpool::managed::Pool; +pub type Pool = managed::Pool; -/// A type alias for using [`deadpool::managed::PoolError`] with +/// A type alias for using `deadpool::managed::PoolError` with /// [`CoturnTelnetConnection`]. -pub type PoolError = deadpool::managed::PoolError; +pub type PoolError = managed::PoolError; -/// A type alias for using [`deadpool::managed::Object`] with +/// A type alias for using `deadpool::managed::Object` with /// [`CoturnTelnetConnection`]. pub type Connection = - deadpool::managed::Object; + managed::Object; -type RecycleResult = deadpool::managed::RecycleResult; +type RecycleResult = managed::RecycleResult; -/// The manager for creating and recycling Coturn telnet connections +/// The manager for creating and recycling Coturn telnet connections. pub struct Manager { addr: (String, u16), pass: Bytes, @@ -56,9 +56,7 @@ impl Manager { } #[async_trait] -impl deadpool::managed::Manager - for Manager -{ +impl managed::Manager for Manager { async fn create( &self, ) -> Result { diff --git a/jason/src/lib.rs b/jason/src/lib.rs index f83a24a1b..6dce1acde 100644 --- a/jason/src/lib.rs +++ b/jason/src/lib.rs @@ -7,8 +7,6 @@ #![allow(clippy::module_name_repetitions, clippy::must_use_candidate)] #![cfg_attr(not(feature = "mockable"), warn(missing_docs))] #![cfg_attr(feature = "mockable", allow(missing_docs))] -// TODO: REVERT ME BEFORE MERGE!!! -#![allow(clippy::missing_errors_doc)] #[macro_use] pub mod utils; diff --git a/src/lib.rs b/src/lib.rs index 27c169dc9..8919683d1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,8 +3,6 @@ // TODO: Remove `clippy::must_use_candidate` once the issue below is resolved: // https://github.com/rust-lang/rust-clippy/issues/4779 #![allow(clippy::module_name_repetitions, clippy::must_use_candidate)] -// TODO: REVERT ME BEFORE MERGE!!! -#![allow(clippy::missing_errors_doc)] #[macro_use] pub mod utils; diff --git a/src/turn/cli.rs b/src/turn/cli.rs index 9e3070964..ae8cfd851 100644 --- a/src/turn/cli.rs +++ b/src/turn/cli.rs @@ -27,10 +27,7 @@ pub struct CoturnTelnetClient { impl CoturnTelnetClient { /// Creates new [`CoturnTelnetClient`]. - pub fn new( - addr: (String, u16), - pass: String, - ) -> Result { + pub fn new(addr: (String, u16), pass: String) -> Self { let manager = Manager::new(addr, pass); // TODO: to conf let config = PoolConfig { @@ -41,9 +38,9 @@ impl CoturnTelnetClient { recycle: Some(Duration::from_secs(5)), }, }; - Ok(Self { + Self { pool: Pool::from_config(manager, config), - }) + } } /// Forcefully closes provided [`IceUser`]s sessions on Coturn server. diff --git a/src/turn/service.rs b/src/turn/service.rs index 6bd6148d2..42a62c75d 100644 --- a/src/turn/service.rs +++ b/src/turn/service.rs @@ -173,7 +173,7 @@ pub fn new_turn_auth_service<'a>( let coturn_cli = CoturnTelnetClient::new( (cf.cli.ip.to_string(), cf.cli.port), cf.cli.pass.clone(), - )?; + ); let turn_service = Service { turn_db, From 56791475d1094a84c223bdabb60286e7b612aec1 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Tue, 11 Feb 2020 10:05:16 +0200 Subject: [PATCH 03/21] coturn telnet docs --- crates/coturn-telnet/src/codec.rs | 2 ++ crates/coturn-telnet/src/connection.rs | 11 ++++++----- crates/coturn-telnet/src/lib.rs | 12 +++++++++--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/crates/coturn-telnet/src/codec.rs b/crates/coturn-telnet/src/codec.rs index 2420d585f..c23549381 100644 --- a/crates/coturn-telnet/src/codec.rs +++ b/crates/coturn-telnet/src/codec.rs @@ -145,6 +145,8 @@ impl Into for CoturnCliRequest { } } +/// Errors that can happen while decoding bytes received to +/// [`CoturnCliResponse`]. #[derive(Debug)] pub enum CoturnCliCodecError { IoError(io::Error), diff --git a/crates/coturn-telnet/src/connection.rs b/crates/coturn-telnet/src/connection.rs index fd2fa2a19..5754392db 100644 --- a/crates/coturn-telnet/src/connection.rs +++ b/crates/coturn-telnet/src/connection.rs @@ -12,14 +12,15 @@ use crate::codec::{ CoturnResponseParseError, }; +/// Any errors that can be thrown from [`CoturnTelnetConnection`]. #[derive(Debug, derive_more::Display, derive_more::From)] pub enum CoturnTelnetError { /// Underlying transport encountered [`io::Error`]. You should try - /// recreating [`CoturnTelnetClient`]. + /// recreating [`CoturnTelnetConnection`]. #[display(fmt = "Underlying transport encountered IoError: {}", _0)] IoError(io::Error), /// Underlying stream exhausted. You should try recreating - /// [`CoturnTelnetClient`]. + /// [`CoturnTelnetConnection`]. #[display(fmt = "Disconnected from Coturn telnet server")] Disconnected, /// Unable to parse response from Coturn telnet server. This is @@ -45,7 +46,7 @@ impl From for CoturnTelnetError { /// Asynchronous connection to remote [Coturn] server telnet interface. You can /// use this directly, but it is recommended to use this with connection pool -/// from [`crate::pool::Pool`], which takes care of connection life cycle. +/// from [`crate::pool::Pool`], which takes care of connection lifecycle. /// /// [Coturn]: https://github.com/coturn/coturn. pub struct CoturnTelnetConnection(Framed); @@ -66,7 +67,7 @@ impl CoturnTelnetConnection { /// Returns session ids associated with provided username. /// - /// 1. Sends [`CoturnTelnetClientError::PrintSessions`] with provided + /// 1. Sends [`CoturnCliRequest::PrintSessions`] with provided /// username. /// 2. Awaits for [`CoturnCliResponse::Sessions`]. pub async fn print_sessions( @@ -131,7 +132,7 @@ impl CoturnTelnetConnection { Ok(()) } - /// Authenticates [`CoturnTelnetClient`]. + /// Authenticates [`CoturnTelnetConnection`]. /// /// 1. Awaits for [`CoturnCliResponse::EnterPassword`]. /// 2. Sends [`CoturnCliRequest::Auth`]. diff --git a/crates/coturn-telnet/src/lib.rs b/crates/coturn-telnet/src/lib.rs index 321641c49..b4ca61b19 100644 --- a/crates/coturn-telnet/src/lib.rs +++ b/crates/coturn-telnet/src/lib.rs @@ -1,8 +1,14 @@ +//! Implements client to access [Coturn] telnet cli. You can use +//! [`CoturnTelnetConnection`] directly, but it is recommended to use connection +//! pool based on [deadpool] that will take care of connection lifecycle. +//! +//! [Coturn]: https://github.com/coturn/coturn +//! [deadpool]: https://crates.io/crates/deadpool #![allow(clippy::module_name_repetitions)] -mod codec; -mod connection; -mod pool; +pub mod codec; +pub mod connection; +pub mod pool; pub use connection::{CoturnTelnetConnection, CoturnTelnetError}; pub use pool::{Connection, Manager, Pool, PoolError}; From 2512b0b83f6197f218a451409b159f09c70631ee Mon Sep 17 00:00:00 2001 From: alexlapa Date: Tue, 11 Feb 2020 10:22:18 +0200 Subject: [PATCH 04/21] doctest --- crates/coturn-telnet/src/pool.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/crates/coturn-telnet/src/pool.rs b/crates/coturn-telnet/src/pool.rs index 8b7feeb09..75d59da27 100644 --- a/crates/coturn-telnet/src/pool.rs +++ b/crates/coturn-telnet/src/pool.rs @@ -6,17 +6,21 @@ //! # Example //! //! ```rust +//! use std::ops::DerefMut; //! use coturn_telnet::{Manager, Pool}; //! -//! let mgr = Manager::new((String::from("localhost", 5766)), "turn") -//! .unwrap(); -//! let pool = Pool::new(mgr, 16); -//! let mut conn = pool.get().await.unwrap(); +//! let mut rt = tokio::runtime::Runtime::new().unwrap(); +//! rt.block_on(async { +//! let mgr = Manager::new((String::from("localhost"), 5766), "turn"); +//! let pool = Pool::new(mgr, 16); //! -//! conn.deref_mut() -//! .print_sessions(String::from("username")) -//! .await -//! .unwrap(); +//! let mut conn = pool.get().await.unwrap(); +//! +//! conn.deref_mut() +//! .print_sessions(String::from("username")) +//! .await +//! .unwrap(); +//! }); //! ``` use async_trait::async_trait; From be00905664bd623a598e552e7d830ae06d6bbc27 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Tue, 11 Feb 2020 11:41:47 +0200 Subject: [PATCH 05/21] add timeouts to config --- config.toml | 19 ++++++++- crates/coturn-telnet/Cargo.toml | 2 +- crates/coturn-telnet/README.md | 2 +- src/conf/turn.rs | 69 +++++++++++++++++++++++++++++---- 4 files changed, 82 insertions(+), 10 deletions(-) diff --git a/config.toml b/config.toml index d4175eee1..cfefc8712 100644 --- a/config.toml +++ b/config.toml @@ -128,7 +128,7 @@ [turn.cli] # Coturn server host. # -# Env var: MEDEA_TURN__CLI__HOST +# Env var: MEDEA_TURN__CLI__IP # Default: # host = "127.0.0.1" @@ -144,7 +144,24 @@ # Default: # pass = "turn" +[turn.cli.timeouts] +# Timeout when waiting for an available connection. +# +# Env var: MEDEA_TURN__CLI__TIMEOUTS__WAIT +# Default: +# wait = "5s" +# Timeout when creating a new connection. +# +# Env var: MEDEA_TURN__CLI__TIMEOUTS__CREATE +# Default: +# create = "5s" + +# Timeout when recycling connection. +# +# Env var: MEDEA_TURN__CLI__TIMEOUTS__RECYCLE +# Default: +# recycle = "5s" [log] # Maximum allowed level of application log entries. diff --git a/crates/coturn-telnet/Cargo.toml b/crates/coturn-telnet/Cargo.toml index 03f768a3b..d545405d8 100644 --- a/crates/coturn-telnet/Cargo.toml +++ b/crates/coturn-telnet/Cargo.toml @@ -2,7 +2,7 @@ name = "coturn-telnet" version = "0.1.0-dev" edition = "2018" -description = "Coturn TURN server telnet cli client" +description = "Coturn TURN server telnet client" authors = ["Instrumentisto Team "] license = "MIT/Apache-2.0" documentation = "https://docs.rs/coturn-telnet" diff --git a/crates/coturn-telnet/README.md b/crates/coturn-telnet/README.md index 3411b4d2b..63dbe12a2 100644 --- a/crates/coturn-telnet/README.md +++ b/crates/coturn-telnet/README.md @@ -7,7 +7,7 @@ coturn-telnet [API Docs](https://docs.rs/coturn-telnet) | [Changelog](https://github.com/instrumentisto/medea/blob/master/crates/coturn-telnet/CHANGELOG.md) -[Coturn] telnet cli client implementation. +[Coturn] telnet admin interface client implementation. diff --git a/src/conf/turn.rs b/src/conf/turn.rs index 72e4d6089..c7ce09e8f 100644 --- a/src/conf/turn.rs +++ b/src/conf/turn.rs @@ -6,6 +6,7 @@ use std::{ time::Duration, }; +use deadpool::managed::Timeouts as PoolTimeouts; use serde::{Deserialize, Serialize}; use smart_default::SmartDefault; @@ -15,7 +16,7 @@ use smart_default::SmartDefault; pub struct Turn { /// Database settings pub db: Db, - /// Coturn cli connection settings. + /// Coturn telnet connection settings. pub cli: CoturnCli, /// Host of STUN/TURN server. Defaults to `localhost`. #[default = "localhost"] @@ -86,6 +87,35 @@ pub struct CoturnCli { /// Password for authorize on Coturn server telnet interface. #[default(String::from("turn"))] pub pass: String, + /// Coturn connection timeouts. + pub timeouts: Timeouts, +} + +/// [Deadpool] connection pool timeouts. +/// +/// [Deadpool]: https://crates.io/crates/deadpool +#[derive(Clone, Debug, Deserialize, Serialize, SmartDefault)] +#[serde(default)] +pub struct Timeouts { + #[default(Some(Duration::from_secs(5)))] + #[serde(with = "humantime_serde")] + pub wait: Option, + #[default(Some(Duration::from_secs(5)))] + #[serde(with = "humantime_serde")] + pub create: Option, + #[default(Some(Duration::from_secs(5)))] + #[serde(with = "humantime_serde")] + pub recycle: Option, +} + +impl Into for &Timeouts { + fn into(self) -> PoolTimeouts { + PoolTimeouts { + wait: self.wait, + create: self.create, + recycle: self.recycle + } + } } #[cfg(test)] @@ -157,14 +187,39 @@ mod spec { #[test] #[serial] - fn turn_conf() { + fn coturn_cli() { let default_conf = Conf::default(); - let env_conf = overrided_by_env_conf!( - "MEDEA_TURN__HOST" => "example.com", - "MEDEA_TURN__PORT" => "1234", + let env_conf:Conf = overrided_by_env_conf!( + "MEDEA_TURN__CLI__IP" => "4.4.4.4", + "MEDEA_TURN__CLI__PORT" => "1234", + "MEDEA_TURN__CLI__PASS" => "clipass", ); - assert_ne!(default_conf.turn.host, env_conf.turn.host); - assert_ne!(default_conf.turn.port, env_conf.turn.port); + assert_ne!(default_conf.turn.cli.ip, env_conf.turn.cli.ip); + assert_ne!(default_conf.turn.cli.port, env_conf.turn.cli.port); + assert_ne!(default_conf.turn.cli.pass, env_conf.turn.cli.pass); + + assert_eq!(env_conf.turn.cli.ip, Ipv4Addr::new(4, 4, 4, 4)); + assert_eq!(env_conf.turn.cli.port, 1234); + assert_eq!(env_conf.turn.cli.pass, "clipass"); + } + + #[test] + #[serial] + fn coturn_cli_timeouts() { + let default_conf = Conf::default(); + let env_conf:Conf = overrided_by_env_conf!( + "MEDEA_TURN__CLI__TIMEOUTS__WAIT" => "1s", + "MEDEA_TURN__CLI__TIMEOUTS__CREATE" => "2s", + "MEDEA_TURN__CLI__TIMEOUTS__RECYCLE" => "3s", + ); + + assert_ne!(default_conf.turn.cli.timeouts.wait, env_conf.turn.cli.timeouts.wait); + assert_ne!(default_conf.turn.cli.timeouts.create, env_conf.turn.cli.timeouts.create); + assert_ne!(default_conf.turn.cli.timeouts.recycle, env_conf.turn.cli.timeouts.recycle); + + assert_eq!(env_conf.turn.cli.timeouts.wait, Some(Duration::from_secs(1))); + assert_eq!(env_conf.turn.cli.timeouts.create, Some(Duration::from_secs(2))); + assert_eq!(env_conf.turn.cli.timeouts.recycle, Some(Duration::from_secs(3))); } } From 92ced951848050ab60c8fa984c26502a69a1f66b Mon Sep 17 00:00:00 2001 From: alexlapa Date: Tue, 11 Feb 2020 12:14:44 +0200 Subject: [PATCH 06/21] add timeouts to config --- config.toml | 9 ++++-- src/conf/turn.rs | 78 +++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 73 insertions(+), 14 deletions(-) diff --git a/config.toml b/config.toml index cfefc8712..13cce3ede 100644 --- a/config.toml +++ b/config.toml @@ -145,19 +145,22 @@ # pass = "turn" [turn.cli.timeouts] -# Timeout when waiting for an available connection. +# Timeout when waiting for an available connection. 0 means no timeout and is +# not recommended. # # Env var: MEDEA_TURN__CLI__TIMEOUTS__WAIT # Default: # wait = "5s" -# Timeout when creating a new connection. +# Timeout when creating a new connection. 0 means no timeout and is not +# recommended. # # Env var: MEDEA_TURN__CLI__TIMEOUTS__CREATE # Default: # create = "5s" -# Timeout when recycling connection. +# Timeout when recycling connection. 0 means no timeout and is not +# recommended. # # Env var: MEDEA_TURN__CLI__TIMEOUTS__RECYCLE # Default: diff --git a/src/conf/turn.rs b/src/conf/turn.rs index c7ce09e8f..438842c62 100644 --- a/src/conf/turn.rs +++ b/src/conf/turn.rs @@ -110,10 +110,31 @@ pub struct Timeouts { impl Into for &Timeouts { fn into(self) -> PoolTimeouts { + let wait = self.wait.and_then(|wait| { + if wait.as_nanos() == 0 { + None + } else { + Some(wait) + } + }); + let create = self.create.and_then(|create| { + if create.as_nanos() == 0 { + None + } else { + Some(create) + } + }); + let recycle = self.recycle.and_then(|recycle| { + if recycle.as_nanos() == 0 { + None + } else { + Some(recycle) + } + }); PoolTimeouts { - wait: self.wait, - create: self.create, - recycle: self.recycle + wait, + create, + recycle, } } } @@ -126,6 +147,8 @@ mod spec { use crate::{conf::Conf, overrided_by_env_conf}; + use super::*; + #[test] #[serial] fn redis_db_overrides_defaults() { @@ -189,7 +212,7 @@ mod spec { #[serial] fn coturn_cli() { let default_conf = Conf::default(); - let env_conf:Conf = overrided_by_env_conf!( + let env_conf: Conf = overrided_by_env_conf!( "MEDEA_TURN__CLI__IP" => "4.4.4.4", "MEDEA_TURN__CLI__PORT" => "1234", "MEDEA_TURN__CLI__PASS" => "clipass", @@ -208,18 +231,51 @@ mod spec { #[serial] fn coturn_cli_timeouts() { let default_conf = Conf::default(); - let env_conf:Conf = overrided_by_env_conf!( + let env_conf: Conf = overrided_by_env_conf!( "MEDEA_TURN__CLI__TIMEOUTS__WAIT" => "1s", "MEDEA_TURN__CLI__TIMEOUTS__CREATE" => "2s", "MEDEA_TURN__CLI__TIMEOUTS__RECYCLE" => "3s", ); - assert_ne!(default_conf.turn.cli.timeouts.wait, env_conf.turn.cli.timeouts.wait); - assert_ne!(default_conf.turn.cli.timeouts.create, env_conf.turn.cli.timeouts.create); - assert_ne!(default_conf.turn.cli.timeouts.recycle, env_conf.turn.cli.timeouts.recycle); + assert_ne!( + default_conf.turn.cli.timeouts.wait, + env_conf.turn.cli.timeouts.wait + ); + assert_ne!( + default_conf.turn.cli.timeouts.create, + env_conf.turn.cli.timeouts.create + ); + assert_ne!( + default_conf.turn.cli.timeouts.recycle, + env_conf.turn.cli.timeouts.recycle + ); + + assert_eq!( + env_conf.turn.cli.timeouts.wait, + Some(Duration::from_secs(1)) + ); + assert_eq!( + env_conf.turn.cli.timeouts.create, + Some(Duration::from_secs(2)) + ); + assert_eq!( + env_conf.turn.cli.timeouts.recycle, + Some(Duration::from_secs(3)) + ); + } + + #[test] + fn into_pool_timeouts() { + let timeouts = Timeouts { + wait: None, + create: Some(Duration::from_secs(0)), + recycle: Some(Duration::from_secs(2)), + }; + + let timeouts: PoolTimeouts = (&timeouts).into(); - assert_eq!(env_conf.turn.cli.timeouts.wait, Some(Duration::from_secs(1))); - assert_eq!(env_conf.turn.cli.timeouts.create, Some(Duration::from_secs(2))); - assert_eq!(env_conf.turn.cli.timeouts.recycle, Some(Duration::from_secs(3))); + assert!(timeouts.wait.is_none()); + assert!(timeouts.create.is_none()); + assert_eq!(timeouts.recycle, Some(Duration::from_secs(2))); } } From 938d9227e43c6f4df46892448bf6f3f7f3ea8f91 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Tue, 11 Feb 2020 12:50:04 +0200 Subject: [PATCH 07/21] add timeouts to config --- src/conf/turn.rs | 36 ++++++++++++++++++++++++------------ src/turn/cli.rs | 32 +++++++++++--------------------- src/turn/service.rs | 1 + 3 files changed, 36 insertions(+), 33 deletions(-) diff --git a/src/conf/turn.rs b/src/conf/turn.rs index 438842c62..d6abc8580 100644 --- a/src/conf/turn.rs +++ b/src/conf/turn.rs @@ -6,7 +6,9 @@ use std::{ time::Duration, }; -use deadpool::managed::Timeouts as PoolTimeouts; +use deadpool::managed::{ + PoolConfig as DeadpoolPoolConfig, Timeouts as DeadpoolTimeouts, +}; use serde::{Deserialize, Serialize}; use smart_default::SmartDefault; @@ -87,29 +89,35 @@ pub struct CoturnCli { /// Password for authorize on Coturn server telnet interface. #[default(String::from("turn"))] pub pass: String, - /// Coturn connection timeouts. - pub timeouts: Timeouts, + /// Connection pool config. + pub pool: PoolConfig, } -/// [Deadpool] connection pool timeouts. +/// [Deadpool] connection pool config. /// /// [Deadpool]: https://crates.io/crates/deadpool -#[derive(Clone, Debug, Deserialize, Serialize, SmartDefault)] +#[derive(Copy, Clone, Debug, Deserialize, Serialize, SmartDefault)] #[serde(default)] -pub struct Timeouts { +pub struct PoolConfig { + /// Maximum size of the pool + #[default = 16] + pub max_size: usize, + /// Timeout when waiting for available connection to become available. #[default(Some(Duration::from_secs(5)))] #[serde(with = "humantime_serde")] pub wait: Option, + /// Timeout when creating a new connection. #[default(Some(Duration::from_secs(5)))] #[serde(with = "humantime_serde")] pub create: Option, + /// Timeout when recycling connection. #[default(Some(Duration::from_secs(5)))] #[serde(with = "humantime_serde")] pub recycle: Option, } -impl Into for &Timeouts { - fn into(self) -> PoolTimeouts { +impl Into for PoolConfig { + fn into(self) -> DeadpoolPoolConfig { let wait = self.wait.and_then(|wait| { if wait.as_nanos() == 0 { None @@ -131,10 +139,14 @@ impl Into for &Timeouts { Some(recycle) } }); - PoolTimeouts { - wait, - create, - recycle, + + DeadpoolPoolConfig { + max_size: self.max_size, + timeouts: DeadpoolTimeouts { + wait, + create, + recycle, + }, } } } diff --git a/src/turn/cli.rs b/src/turn/cli.rs index ae8cfd851..2a3c47197 100644 --- a/src/turn/cli.rs +++ b/src/turn/cli.rs @@ -1,7 +1,7 @@ -use std::{fmt, ops::DerefMut, time::Duration}; +use std::{fmt, ops::DerefMut}; use coturn_telnet::{CoturnTelnetError, Manager, Pool, PoolError}; -use deadpool::managed::{PoolConfig, Timeouts}; +use deadpool::managed::PoolConfig; use derive_more::{Display, From}; use failure::Fail; @@ -21,26 +21,16 @@ pub enum CoturnCliError { /// /// [Coturn]: https://github.com/coturn/coturn #[derive(Clone)] -pub struct CoturnTelnetClient { - pool: Pool, -} +pub struct CoturnTelnetClient(Pool); impl CoturnTelnetClient { /// Creates new [`CoturnTelnetClient`]. - pub fn new(addr: (String, u16), pass: String) -> Self { - let manager = Manager::new(addr, pass); - // TODO: to conf - let config = PoolConfig { - max_size: 16, - timeouts: Timeouts { - wait: Some(Duration::from_secs(5)), - create: Some(Duration::from_secs(5)), - recycle: Some(Duration::from_secs(5)), - }, - }; - Self { - pool: Pool::from_config(manager, config), - } + pub fn new( + addr: (String, u16), + pass: String, + pool_config: PoolConfig, + ) -> Self { + Self(Pool::from_config(Manager::new(addr, pass), pool_config)) } /// Forcefully closes provided [`IceUser`]s sessions on Coturn server. @@ -48,7 +38,7 @@ impl CoturnTelnetClient { &self, users: &[&IceUser], ) -> Result<(), CoturnCliError> { - let mut connection = self.pool.get().await?; + let mut connection = self.0.get().await?; for user in users { let sessions = connection .deref_mut() @@ -64,7 +54,7 @@ impl CoturnTelnetClient { impl fmt::Debug for CoturnTelnetClient { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("CoturnTelnetClient") - .field("pool", &self.pool.status()) + .field("pool", &self.0.status()) .finish() } } diff --git a/src/turn/service.rs b/src/turn/service.rs index 42a62c75d..91d0284f0 100644 --- a/src/turn/service.rs +++ b/src/turn/service.rs @@ -173,6 +173,7 @@ pub fn new_turn_auth_service<'a>( let coturn_cli = CoturnTelnetClient::new( (cf.cli.ip.to_string(), cf.cli.port), cf.cli.pass.clone(), + cf.cli.pool.into(), ); let turn_service = Service { From 033b97a93649b8ce295bf1f2575b86a10f67af47 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Tue, 11 Feb 2020 13:34:30 +0200 Subject: [PATCH 08/21] add timeouts to config --- config.toml | 14 +++++++++---- src/conf/turn.rs | 53 +++++++++++++++++++++++++----------------------- 2 files changed, 38 insertions(+), 29 deletions(-) diff --git a/config.toml b/config.toml index 13cce3ede..0b7325cc0 100644 --- a/config.toml +++ b/config.toml @@ -144,25 +144,31 @@ # Default: # pass = "turn" -[turn.cli.timeouts] +[turn.cli.pool] +# Maximum connection pool size. +# +# Env var: MEDEA_TURN__CLI__POOL__MAX_SIZE +# Default: +# max_size = 16 + # Timeout when waiting for an available connection. 0 means no timeout and is # not recommended. # -# Env var: MEDEA_TURN__CLI__TIMEOUTS__WAIT +# Env var: MEDEA_TURN__CLI__POOL__WAIT # Default: # wait = "5s" # Timeout when creating a new connection. 0 means no timeout and is not # recommended. # -# Env var: MEDEA_TURN__CLI__TIMEOUTS__CREATE +# Env var: MEDEA_TURN__CLI__POOL__CREATE # Default: # create = "5s" # Timeout when recycling connection. 0 means no timeout and is not # recommended. # -# Env var: MEDEA_TURN__CLI__TIMEOUTS__RECYCLE +# Env var: MEDEA_TURN__CLI__POLL__RECYCLE # Default: # recycle = "5s" diff --git a/src/conf/turn.rs b/src/conf/turn.rs index d6abc8580..12a5f21d4 100644 --- a/src/conf/turn.rs +++ b/src/conf/turn.rs @@ -68,6 +68,7 @@ pub struct Redis { /// The database number to use. This is usually 0. #[default = 0] pub db_number: i64, + //TODO: replace with PoolConfig /// The duration to wait to start a connection before returning err. #[default(Duration::from_secs(5))] #[serde(with = "humantime_serde")] @@ -241,53 +242,55 @@ mod spec { #[test] #[serial] - fn coturn_cli_timeouts() { + fn coturn_cli_pool() { let default_conf = Conf::default(); let env_conf: Conf = overrided_by_env_conf!( - "MEDEA_TURN__CLI__TIMEOUTS__WAIT" => "1s", - "MEDEA_TURN__CLI__TIMEOUTS__CREATE" => "2s", - "MEDEA_TURN__CLI__TIMEOUTS__RECYCLE" => "3s", + "MEDEA_TURN__CLI__POOL__MAX_SIZE" => "10", + "MEDEA_TURN__CLI__POOL__WAIT" => "1s", + "MEDEA_TURN__CLI__POOL__CREATE" => "2s", + "MEDEA_TURN__CLI__POLL__RECYCLE" => "3s", ); assert_ne!( - default_conf.turn.cli.timeouts.wait, - env_conf.turn.cli.timeouts.wait + default_conf.turn.cli.pool.max_size, + env_conf.turn.cli.pool.max_size ); assert_ne!( - default_conf.turn.cli.timeouts.create, - env_conf.turn.cli.timeouts.create + default_conf.turn.cli.pool.wait, + env_conf.turn.cli.pool.wait ); assert_ne!( - default_conf.turn.cli.timeouts.recycle, - env_conf.turn.cli.timeouts.recycle + default_conf.turn.cli.pool.create, + env_conf.turn.cli.pool.create ); - - assert_eq!( - env_conf.turn.cli.timeouts.wait, - Some(Duration::from_secs(1)) - ); - assert_eq!( - env_conf.turn.cli.timeouts.create, - Some(Duration::from_secs(2)) + assert_ne!( + default_conf.turn.cli.pool.recycle, + env_conf.turn.cli.pool.recycle ); + + assert_eq!(env_conf.turn.cli.pool.max_size, 10); + assert_eq!(env_conf.turn.cli.pool.wait, Some(Duration::from_secs(1))); + assert_eq!(env_conf.turn.cli.pool.create, Some(Duration::from_secs(2))); assert_eq!( - env_conf.turn.cli.timeouts.recycle, + env_conf.turn.cli.pool.recycle, Some(Duration::from_secs(3)) ); } #[test] - fn into_pool_timeouts() { - let timeouts = Timeouts { + fn into_pool_config() { + let pool_config = PoolConfig { + max_size: 6, wait: None, create: Some(Duration::from_secs(0)), recycle: Some(Duration::from_secs(2)), }; - let timeouts: PoolTimeouts = (&timeouts).into(); + let pool_config: DeadpoolPoolConfig = pool_config.into(); - assert!(timeouts.wait.is_none()); - assert!(timeouts.create.is_none()); - assert_eq!(timeouts.recycle, Some(Duration::from_secs(2))); + assert_eq!(pool_config.max_size, 6); + assert!(pool_config.timeouts.wait.is_none()); + assert!(pool_config.timeouts.create.is_none()); + assert_eq!(pool_config.timeouts.recycle, Some(Duration::from_secs(2))); } } From e09d1f4613b9d9ca1a093b76a51d6da18c7acfea Mon Sep 17 00:00:00 2001 From: alexlapa Date: Tue, 11 Feb 2020 15:44:05 +0200 Subject: [PATCH 09/21] fixes --- Cargo.toml | 2 +- config.toml | 4 ++-- src/conf/turn.rs | 30 +++++++++++++++--------------- src/media/ice_user.rs | 1 + src/signalling/participants.rs | 6 +++--- src/signalling/room.rs | 4 ++-- src/turn/mod.rs | 2 +- src/turn/service.rs | 3 ++- 8 files changed, 27 insertions(+), 25 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3c61f9bf3..a96200bb5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ actix-web-actors = "2.0" async-trait = "0.1" chrono = "0.4" config = "0.10" -coturn-telnet = {path = "crates/coturn-telnet"} +coturn-telnet = { path = "crates/coturn-telnet" } deadpool = "0.5" deadpool-redis = "0.5" derive_more = "0.99" diff --git a/config.toml b/config.toml index 0b7325cc0..74e5b7bc4 100644 --- a/config.toml +++ b/config.toml @@ -165,10 +165,10 @@ # Default: # create = "5s" -# Timeout when recycling connection. 0 means no timeout and is not +# Timeout when recycling connection. 0 means no timeout and is not # recommended. # -# Env var: MEDEA_TURN__CLI__POLL__RECYCLE +# Env var: MEDEA_TURN__CLI__POOL__RECYCLE # Default: # recycle = "5s" diff --git a/src/conf/turn.rs b/src/conf/turn.rs index 12a5f21d4..27d2cce3c 100644 --- a/src/conf/turn.rs +++ b/src/conf/turn.rs @@ -68,23 +68,23 @@ pub struct Redis { /// The database number to use. This is usually 0. #[default = 0] pub db_number: i64, - //TODO: replace with PoolConfig + // TODO: replace with PoolConfig /// The duration to wait to start a connection before returning err. #[default(Duration::from_secs(5))] #[serde(with = "humantime_serde")] pub connection_timeout: Duration, } -/// Setting of [coturn] server telnet interface. +/// Settings of [Coturn] server telnet interface. /// -/// [coturn]: https://github.com/coturn/coturn +/// [Coturn]: https://github.com/coturn/coturn #[derive(Clone, Debug, Deserialize, Serialize, SmartDefault)] #[serde(default)] pub struct CoturnCli { - /// Coturn server IP address. Defaults to `127.0.0.1`. + /// Coturn server cli IP address. Defaults to `127.0.0.1`. #[default(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)))] pub ip: IpAddr, - /// Coturn server port. Defaults to `5766`. + /// Coturn server cli port. Defaults to `5766`. #[default = 5766] pub port: u16, /// Password for authorize on Coturn server telnet interface. @@ -225,7 +225,7 @@ mod spec { #[serial] fn coturn_cli() { let default_conf = Conf::default(); - let env_conf: Conf = overrided_by_env_conf!( + let env_conf = overrided_by_env_conf!( "MEDEA_TURN__CLI__IP" => "4.4.4.4", "MEDEA_TURN__CLI__PORT" => "1234", "MEDEA_TURN__CLI__PASS" => "clipass", @@ -244,11 +244,11 @@ mod spec { #[serial] fn coturn_cli_pool() { let default_conf = Conf::default(); - let env_conf: Conf = overrided_by_env_conf!( + let env_conf = overrided_by_env_conf!( "MEDEA_TURN__CLI__POOL__MAX_SIZE" => "10", "MEDEA_TURN__CLI__POOL__WAIT" => "1s", "MEDEA_TURN__CLI__POOL__CREATE" => "2s", - "MEDEA_TURN__CLI__POLL__RECYCLE" => "3s", + "MEDEA_TURN__CLI__POOL__RECYCLE" => "3s", ); assert_ne!( @@ -268,13 +268,13 @@ mod spec { env_conf.turn.cli.pool.recycle ); - assert_eq!(env_conf.turn.cli.pool.max_size, 10); - assert_eq!(env_conf.turn.cli.pool.wait, Some(Duration::from_secs(1))); - assert_eq!(env_conf.turn.cli.pool.create, Some(Duration::from_secs(2))); - assert_eq!( - env_conf.turn.cli.pool.recycle, - Some(Duration::from_secs(3)) - ); +// assert_eq!(env_conf.turn.cli.pool.max_size, 10); +// assert_eq!(env_conf.turn.cli.pool.wait, Some(Duration::from_secs(1))); +// assert_eq!(env_conf.turn.cli.pool.create, Some(Duration::from_secs(2))); +// assert_eq!( +// env_conf.turn.cli.pool.recycle, +// Some(Duration::from_secs(3)) +// ); } #[test] diff --git a/src/media/ice_user.rs b/src/media/ice_user.rs index 94c7680dd..e06805a13 100644 --- a/src/media/ice_user.rs +++ b/src/media/ice_user.rs @@ -7,6 +7,7 @@ use medea_client_api_proto::IceServer; use crate::api::control::RoomId; +/// Username for authorization on Turn server. #[derive(AsRef, Clone, Debug, Display, From, Into)] #[as_ref(forward)] pub struct IceUsername(String); diff --git a/src/signalling/participants.rs b/src/signalling/participants.rs index 6bfb24c93..1008afa6b 100644 --- a/src/signalling/participants.rs +++ b/src/signalling/participants.rs @@ -343,9 +343,9 @@ impl ParticipantService { match self.get_member_by_id(&member_id) { None => future::ok(()).boxed_local(), Some(member) => { - if let Some(turn_user) = member.take_ice_user() { + if let Some(ice_user) = member.take_ice_user() { let turn_service = self.turn_service.clone(); - async move { turn_service.delete(&[turn_user]).await } + async move { turn_service.delete(&[ice_user]).await } .boxed_local() } else { future::ok(()).boxed_local() @@ -389,7 +389,7 @@ impl ParticipantService { let turn_service = self.turn_service.clone(); let delete_ice_users = async move { if let Err(e) = turn_service.delete(ice_users.as_slice()).await { - error!("Error removing IceUser {:?}", e) + error!("Error removing IceUsers {:?}", e) }; }; diff --git a/src/signalling/room.rs b/src/signalling/room.rs index f5ea3c2eb..0f06ebc99 100644 --- a/src/signalling/room.rs +++ b/src/signalling/room.rs @@ -248,7 +248,7 @@ impl Room { sdp_offer: None, tracks: sender.tracks(), ice_servers, - force_relay: true, + force_relay: sender.is_force_relayed(), }; self.peers.add_peer(sender); Ok(Box::new( @@ -824,7 +824,7 @@ impl CommandHandler for Room { sdp_offer: Some(sdp_offer), tracks: to_peer.tracks(), ice_servers, - force_relay: true, + force_relay: to_peer.is_force_relayed(), }; self.peers.add_peer(from_peer); diff --git a/src/turn/mod.rs b/src/turn/mod.rs index bbf887586..d53d62330 100644 --- a/src/turn/mod.rs +++ b/src/turn/mod.rs @@ -2,7 +2,7 @@ //! //! [TURN]: https://webrtcglossary.com/turn -pub mod cli; +mod cli; pub mod repo; pub mod service; diff --git a/src/turn/service.rs b/src/turn/service.rs index 91d0284f0..168f5626b 100644 --- a/src/turn/service.rs +++ b/src/turn/service.rs @@ -70,6 +70,7 @@ struct Service { /// Turn credentials repository. turn_db: TurnDatabase, + /// Connection to Coturn server admin interface. coturn_cli: CoturnTelnetClient, /// TurnAuthRepo password. @@ -131,7 +132,7 @@ impl TurnAuthService for Service { } /// Deletes provided [`IceUser`]s from [`TurnDatabase`] and closes their - /// sessions on Coturn. + /// sessions on Coturn TURN server. async fn delete(&self, users: &[IceUser]) -> Result<(), TurnServiceErr> { if users.is_empty() { return Ok(()); From 04aea39872b4f83338f688fcf9fa342a8e6d155c Mon Sep 17 00:00:00 2001 From: alexlapa Date: Tue, 11 Feb 2020 15:47:36 +0200 Subject: [PATCH 10/21] fixes --- src/conf/turn.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/conf/turn.rs b/src/conf/turn.rs index 27d2cce3c..0b6447a48 100644 --- a/src/conf/turn.rs +++ b/src/conf/turn.rs @@ -268,13 +268,13 @@ mod spec { env_conf.turn.cli.pool.recycle ); -// assert_eq!(env_conf.turn.cli.pool.max_size, 10); -// assert_eq!(env_conf.turn.cli.pool.wait, Some(Duration::from_secs(1))); -// assert_eq!(env_conf.turn.cli.pool.create, Some(Duration::from_secs(2))); -// assert_eq!( -// env_conf.turn.cli.pool.recycle, -// Some(Duration::from_secs(3)) -// ); + assert_eq!(env_conf.turn.cli.pool.max_size, 10); + assert_eq!(env_conf.turn.cli.pool.wait, Some(Duration::from_secs(1))); + assert_eq!(env_conf.turn.cli.pool.create, Some(Duration::from_secs(2))); + assert_eq!( + env_conf.turn.cli.pool.recycle, + Some(Duration::from_secs(3)) + ); } #[test] From 47aa64ad18f77dfc4fbd63c27207d943720b7e95 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Tue, 11 Feb 2020 16:20:50 +0200 Subject: [PATCH 11/21] k8s integration --- _dev/coturn/turnserver.conf | 1 + jason/demo/chart/medea-demo/templates/configmap.server.yaml | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/_dev/coturn/turnserver.conf b/_dev/coturn/turnserver.conf index 47082fe91..32239a121 100644 --- a/_dev/coturn/turnserver.conf +++ b/_dev/coturn/turnserver.conf @@ -6,3 +6,4 @@ realm=medea redis-userdb="ip=127.0.0.1 port=6379 dbname=0 password=turn" user=USER:PASS cli-password=turn +cli-port=5766 diff --git a/jason/demo/chart/medea-demo/templates/configmap.server.yaml b/jason/demo/chart/medea-demo/templates/configmap.server.yaml index 391fccb50..8fde5d316 100644 --- a/jason/demo/chart/medea-demo/templates/configmap.server.yaml +++ b/jason/demo/chart/medea-demo/templates/configmap.server.yaml @@ -23,7 +23,6 @@ data: {{- $coturnConf := .Values.server.coturn.conf }} lt-cred-mech fingerprint - no-cli no-tls no-dtls realm=medea From 1e05b16f936846341d6e5963297b74e13005a059 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Wed, 12 Feb 2020 09:56:46 +0200 Subject: [PATCH 12/21] k8s --- .../demo/chart/medea-demo/templates/deployment.server.yaml | 7 +++++++ jason/demo/chart/medea-demo/templates/secret.server.yaml | 2 ++ jason/demo/chart/medea-demo/values.yaml | 4 ++++ jason/demo/staging.vals.yaml | 2 ++ 4 files changed, 15 insertions(+) diff --git a/jason/demo/chart/medea-demo/templates/deployment.server.yaml b/jason/demo/chart/medea-demo/templates/deployment.server.yaml index 4bec1198d..c041b8cbb 100644 --- a/jason/demo/chart/medea-demo/templates/deployment.server.yaml +++ b/jason/demo/chart/medea-demo/templates/deployment.server.yaml @@ -113,6 +113,8 @@ spec: - --relay-ip=$(EXTERNAL_IP) - --redis-userdb=ip=127.0.0.1 port={{ $coturnDb.conf.port | int }} dbname={{ .Values.server.conf.turn.db.redis.db_number }} password=$(MEDEA_TURN__DB__REDIS__PASS) - --user={{ .Values.server.conf.turn.user }}:$(MEDEA_TURN__PASS) + - --cli-port={{ $coturn.conf.cli_port | int }} + - --cli-password=$(MEDEA_TURN__CLI__PASS) {{- with $coturn.extraArgs }} {{- toYaml . | nindent 12 }} {{- end }} @@ -135,6 +137,11 @@ spec: secretKeyRef: name: {{ printf "%s.server.cred" (include "medea-demo.fullname" .) | quote }} key: MEDEA_TURN__DB__REDIS__PASS + - name: MEDEA_TURN__CLI__PASS + valueFrom: + secretKeyRef: + name: {{ printf "%s.server.cred" (include "medea-demo.fullname" .) | quote }} + key: MEDEA_TURN__CLI__PASS ports: - name: turn containerPort: {{ $coturn.conf.listening_port | int }} diff --git a/jason/demo/chart/medea-demo/templates/secret.server.yaml b/jason/demo/chart/medea-demo/templates/secret.server.yaml index d2e8017ea..7c62182b7 100644 --- a/jason/demo/chart/medea-demo/templates/secret.server.yaml +++ b/jason/demo/chart/medea-demo/templates/secret.server.yaml @@ -16,5 +16,7 @@ type: Opaque data: {{- $medeaConf := .Values.server.conf }} {{- $coturnDbConf := index .Values "server" "coturn-db" "conf" }} + {{- $coturnConf := index .Values "server" "coturn" "conf" }} MEDEA_TURN__PASS: {{ $medeaConf.turn.pass | b64enc | quote }} MEDEA_TURN__DB__REDIS__PASS: {{ $coturnDbConf.requirepass | b64enc | quote }} + MEDEA_TURN__CLI__PASS: {{ $coturnConf.cli_pass | b64enc | quote }} diff --git a/jason/demo/chart/medea-demo/values.yaml b/jason/demo/chart/medea-demo/values.yaml index 56fdb3f66..f0df97521 100644 --- a/jason/demo/chart/medea-demo/values.yaml +++ b/jason/demo/chart/medea-demo/values.yaml @@ -29,6 +29,8 @@ server: db: redis: db_number: 0 + cli: + port: 5766 deployment: revisionHistoryLimit: 0 @@ -82,6 +84,8 @@ server: # Coturn TURN server configuration. conf: listening_port: 3478 + cli_port: 5766 + cli_pass: turn # IP adress to be used by Coturn as `external-ip`. # If empty then `status.hostIP` of Pod will be used. external_ip: "" diff --git a/jason/demo/staging.vals.yaml b/jason/demo/staging.vals.yaml index 9af6bf98f..50cac4f7e 100644 --- a/jason/demo/staging.vals.yaml +++ b/jason/demo/staging.vals.yaml @@ -30,6 +30,8 @@ server: pullPolicy: Always conf: listening_port: 9934 + cli_port: 5766 + cli_pass: changeme coturn-db: image: From 0911d0e9f6bb14b133cc666ca93e7abaf1496718 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Wed, 12 Feb 2020 11:03:13 +0200 Subject: [PATCH 13/21] k8s [run ci] --- jason/demo/chart/medea-demo/templates/deployment.server.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jason/demo/chart/medea-demo/templates/deployment.server.yaml b/jason/demo/chart/medea-demo/templates/deployment.server.yaml index c041b8cbb..19f8071da 100644 --- a/jason/demo/chart/medea-demo/templates/deployment.server.yaml +++ b/jason/demo/chart/medea-demo/templates/deployment.server.yaml @@ -62,6 +62,8 @@ spec: value: {{ $coturn.conf.listening_port | quote }} - name: MEDEA_TURN__DB__REDIS__PORT value: {{ $coturnDb.conf.port | quote }} + - name: MEDEA_TURN__CLI__PORT + value: {{ $coturn.conf.cli_port | quote }} envFrom: - secretRef: name: {{ printf "%s.server.cred" (include "medea-demo.fullname" .) | quote }} @@ -94,7 +96,7 @@ spec: imagePullPolicy: {{ $controlMock.image.pullPolicy | quote }} args: - --addr=0.0.0.0:{{ $controlMock.conf.bind_port | int }} - - --medea-addr=127.0.0.1:{{ .Values.server.conf.server.control.grpc.bind_port | int }} + - --medea-addr=http://127.0.0.1:{{ .Values.server.conf.server.control.grpc.bind_port | int }} env: - name: RUST_LOG value: {{ $controlMock.conf.log.level | quote }} From 1b7cd09d89b58f8bfa1f3dd3e6dcc42800634045 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Wed, 12 Feb 2020 11:34:47 +0200 Subject: [PATCH 14/21] changelog --- CHANGELOG.md | 2 ++ crates/coturn-telnet/CHANGELOG.md | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cb17f66b..04fb6cd73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,8 @@ All user visible changes to this project will be documented in this file. This p - `rpc.ping_interval` option to configure `Ping`s sending interval ([#75]). - Testing: - E2E tests for signalling ([#28]). +- Turn server integration: + - Turn sessions cancellation ([#84](/../../pull/84)). [#28]: /../../pull/28 [#33]: /../../pull/33 diff --git a/crates/coturn-telnet/CHANGELOG.md b/crates/coturn-telnet/CHANGELOG.md index 6421f07f6..677f967da 100644 --- a/crates/coturn-telnet/CHANGELOG.md +++ b/crates/coturn-telnet/CHANGELOG.md @@ -11,12 +11,13 @@ All user visible changes to this project will be documented in this file. This p ### Added -- Asynchronous [Coturn] client. -- Connection pool. -- Requests: +- Asynchronous [Coturn] client ([#84]). +- Connection pool ([#84]). +- Requests ([#84]): - `ps [username]`, that prints sessions, with optional exact user match. - `cs `, that forcefully cancels session. +[#28]: /../../pull/84 From 68dfa1bb1c65e9945abfde5a5b5e0f093e9dc054 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Wed, 12 Feb 2020 12:16:54 +0200 Subject: [PATCH 15/21] rename coturn-telnet to medea-coturn-telnet [run ci] --- Cargo.lock | 34 +++++++++---------- Cargo.toml | 4 +-- Dockerfile | 4 +-- .../CHANGELOG.md | 4 +-- .../Cargo.toml | 8 ++--- .../LICENSE-APACHE.md | 0 .../LICENSE-MIT.md | 0 .../README.md | 14 ++++---- .../src/codec.rs | 0 .../src/connection.rs | 0 .../src/lib.rs | 0 .../src/pool.rs | 0 src/turn/cli.rs | 2 +- 13 files changed, 35 insertions(+), 35 deletions(-) rename crates/{coturn-telnet => medea-coturn-telnet}/CHANGELOG.md (83%) rename crates/{coturn-telnet => medea-coturn-telnet}/Cargo.toml (83%) rename crates/{coturn-telnet => medea-coturn-telnet}/LICENSE-APACHE.md (100%) rename crates/{coturn-telnet => medea-coturn-telnet}/LICENSE-MIT.md (100%) rename crates/{coturn-telnet => medea-coturn-telnet}/README.md (54%) rename crates/{coturn-telnet => medea-coturn-telnet}/src/codec.rs (100%) rename crates/{coturn-telnet => medea-coturn-telnet}/src/connection.rs (100%) rename crates/{coturn-telnet => medea-coturn-telnet}/src/lib.rs (100%) rename crates/{coturn-telnet => medea-coturn-telnet}/src/pool.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index f951d9c4b..afa6ad101 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -621,22 +621,6 @@ name = "copyless" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "coturn-telnet" -version = "0.1.0-dev" -dependencies = [ - "async-trait 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "deadpool 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-test 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "crc32fast" version = "1.2.0" @@ -1368,7 +1352,6 @@ dependencies = [ "awc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "config 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "coturn-telnet 0.1.0-dev", "deadpool 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "deadpool-redis 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "derive_builder 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1380,6 +1363,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "medea-client-api-proto 0.2.0-dev", "medea-control-api-proto 0.1.0-dev", + "medea-coturn-telnet 0.1.0-dev", "medea-macro 0.2.0-dev", "mockall 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1446,6 +1430,22 @@ dependencies = [ "tonic-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "medea-coturn-telnet" +version = "0.1.0-dev" +dependencies = [ + "async-trait 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "deadpool 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-test 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "medea-jason" version = "0.2.0-dev" diff --git a/Cargo.toml b/Cargo.toml index a96200bb5..ed1accb11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ include = ["/src/", "/Cargo.*", "/CHANGELOG.md", "/LICENSE.md", "/README.md"] [workspace] members = [ "crates/medea-macro", - "crates/coturn-telnet", + "crates/medea-coturn-telnet", "jason", "mock/control-api", "proto/client-api", @@ -33,7 +33,7 @@ actix-web-actors = "2.0" async-trait = "0.1" chrono = "0.4" config = "0.10" -coturn-telnet = { path = "crates/coturn-telnet" } +medea-coturn-telnet = { path = "crates/medea-coturn-telnet" } deadpool = "0.5" deadpool-redis = "0.5" derive_more = "0.99" diff --git a/Dockerfile b/Dockerfile index 644ca68d1..4c87ed0e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,7 @@ RUN apt-get update \ # Prepare Cargo workspace for building dependencies only. COPY crates/medea-macro/Cargo.toml /app/crates/medea-macro/ -COPY crates/coturn-telnet/Cargo.toml /app/crates/coturn-telnet/ +COPY crates/medea-coturn-telnet/Cargo.toml /app/crates/medea-coturn-telnet/ COPY mock/control-api/Cargo.toml /app/mock/control-api/ COPY proto/client-api/Cargo.toml /app/proto/client-api/ COPY proto/control-api/Cargo.toml /app/proto/control-api/ @@ -39,7 +39,7 @@ COPY jason/Cargo.toml /app/jason/ COPY Cargo.toml Cargo.lock /app/ WORKDIR /app/ RUN mkdir -p crates/medea-macro/src/ && touch crates/medea-macro/src/lib.rs \ - && mkdir -p crates/coturn-telnet/src/ && touch crates/coturn-telnet/src/lib.rs \ + && mkdir -p crates/medea-coturn-telnet/src/ && touch crates/medea-coturn-telnet/src/lib.rs \ && mkdir -p mock/control-api/src/ && touch mock/control-api/src/lib.rs \ && mkdir -p proto/client-api/src/ && touch proto/client-api/src/lib.rs \ && mkdir -p proto/control-api/src/ && touch proto/control-api/src/lib.rs \ diff --git a/crates/coturn-telnet/CHANGELOG.md b/crates/medea-coturn-telnet/CHANGELOG.md similarity index 83% rename from crates/coturn-telnet/CHANGELOG.md rename to crates/medea-coturn-telnet/CHANGELOG.md index 677f967da..ef0b23d12 100644 --- a/crates/coturn-telnet/CHANGELOG.md +++ b/crates/medea-coturn-telnet/CHANGELOG.md @@ -1,4 +1,4 @@ -`coturn-telnet` changelog +`medea-coturn-telnet` changelog ======================= All user visible changes to this project will be documented in this file. This project uses [Semantic Versioning 2.0.0]. @@ -7,7 +7,7 @@ All user visible changes to this project will be documented in this file. This p ## TBD [0.1.0] · 2019-??-?? -[0.1.0]: /../../tree/coturn-telnet-0.1.0/crates/coturn-telnet +[0.1.0]: /../../tree/medea-coturn-telnet-0.1.0/crates/medea-coturn-telnet ### Added diff --git a/crates/coturn-telnet/Cargo.toml b/crates/medea-coturn-telnet/Cargo.toml similarity index 83% rename from crates/coturn-telnet/Cargo.toml rename to crates/medea-coturn-telnet/Cargo.toml index d545405d8..65d3ad873 100644 --- a/crates/coturn-telnet/Cargo.toml +++ b/crates/medea-coturn-telnet/Cargo.toml @@ -1,13 +1,13 @@ [package] -name = "coturn-telnet" +name = "medea-coturn-telnet" version = "0.1.0-dev" edition = "2018" description = "Coturn TURN server telnet client" authors = ["Instrumentisto Team "] license = "MIT/Apache-2.0" -documentation = "https://docs.rs/coturn-telnet" -homepage = "https://github.com/instrumentisto/medea/tree/master/crates/coturn-telnet" -repository = "https://github.com/instrumentisto/medea/tree/master/crates/coturn-telnet" +documentation = "https://docs.rs/medea-coturn-telnet" +homepage = "https://github.com/instrumentisto/medea/tree/master/crates/medea-coturn-telnet" +repository = "https://github.com/instrumentisto/medea/tree/master/crates/medea-coturn-telnet" readme = "README.md" keywords = ["coturn", "telnet", "cli"] categories = ["web-programming"] diff --git a/crates/coturn-telnet/LICENSE-APACHE.md b/crates/medea-coturn-telnet/LICENSE-APACHE.md similarity index 100% rename from crates/coturn-telnet/LICENSE-APACHE.md rename to crates/medea-coturn-telnet/LICENSE-APACHE.md diff --git a/crates/coturn-telnet/LICENSE-MIT.md b/crates/medea-coturn-telnet/LICENSE-MIT.md similarity index 100% rename from crates/coturn-telnet/LICENSE-MIT.md rename to crates/medea-coturn-telnet/LICENSE-MIT.md diff --git a/crates/coturn-telnet/README.md b/crates/medea-coturn-telnet/README.md similarity index 54% rename from crates/coturn-telnet/README.md rename to crates/medea-coturn-telnet/README.md index 63dbe12a2..2a1b59a25 100644 --- a/crates/coturn-telnet/README.md +++ b/crates/medea-coturn-telnet/README.md @@ -1,11 +1,11 @@ -coturn-telnet +medea-coturn-telnet =========== -[![Crates.io](https://img.shields.io/crates/v/coturn-telnet)](https://crates.io/crates/coturn-telnet) -![Crates.io license](https://img.shields.io/crates/l/coturn-telnet) +[![Crates.io](https://img.shields.io/crates/v/medea-coturn-telnet)](https://crates.io/crates/medea-coturn-telnet) +![Crates.io license](https://img.shields.io/crates/l/medea-coturn-telnet) -[API Docs](https://docs.rs/coturn-telnet) | -[Changelog](https://github.com/instrumentisto/medea/blob/master/crates/coturn-telnet/CHANGELOG.md) +[API Docs](https://docs.rs/medea-coturn-telnet) | +[Changelog](https://github.com/instrumentisto/medea/blob/master/crates/medea-coturn-telnet/CHANGELOG.md) [Coturn] telnet admin interface client implementation. @@ -16,8 +16,8 @@ coturn-telnet This project is licensed under either of -- Apache License, Version 2.0, ([LICENSE-APACHE](https://github.com/instrumentisto/medea/blob/master/crates/coturn-telnet/LICENSE-APACHE.md) or http://www.apache.org/licenses/LICENSE-2.0) -- MIT license ([LICENSE-MIT](https://github.com/instrumentisto/medea/blob/master/crates/coturn-telnet/LICENSE-MIT.md) or http://opensource.org/licenses/MIT) +- Apache License, Version 2.0, ([LICENSE-APACHE](https://github.com/instrumentisto/medea/blob/master/crates/medea-coturn-telnet/LICENSE-APACHE.md) or http://www.apache.org/licenses/LICENSE-2.0) +- MIT license ([LICENSE-MIT](https://github.com/instrumentisto/medea/blob/master/crates/medea-coturn-telnet/LICENSE-MIT.md) or http://opensource.org/licenses/MIT) at your option. diff --git a/crates/coturn-telnet/src/codec.rs b/crates/medea-coturn-telnet/src/codec.rs similarity index 100% rename from crates/coturn-telnet/src/codec.rs rename to crates/medea-coturn-telnet/src/codec.rs diff --git a/crates/coturn-telnet/src/connection.rs b/crates/medea-coturn-telnet/src/connection.rs similarity index 100% rename from crates/coturn-telnet/src/connection.rs rename to crates/medea-coturn-telnet/src/connection.rs diff --git a/crates/coturn-telnet/src/lib.rs b/crates/medea-coturn-telnet/src/lib.rs similarity index 100% rename from crates/coturn-telnet/src/lib.rs rename to crates/medea-coturn-telnet/src/lib.rs diff --git a/crates/coturn-telnet/src/pool.rs b/crates/medea-coturn-telnet/src/pool.rs similarity index 100% rename from crates/coturn-telnet/src/pool.rs rename to crates/medea-coturn-telnet/src/pool.rs diff --git a/src/turn/cli.rs b/src/turn/cli.rs index 2a3c47197..80e1c6893 100644 --- a/src/turn/cli.rs +++ b/src/turn/cli.rs @@ -1,9 +1,9 @@ use std::{fmt, ops::DerefMut}; -use coturn_telnet::{CoturnTelnetError, Manager, Pool, PoolError}; use deadpool::managed::PoolConfig; use derive_more::{Display, From}; use failure::Fail; +use medea_coturn_telnet::{CoturnTelnetError, Manager, Pool, PoolError}; use crate::media::IceUser; From c06d1204e7b913d5b2bd3f489203ec8bc24e3a4d Mon Sep 17 00:00:00 2001 From: alexlapa Date: Wed, 12 Feb 2020 12:58:50 +0200 Subject: [PATCH 16/21] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04fb6cd73..a8022e621 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ All user visible changes to this project will be documented in this file. This p - Send relay mode in `Event::PeerCreated` which is used for configuring client's `RtcIceTransportPolicy` ([#79](/../../pull/79)). - Configuration: - `[server.control.grpc]` section to configure Control API gRPC server ([#33]); + - `[turn.cli]` and `[turn.cli.pool]` sections to configure access to [Coturn] admin interface ([#84](/../../pull/84)); - `server.client.http.public_url` option to configure public URL of Client API HTTP server ([#33]); - `rpc.ping_interval` option to configure `Ping`s sending interval ([#75]). - Testing: From 4d2e7dcda0b24aea761b92cb34dc0c610a5d80c2 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Mon, 17 Feb 2020 11:05:30 +0200 Subject: [PATCH 17/21] fix review notes [run ci] --- Cargo.lock | 58 +++--- Cargo.toml | 4 +- Dockerfile | 4 +- Makefile | 4 + config.toml | 4 +- .../CHANGELOG.md | 4 +- .../Cargo.toml | 16 +- .../medea-coturn-telnet-client}/LICENSE.md | 0 crates/medea-coturn-telnet-client/README.md | 24 +++ .../src/client.rs} | 46 ++++- .../src/con_pool.rs} | 10 +- .../src/framed.rs} | 122 +++++++---- crates/medea-coturn-telnet-client/src/lib.rs | 36 ++++ crates/medea-coturn-telnet/LICENSE-APACHE.md | 194 ------------------ crates/medea-coturn-telnet/LICENSE-MIT.md | 25 --- crates/medea-coturn-telnet/README.md | 33 --- crates/medea-coturn-telnet/src/lib.rs | 14 -- jason/demo/chart/medea-demo/Chart.yaml | 2 +- mock/control-api/Dockerfile | 2 + src/turn/cli.rs | 2 +- 20 files changed, 245 insertions(+), 359 deletions(-) rename crates/{medea-coturn-telnet => medea-coturn-telnet-client}/CHANGELOG.md (80%) rename crates/{medea-coturn-telnet => medea-coturn-telnet-client}/Cargo.toml (61%) rename {proto/control-api => crates/medea-coturn-telnet-client}/LICENSE.md (100%) create mode 100644 crates/medea-coturn-telnet-client/README.md rename crates/{medea-coturn-telnet/src/connection.rs => medea-coturn-telnet-client/src/client.rs} (81%) rename crates/{medea-coturn-telnet/src/pool.rs => medea-coturn-telnet-client/src/con_pool.rs} (89%) rename crates/{medea-coturn-telnet/src/codec.rs => medea-coturn-telnet-client/src/framed.rs} (72%) create mode 100644 crates/medea-coturn-telnet-client/src/lib.rs delete mode 100644 crates/medea-coturn-telnet/LICENSE-APACHE.md delete mode 100644 crates/medea-coturn-telnet/LICENSE-MIT.md delete mode 100644 crates/medea-coturn-telnet/README.md delete mode 100644 crates/medea-coturn-telnet/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index afa6ad101..5af3ed4cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -115,7 +115,7 @@ dependencies = [ "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -271,7 +271,7 @@ dependencies = [ "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -321,7 +321,7 @@ name = "aho-corasick" version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -432,7 +432,7 @@ dependencies = [ "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -583,7 +583,7 @@ dependencies = [ "ascii 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -597,7 +597,7 @@ dependencies = [ "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "serde-hjson 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1046,7 +1046,7 @@ dependencies = [ "futures-macro 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1363,14 +1363,14 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "medea-client-api-proto 0.2.0-dev", "medea-control-api-proto 0.1.0-dev", - "medea-coturn-telnet 0.1.0-dev", + "medea-coturn-telnet-client 0.1.0-dev", "medea-macro 0.2.0-dev", "mockall 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "redis 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)", "serial_test 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "serial_test_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1395,7 +1395,7 @@ dependencies = [ "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "medea-macro 0.2.0-dev", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1431,7 +1431,7 @@ dependencies = [ ] [[package]] -name = "medea-coturn-telnet" +name = "medea-coturn-telnet-client" version = "0.1.0-dev" dependencies = [ "async-trait 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1439,7 +1439,7 @@ dependencies = [ "deadpool 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "once_cell 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-test 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1461,7 +1461,7 @@ dependencies = [ "mockall 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "predicates-tree 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "tracerr 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-futures 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1484,7 +1484,7 @@ dependencies = [ [[package]] name = "memchr" -version = "2.3.0" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1627,7 +1627,7 @@ name = "nom" version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1637,7 +1637,7 @@ version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lexical-core 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1680,6 +1680,11 @@ dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "once_cell" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "parking_lot" version = "0.9.0" @@ -2036,7 +2041,7 @@ version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2174,7 +2179,7 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.47" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2288,7 +2293,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2493,7 +2498,7 @@ dependencies = [ "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2570,7 +2575,7 @@ dependencies = [ "tower-make 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "tracing 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tracing-futures 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-futures 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2785,7 +2790,7 @@ dependencies = [ [[package]] name = "tracing-futures" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2929,7 +2934,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-macro 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3269,7 +3274,7 @@ dependencies = [ "checksum lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" -"checksum memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3197e20c7edb283f87c071ddfc7a2cca8f8e0b888c242959846a6fce03c72223" +"checksum memchr 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53445de381a1f436797497c61d851644d0e8e88e6140f22872ad33a704933978" "checksum memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9" "checksum memory_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" "checksum mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" @@ -3291,6 +3296,7 @@ dependencies = [ "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" "checksum num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6" +"checksum once_cell 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1c601810575c99596d4afc46f78a678c80105117c379eb3650cf99b8a21ce5b" "checksum parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc" "checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" "checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" @@ -3350,7 +3356,7 @@ dependencies = [ "checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" "checksum serde-hjson 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6a3a4e0ea8a88553209f6cc6cfe8724ecad22e1acf372793c27d995290fe74f8" "checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64" -"checksum serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)" = "15913895b61e0be854afd32fd4163fcd2a3df34142cf2cb961b310ce694cbf90" +"checksum serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "9371ade75d4c2d6cb154141b9752cf3781ec9c05e0e5cf35060e1e70ee7b9c25" "checksum serde_test 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "110b3dbdf8607ec493c22d5d947753282f3bae73c0f56d322af1e8c78e4c23d5" "checksum serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" "checksum serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)" = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35" @@ -3410,7 +3416,7 @@ dependencies = [ "checksum tracing 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1e213bd24252abeb86a0b7060e02df677d367ce6cb772cef17e9214b8390a8d3" "checksum tracing-attributes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04cfd395def5a60236e187e1ff905cb55668a59f29928dec05e6e1b1fd2ac1f3" "checksum tracing-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "13a46f11e372b8bd4b4398ea54353412fdd7fd42a8370c7e543e218cf7661978" -"checksum tracing-futures 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "33848db47a7c848ab48b66aab3293cb9c61ea879a3586ecfcd17302fcea0baf1" +"checksum tracing-futures 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "58b6233e421bf43203d36a8cd430acd24a75bed39832b0e07bec24541f9759e9" "checksum treeline 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" "checksum trust-dns-proto 0.18.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2a7f3a2ab8a919f5eca52a468866a67ed7d3efa265d48a652a9a3452272b413f" "checksum trust-dns-resolver 0.18.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6f90b1502b226f8b2514c6d5b37bafa8c200d7ca4102d57dc36ee0f3b7a04a2f" diff --git a/Cargo.toml b/Cargo.toml index ed1accb11..d5ba9cb71 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ include = ["/src/", "/Cargo.*", "/CHANGELOG.md", "/LICENSE.md", "/README.md"] [workspace] members = [ "crates/medea-macro", - "crates/medea-coturn-telnet", + "crates/medea-coturn-telnet-client", "jason", "mock/control-api", "proto/client-api", @@ -33,7 +33,7 @@ actix-web-actors = "2.0" async-trait = "0.1" chrono = "0.4" config = "0.10" -medea-coturn-telnet = { path = "crates/medea-coturn-telnet" } +medea-coturn-telnet-client = { path = "crates/medea-coturn-telnet-client" } deadpool = "0.5" deadpool-redis = "0.5" derive_more = "0.99" diff --git a/Dockerfile b/Dockerfile index 4c87ed0e6..dff09fed2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,7 @@ RUN apt-get update \ # Prepare Cargo workspace for building dependencies only. COPY crates/medea-macro/Cargo.toml /app/crates/medea-macro/ -COPY crates/medea-coturn-telnet/Cargo.toml /app/crates/medea-coturn-telnet/ +COPY crates/medea-coturn-telnet-client/Cargo.toml /app/crates/medea-coturn-telnet-client/ COPY mock/control-api/Cargo.toml /app/mock/control-api/ COPY proto/client-api/Cargo.toml /app/proto/client-api/ COPY proto/control-api/Cargo.toml /app/proto/control-api/ @@ -39,7 +39,7 @@ COPY jason/Cargo.toml /app/jason/ COPY Cargo.toml Cargo.lock /app/ WORKDIR /app/ RUN mkdir -p crates/medea-macro/src/ && touch crates/medea-macro/src/lib.rs \ - && mkdir -p crates/medea-coturn-telnet/src/ && touch crates/medea-coturn-telnet/src/lib.rs \ + && mkdir -p crates/medea-coturn-telnet-client/src/ && touch crates/medea-coturn-telnet-client/src/lib.rs \ && mkdir -p mock/control-api/src/ && touch mock/control-api/src/lib.rs \ && mkdir -p proto/client-api/src/ && touch proto/client-api/src/lib.rs \ && mkdir -p proto/control-api/src/ && touch proto/control-api/src/lib.rs \ diff --git a/Makefile b/Makefile index 7e957f41b..0777287bd 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,9 @@ endif ifeq ($(crate),medea-macro) crate-dir = crates/medea-macro endif +ifeq ($(crate),medea-coturn-telnet-client) +crate-dir = "crates/medea-coturn-telnet-client" +endif @@ -346,6 +349,7 @@ ifeq ($(test-unit-crate),@all) @make test.unit crate=medea-client-api-proto @make test.unit crate=medea-jason @make test.unit crate=medea + @make test.unit crate=medea-coturn-telnet-client else ifeq ($(test-unit-crate),medea) cargo test --lib --bin medea diff --git a/config.toml b/config.toml index 74e5b7bc4..ddb5f3d12 100644 --- a/config.toml +++ b/config.toml @@ -18,7 +18,6 @@ # Default: # bind_port = 8080 - [server.control.grpc] # IP address to bind Control API gRPC server to. # @@ -172,6 +171,9 @@ # Default: # recycle = "5s" + + + [log] # Maximum allowed level of application log entries. # diff --git a/crates/medea-coturn-telnet/CHANGELOG.md b/crates/medea-coturn-telnet-client/CHANGELOG.md similarity index 80% rename from crates/medea-coturn-telnet/CHANGELOG.md rename to crates/medea-coturn-telnet-client/CHANGELOG.md index ef0b23d12..e9944f02c 100644 --- a/crates/medea-coturn-telnet/CHANGELOG.md +++ b/crates/medea-coturn-telnet-client/CHANGELOG.md @@ -1,4 +1,4 @@ -`medea-coturn-telnet` changelog +`medea-coturn-telnet-client` changelog ======================= All user visible changes to this project will be documented in this file. This project uses [Semantic Versioning 2.0.0]. @@ -7,7 +7,7 @@ All user visible changes to this project will be documented in this file. This p ## TBD [0.1.0] · 2019-??-?? -[0.1.0]: /../../tree/medea-coturn-telnet-0.1.0/crates/medea-coturn-telnet +[0.1.0]: /../../tree/medea-coturn-telnet-client-0.1.0/crates/medea-coturn-telnet-client ### Added diff --git a/crates/medea-coturn-telnet/Cargo.toml b/crates/medea-coturn-telnet-client/Cargo.toml similarity index 61% rename from crates/medea-coturn-telnet/Cargo.toml rename to crates/medea-coturn-telnet-client/Cargo.toml index 65d3ad873..66c657b86 100644 --- a/crates/medea-coturn-telnet/Cargo.toml +++ b/crates/medea-coturn-telnet-client/Cargo.toml @@ -1,13 +1,13 @@ [package] -name = "medea-coturn-telnet" +name = "medea-coturn-telnet-client" version = "0.1.0-dev" edition = "2018" description = "Coturn TURN server telnet client" authors = ["Instrumentisto Team "] -license = "MIT/Apache-2.0" -documentation = "https://docs.rs/medea-coturn-telnet" -homepage = "https://github.com/instrumentisto/medea/tree/master/crates/medea-coturn-telnet" -repository = "https://github.com/instrumentisto/medea/tree/master/crates/medea-coturn-telnet" +license = "BlueOak-1.0.0" +documentation = "https://docs.rs/medea-coturn-telnet-client" +homepage = "https://github.com/instrumentisto/medea/tree/master/crates/medea-coturn-telnet-client" +repository = "https://github.com/instrumentisto/medea/tree/master/crates/medea-coturn-telnet-client" readme = "README.md" keywords = ["coturn", "telnet", "cli"] categories = ["web-programming"] @@ -15,12 +15,12 @@ categories = ["web-programming"] [dependencies] async-trait = "0.1" bytes = "0.5" -deadpool = "0.5" +deadpool = { version = "0.5", default-features = false , features = ["managed"]} derive_more = "0.99" futures = "0.3" -lazy_static = "1.4" +once_cell = "1.3.1" regex = "1.3" -tokio = { version = "0.2", features = ["dns", "macros"] } +tokio = { version = "0.2", features = ["dns", "macros", "tcp"] } tokio-util = { version = "0.2", features = ["codec"] } [dev-dependencies] diff --git a/proto/control-api/LICENSE.md b/crates/medea-coturn-telnet-client/LICENSE.md similarity index 100% rename from proto/control-api/LICENSE.md rename to crates/medea-coturn-telnet-client/LICENSE.md diff --git a/crates/medea-coturn-telnet-client/README.md b/crates/medea-coturn-telnet-client/README.md new file mode 100644 index 000000000..467622f90 --- /dev/null +++ b/crates/medea-coturn-telnet-client/README.md @@ -0,0 +1,24 @@ +medea-coturn-telnet-client +=========== + +[![Crates.io](https://img.shields.io/crates/v/medea-coturn-telnet-client)](https://crates.io/crates/medea-coturn-telnet-client) +![Crates.io license](https://img.shields.io/crates/l/medea-coturn-telnet-client) + +[API Docs](https://docs.rs/medea-coturn-telnet-client) | +[Changelog](https://github.com/instrumentisto/medea/blob/master/crates/medea-coturn-telnet-client/CHANGELOG.md) + +[Coturn] telnet admin interface client implementation. + + + + +## License + +Copyright © 2019 Instrumentisto Team, https://github.com/instrumentisto + +This software is subject to the terms of the [Blue Oak Model License 1.0.0](https://github.com/instrumentisto/medea/blob/master/proto/control-api/LICENSE.md). If a copy of the [BlueOak-1.0.0](https://spdx.org/licenses/BlueOak-1.0.0.html) license was not distributed with this file, You can obtain one at https://blueoakcouncil.org/license/1.0.0 . + + + + +[Coturn]: https://github.com/coturn/coturn diff --git a/crates/medea-coturn-telnet/src/connection.rs b/crates/medea-coturn-telnet-client/src/client.rs similarity index 81% rename from crates/medea-coturn-telnet/src/connection.rs rename to crates/medea-coturn-telnet-client/src/client.rs index 5754392db..ad24d85a0 100644 --- a/crates/medea-coturn-telnet/src/connection.rs +++ b/crates/medea-coturn-telnet-client/src/client.rs @@ -7,7 +7,7 @@ use futures::{SinkExt, StreamExt}; use tokio::net::{TcpStream, ToSocketAddrs}; use tokio_util::codec::Framed; -use crate::codec::{ +use crate::framed::{ CoturnCliCodec, CoturnCliCodecError, CoturnCliRequest, CoturnCliResponse, CoturnResponseParseError, }; @@ -49,11 +49,16 @@ impl From for CoturnTelnetError { /// from [`crate::pool::Pool`], which takes care of connection lifecycle. /// /// [Coturn]: https://github.com/coturn/coturn. +#[derive(Debug)] pub struct CoturnTelnetConnection(Framed); impl CoturnTelnetConnection { /// Opens a telnet connection to a remote host using a `TcpStream` and /// performs authentication. + /// + /// # Errors + /// + /// Errors if could not open [`TcpStream`] or authentication failed. pub async fn connect>( addr: A, pass: B, @@ -70,6 +75,14 @@ impl CoturnTelnetConnection { /// 1. Sends [`CoturnCliRequest::PrintSessions`] with provided /// username. /// 2. Awaits for [`CoturnCliResponse::Sessions`]. + /// + /// # Errors + /// + /// Errors if: + /// 1. Unable to send message to remote. + /// 2. Transport error while waiting for server response. + /// 3. Received unexpected (not [`CoturnCliResponse::Sessions`]) response + /// from remote. pub async fn print_sessions( &mut self, username: String, @@ -96,6 +109,14 @@ impl CoturnTelnetConnection { /// /// 1. Sends [`CoturnCliRequest::CloseSession`] with specified session id. /// 2. Awaits for [`CoturnCliResponse::Ready`]. + /// + /// # Errors + /// + /// Errors if: + /// 1. Unable to send message to remote. + /// 2. Transport error while waiting for server response. + /// 3. Received unexpected (not [`CoturnCliResponse::Ready`]) response from + /// remote. pub async fn delete_session( &mut self, session_id: String, @@ -122,6 +143,14 @@ impl CoturnTelnetConnection { /// For each provided session id: /// 1. Sends [`CoturnCliRequest::CloseSession`] with specified session id. /// 2. Awaits for [`CoturnCliResponse::Ready`]. + /// + /// # Errors + /// + /// Errors if: + /// 1. Unable to send message to remote. + /// 2. Transport error while waiting for server response. + /// 3. Received unexpected (not [`CoturnCliResponse::Ready`]) response from + /// remote. pub async fn delete_sessions>( &mut self, session_ids: T, @@ -137,6 +166,14 @@ impl CoturnTelnetConnection { /// 1. Awaits for [`CoturnCliResponse::EnterPassword`]. /// 2. Sends [`CoturnCliRequest::Auth`]. /// 3. Awaits for [`CoturnCliResponse::Ready`]. + /// + /// # Errors + /// + /// Errors if: + /// 1. Transport error while waiting for server response. + /// 2. First message received is not [`CoturnCliResponse::EnterPassword`]. + /// 3. Unable to send message to remote. + /// 4. Second message received is not [`CoturnCliResponse::Ready`]. async fn auth(&mut self, pass: Bytes) -> Result<(), CoturnTelnetError> { // Wait for `CoturnCliResponse::EnterPassword`; let response = self @@ -169,6 +206,13 @@ impl CoturnTelnetConnection { } /// Pings Coturn telnet server. + /// + /// # Errors + /// + /// Errors if: + /// 1. Unable to send message to remote. + /// 2. Transport error while waiting for server response. + /// 3. First message received is not [`CoturnCliResponse::UnknownCommand`]. pub async fn ping(&mut self) -> Result<(), CoturnTelnetError> { self.0.send(CoturnCliRequest::Ping).await?; diff --git a/crates/medea-coturn-telnet/src/pool.rs b/crates/medea-coturn-telnet-client/src/con_pool.rs similarity index 89% rename from crates/medea-coturn-telnet/src/pool.rs rename to crates/medea-coturn-telnet-client/src/con_pool.rs index 75d59da27..254f36d15 100644 --- a/crates/medea-coturn-telnet/src/pool.rs +++ b/crates/medea-coturn-telnet-client/src/con_pool.rs @@ -5,13 +5,13 @@ //! //! # Example //! -//! ```rust +//! ```rust,should_panic //! use std::ops::DerefMut; -//! use coturn_telnet::{Manager, Pool}; +//! use medea_coturn_telnet_client::{Manager, Pool}; //! //! let mut rt = tokio::runtime::Runtime::new().unwrap(); //! rt.block_on(async { -//! let mgr = Manager::new((String::from("localhost"), 5766), "turn"); +//! let mgr = Manager::new((String::from("localhost"), 1234), "turn"); //! let pool = Pool::new(mgr, 16); //! //! let mut conn = pool.get().await.unwrap(); @@ -27,7 +27,7 @@ use async_trait::async_trait; use bytes::Bytes; use deadpool::managed; -use crate::connection::{CoturnTelnetConnection, CoturnTelnetError}; +use crate::client::{CoturnTelnetConnection, CoturnTelnetError}; /// A type alias for using `deadpool::managed::Pool` with /// [`CoturnTelnetConnection`]. @@ -45,12 +45,14 @@ pub type Connection = type RecycleResult = managed::RecycleResult; /// The manager for creating and recycling Coturn telnet connections. +#[derive(Debug)] pub struct Manager { addr: (String, u16), pass: Bytes, } impl Manager { + /// Creates [`Manager`]. pub fn new>(addr: (String, u16), pass: P) -> Self { Self { addr, diff --git a/crates/medea-coturn-telnet/src/codec.rs b/crates/medea-coturn-telnet-client/src/framed.rs similarity index 72% rename from crates/medea-coturn-telnet/src/codec.rs rename to crates/medea-coturn-telnet-client/src/framed.rs index c23549381..153411830 100644 --- a/crates/medea-coturn-telnet/src/codec.rs +++ b/crates/medea-coturn-telnet-client/src/framed.rs @@ -12,6 +12,7 @@ use std::{ }; use bytes::{BufMut as _, Bytes, BytesMut}; +use once_cell::sync::Lazy; use regex::Regex; use tokio_util::codec::{Decoder, Encoder}; @@ -25,15 +26,13 @@ static NEED_PASS: &str = "Enter password: \r\n"; /// Received when telnet server did not recognized last command. static UNKNOWN_COMMAND: &str = "Unknown command\r\n\r\n"; -lazy_static::lazy_static! { - // Used to check is message can be parsed to CoturnCliResponse::Sessions. - static ref IS_SESSIONS_REGEX: Regex = - Regex::new(r#"Total sessions: \d"#).unwrap(); +// Used to check is message can be parsed to CoturnCliResponse::Sessions. +static IS_SESSIONS_REGEX: Lazy = + Lazy::new(|| Regex::new(r#"Total sessions: \d"#).unwrap()); - // Used to extract session ids from CoturnCliResponse::Sessions. - static ref EXTRACT_SESSIONS_REGEX: Regex = - Regex::new(r"\d\) id=(.*),").unwrap(); -} +// Used to extract session ids from CoturnCliResponse::Sessions. +static EXTRACT_SESSIONS_REGEX: Lazy = + Lazy::new(|| Regex::new(r"\d\) id=(.*),").unwrap()); /// Messages that can be received from Coturn telnet server. #[derive(Clone, Debug, PartialEq)] @@ -115,6 +114,7 @@ impl TryFrom for CoturnCliResponse { } /// Messages that can be sent to Coturn telnet client. +#[derive(Debug)] pub enum CoturnCliRequest { /// Request to authenticate. Contains password. Should be sent when /// [`CoturnCliResponse::EnterPassword`] is received. @@ -149,7 +149,11 @@ impl Into for CoturnCliRequest { /// [`CoturnCliResponse`]. #[derive(Debug)] pub enum CoturnCliCodecError { + /// Errors that can happen while preforming I/O operations. IoError(io::Error), + + /// Errors that can happen when parsing message received from Coturn via + /// telnet connection. CannotParseResponse(CoturnResponseParseError), } @@ -169,7 +173,7 @@ impl From for CoturnCliCodecError { /// [Coturn] server telnet interface. /// /// [Coturn]: https://github.com/coturn/coturn -#[derive(Default)] +#[derive(Copy, Clone, Default, Debug)] pub struct CoturnCliCodec; impl Decoder for CoturnCliCodec { @@ -245,46 +249,74 @@ mod test { #[tokio::test] async fn parse_sessions() { let mut codec = CoturnCliCodec::default(); - let mut greeting = "\r\n 1) id=007000000000000001, user - :\r\n realm: medea\r\n started 49 secs ago\r\n - expiring in 551 secs\r\n client protocol UDP, relay protocol - UDP\r\n client addr 192.168.31.183:39514, server addr - 127.0.0.1:3478\r\n relay addr 127.0.0.1:55869\r\n - fingerprints enforced: OFF\r\n mobile: OFF\r\n usage: rp=6, - rb=480, sp=4, sb=440\r\n rate: r=0, s=0, total=0 (bytes per - sec)\r\n\r\n 2) id=010000000000000002, user :\r\n - realm: medea\r\n started 49 secs ago\r\n expiring in 551 - secs\r\n client protocol TCP, relay protocol UDP\r\n client - addr [::1]:33710, server addr [::1]:3478\r\n relay addr - [::1]:60216\r\n fingerprints enforced: OFF\r\n mobile: - OFF\r\n usage: rp=4, rb=348, sp=3, sb=336\r\n rate: r=0, - s=0, total=0 (bytes per sec)\r\n peers:\r\n ::1\r\n\r\n - 3) id=000000000000000001, user :\r\n realm: medea\r\n - started 49 secs ago\r\n expiring in 551 secs\r\n client - protocol UDP, relay protocol UDP\r\n client addr - 192.168.31.183:59996, server addr 127.0.0.1:3478\r\n relay addr - 127.0.0.1:54289\r\n fingerprints enforced: OFF\r\n mobile: - OFF\r\n usage: rp=5, rb=344, sp=4, sb=440\r\n rate: r=0, - s=0, total=0 (bytes per sec)\r\n\r\n 4) id=005000000000000001, - user :\r\n realm: medea\r\n started 49 secs - ago\r\n expiring in 551 secs\r\n client protocol TCP, relay - protocol UDP\r\n client addr [::1]:33712, server addr - [::1]:3478\r\n relay addr [::1]:52934\r\n fingerprints - enforced: OFF\r\n mobile: OFF\r\n usage: rp=12288, - rb=10012764, sp=12288, sb=10022892\r\n rate: r=222505, - s=222730, total=445235 (bytes per sec)\r\n peers:\r\n - ::1\r\n [::1]:62869\r\n\r\n Total sessions: 4\r\n\r\n> " - .into(); - - match codec.decode(&mut greeting).unwrap().unwrap() { + let mut sessions_message = " + 1) id=010000000000000001, user <777_Mireya>: + realm: medea + started 545 secs ago + expiring in 171 secs + client protocol TCP, relay protocol UDP + client addr [::1]:56278, server addr [::1]:3478 + relay addr [::1]:58490 + fingerprints enforced: OFF + mobile: OFF + usage: rp=878759, rb=704147763, sp=878425, sb=705869096 + rate: r=1299165, s=1302341, total=2601506 (bytes per sec) + peers: + ::1 + [::1]:65282 + + 2) id=001000000000000002, user <777_Mireya>: + realm: medea + started 545 secs ago + expiring in 171 secs + client protocol UDP, relay protocol UDP + client addr 192.168.31.183:45096, server addr 127.0.0.1:3478 + relay addr 127.0.0.1:57758 + fingerprints enforced: OFF + mobile: OFF + usage: rp=16, rb=1080, sp=15, sb=1568 + rate: r=0, s=0, total=0 (bytes per sec) + + 3) id=011000000000000002, user <777_Mireya>: + realm: medea + started 545 secs ago + expiring in 171 secs + client protocol UDP, relay protocol UDP + client addr 192.168.31.183:39916, server addr 127.0.0.1:3478 + relay addr 127.0.0.1:55028 + fingerprints enforced: OFF + mobile: OFF + usage: rp=17, rb=1212, sp=15, sb=1568 + rate: r=0, s=0, total=0 (bytes per sec) + + 4) id=011000000000000003, user <777_Mireya>: + realm: medea + started 545 secs ago + expiring in 171 secs + client protocol TCP, relay protocol UDP + client addr [::1]:56276, server addr [::1]:3478 + relay addr [::1]:61957 + fingerprints enforced: OFF + mobile: OFF + usage: rp=155, rb=21184, sp=154, sb=23228 + rate: r=0, s=0, total=0 (bytes per sec) + peers: + ::1 + + Total sessions: 4 + +> " + .into(); + + match codec.decode(&mut sessions_message).unwrap().unwrap() { CoturnCliResponse::Sessions(sessions) => { assert_eq!( sessions, vec![ - "007000000000000001", - "010000000000000002", - "000000000000000001", - "005000000000000001" + "010000000000000001", + "001000000000000002", + "011000000000000002", + "011000000000000003" ] ); } diff --git a/crates/medea-coturn-telnet-client/src/lib.rs b/crates/medea-coturn-telnet-client/src/lib.rs new file mode 100644 index 000000000..ab0e3aa7d --- /dev/null +++ b/crates/medea-coturn-telnet-client/src/lib.rs @@ -0,0 +1,36 @@ +//! Implements client to access [Coturn] telnet cli. You can use +//! [`CoturnTelnetConnection`] directly, but it is recommended to use connection +//! pool based on [deadpool] that will take care of connection lifecycle. +//! +//! [Coturn]: https://github.com/coturn/coturn +//! [deadpool]: https://crates.io/crates/deadpool + +#![deny( + intra_doc_link_resolution_failure, + missing_debug_implementations, + nonstandard_style, + rust_2018_idioms, + trivial_casts, + trivial_numeric_casts +)] +#![forbid(unsafe_code)] +#![warn( + deprecated_in_future, + missing_copy_implementations, + missing_docs, + unreachable_pub, + unused_import_braces, + unused_labels, + unused_lifetimes, + unused_qualifications, + unused_results +)] + +pub mod client; +pub mod con_pool; +pub mod framed; + +#[doc(inline)] +pub use client::{CoturnTelnetConnection, CoturnTelnetError}; +#[doc(inline)] +pub use con_pool::{Connection, Manager, Pool, PoolError}; diff --git a/crates/medea-coturn-telnet/LICENSE-APACHE.md b/crates/medea-coturn-telnet/LICENSE-APACHE.md deleted file mode 100644 index 24e951b55..000000000 --- a/crates/medea-coturn-telnet/LICENSE-APACHE.md +++ /dev/null @@ -1,194 +0,0 @@ -Apache License -============== - -_Version 2.0, January 2004_ -_<>_ - -### Terms and Conditions for use, reproduction, and distribution - -#### 1. Definitions - -“License” shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -“Licensor” shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -“Legal Entity” shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, “control” means **(i)** the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the -outstanding shares, or **(iii)** beneficial ownership of such entity. - -“You” (or “Your”) shall mean an individual or Legal Entity exercising -permissions granted by this License. - -“Source” form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -“Object” form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -“Work” shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -“Derivative Works” shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -“Contribution” shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -“submitted” means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as “Not a Contribution.” - -“Contributor” shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -#### 2. Grant of Copyright License - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -#### 3. Grant of Patent License - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -#### 4. Redistribution - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -* **(a)** You must give any other recipients of the Work or Derivative Works a copy of -this License; and -* **(b)** You must cause any modified files to carry prominent notices stating that You -changed the files; and -* **(c)** You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any -Derivative Works that You distribute must include a readable copy of the -attribution notices contained within such NOTICE file, excluding those notices -that do not pertain to any part of the Derivative Works, in at least one of the -following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. - -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -#### 5. Submission of Contributions - -Unless You explicitly state otherwise, any Contribution intentionally submitted -for inclusion in the Work by You to the Licensor shall be under the terms and -conditions of this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify the terms of -any separate license agreement you may have executed with Licensor regarding -such Contributions. - -#### 6. Trademarks - -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -#### 7. Disclaimer of Warranty - -Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, -including, without limitation, any warranties or conditions of TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are -solely responsible for determining the appropriateness of using or -redistributing the Work and assume any risks associated with Your exercise of -permissions under this License. - -#### 8. Limitation of Liability - -In no event and under no legal theory, whether in tort (including negligence), -contract, or otherwise, unless required by applicable law (such as deliberate -and grossly negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, incidental, -or consequential damages of any character arising as a result of this License or -out of the use or inability to use the Work (including but not limited to -damages for loss of goodwill, work stoppage, computer failure or malfunction, or -any and all other commercial damages or losses), even if such Contributor has -been advised of the possibility of such damages. - -#### 9. Accepting Warranty or Additional Liability - -While redistributing the Work or Derivative Works thereof, You may choose to -offer, and charge a fee for, acceptance of support, warranty, indemnity, or -other liability obligations and/or rights consistent with this License. However, -in accepting such obligations, You may act only on Your own behalf and on Your -sole responsibility, not on behalf of any other Contributor, and only if You -agree to indemnify, defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason of your -accepting any such warranty or additional liability. - -_END OF TERMS AND CONDITIONS_ - -### APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets `[]` replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same “printed page” as the copyright notice for easier identification within -third-party archives. - - Copyright © 2019 Instrumentisto Team, https://github.com/instrumentisto - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/crates/medea-coturn-telnet/LICENSE-MIT.md b/crates/medea-coturn-telnet/LICENSE-MIT.md deleted file mode 100644 index 8852bcc25..000000000 --- a/crates/medea-coturn-telnet/LICENSE-MIT.md +++ /dev/null @@ -1,25 +0,0 @@ -The MIT License (MIT) -===================== - -Copyright © 2019 Instrumentisto Team, https://github.com/instrumentisto - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the “Software”), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/crates/medea-coturn-telnet/README.md b/crates/medea-coturn-telnet/README.md deleted file mode 100644 index 2a1b59a25..000000000 --- a/crates/medea-coturn-telnet/README.md +++ /dev/null @@ -1,33 +0,0 @@ -medea-coturn-telnet -=========== - -[![Crates.io](https://img.shields.io/crates/v/medea-coturn-telnet)](https://crates.io/crates/medea-coturn-telnet) -![Crates.io license](https://img.shields.io/crates/l/medea-coturn-telnet) - -[API Docs](https://docs.rs/medea-coturn-telnet) | -[Changelog](https://github.com/instrumentisto/medea/blob/master/crates/medea-coturn-telnet/CHANGELOG.md) - -[Coturn] telnet admin interface client implementation. - - - - -## License - -This project is licensed under either of - -- Apache License, Version 2.0, ([LICENSE-APACHE](https://github.com/instrumentisto/medea/blob/master/crates/medea-coturn-telnet/LICENSE-APACHE.md) or http://www.apache.org/licenses/LICENSE-2.0) -- MIT license ([LICENSE-MIT](https://github.com/instrumentisto/medea/blob/master/crates/medea-coturn-telnet/LICENSE-MIT.md) or http://opensource.org/licenses/MIT) - -at your option. - - -### Contribution - -Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. - - - - - -[Coturn]: https://github.com/coturn/coturn diff --git a/crates/medea-coturn-telnet/src/lib.rs b/crates/medea-coturn-telnet/src/lib.rs deleted file mode 100644 index b4ca61b19..000000000 --- a/crates/medea-coturn-telnet/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -//! Implements client to access [Coturn] telnet cli. You can use -//! [`CoturnTelnetConnection`] directly, but it is recommended to use connection -//! pool based on [deadpool] that will take care of connection lifecycle. -//! -//! [Coturn]: https://github.com/coturn/coturn -//! [deadpool]: https://crates.io/crates/deadpool -#![allow(clippy::module_name_repetitions)] - -pub mod codec; -pub mod connection; -pub mod pool; - -pub use connection::{CoturnTelnetConnection, CoturnTelnetError}; -pub use pool::{Connection, Manager, Pool, PoolError}; diff --git a/jason/demo/chart/medea-demo/Chart.yaml b/jason/demo/chart/medea-demo/Chart.yaml index ec476ddb0..a8709dbe7 100644 --- a/jason/demo/chart/medea-demo/Chart.yaml +++ b/jason/demo/chart/medea-demo/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 name: medea-demo -version: 0.3.2 +version: 0.3.3 appVersion: 0.1.0 type: application diff --git a/mock/control-api/Dockerfile b/mock/control-api/Dockerfile index b089a3439..1f2dc4c74 100644 --- a/mock/control-api/Dockerfile +++ b/mock/control-api/Dockerfile @@ -26,6 +26,7 @@ RUN apt-get update \ # Prepare Cargo workspace for building dependencies only. COPY crates/medea-macro/Cargo.toml /app/crates/medea-macro/ +COPY crates/medea-coturn-telnet-client/Cargo.toml /app/crates/medea-coturn-telnet-client/ COPY mock/control-api/Cargo.toml /app/mock/control-api/ COPY proto/client-api/Cargo.toml /app/proto/client-api/ COPY proto/control-api/Cargo.toml /app/proto/control-api/ @@ -38,6 +39,7 @@ COPY jason/Cargo.toml /app/jason/ COPY Cargo.toml Cargo.lock /app/ WORKDIR /app/ RUN mkdir -p crates/medea-macro/src/ && touch crates/medea-macro/src/lib.rs \ + && mkdir -p crates/medea-coturn-telnet-client/src/ && touch crates/medea-coturn-telnet-client/src/lib.rs \ && mkdir -p mock/control-api/src/ && touch mock/control-api/src/lib.rs \ && mkdir -p proto/client-api/src/ && touch proto/client-api/src/lib.rs \ && mkdir -p proto/control-api/src/ && touch proto/control-api/src/lib.rs \ diff --git a/src/turn/cli.rs b/src/turn/cli.rs index 80e1c6893..1faa2ebd8 100644 --- a/src/turn/cli.rs +++ b/src/turn/cli.rs @@ -3,7 +3,7 @@ use std::{fmt, ops::DerefMut}; use deadpool::managed::PoolConfig; use derive_more::{Display, From}; use failure::Fail; -use medea_coturn_telnet::{CoturnTelnetError, Manager, Pool, PoolError}; +use medea_coturn_telnet_client::{CoturnTelnetError, Manager, Pool, PoolError}; use crate::media::IceUser; From d496e60c62fab6a3e21352e7574602eb076f0b25 Mon Sep 17 00:00:00 2001 From: tyranron Date: Tue, 18 Feb 2020 19:01:35 +0200 Subject: [PATCH 18/21] Corrections to 'medea-coturn-telnet-client' crate --- .../medea-coturn-telnet-client/CHANGELOG.md | 12 +- crates/medea-coturn-telnet-client/Cargo.toml | 25 +- crates/medea-coturn-telnet-client/README.md | 12 +- .../medea-coturn-telnet-client/src/client.rs | 210 ++++++++-------- .../src/con_pool.rs | 83 ------- crates/medea-coturn-telnet-client/src/lib.rs | 20 +- crates/medea-coturn-telnet-client/src/pool.rs | 96 ++++++++ .../src/{framed.rs => proto.rs} | 231 ++++++++++-------- proto/control-api/LICENSE.md | 56 +++++ 9 files changed, 436 insertions(+), 309 deletions(-) delete mode 100644 crates/medea-coturn-telnet-client/src/con_pool.rs create mode 100644 crates/medea-coturn-telnet-client/src/pool.rs rename crates/medea-coturn-telnet-client/src/{framed.rs => proto.rs} (51%) create mode 100644 proto/control-api/LICENSE.md diff --git a/crates/medea-coturn-telnet-client/CHANGELOG.md b/crates/medea-coturn-telnet-client/CHANGELOG.md index e9944f02c..cb5d464bc 100644 --- a/crates/medea-coturn-telnet-client/CHANGELOG.md +++ b/crates/medea-coturn-telnet-client/CHANGELOG.md @@ -1,23 +1,23 @@ `medea-coturn-telnet-client` changelog -======================= +====================================== All user visible changes to this project will be documented in this file. This project uses [Semantic Versioning 2.0.0]. -## TBD [0.1.0] · 2019-??-?? +## TBD [0.1.0] · 2020-??-?? [0.1.0]: /../../tree/medea-coturn-telnet-client-0.1.0/crates/medea-coturn-telnet-client ### Added - Asynchronous [Coturn] client ([#84]). -- Connection pool ([#84]). +- Connections pool ([#84]). - Requests ([#84]): - - `ps [username]`, that prints sessions, with optional exact user match. - - `cs `, that forcefully cancels session. + - `ps []`: prints sessions, with optional exact user match; + - `cs `: forcefully cancels session. -[#28]: /../../pull/84 +[#84]: /../../pull/84 diff --git a/crates/medea-coturn-telnet-client/Cargo.toml b/crates/medea-coturn-telnet-client/Cargo.toml index 66c657b86..b3c955995 100644 --- a/crates/medea-coturn-telnet-client/Cargo.toml +++ b/crates/medea-coturn-telnet-client/Cargo.toml @@ -9,19 +9,30 @@ documentation = "https://docs.rs/medea-coturn-telnet-client" homepage = "https://github.com/instrumentisto/medea/tree/master/crates/medea-coturn-telnet-client" repository = "https://github.com/instrumentisto/medea/tree/master/crates/medea-coturn-telnet-client" readme = "README.md" -keywords = ["coturn", "telnet", "cli"] -categories = ["web-programming"] +keywords = ["coturn", "telnet", "cli", "client"] +categories = ["api-bindings", "network-programming"] + +[features] +pool = ["async-trait", "deadpool"] [dependencies] -async-trait = "0.1" +async-trait = { version = "0.1.20", optional = true } bytes = "0.5" -deadpool = { version = "0.5", default-features = false , features = ["managed"]} derive_more = "0.99" futures = "0.3" once_cell = "1.3.1" -regex = "1.3" -tokio = { version = "0.2", features = ["dns", "macros", "tcp"] } +regex = "1.3.4" +tokio = { version = "0.2", features = ["dns", "tcp"] } tokio-util = { version = "0.2", features = ["codec"] } +[dependencies.deadpool] + version = "0.5" + optional = true + features = ["managed"] + default-features = false [dev-dependencies] -tokio-test = "0.2" +tokio = { version = "0.2", features = ["macros"] } + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] diff --git a/crates/medea-coturn-telnet-client/README.md b/crates/medea-coturn-telnet-client/README.md index 467622f90..af4193c51 100644 --- a/crates/medea-coturn-telnet-client/README.md +++ b/crates/medea-coturn-telnet-client/README.md @@ -1,24 +1,28 @@ medea-coturn-telnet-client -=========== +========================== [![Crates.io](https://img.shields.io/crates/v/medea-coturn-telnet-client)](https://crates.io/crates/medea-coturn-telnet-client) ![Crates.io license](https://img.shields.io/crates/l/medea-coturn-telnet-client) +![Unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg) +[![Rust docs](https://docs.rs/medea-coturn-telnet-client/badge.svg)](https://docs.rs/medea-coturn-telnet-client) [API Docs](https://docs.rs/medea-coturn-telnet-client) | [Changelog](https://github.com/instrumentisto/medea/blob/master/crates/medea-coturn-telnet-client/CHANGELOG.md) -[Coturn] telnet admin interface client implementation. +[Telnet] client implementation for [Coturn] admin interface. ## License -Copyright © 2019 Instrumentisto Team, https://github.com/instrumentisto +Copyright © 2020 Instrumentisto Team, https://github.com/instrumentisto + +This software is subject to the terms of the [Blue Oak Model License 1.0.0](https://github.com/instrumentisto/medea/blob/master/crates/medea-coturn-telnet-client/LICENSE.md). If a copy of the [BlueOak-1.0.0](https://spdx.org/licenses/BlueOak-1.0.0.html) license was not distributed with this file, You can obtain one at https://blueoakcouncil.org/license/1.0.0 . -This software is subject to the terms of the [Blue Oak Model License 1.0.0](https://github.com/instrumentisto/medea/blob/master/proto/control-api/LICENSE.md). If a copy of the [BlueOak-1.0.0](https://spdx.org/licenses/BlueOak-1.0.0.html) license was not distributed with this file, You can obtain one at https://blueoakcouncil.org/license/1.0.0 . [Coturn]: https://github.com/coturn/coturn +[Telnet]: https://en.wikipedia.org/wiki/Telnet diff --git a/crates/medea-coturn-telnet-client/src/client.rs b/crates/medea-coturn-telnet-client/src/client.rs index ad24d85a0..9c0ee37d9 100644 --- a/crates/medea-coturn-telnet-client/src/client.rs +++ b/crates/medea-coturn-telnet-client/src/client.rs @@ -1,64 +1,84 @@ -//! Contains [`CoturnTelnetConnection`]. +//! Asynchronous client to remote [Coturn] server. +//! +//! [Coturn]: https://github.com/coturn/coturn use std::io; use bytes::Bytes; +use derive_more::{Display, From}; use futures::{SinkExt, StreamExt}; use tokio::net::{TcpStream, ToSocketAddrs}; use tokio_util::codec::Framed; -use crate::framed::{ +use crate::proto::{ CoturnCliCodec, CoturnCliCodecError, CoturnCliRequest, CoturnCliResponse, CoturnResponseParseError, }; -/// Any errors that can be thrown from [`CoturnTelnetConnection`]. -#[derive(Debug, derive_more::Display, derive_more::From)] +/// Errors that can be returned by [`CoturnTelnetConnection`]. +#[derive(Debug, Display, From)] pub enum CoturnTelnetError { - /// Underlying transport encountered [`io::Error`]. You should try - /// recreating [`CoturnTelnetConnection`]. - #[display(fmt = "Underlying transport encountered IoError: {}", _0)] - IoError(io::Error), - /// Underlying stream exhausted. You should try recreating - /// [`CoturnTelnetConnection`]. + /// Underlying transport encountered error on I/O operation. + /// + /// You should try to recreate [`CoturnTelnetConnection`]. + #[display(fmt = "Underlying transport failed on I/O operation: {}", _0)] + IoFailed(io::Error), + + /// Underlying stream exhausted. + /// + /// You should try to recreate [`CoturnTelnetConnection`]. #[display(fmt = "Disconnected from Coturn telnet server")] Disconnected, - /// Unable to parse response from Coturn telnet server. This is - /// unrecoverable error. - #[display(fmt = "Unable to parse Coturn response: {:?}", _0)] + + /// Unable to parse response from [Coturn] server. + /// + /// This is unrecoverable error. + /// + /// [Coturn]: https://github.com/coturn/coturn + #[display(fmt = "Unable to parse response: {}", _0)] MessageParseError(CoturnResponseParseError), - /// Coturn answered with unexpected message. This is unrecoverable error. - #[display(fmt = "Unexpected response received {:?}", _0)] + + /// [Coturn] answered with unexpected message. + /// + /// This is unrecoverable error. + /// + /// [Coturn]: https://github.com/coturn/coturn + #[display(fmt = "Unexpected response received: {:?}", _0)] UnexpectedMessage(CoturnCliResponse), - /// Authentication failed. This is unrecoverable error. + + /// Authentication failed. + /// + /// This is unrecoverable error. #[display(fmt = "Coturn server rejected provided password")] WrongPassword, } impl From for CoturnTelnetError { fn from(err: CoturnCliCodecError) -> Self { + use CoturnCliCodecError::*; match err { - CoturnCliCodecError::IoError(err) => Self::from(err), - CoturnCliCodecError::CannotParseResponse(err) => Self::from(err), + IoFailed(e) => Self::from(e), + BadResponse(e) => Self::from(e), } } } -/// Asynchronous connection to remote [Coturn] server telnet interface. You can -/// use this directly, but it is recommended to use this with connection pool -/// from [`crate::pool::Pool`], which takes care of connection lifecycle. +/// Asynchronous connection to remote [Coturn] server via [Telnet] interface. /// -/// [Coturn]: https://github.com/coturn/coturn. +/// [Coturn]: https://github.com/coturn/coturn +/// [Telnet]: https://en.wikipedia.org/wiki/Telnet #[derive(Debug)] pub struct CoturnTelnetConnection(Framed); impl CoturnTelnetConnection { - /// Opens a telnet connection to a remote host using a `TcpStream` and + /// Opens a [Telnet] connection to a remote host using a [`TcpStream`] and /// performs authentication. /// /// # Errors /// - /// Errors if could not open [`TcpStream`] or authentication failed. + /// Errors if couldn't open [`TcpStream`] or authentication failed. + /// + /// [Telnet]: https://en.wikipedia.org/wiki/Telnet pub async fn connect>( addr: A, pass: B, @@ -66,79 +86,77 @@ impl CoturnTelnetConnection { let stream = TcpStream::connect(addr).await?; let mut this = Self(Framed::new(stream, CoturnCliCodec::default())); this.auth(pass.into()).await?; - Ok(this) } - /// Returns session ids associated with provided username. + /// Returns session IDs for [Coturn] server associated with the provided + /// `username`. /// - /// 1. Sends [`CoturnCliRequest::PrintSessions`] with provided - /// username. + /// 1. Sends [`CoturnCliRequest::PrintSessions`] with the provided + /// `username`. /// 2. Awaits for [`CoturnCliResponse::Sessions`]. /// /// # Errors /// - /// Errors if: - /// 1. Unable to send message to remote. - /// 2. Transport error while waiting for server response. - /// 3. Received unexpected (not [`CoturnCliResponse::Sessions`]) response - /// from remote. + /// - Unable to send message to remote server. + /// - Transport error while waiting for server response. + /// - Received an unexpected (not [`CoturnCliResponse::Sessions`]) response + /// from remote server. + /// + /// [Coturn]: https://github.com/coturn/coturn pub async fn print_sessions( &mut self, username: String, ) -> Result, CoturnTelnetError> { - // Send `CoturnCliRequest::PrintSessions`. + use CoturnTelnetError::*; + self.0 .send(CoturnCliRequest::PrintSessions(username)) .await?; - // Await for `CoturnCliResponse::Sessions`. - let response: CoturnCliResponse = self - .0 - .next() - .await - .ok_or_else(|| CoturnTelnetError::Disconnected)??; + let response: CoturnCliResponse = + self.0.next().await.ok_or(Disconnected)??; match response { CoturnCliResponse::Sessions(sessions) => Ok(sessions), - _ => Err(CoturnTelnetError::UnexpectedMessage(response)), + _ => Err(UnexpectedMessage(response)), } } - /// Closes session on Coturn server destroying this session allocations and - /// channels. + /// Closes session on [Coturn] server destroying this session's allocations + /// and channels. /// - /// 1. Sends [`CoturnCliRequest::CloseSession`] with specified session id. + /// 1. Sends [`CoturnCliRequest::CloseSession`] with the provided + /// `session_id`. /// 2. Awaits for [`CoturnCliResponse::Ready`]. /// /// # Errors /// - /// Errors if: - /// 1. Unable to send message to remote. - /// 2. Transport error while waiting for server response. - /// 3. Received unexpected (not [`CoturnCliResponse::Ready`]) response from - /// remote. + /// - Unable to send message to remote server. + /// - Transport error while waiting for server response. + /// - Received an unexpected (not [`CoturnCliResponse::Ready`]) response + /// from remote server. + /// + /// [Coturn]: https://github.com/coturn/coturn pub async fn delete_session( &mut self, session_id: String, ) -> Result<(), CoturnTelnetError> { + use CoturnTelnetError::*; + self.0 .send(CoturnCliRequest::CloseSession(session_id)) .await?; - // Await for `CoturnCliResponse::Ready`. - let response: CoturnCliResponse = self - .0 - .next() - .await - .ok_or_else(|| CoturnTelnetError::Disconnected)??; + let response: CoturnCliResponse = + self.0.next().await.ok_or(Disconnected)??; match response { CoturnCliResponse::Ready => Ok(()), - _ => Err(CoturnTelnetError::UnexpectedMessage(response)), + _ => Err(UnexpectedMessage(response)), } } - /// Closes sessions on Coturn server destroying provided sessions - /// allocations and channels. + /// Closes multiple sessions on [Coturn] server destroying their allocations + /// and channels. /// /// For each provided session id: /// 1. Sends [`CoturnCliRequest::CloseSession`] with specified session id. @@ -146,17 +164,18 @@ impl CoturnTelnetConnection { /// /// # Errors /// - /// Errors if: - /// 1. Unable to send message to remote. - /// 2. Transport error while waiting for server response. - /// 3. Received unexpected (not [`CoturnCliResponse::Ready`]) response from - /// remote. + /// - Unable to send message to remote server. + /// - Transport error while waiting for server response. + /// - Received an unexpected (not [`CoturnCliResponse::Sessions`]) response + /// from remote server. + /// + /// [Coturn]: https://github.com/coturn/coturn pub async fn delete_sessions>( &mut self, session_ids: T, ) -> Result<(), CoturnTelnetError> { - for session_id in session_ids { - self.delete_session(session_id).await?; + for id in session_ids { + self.delete_session(id).await?; } Ok(()) } @@ -169,63 +188,50 @@ impl CoturnTelnetConnection { /// /// # Errors /// - /// Errors if: - /// 1. Transport error while waiting for server response. - /// 2. First message received is not [`CoturnCliResponse::EnterPassword`]. - /// 3. Unable to send message to remote. - /// 4. Second message received is not [`CoturnCliResponse::Ready`]. + /// - Unable to send message to remote server. + /// - Transport error while waiting for server response. + /// - First message received is not [`CoturnCliResponse::EnterPassword`]. + /// - Second message received is not [`CoturnCliResponse::Ready`]. async fn auth(&mut self, pass: Bytes) -> Result<(), CoturnTelnetError> { - // Wait for `CoturnCliResponse::EnterPassword`; - let response = self - .0 - .next() - .await - .ok_or_else(|| CoturnTelnetError::Disconnected)??; + use CoturnTelnetError::*; + let response = self.0.next().await.ok_or(Disconnected)??; if let CoturnCliResponse::EnterPassword = response { } else { - return Err(CoturnTelnetError::UnexpectedMessage(response)); + return Err(UnexpectedMessage(response)); }; - // Send `CoturnCliRequest::Auth` with provided password. self.0.send(CoturnCliRequest::Auth(pass)).await?; - // Wait for `CoturnCliResponse::Ready`. - let response = self - .0 - .next() - .await - .ok_or_else(|| CoturnTelnetError::Disconnected)??; + let response = self.0.next().await.ok_or(Disconnected)??; match response { - CoturnCliResponse::EnterPassword => { - Err(CoturnTelnetError::WrongPassword) - } + CoturnCliResponse::EnterPassword => Err(WrongPassword), CoturnCliResponse::Ready => Ok(()), - _ => Err(CoturnTelnetError::UnexpectedMessage(response)), + _ => Err(UnexpectedMessage(response)), } } - /// Pings Coturn telnet server. + /// Pings [Coturn] server via [Telnet]. /// /// # Errors /// - /// Errors if: - /// 1. Unable to send message to remote. - /// 2. Transport error while waiting for server response. - /// 3. First message received is not [`CoturnCliResponse::UnknownCommand`]. + /// - Unable to send message to remote server. + /// - Transport error while waiting for server response. + /// - First message received is not [`CoturnCliResponse::UnknownCommand`]. + /// + /// [Coturn]: https://github.com/coturn/coturn + /// [Telnet]: https://en.wikipedia.org/wiki/Telnet pub async fn ping(&mut self) -> Result<(), CoturnTelnetError> { + use CoturnTelnetError::*; + self.0.send(CoturnCliRequest::Ping).await?; - let response: CoturnCliResponse = self - .0 - .next() - .await - .ok_or_else(|| CoturnTelnetError::Disconnected)??; + let response: CoturnCliResponse = + self.0.next().await.ok_or(Disconnected)??; if let CoturnCliResponse::UnknownCommand = response { + Ok(()) } else { - return Err(CoturnTelnetError::UnexpectedMessage(response)); - }; - - Ok(()) + Err(UnexpectedMessage(response)) + } } } diff --git a/crates/medea-coturn-telnet-client/src/con_pool.rs b/crates/medea-coturn-telnet-client/src/con_pool.rs deleted file mode 100644 index 254f36d15..000000000 --- a/crates/medea-coturn-telnet-client/src/con_pool.rs +++ /dev/null @@ -1,83 +0,0 @@ -//! Deadpool simple async pool for [`CoturnTelnetConnection`]'s. -//! -//! You should not need to use `deadpool` directly. Use the `Pool` type -//! provided by this crate instead. -//! -//! # Example -//! -//! ```rust,should_panic -//! use std::ops::DerefMut; -//! use medea_coturn_telnet_client::{Manager, Pool}; -//! -//! let mut rt = tokio::runtime::Runtime::new().unwrap(); -//! rt.block_on(async { -//! let mgr = Manager::new((String::from("localhost"), 1234), "turn"); -//! let pool = Pool::new(mgr, 16); -//! -//! let mut conn = pool.get().await.unwrap(); -//! -//! conn.deref_mut() -//! .print_sessions(String::from("username")) -//! .await -//! .unwrap(); -//! }); -//! ``` - -use async_trait::async_trait; -use bytes::Bytes; -use deadpool::managed; - -use crate::client::{CoturnTelnetConnection, CoturnTelnetError}; - -/// A type alias for using `deadpool::managed::Pool` with -/// [`CoturnTelnetConnection`]. -pub type Pool = managed::Pool; - -/// A type alias for using `deadpool::managed::PoolError` with -/// [`CoturnTelnetConnection`]. -pub type PoolError = managed::PoolError; - -/// A type alias for using `deadpool::managed::Object` with -/// [`CoturnTelnetConnection`]. -pub type Connection = - managed::Object; - -type RecycleResult = managed::RecycleResult; - -/// The manager for creating and recycling Coturn telnet connections. -#[derive(Debug)] -pub struct Manager { - addr: (String, u16), - pass: Bytes, -} - -impl Manager { - /// Creates [`Manager`]. - pub fn new>(addr: (String, u16), pass: P) -> Self { - Self { - addr, - pass: pass.into(), - } - } -} - -#[async_trait] -impl managed::Manager for Manager { - async fn create( - &self, - ) -> Result { - let connection = CoturnTelnetConnection::connect( - (self.addr.0.as_str(), self.addr.1), - self.pass.clone(), - ) - .await?; - Ok(connection) - } - - async fn recycle( - &self, - connection: &mut CoturnTelnetConnection, - ) -> RecycleResult { - connection.ping().await.map_err(From::from) - } -} diff --git a/crates/medea-coturn-telnet-client/src/lib.rs b/crates/medea-coturn-telnet-client/src/lib.rs index ab0e3aa7d..ad3331569 100644 --- a/crates/medea-coturn-telnet-client/src/lib.rs +++ b/crates/medea-coturn-telnet-client/src/lib.rs @@ -1,10 +1,14 @@ -//! Implements client to access [Coturn] telnet cli. You can use -//! [`CoturnTelnetConnection`] directly, but it is recommended to use connection -//! pool based on [deadpool] that will take care of connection lifecycle. +//! [Telnet] client implementation to access [Coturn] admin interface (cli). +//! +//! You may use [`CoturnTelnetConnection`] directly, but it is recommended +//! to use connections pool (based on [deadpool]) that will take care of +//! connections lifecycle. Enable `pool` feature for that. //! //! [Coturn]: https://github.com/coturn/coturn //! [deadpool]: https://crates.io/crates/deadpool +//! [Telnet]: https://en.wikipedia.org/wiki/Telnet +#![cfg_attr(docsrs, feature(doc_cfg))] #![deny( intra_doc_link_resolution_failure, missing_debug_implementations, @@ -27,10 +31,10 @@ )] pub mod client; -pub mod con_pool; -pub mod framed; +#[cfg(feature = "pool")] +#[cfg_attr(docsrs, doc(cfg(feature = "pool")))] +pub mod pool; +pub mod proto; #[doc(inline)] -pub use client::{CoturnTelnetConnection, CoturnTelnetError}; -#[doc(inline)] -pub use con_pool::{Connection, Manager, Pool, PoolError}; +pub use self::client::{CoturnTelnetConnection, CoturnTelnetError}; diff --git a/crates/medea-coturn-telnet-client/src/pool.rs b/crates/medea-coturn-telnet-client/src/pool.rs new file mode 100644 index 000000000..4d0bcce4f --- /dev/null +++ b/crates/medea-coturn-telnet-client/src/pool.rs @@ -0,0 +1,96 @@ +//! [deadpool]-based simple async pool for [`CoturnTelnetConnection`]s. +//! +//! You shouldn't use [deadpool] directly, just use the [`Pool`] type provided +//! by this crate instead. +//! +//! # Example +//! +//! ```rust,should_panic +//! use std::ops::DerefMut as _; +//! use medea_coturn_telnet_client::pool::{Manager, Pool}; +//! +//! #[tokio::main] +//! async fn main() { +//! let pool = Pool::new(Manager::new("localhost", 1234, "turn"), 16); +//! pool.get() +//! .await +//! .expect("Failed connect to TURN server") +//! .print_sessions(String::from("username")) +//! .await +//! .expect("Failed to print sessions"); +//! } +//! ``` +//! +//! [deadpool]: https://crates.io/crates/deadpool + +#![allow(clippy::needless_doctest_main)] + +use async_trait::async_trait; +use bytes::Bytes; +use deadpool::managed; + +use crate::client::{CoturnTelnetConnection, CoturnTelnetError}; + +/// Type alias for using [`deadpool::managed::Pool`] with +/// [`CoturnTelnetConnection`]. +pub type Pool = managed::Pool; + +/// Type alias for using [`deadpool::managed::PoolError`] with +/// [`CoturnTelnetConnection`]. +pub type PoolError = managed::PoolError; + +/// Type alias for using [`deadpool::managed::Object`] with +/// [`CoturnTelnetConnection`]. +pub type Connection = + managed::Object; + +/// Type alias for using [`deadpool::managed::RecycleResult`] with +/// [`CoturnTelnetError`]. +type RecycleResult = managed::RecycleResult; + +/// Manager for creating and recycling [`CoturnTelnetConnection`]s. +#[derive(Debug)] +pub struct Manager { + /// Host and port of the server to establish connections onto. + addr: (String, u16), + + /// Password to authenticate connections with. + pass: Bytes, +} + +impl Manager { + /// Creates new [`Manager`] with the given credentials. + #[inline] + pub fn new(host: S, port: u16, pass: P) -> Self + where + S: Into, + P: Into, + { + Self { + addr: (host.into(), port), + pass: pass.into(), + } + } +} + +#[async_trait] +impl managed::Manager for Manager { + #[inline] + async fn create( + &self, + ) -> Result { + Ok(CoturnTelnetConnection::connect( + (self.addr.0.as_str(), self.addr.1), + self.pass.clone(), + ) + .await?) + } + + #[inline] + async fn recycle( + &self, + conn: &mut CoturnTelnetConnection, + ) -> RecycleResult { + Ok(conn.ping().await?) + } +} diff --git a/crates/medea-coturn-telnet-client/src/framed.rs b/crates/medea-coturn-telnet-client/src/proto.rs similarity index 51% rename from crates/medea-coturn-telnet-client/src/framed.rs rename to crates/medea-coturn-telnet-client/src/proto.rs index 153411830..731e4a265 100644 --- a/crates/medea-coturn-telnet-client/src/framed.rs +++ b/crates/medea-coturn-telnet-client/src/proto.rs @@ -1,9 +1,7 @@ -//! Contains definitions for messages sent to [Coturn] server telnet interface -//! [`CoturnCliRequest`], messages received from Coturn server telnet interface: -//! [`CoturnCliResponse`]. [`CoturnCliCodec`] which encodes and decodes those -//! messages. +//! [Telnet] messages to operate with [Coturn] and their encoding. //! //! [Coturn]: https://github.com/coturn/coturn +//! [Telnet]: https://en.wikipedia.org/wiki/Telnet use std::{ convert::TryFrom, @@ -12,74 +10,106 @@ use std::{ }; use bytes::{BufMut as _, Bytes, BytesMut}; +use derive_more::{Display, From}; use once_cell::sync::Lazy; use regex::Regex; use tokio_util::codec::{Decoder, Encoder}; -// Cursor is received when telnet server has finished writing response and is -// ready to receive new requests. +/// [`CURSOR`] is received whenever [Telnet] server has finished writing +/// response and is ready to receive new requests. +/// +/// [Telnet]: https://en.wikipedia.org/wiki/Telnet static CURSOR: &str = "> "; -// Received when telnet server awaits for password. +/// Received whenever [Telnet] server awaits for password. +/// +/// [Telnet]: https://en.wikipedia.org/wiki/Telnet static NEED_PASS: &str = "Enter password: \r\n"; -/// Received when telnet server did not recognized last command. +/// Received whenever [Telnet] server didn't recognized last command. +/// +/// [Telnet]: https://en.wikipedia.org/wiki/Telnet static UNKNOWN_COMMAND: &str = "Unknown command\r\n\r\n"; -// Used to check is message can be parsed to CoturnCliResponse::Sessions. +/// Regular expression to check if message can be parsed as +/// [`CoturnCliResponse::Sessions`]. static IS_SESSIONS_REGEX: Lazy = Lazy::new(|| Regex::new(r#"Total sessions: \d"#).unwrap()); -// Used to extract session ids from CoturnCliResponse::Sessions. +/// Regular expression to extract session IDs from +/// [`CoturnCliResponse::Sessions`]. static EXTRACT_SESSIONS_REGEX: Lazy = Lazy::new(|| Regex::new(r"\d\) id=(.*),").unwrap()); -/// Messages that can be received from Coturn telnet server. -#[derive(Clone, Debug, PartialEq)] +/// Message that is received from [Coturn] server via [Telnet]. +/// +/// [Coturn]: https://github.com/coturn/coturn +/// [Telnet]: https://en.wikipedia.org/wiki/Telnet +#[derive(Clone, Debug, Eq, PartialEq)] pub enum CoturnCliResponse { - /// Current telnet connection requires authentication. Next message sent to - /// server should be [`CoturnCliRequest::Auth`]. + /// Current [Telnet] connection requires authentication. + /// + /// Next message sent to server should be [`CoturnCliRequest::Auth`]. + /// + /// [Telnet]: https://en.wikipedia.org/wiki/Telnet EnterPassword, - /// Coturn server finished processing latest telnet request and is ready to - /// accept next. You should wait for this message after sending request - /// to make sure that request succeeded. + /// [Coturn] server has finished processing latest [Telnet] request and + /// is ready to accept the next one. + /// + /// You should wait for this message after sending request to make sure + /// that the request has succeeded. + /// + /// [Coturn]: https://github.com/coturn/coturn + /// [Telnet]: https://en.wikipedia.org/wiki/Telnet Ready, - /// Answer to [`CoturnCliRequest::PrintSessions`], contains list of session - /// ids associated with username provided in + /// Answer to [`CoturnCliRequest::PrintSessions`], which contains list of + /// session IDs associated with the provided username in /// [`CoturnCliRequest::PrintSessions`] message. Sessions(Vec), - /// Coturn telnet server did not recognized last command. + /// [Coturn] server hasn't recognized last [Telnet] command. + /// + /// [Coturn]: https://github.com/coturn/coturn + /// [Telnet]: https://en.wikipedia.org/wiki/Telnet UnknownCommand, } -/// Errors that can happen when parsing message received from Coturn via telnet -/// connection. -#[derive(Debug)] +/// Errors that can happen when parsing message received from [Coturn] via +/// [Telnet] connection. +/// +/// [Coturn]: https://github.com/coturn/coturn +/// [Telnet]: https://en.wikipedia.org/wiki/Telnet +#[derive(Debug, Display, From)] // TODO: derive(Error) with derive_more pub enum CoturnResponseParseError { - /// Could not represent byte slice as `String`. - BadString(Utf8Error), + /// Couldn't parse provided bytes to determined response type. + #[display(fmt = "Bad response format: {}", _0)] + #[from(ignore)] + BadResponseFormat(String), - /// Could not determine concrete response type. - CannotDetermineResponseType(String), + /// Failed to determine concrete response type. + #[display(fmt = "Bad response type: {}", _0)] + #[from(ignore)] + BadResponseType(String), - /// Could not parse provided bytes to determined response type. - BadResponseFormat(String), + /// Failed to represent provided bytes as [`String`]. + #[display(fmt = "Cannot convert to String: {}", _0)] + BadString(Utf8Error), } impl TryFrom for CoturnCliResponse { type Error = CoturnResponseParseError; fn try_from(mut msg: BytesMut) -> Result { + use CoturnResponseParseError::*; + // delete cursor if message ends with it if msg.ends_with(CURSOR.as_bytes()) { msg.truncate(msg.len() - CURSOR.as_bytes().len()); } - let msg = - from_utf8(&msg).map_err(CoturnResponseParseError::BadString)?; + let msg = from_utf8(&msg)?; if msg.is_empty() { return Ok(CoturnCliResponse::Ready); @@ -94,86 +124,79 @@ impl TryFrom for CoturnCliResponse { } if IS_SESSIONS_REGEX.is_match(msg) { - let mut session_ids: Vec = Vec::new(); + let mut ids: Vec = Vec::new(); for mat in EXTRACT_SESSIONS_REGEX.captures_iter(msg) { if let Some(id) = mat.get(1) { - session_ids.push(id.as_str().to_owned()); + ids.push(id.as_str().to_owned()); } else { - return Err(CoturnResponseParseError::BadResponseFormat( - msg.to_owned(), - )); + return Err(BadResponseFormat(msg.to_owned())); } } - return Ok(CoturnCliResponse::Sessions(session_ids)); + return Ok(CoturnCliResponse::Sessions(ids)); } - Err(CoturnResponseParseError::CannotDetermineResponseType( - msg.to_owned(), - )) + Err(BadResponseType(msg.to_owned())) } } -/// Messages that can be sent to Coturn telnet client. -#[derive(Debug)] +/// Messages that can be sent to [Coturn] server via [Telnet]. +/// +/// [Coturn]: https://github.com/coturn/coturn +/// [Telnet]: https://en.wikipedia.org/wiki/Telnet +#[derive(Clone, Debug, Eq, PartialEq)] pub enum CoturnCliRequest { - /// Request to authenticate. Contains password. Should be sent when + /// Authentication request. Contains password. Should be sent when /// [`CoturnCliResponse::EnterPassword`] is received. Auth(Bytes), - /// Get Coturn session ids by username. + /// Request to retrieve [Coturn] session IDs by username. + /// + /// [Coturn]: https://github.com/coturn/coturn PrintSessions(String), - /// Close Coturn session by its id. + /// Close [Coturn] session by its ID. + /// + /// [Coturn]: https://github.com/coturn/coturn CloseSession(String), - /// Ping + /// Ping request. Ping, } -impl Into for CoturnCliRequest { - fn into(self) -> Bytes { - match self { - CoturnCliRequest::Auth(pass) => pass, - CoturnCliRequest::PrintSessions(username) => { - format!("ps {}", username).into() - } - CoturnCliRequest::CloseSession(session_id) => { - format!("cs {}", session_id).into() - } - CoturnCliRequest::Ping => "ping".into(), +impl From for Bytes { + fn from(req: CoturnCliRequest) -> Self { + use CoturnCliRequest::*; + match req { + Auth(pass) => pass, + PrintSessions(username) => format!("ps {}", username).into(), + CloseSession(session_id) => format!("cs {}", session_id).into(), + Ping => "ping".into(), } } } -/// Errors that can happen while decoding bytes received to +/// Errors that can happen while decoding bytes received as /// [`CoturnCliResponse`]. -#[derive(Debug)] +#[derive(Debug, Display, From)] // TODO: derive(Error) with derive_more pub enum CoturnCliCodecError { - /// Errors that can happen while preforming I/O operations. - IoError(io::Error), - - /// Errors that can happen when parsing message received from Coturn via - /// telnet connection. - CannotParseResponse(CoturnResponseParseError), -} - -impl From for CoturnCliCodecError { - fn from(err: io::Error) -> Self { - CoturnCliCodecError::IoError(err) - } -} - -impl From for CoturnCliCodecError { - fn from(err: CoturnResponseParseError) -> Self { - CoturnCliCodecError::CannotParseResponse(err) - } + /// Failed to perform I/O operation. + #[display(fmt = "I/O operation failed: {}", _0)] + IoFailed(io::Error), + + /// Failed to parse received response from [Coturn]. + /// + /// [Coturn]: https://github.com/coturn/coturn + #[display(fmt = "Cannot parse response: {}", _0)] + BadResponse(CoturnResponseParseError), } -/// Adapter that encodes requests and decodes responses received from or sent to -/// [Coturn] server telnet interface. +/// Adapter for encoding [`CoturnCliRequest`]s and decoding +/// [`CoturnCliResponse`]s received from or sent to +/// [Coturn] server via [Telnet] interface. /// /// [Coturn]: https://github.com/coturn/coturn -#[derive(Copy, Clone, Default, Debug)] +/// [Telnet]: https://en.wikipedia.org/wiki/Telnet +#[derive(Clone, Copy, Debug, Default)] pub struct CoturnCliCodec; impl Decoder for CoturnCliCodec { @@ -213,32 +236,38 @@ impl Encoder for CoturnCliCodec { } #[cfg(test)] -mod test { - - use bytes::BytesMut; - +mod spec { use super::*; #[tokio::test] - async fn parse_greeting() { + async fn parses_greeting() { let mut codec = CoturnCliCodec::default(); - let mut greeting: BytesMut = "TURN Server\r\nCoturn-4.5.1.1 'dan \ - Eider'\r\n\r\nType '?' for \ - help\r\nEnter password: \r\n" + #[rustfmt::skip] + let mut greeting = "\ + TURN Server\r\n\ + Coturn-4.5.1.1 'dan Eider'\r\n\ + \r\n\ + Type '?' for help\r\n\ + Enter password: \r\n" .into(); - assert_eq!( - codec.decode(&mut greeting).unwrap().unwrap(), - CoturnCliResponse::EnterPassword - ); + let decoded = codec + .decode(&mut greeting) + .expect("Failed to decode") + .unwrap(); + assert_eq!(decoded, CoturnCliResponse::EnterPassword); } #[tokio::test] - async fn parse_empty_sessions() { + async fn parses_empty_sessions() { let mut codec = CoturnCliCodec::default(); let mut greeting = "\r\n Total sessions: 0\r\n\r\n> ".into(); - match codec.decode(&mut greeting).unwrap().unwrap() { + match codec + .decode(&mut greeting) + .expect("Failed to decode") + .unwrap() + { CoturnCliResponse::Sessions(sessions) => { assert!(sessions.is_empty()); } @@ -247,9 +276,9 @@ mod test { } #[tokio::test] - async fn parse_sessions() { + async fn parses_sessions() { let mut codec = CoturnCliCodec::default(); - let mut sessions_message = " + let mut message = " 1) id=010000000000000001, user <777_Mireya>: realm: medea started 545 secs ago @@ -308,7 +337,11 @@ mod test { > " .into(); - match codec.decode(&mut sessions_message).unwrap().unwrap() { + match codec + .decode(&mut message) + .expect("Failed to decode") + .unwrap() + { CoturnCliResponse::Sessions(sessions) => { assert_eq!( sessions, @@ -316,8 +349,8 @@ mod test { "010000000000000001", "001000000000000002", "011000000000000002", - "011000000000000003" - ] + "011000000000000003", + ], ); } _ => unreachable!(), diff --git a/proto/control-api/LICENSE.md b/proto/control-api/LICENSE.md new file mode 100644 index 000000000..49c86075f --- /dev/null +++ b/proto/control-api/LICENSE.md @@ -0,0 +1,56 @@ +Blue Oak Model License +====================== + +Version 1.0.0 + +## Purpose + +This license gives everyone as much permission to work with +this software as possible, while protecting contributors +from liability. + +## Acceptance + +In order to receive this license, you must agree to its +rules. The rules of this license are both obligations +under that agreement and conditions to your license. +You must not do anything with this software that triggers +a rule that you cannot or will not follow. + +## Copyright + +Each contributor licenses you to do everything with this +software that would otherwise infringe that contributor's +copyright in it. + +## Notices + +You must ensure that everyone who gets a copy of +any part of this software from you, with or without +changes, also gets the text of this license or a link to +. + +## Excuse + +If anyone notifies you in writing that you have not +complied with [Notices](#notices), you can keep your +license by taking all practical steps to comply within 30 +days after the notice. If you do not do so, your license +ends immediately. + +## Patent + +Each contributor licenses you to do everything with this +software that would otherwise infringe any patent claims +they can license or become able to license. + +## Reliability + +No contributor can revoke this license. + +## No Liability + +***As far as the law allows, this software comes as is, +without any warranty or condition, and no contributor +will be liable to anyone for any damages related to this +software or this license, under any kind of legal claim.*** From 415d748967dda38bf7a5256363dffadc73880065 Mon Sep 17 00:00:00 2001 From: tyranron Date: Wed, 19 Feb 2020 10:40:30 +0200 Subject: [PATCH 19/21] Toolchain corrections --- .travis.yml | 5 +++++ CHANGELOG.md | 7 ++++--- Cargo.lock | 12 ------------ Cargo.toml | 4 ++-- Dockerfile | 6 ++++-- Makefile | 7 ++++--- mock/control-api/Dockerfile | 6 ++++-- 7 files changed, 23 insertions(+), 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index ff989783b..05e64e873 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,6 +79,11 @@ jobs: rust: stable script: make test.unit crate=medea-macro + - name: unit medea-coturn-telnet-client (stable) + stage: test + rust: stable + script: make test.unit crate=medea-coturn-telnet-client + - name: unit medea-client-api-proto (stable) stage: test rust: stable diff --git a/CHANGELOG.md b/CHANGELOG.md index a8022e621..9fbe96245 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,20 +36,21 @@ All user visible changes to this project will be documented in this file. This p - Send reason of closing WebSocket connection as [Close](https://tools.ietf.org/html/rfc4566#section-5.14) frame's description ([#58](/../../pull/58)); - Send `Event::RpcSettingsUpdated` when `Member` connects ([#75]); - Send relay mode in `Event::PeerCreated` which is used for configuring client's `RtcIceTransportPolicy` ([#79](/../../pull/79)). +- [Coturn] integration: + - [Coturn] sessions destroying ([#84]). - Configuration: - `[server.control.grpc]` section to configure Control API gRPC server ([#33]); - - `[turn.cli]` and `[turn.cli.pool]` sections to configure access to [Coturn] admin interface ([#84](/../../pull/84)); + - `[turn.cli]` and `[turn.cli.pool]` sections to configure access to [Coturn] admin interface ([#84]); - `server.client.http.public_url` option to configure public URL of Client API HTTP server ([#33]); - `rpc.ping_interval` option to configure `Ping`s sending interval ([#75]). - Testing: - E2E tests for signalling ([#28]). -- Turn server integration: - - Turn sessions cancellation ([#84](/../../pull/84)). [#28]: /../../pull/28 [#33]: /../../pull/33 [#63]: /../../pull/63 [#75]: /../../pull/75 +[#84]: /../../pull/84 diff --git a/Cargo.lock b/Cargo.lock index 5af3ed4cd..90d3f759b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1442,7 +1442,6 @@ dependencies = [ "once_cell 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-test 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2518,16 +2517,6 @@ dependencies = [ "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "tokio-test" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "tokio-util" version = "0.2.0" @@ -3393,7 +3382,6 @@ dependencies = [ "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8fdd17989496f49cdc57978c96f0c9fe5e4a58a8bddc6813c449a4624f6a030b" "checksum tokio-macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f4b1e7ed7d5d4c2af3d999904b0eebe76544897cdbfb2b9684bed2174ab20f7c" -"checksum tokio-test 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "09cf9705471976fa5fc6817d3fbc9c4ff9696a6647af0e5c1870c81ca7445b05" "checksum tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" "checksum toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" "checksum tonic 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08283643b1d483eb7f3fc77069e63b5cba3e4db93514b3d45470e67f123e4e48" diff --git a/Cargo.toml b/Cargo.toml index d5ba9cb71..37b84064f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,8 +15,8 @@ include = ["/src/", "/Cargo.*", "/CHANGELOG.md", "/LICENSE.md", "/README.md"] [workspace] members = [ - "crates/medea-macro", "crates/medea-coturn-telnet-client", + "crates/medea-macro", "jason", "mock/control-api", "proto/client-api", @@ -33,7 +33,6 @@ actix-web-actors = "2.0" async-trait = "0.1" chrono = "0.4" config = "0.10" -medea-coturn-telnet-client = { path = "crates/medea-coturn-telnet-client" } deadpool = "0.5" deadpool-redis = "0.5" derive_more = "0.99" @@ -43,6 +42,7 @@ futures = { version = "0.3", features = ["compat"] } humantime-serde = "0.1" medea-client-api-proto = { path = "proto/client-api", features = ["medea"] } medea-control-api-proto = { path = "proto/control-api" } +medea-coturn-telnet-client = { path = "crates/medea-coturn-telnet-client" } medea-macro = { path = "crates/medea-macro" } rand = "0.7" redis = "0.15" diff --git a/Dockerfile b/Dockerfile index dff09fed2..8c795fae9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,8 @@ RUN apt-get update \ # Prepare Cargo workspace for building dependencies only. COPY crates/medea-macro/Cargo.toml /app/crates/medea-macro/ -COPY crates/medea-coturn-telnet-client/Cargo.toml /app/crates/medea-coturn-telnet-client/ +COPY crates/medea-coturn-telnet-client/Cargo.toml \ + /app/crates/medea-coturn-telnet-client/ COPY mock/control-api/Cargo.toml /app/mock/control-api/ COPY proto/client-api/Cargo.toml /app/proto/client-api/ COPY proto/control-api/Cargo.toml /app/proto/control-api/ @@ -39,7 +40,8 @@ COPY jason/Cargo.toml /app/jason/ COPY Cargo.toml Cargo.lock /app/ WORKDIR /app/ RUN mkdir -p crates/medea-macro/src/ && touch crates/medea-macro/src/lib.rs \ - && mkdir -p crates/medea-coturn-telnet-client/src/ && touch crates/medea-coturn-telnet-client/src/lib.rs \ + && mkdir -p crates/medea-coturn-telnet-client/src/ \ + && touch crates/medea-coturn-telnet-client/src/lib.rs \ && mkdir -p mock/control-api/src/ && touch mock/control-api/src/lib.rs \ && mkdir -p proto/client-api/src/ && touch proto/client-api/src/lib.rs \ && mkdir -p proto/control-api/src/ && touch proto/control-api/src/lib.rs \ diff --git a/Makefile b/Makefile index 0777287bd..285859b42 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ ifeq ($(crate),medea-macro) crate-dir = crates/medea-macro endif ifeq ($(crate),medea-coturn-telnet-client) -crate-dir = "crates/medea-coturn-telnet-client" +crate-dir = crates/medea-coturn-telnet-client endif @@ -346,10 +346,11 @@ webdriver-env = $(if $(call eq,$(browser),firefox),GECKO,CHROME)DRIVER_REMOTE test.unit: ifeq ($(test-unit-crate),@all) @make test.unit crate=medea-macro + @make test.unit crate=medea-coturn-telnet-client @make test.unit crate=medea-client-api-proto + @make test.unit crate=medea-control-api-proto @make test.unit crate=medea-jason @make test.unit crate=medea - @make test.unit crate=medea-coturn-telnet-client else ifeq ($(test-unit-crate),medea) cargo test --lib --bin medea @@ -368,7 +369,7 @@ else endif else cd $(crate-dir)/ && \ - cargo test -p $(test-unit-crate) + cargo test -p $(test-unit-crate) --all-features endif endif endif diff --git a/mock/control-api/Dockerfile b/mock/control-api/Dockerfile index 1f2dc4c74..77adb6108 100644 --- a/mock/control-api/Dockerfile +++ b/mock/control-api/Dockerfile @@ -26,7 +26,8 @@ RUN apt-get update \ # Prepare Cargo workspace for building dependencies only. COPY crates/medea-macro/Cargo.toml /app/crates/medea-macro/ -COPY crates/medea-coturn-telnet-client/Cargo.toml /app/crates/medea-coturn-telnet-client/ +COPY crates/medea-coturn-telnet-client/Cargo.toml \ + /app/crates/medea-coturn-telnet-client/ COPY mock/control-api/Cargo.toml /app/mock/control-api/ COPY proto/client-api/Cargo.toml /app/proto/client-api/ COPY proto/control-api/Cargo.toml /app/proto/control-api/ @@ -39,7 +40,8 @@ COPY jason/Cargo.toml /app/jason/ COPY Cargo.toml Cargo.lock /app/ WORKDIR /app/ RUN mkdir -p crates/medea-macro/src/ && touch crates/medea-macro/src/lib.rs \ - && mkdir -p crates/medea-coturn-telnet-client/src/ && touch crates/medea-coturn-telnet-client/src/lib.rs \ + && mkdir -p crates/medea-coturn-telnet-client/src/ \ + && touch crates/medea-coturn-telnet-client/src/lib.rs \ && mkdir -p mock/control-api/src/ && touch mock/control-api/src/lib.rs \ && mkdir -p proto/client-api/src/ && touch proto/client-api/src/lib.rs \ && mkdir -p proto/control-api/src/ && touch proto/control-api/src/lib.rs \ From d135a89c4548a1a204edc207ffff04a278f84144 Mon Sep 17 00:00:00 2001 From: tyranron Date: Wed, 19 Feb 2020 14:27:01 +0200 Subject: [PATCH 20/21] Correct config and Helm chart --- Cargo.toml | 4 +- _dev/coturn/turnserver.conf | 2 +- config.toml | 58 ++-- jason/demo/chart/medea-demo/Chart.yaml | 4 +- .../templates/configmap.server.yaml | 18 +- .../templates/deployment.server.yaml | 19 +- .../medea-demo/templates/secret.server.yaml | 4 +- jason/demo/chart/medea-demo/values.yaml | 17 +- jason/demo/minikube.vals.yaml | 1 - jason/demo/staging.vals.yaml | 5 +- src/conf/turn.rs | 291 ++++++++++-------- src/signalling/participants.rs | 2 +- src/turn/cli.rs | 23 +- src/turn/service.rs | 16 +- 14 files changed, 260 insertions(+), 204 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 37b84064f..b1a1e9c19 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,6 @@ futures = { version = "0.3", features = ["compat"] } humantime-serde = "0.1" medea-client-api-proto = { path = "proto/client-api", features = ["medea"] } medea-control-api-proto = { path = "proto/control-api" } -medea-coturn-telnet-client = { path = "crates/medea-coturn-telnet-client" } medea-macro = { path = "crates/medea-macro" } rand = "0.7" redis = "0.15" @@ -60,6 +59,9 @@ tokio = { version = "0.2", features = ["signal", "time"] } tonic = "0.1" toml = "0.5" url = "2.1" +[dependencies.medea-coturn-telnet-client] + path = "crates/medea-coturn-telnet-client" + features = ["pool"] [dependencies.slog] version = "2.5" features = ["release_max_level_trace", "max_level_trace"] diff --git a/_dev/coturn/turnserver.conf b/_dev/coturn/turnserver.conf index 32239a121..28d8dd47d 100644 --- a/_dev/coturn/turnserver.conf +++ b/_dev/coturn/turnserver.conf @@ -5,5 +5,5 @@ no-dtls realm=medea redis-userdb="ip=127.0.0.1 port=6379 dbname=0 password=turn" user=USER:PASS -cli-password=turn cli-port=5766 +cli-password=turn diff --git a/config.toml b/config.toml index ddb5f3d12..1f9ee963a 100644 --- a/config.toml +++ b/config.toml @@ -18,6 +18,7 @@ # Default: # bind_port = 8080 + [server.control.grpc] # IP address to bind Control API gRPC server to. # @@ -69,44 +70,45 @@ [turn] -# Turn server host. +# Host of STUN/TURN server. # # Env var: MEDEA_TURN__HOST # Default: # host = "localhost" -# Turn server port. +# Port of TURN server. # # Env var: MEDEA_TURN__PORT # Default: # port = 3478 -# Static user on Turn server. +# Name of static user to authenticate on TURN server as. # # Env var: MEDEA_TURN__USER # Default: # user = "USER" -# Static user password on Turn server. +# Password of static user to authenticate on TURN server with. # # Env var: MEDEA_TURN__PASS # Default: # pass = "PASS" + [turn.db.redis] -# Host of Coturn's Redis database. +# Host of Coturn's Redis database server. # # Env var: MEDEA_TURN__DB__REDIS__HOST # Default: # host = "127.0.0.1" -# Port of Coturn's Redis database for client connections. +# Port of Coturn's Redis database server for client connections. # # Env var: MEDEA_TURN__DB__REDIS__PORT # Default: # port = 6379 -# Password to connect to Coturn's Redis database with. +# Password to authenticate on Coturn's Redis database server with. # # Env var: MEDEA_TURN__DB__REDIS__PASS # Default: @@ -120,56 +122,60 @@ # Timeout for establishing connection with Coturn's Redis database. # -# Env var: MEDEA_TURN__DB__REDIS__CONNECTION_TIMEOUT +# Env var: MEDEA_TURN__DB__REDIS__CONNECT_TIMEOUT # Default: -# connection_timeout = "5s" +# connect_timeout = "5s" + [turn.cli] -# Coturn server host. +# Host of Coturn's admin interface. # -# Env var: MEDEA_TURN__CLI__IP +# Env var: MEDEA_TURN__CLI__HOST # Default: # host = "127.0.0.1" -# Port of Coturn's Redis database for client connections. +# Port of Coturn's admin interface for Telnet connections. # # Env var: MEDEA_TURN__CLI__PORT # Default: # port = 5766 -# Port of Coturn's Redis database for client connections. +# Password to authenticate on Coturn's admin interface with. # # Env var: MEDEA_TURN__CLI__PASS # Default: # pass = "turn" [turn.cli.pool] -# Maximum connection pool size. +# Maximum pool size of connections to Coturn's admin interface. # # Env var: MEDEA_TURN__CLI__POOL__MAX_SIZE # Default: # max_size = 16 -# Timeout when waiting for an available connection. 0 means no timeout and is -# not recommended. +# Waiting timeout for an available connection with Coturn's admin interface. # -# Env var: MEDEA_TURN__CLI__POOL__WAIT +# "0" means no timeout and is not recommended. +# +# Env var: MEDEA_TURN__CLI__POOL__WAIT_TIMEOUT # Default: -# wait = "5s" +# wait_timeout = "2s" -# Timeout when creating a new connection. 0 means no timeout and is not -# recommended. +# Timeout for establishing connection with Coturn's admin interface. +# +# "0" means no timeout and is not recommended. # -# Env var: MEDEA_TURN__CLI__POOL__CREATE +# Env var: MEDEA_TURN__CLI__POOL__CONNECT_TIMEOUT # Default: -# create = "5s" +# connect_timeout = "2s" -# Timeout when recycling connection. 0 means no timeout and is not -# recommended. +# Timeout for recycling established connection with Coturn's admin interface. +# +# "0" means no timeout and is not recommended. # -# Env var: MEDEA_TURN__CLI__POOL__RECYCLE +# Env var: MEDEA_TURN__CLI__POOL__RECYCLE_TIMEOUT # Default: -# recycle = "5s" +# recycle_timeout = "2s" diff --git a/jason/demo/chart/medea-demo/Chart.yaml b/jason/demo/chart/medea-demo/Chart.yaml index a8709dbe7..72675f0c2 100644 --- a/jason/demo/chart/medea-demo/Chart.yaml +++ b/jason/demo/chart/medea-demo/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 name: medea-demo -version: 0.3.3 -appVersion: 0.1.0 +version: 0.4.0 +appVersion: 0.2.0-dev type: application diff --git a/jason/demo/chart/medea-demo/templates/configmap.server.yaml b/jason/demo/chart/medea-demo/templates/configmap.server.yaml index 8fde5d316..2715023eb 100644 --- a/jason/demo/chart/medea-demo/templates/configmap.server.yaml +++ b/jason/demo/chart/medea-demo/templates/configmap.server.yaml @@ -15,8 +15,19 @@ metadata: data: medea.toml: | {{- $medeaConf := .Values.server.conf | toJson | fromJson }} - {{- $_ := unset $medeaConf.turn "pass" }} - {{- $_ := unset $medeaConf.turn.db.redis "pass" }} + {{- if $medeaConf.turn }} + {{- $_ := unset $medeaConf.turn "pass" }} + {{- if $medeaConf.turn.db }} + {{- if $medeaConf.turn.db.redis }} + {{- $_ := unset $medeaConf.turn.db.redis "host" }} + {{- $_ := unset $medeaConf.turn.db.redis "pass" }} + {{- end }} + {{- end }} + {{- if $medeaConf.turn.cli }} + {{- $_ := unset $medeaConf.turn.cli "host" }} + {{- $_ := unset $medeaConf.turn.cli "pass" }} + {{- end }} + {{- end }} {{- toToml $medeaConf | nindent 4 }} turnserver.conf: | @@ -26,7 +37,8 @@ data: no-tls no-dtls realm=medea - listening-port={{ $coturnConf.listening_port | int }} + listening-port={{ index $coturnConf "listening-port" | int }} + cli-port={{ index $coturnConf "cli-port" | int }} redis.conf: | {{- $redisConf := index .Values "server" "coturn-db" "conf" | toJson | fromJson }} diff --git a/jason/demo/chart/medea-demo/templates/deployment.server.yaml b/jason/demo/chart/medea-demo/templates/deployment.server.yaml index 19f8071da..5dd0b6948 100644 --- a/jason/demo/chart/medea-demo/templates/deployment.server.yaml +++ b/jason/demo/chart/medea-demo/templates/deployment.server.yaml @@ -50,8 +50,8 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} containers: - {{- $coturnDb := index .Values "server" "coturn-db" }} {{- $coturn := .Values.server.coturn }} + {{- $coturnDb := index .Values "server" "coturn-db" }} - name: medea image: {{ printf "%s:%s" .Values.server.image.repository .Values.server.image.tag | quote }} imagePullPolicy: {{ .Values.server.image.pullPolicy | quote }} @@ -59,11 +59,11 @@ spec: - name: MEDEA_CONF value: /etc/medea.toml - name: MEDEA_TURN__PORT - value: {{ $coturn.conf.listening_port | quote }} + value: {{ index $coturn "conf" "listening-port" | quote }} - name: MEDEA_TURN__DB__REDIS__PORT value: {{ $coturnDb.conf.port | quote }} - name: MEDEA_TURN__CLI__PORT - value: {{ $coturn.conf.cli_port | quote }} + value: {{ index $coturn "conf" "cli-port" | quote }} envFrom: - secretRef: name: {{ printf "%s.server.cred" (include "medea-demo.fullname" .) | quote }} @@ -115,15 +115,14 @@ spec: - --relay-ip=$(EXTERNAL_IP) - --redis-userdb=ip=127.0.0.1 port={{ $coturnDb.conf.port | int }} dbname={{ .Values.server.conf.turn.db.redis.db_number }} password=$(MEDEA_TURN__DB__REDIS__PASS) - --user={{ .Values.server.conf.turn.user }}:$(MEDEA_TURN__PASS) - - --cli-port={{ $coturn.conf.cli_port | int }} - --cli-password=$(MEDEA_TURN__CLI__PASS) {{- with $coturn.extraArgs }} {{- toYaml . | nindent 12 }} {{- end }} env: - name: EXTERNAL_IP - {{- if $coturn.conf.external_ip }} - value: {{ $coturn.conf.external_ip | quote }} + {{- if index $coturn "conf" "external-ip" }} + value: {{ index $coturn "conf" "external-ip" | quote }} {{- else }} valueFrom: fieldRef: @@ -146,10 +145,10 @@ spec: key: MEDEA_TURN__CLI__PASS ports: - name: turn - containerPort: {{ $coturn.conf.listening_port | int }} + containerPort: {{ index $coturn "conf" "listening-port" | int }} protocol: TCP - name: turn-udp - containerPort: {{ $coturn.conf.listening_port | int }} + containerPort: {{ index $coturn "conf" "listening-port" | int }} protocol: UDP volumeMounts: - name: conf @@ -163,11 +162,11 @@ spec: {{- end }} livenessProbe: tcpSocket: - port: {{ $coturn.conf.listening_port | int }} + port: {{ index $coturn "conf" "listening-port" | int }} initialDelaySeconds: 3 readinessProbe: tcpSocket: - port: {{ $coturn.conf.listening_port | int }} + port: {{ index $coturn "conf" "listening-port" | int }} initialDelaySeconds: 5 - name: coturn-db image: {{ printf "%s:%s" $coturnDb.image.repository $coturnDb.image.tag | quote }} diff --git a/jason/demo/chart/medea-demo/templates/secret.server.yaml b/jason/demo/chart/medea-demo/templates/secret.server.yaml index 7c62182b7..31795b479 100644 --- a/jason/demo/chart/medea-demo/templates/secret.server.yaml +++ b/jason/demo/chart/medea-demo/templates/secret.server.yaml @@ -15,8 +15,8 @@ metadata: type: Opaque data: {{- $medeaConf := .Values.server.conf }} + {{- $coturnConf := .Values.server.coturn.conf }} {{- $coturnDbConf := index .Values "server" "coturn-db" "conf" }} - {{- $coturnConf := index .Values "server" "coturn" "conf" }} MEDEA_TURN__PASS: {{ $medeaConf.turn.pass | b64enc | quote }} MEDEA_TURN__DB__REDIS__PASS: {{ $coturnDbConf.requirepass | b64enc | quote }} - MEDEA_TURN__CLI__PASS: {{ $coturnConf.cli_pass | b64enc | quote }} + MEDEA_TURN__CLI__PASS: {{ index $coturnConf "cli-password" | b64enc | quote }} diff --git a/jason/demo/chart/medea-demo/values.yaml b/jason/demo/chart/medea-demo/values.yaml index f0df97521..bfeeb3c51 100644 --- a/jason/demo/chart/medea-demo/values.yaml +++ b/jason/demo/chart/medea-demo/values.yaml @@ -6,7 +6,7 @@ labels: {} server: image: repository: instrumentisto/medea - tag: latest + tag: edge pullPolicy: IfNotPresent # Medea media server configuration: @@ -29,8 +29,6 @@ server: db: redis: db_number: 0 - cli: - port: 5766 deployment: revisionHistoryLimit: 0 @@ -66,7 +64,7 @@ server: control-mock: image: repository: instrumentisto/medea-control-api-mock - tag: latest + tag: edge pullPolicy: IfNotPresent # Medea's Control API mock server configuration. @@ -83,12 +81,13 @@ server: # Coturn TURN server configuration. conf: - listening_port: 3478 - cli_port: 5766 - cli_pass: turn - # IP adress to be used by Coturn as `external-ip`. + listening-port: 3478 + # Admin interface (CLI management) configuration. + cli-port: 5766 + cli-password: turn + # IP address to be used by Coturn as external. # If empty then `status.hostIP` of Pod will be used. - external_ip: "" + external-ip: "" extraArgs: [] # - --verbose diff --git a/jason/demo/minikube.vals.yaml b/jason/demo/minikube.vals.yaml index c7646b40b..44c7b906e 100644 --- a/jason/demo/minikube.vals.yaml +++ b/jason/demo/minikube.vals.yaml @@ -12,7 +12,6 @@ server: client: http: public_url: wss://medea-demo.test/ws - turn: host: medea-demo.test diff --git a/jason/demo/staging.vals.yaml b/jason/demo/staging.vals.yaml index 50cac4f7e..34d6fe43d 100644 --- a/jason/demo/staging.vals.yaml +++ b/jason/demo/staging.vals.yaml @@ -29,9 +29,8 @@ server: tag: "4.5" pullPolicy: Always conf: - listening_port: 9934 - cli_port: 5766 - cli_pass: changeme + listening-port: 9934 + cli-password: changeme coturn-db: image: diff --git a/src/conf/turn.rs b/src/conf/turn.rs index 0b6447a48..808874426 100644 --- a/src/conf/turn.rs +++ b/src/conf/turn.rs @@ -1,14 +1,7 @@ //! STUN/TURN server settings. -use std::{ - borrow::Cow, - net::{IpAddr, Ipv4Addr}, - time::Duration, -}; - -use deadpool::managed::{ - PoolConfig as DeadpoolPoolConfig, Timeouts as DeadpoolTimeouts, -}; +use std::{borrow::Cow, time::Duration}; + use serde::{Deserialize, Serialize}; use smart_default::SmartDefault; @@ -16,22 +9,35 @@ use smart_default::SmartDefault; #[derive(Clone, Debug, Deserialize, Serialize, SmartDefault)] #[serde(default)] pub struct Turn { - /// Database settings - pub db: Db, - /// Coturn telnet connection settings. - pub cli: CoturnCli, - /// Host of STUN/TURN server. Defaults to `localhost`. + /// Host of STUN/TURN server. + /// + /// Defaults to `localhost`. #[default = "localhost"] pub host: Cow<'static, str>, - /// Port to connect TURN server. Defaults to `3478`. + + /// Port of TURN server. + /// + /// Defaults to `3478`. #[default = 3478] pub port: u16, - /// Username for authorize on TURN server. - #[default(String::from("USER"))] - pub user: String, - /// Password for authorize on TURN server. - #[default(String::from("PASS"))] - pub pass: String, + + /// Name of static user to authenticate on TURN server as. + /// + /// Defaults to `USER`. + #[default = "USER"] + pub user: Cow<'static, str>, + + /// Password of static user to authenticate on TURN server with. + /// + /// Defaults to `PASS`. + #[default = "PASS"] + pub pass: Cow<'static, str>, + + /// Database settings + pub db: Db, + + /// Admin interface settings. + pub cli: CoturnCli, } impl Turn { @@ -45,108 +51,134 @@ impl Turn { #[derive(Clone, Debug, Deserialize, Serialize, SmartDefault)] #[serde(default)] pub struct Db { - /// Redis server settings. + /// [Redis] database settings. + /// + /// [Redis]: https://redis.io pub redis: Redis, } -/// Setting of [Redis] server which used by [coturn]. +/// Setting of [Redis] database server which backs [Coturn] storage. /// -/// [Redis]: https://redis.io/ -/// [coturn]: https://github.com/coturn/coturn +/// [Coturn]: https://github.com/coturn/coturn +/// [Redis]: https://redis.io #[derive(Clone, Debug, Deserialize, Serialize, SmartDefault)] #[serde(default)] pub struct Redis { - /// IP address Redis server. Defaults to `127.0.0.1`. - #[default(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)))] - pub ip: IpAddr, - /// Port to connect Redis server. Defaults to `6379`. + /// Host of Redis database server. + /// + /// Defaults to `127.0.0.1`. + #[default = "127.0.0.1"] + pub host: Cow<'static, str>, + + /// Port of Redis database server for client connections. + /// + /// Defaults to `6379`. #[default = 6379] pub port: u16, - /// Password for authorize on Redis server. - #[default(String::from("turn"))] - pub pass: String, - /// The database number to use. This is usually 0. + + /// Password to authenticate on Redis database server with. + /// + /// Defaults to `turn`. + #[default = "turn"] + pub pass: Cow<'static, str>, + + /// The Redis database number to use. This is usually `0`. + /// + /// Defaults to `0`. #[default = 0] pub db_number: i64, + // TODO: replace with PoolConfig - /// The duration to wait to start a connection before returning err. + /// Timeout for establishing connection with Redis database server. #[default(Duration::from_secs(5))] #[serde(with = "humantime_serde")] - pub connection_timeout: Duration, + pub connect_timeout: Duration, } -/// Settings of [Coturn] server telnet interface. +/// Settings of [Coturn]'s admin interface. /// /// [Coturn]: https://github.com/coturn/coturn #[derive(Clone, Debug, Deserialize, Serialize, SmartDefault)] #[serde(default)] pub struct CoturnCli { - /// Coturn server cli IP address. Defaults to `127.0.0.1`. - #[default(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)))] - pub ip: IpAddr, - /// Coturn server cli port. Defaults to `5766`. + /// Host of admin interface. + /// + /// Defaults to `127.0.0.1`. + #[default = "127.0.0.1"] + pub host: Cow<'static, str>, + + /// Port of interface for [Telnet] connections. + /// + /// Defaults to `5766`. + /// + /// [Telnet]: https://en.wikipedia.org/wiki/Telnet #[default = 5766] pub port: u16, - /// Password for authorize on Coturn server telnet interface. - #[default(String::from("turn"))] - pub pass: String, - /// Connection pool config. + + /// Password to authenticate on admin interface with. + /// + /// Defaults to `turn`. + #[default = "turn"] + pub pass: Cow<'static, str>, + + /// Settings for pool of connections with admin interface. pub pool: PoolConfig, } -/// [Deadpool] connection pool config. +/// Settings for pool of connections with [Coturn]'s admin interface. /// -/// [Deadpool]: https://crates.io/crates/deadpool -#[derive(Copy, Clone, Debug, Deserialize, Serialize, SmartDefault)] +/// [Coturn]: https://github.com/coturn/coturn +#[derive(Clone, Copy, Debug, Deserialize, Serialize, SmartDefault)] #[serde(default)] pub struct PoolConfig { - /// Maximum size of the pool + /// Maximum size of the pool. + /// + /// Defaults to `16`. #[default = 16] pub max_size: usize, - /// Timeout when waiting for available connection to become available. - #[default(Some(Duration::from_secs(5)))] + + /// Waiting timeout for an available connection in the pool. + /// + /// Defaults to `2s`. + #[default(Duration::from_secs(2))] #[serde(with = "humantime_serde")] - pub wait: Option, - /// Timeout when creating a new connection. - #[default(Some(Duration::from_secs(5)))] + pub wait_timeout: Duration, + + /// Timeout for establishing connection. + /// + /// Defaults to `2s`. + #[default(Duration::from_secs(2))] #[serde(with = "humantime_serde")] - pub create: Option, - /// Timeout when recycling connection. - #[default(Some(Duration::from_secs(5)))] + pub connect_timeout: Duration, + + /// Timeout for recycling established connection. + /// + /// Defaults to `2s`. + #[default(Duration::from_secs(2))] #[serde(with = "humantime_serde")] - pub recycle: Option, + pub recycle_timeout: Duration, } -impl Into for PoolConfig { - fn into(self) -> DeadpoolPoolConfig { - let wait = self.wait.and_then(|wait| { - if wait.as_nanos() == 0 { - None - } else { - Some(wait) - } - }); - let create = self.create.and_then(|create| { - if create.as_nanos() == 0 { - None - } else { - Some(create) - } - }); - let recycle = self.recycle.and_then(|recycle| { - if recycle.as_nanos() == 0 { - None - } else { - Some(recycle) - } - }); - - DeadpoolPoolConfig { - max_size: self.max_size, - timeouts: DeadpoolTimeouts { - wait, - create, - recycle, +impl From for deadpool::managed::PoolConfig { + fn from(cfg: PoolConfig) -> Self { + Self { + max_size: cfg.max_size, + timeouts: deadpool::managed::Timeouts { + wait: if cfg.wait_timeout.as_nanos() == 0 { + None + } else { + Some(cfg.wait_timeout) + }, + create: if cfg.connect_timeout.as_nanos() == 0 { + None + } else { + Some(cfg.connect_timeout) + }, + recycle: if cfg.recycle_timeout.as_nanos() == 0 { + None + } else { + Some(cfg.recycle_timeout) + }, }, } } @@ -154,8 +186,6 @@ impl Into for PoolConfig { #[cfg(test)] mod spec { - use std::{net::Ipv4Addr, time::Duration}; - use serial_test_derive::serial; use crate::{conf::Conf, overrided_by_env_conf}; @@ -167,36 +197,39 @@ mod spec { fn redis_db_overrides_defaults() { let default_conf = Conf::default(); let env_conf = overrided_by_env_conf!( - "MEDEA_TURN__DB__REDIS__IP" => "5.5.5.5", + "MEDEA_TURN__DB__REDIS__HOST" => "5.5.5.5", "MEDEA_TURN__DB__REDIS__PORT" => "1234", "MEDEA_TURN__DB__REDIS__PASS" => "hellofellow", "MEDEA_TURN__DB__REDIS__DB_NUMBER" => "10", - "MEDEA_TURN__DB__REDIS__CONNECTION_TIMEOUT" => "10s", + "MEDEA_TURN__DB__REDIS__CONNECT_TIMEOUT" => "10s", ); - assert_ne!(default_conf.turn.db.redis.ip, env_conf.turn.db.redis.ip); + assert_ne!( + default_conf.turn.db.redis.host, + env_conf.turn.db.redis.host, + ); assert_ne!( default_conf.turn.db.redis.port, - env_conf.turn.db.redis.port + env_conf.turn.db.redis.port, ); assert_ne!( default_conf.turn.db.redis.pass, - env_conf.turn.db.redis.pass + env_conf.turn.db.redis.pass, ); assert_ne!( default_conf.turn.db.redis.db_number, - env_conf.turn.db.redis.db_number + env_conf.turn.db.redis.db_number, ); assert_ne!( - default_conf.turn.db.redis.connection_timeout, - env_conf.turn.db.redis.connection_timeout + default_conf.turn.db.redis.connect_timeout, + env_conf.turn.db.redis.connect_timeout, ); - assert_eq!(env_conf.turn.db.redis.ip, Ipv4Addr::new(5, 5, 5, 5)); + assert_eq!(env_conf.turn.db.redis.host, "5.5.5.5"); assert_eq!(env_conf.turn.db.redis.port, 1234); assert_eq!( - env_conf.turn.db.redis.connection_timeout, - Duration::from_secs(10) + env_conf.turn.db.redis.connect_timeout, + Duration::from_secs(10), ); } @@ -226,16 +259,16 @@ mod spec { fn coturn_cli() { let default_conf = Conf::default(); let env_conf = overrided_by_env_conf!( - "MEDEA_TURN__CLI__IP" => "4.4.4.4", + "MEDEA_TURN__CLI__HOST" => "4.4.4.4", "MEDEA_TURN__CLI__PORT" => "1234", "MEDEA_TURN__CLI__PASS" => "clipass", ); - assert_ne!(default_conf.turn.cli.ip, env_conf.turn.cli.ip); + assert_ne!(default_conf.turn.cli.host, env_conf.turn.cli.host); assert_ne!(default_conf.turn.cli.port, env_conf.turn.cli.port); assert_ne!(default_conf.turn.cli.pass, env_conf.turn.cli.pass); - assert_eq!(env_conf.turn.cli.ip, Ipv4Addr::new(4, 4, 4, 4)); + assert_eq!(env_conf.turn.cli.host, "4.4.4.4"); assert_eq!(env_conf.turn.cli.port, 1234); assert_eq!(env_conf.turn.cli.pass, "clipass"); } @@ -246,51 +279,53 @@ mod spec { let default_conf = Conf::default(); let env_conf = overrided_by_env_conf!( "MEDEA_TURN__CLI__POOL__MAX_SIZE" => "10", - "MEDEA_TURN__CLI__POOL__WAIT" => "1s", - "MEDEA_TURN__CLI__POOL__CREATE" => "2s", - "MEDEA_TURN__CLI__POOL__RECYCLE" => "3s", + "MEDEA_TURN__CLI__POOL__WAIT_TIMEOUT" => "1s", + "MEDEA_TURN__CLI__POOL__CONNECT_TIMEOUT" => "4s", + "MEDEA_TURN__CLI__POOL__RECYCLE_TIMEOUT" => "3s", ); assert_ne!( default_conf.turn.cli.pool.max_size, - env_conf.turn.cli.pool.max_size + env_conf.turn.cli.pool.max_size, ); assert_ne!( - default_conf.turn.cli.pool.wait, - env_conf.turn.cli.pool.wait + default_conf.turn.cli.pool.wait_timeout, + env_conf.turn.cli.pool.wait_timeout, ); assert_ne!( - default_conf.turn.cli.pool.create, - env_conf.turn.cli.pool.create + default_conf.turn.cli.pool.connect_timeout, + env_conf.turn.cli.pool.connect_timeout, ); assert_ne!( - default_conf.turn.cli.pool.recycle, - env_conf.turn.cli.pool.recycle + default_conf.turn.cli.pool.recycle_timeout, + env_conf.turn.cli.pool.recycle_timeout, ); assert_eq!(env_conf.turn.cli.pool.max_size, 10); - assert_eq!(env_conf.turn.cli.pool.wait, Some(Duration::from_secs(1))); - assert_eq!(env_conf.turn.cli.pool.create, Some(Duration::from_secs(2))); + assert_eq!(env_conf.turn.cli.pool.wait_timeout, Duration::from_secs(1)); + assert_eq!( + env_conf.turn.cli.pool.connect_timeout, + Duration::from_secs(4), + ); assert_eq!( - env_conf.turn.cli.pool.recycle, - Some(Duration::from_secs(3)) + env_conf.turn.cli.pool.recycle_timeout, + Duration::from_secs(3), ); } #[test] - fn into_pool_config() { - let pool_config = PoolConfig { + fn into_deadpool_pool_config() { + let pool_cfg = PoolConfig { max_size: 6, - wait: None, - create: Some(Duration::from_secs(0)), - recycle: Some(Duration::from_secs(2)), + wait_timeout: Duration::default(), + connect_timeout: Duration::from_secs(0), + recycle_timeout: Duration::from_secs(3), }; + let pool_cfg: deadpool::managed::PoolConfig = pool_cfg.into(); - let pool_config: DeadpoolPoolConfig = pool_config.into(); - - assert_eq!(pool_config.max_size, 6); - assert!(pool_config.timeouts.wait.is_none()); - assert!(pool_config.timeouts.create.is_none()); - assert_eq!(pool_config.timeouts.recycle, Some(Duration::from_secs(2))); + assert_eq!(pool_cfg.max_size, 6); + assert!(pool_cfg.timeouts.wait.is_none()); + assert!(pool_cfg.timeouts.create.is_none()); + assert_eq!(pool_cfg.timeouts.recycle, Some(Duration::from_secs(3))); } } diff --git a/src/signalling/participants.rs b/src/signalling/participants.rs index 1008afa6b..abe2f8932 100644 --- a/src/signalling/participants.rs +++ b/src/signalling/participants.rs @@ -100,7 +100,7 @@ pub struct ParticipantService { connections: HashMap>, /// Stores [`RpcConnection`] drop tasks. - /// If [`RpcConnection`] is lost, [`Room`] waits for connection_timeout + /// If [`RpcConnection`] is lost, [`Room`] waits for `connect_timeout` /// before dropping it irrevocably in case it gets reestablished. drop_connection_tasks: HashMap, diff --git a/src/turn/cli.rs b/src/turn/cli.rs index 1faa2ebd8..c29db74b7 100644 --- a/src/turn/cli.rs +++ b/src/turn/cli.rs @@ -1,9 +1,12 @@ -use std::{fmt, ops::DerefMut}; +use std::fmt; use deadpool::managed::PoolConfig; use derive_more::{Display, From}; use failure::Fail; -use medea_coturn_telnet_client::{CoturnTelnetError, Manager, Pool, PoolError}; +use medea_coturn_telnet_client::{ + pool::{Manager as PoolManager, Pool, PoolError}, + CoturnTelnetError, +}; use crate::media::IceUser; @@ -11,6 +14,7 @@ use crate::media::IceUser; pub enum CoturnCliError { #[display(fmt = "Couldn't get connection from pool: {}", _0)] PoolError(PoolError), + #[display(fmt = "Coturn telnet connection returned error: {}", _0)] CliError(CoturnTelnetError), } @@ -30,7 +34,10 @@ impl CoturnTelnetClient { pass: String, pool_config: PoolConfig, ) -> Self { - Self(Pool::from_config(Manager::new(addr, pass), pool_config)) + Self(Pool::from_config( + PoolManager::new(addr.0, addr.1, pass), + pool_config, + )) } /// Forcefully closes provided [`IceUser`]s sessions on Coturn server. @@ -38,13 +45,11 @@ impl CoturnTelnetClient { &self, users: &[&IceUser], ) -> Result<(), CoturnCliError> { - let mut connection = self.0.get().await?; + let mut conn = self.0.get().await?; for user in users { - let sessions = connection - .deref_mut() - .print_sessions(user.user().clone().into()) - .await?; - connection.deref_mut().delete_sessions(sessions).await?; + let sessions = + conn.print_sessions(user.user().clone().into()).await?; + conn.delete_sessions(sessions).await?; } Ok(()) diff --git a/src/turn/service.rs b/src/turn/service.rs index 168f5626b..aba990b13 100644 --- a/src/turn/service.rs +++ b/src/turn/service.rs @@ -156,34 +156,34 @@ pub fn new_turn_auth_service<'a>( cf: &conf::Turn, ) -> Result, TurnServiceErr> { let turn_db = TurnDatabase::new( - cf.db.redis.connection_timeout, + cf.db.redis.connect_timeout, ConnectionInfo { addr: Box::new(redis::ConnectionAddr::Tcp( - cf.db.redis.ip.to_string(), + cf.db.redis.host.to_string(), cf.db.redis.port, )), db: cf.db.redis.db_number, passwd: if cf.db.redis.pass.is_empty() { None } else { - Some(cf.db.redis.pass.clone()) + Some(cf.db.redis.pass.to_string()) }, }, )?; let coturn_cli = CoturnTelnetClient::new( - (cf.cli.ip.to_string(), cf.cli.port), - cf.cli.pass.clone(), + (cf.cli.host.to_string(), cf.cli.port), + cf.cli.pass.to_string(), cf.cli.pool.into(), ); let turn_service = Service { turn_db, coturn_cli, - db_pass: cf.db.redis.pass.clone(), + db_pass: cf.db.redis.pass.to_string(), turn_address: cf.addr(), - turn_username: cf.user.clone(), - turn_password: cf.pass.clone(), + turn_username: cf.user.to_string(), + turn_password: cf.pass.to_string(), }; Ok(Arc::new(turn_service)) From 0980016794dd9ba8cba39348abbb255c502e6457 Mon Sep 17 00:00:00 2001 From: tyranron Date: Wed, 19 Feb 2020 14:54:20 +0200 Subject: [PATCH 21/21] Final corrections --- Cargo.lock | 1 + Cargo.toml | 1 + crates/medea-coturn-telnet-client/src/pool.rs | 2 +- .../medea-coturn-telnet-client/src/proto.rs | 2 +- src/media/ice_user.rs | 11 ++++-- src/turn/cli.rs | 37 ++++++++++++------- src/turn/service.rs | 18 +++++---- 7 files changed, 47 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 90d3f759b..f4e358953 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1350,6 +1350,7 @@ dependencies = [ "actix-web-actors 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "async-trait 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "awc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "config 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "deadpool 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index b1a1e9c19..4b1beb426 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ actix = "0.9" actix-web = "2.0" actix-web-actors = "2.0" async-trait = "0.1" +bytes = "0.5" chrono = "0.4" config = "0.10" deadpool = "0.5" diff --git a/crates/medea-coturn-telnet-client/src/pool.rs b/crates/medea-coturn-telnet-client/src/pool.rs index 4d0bcce4f..e1f08b8a4 100644 --- a/crates/medea-coturn-telnet-client/src/pool.rs +++ b/crates/medea-coturn-telnet-client/src/pool.rs @@ -37,7 +37,7 @@ pub type Pool = managed::Pool; /// Type alias for using [`deadpool::managed::PoolError`] with /// [`CoturnTelnetConnection`]. -pub type PoolError = managed::PoolError; +pub type Error = managed::PoolError; /// Type alias for using [`deadpool::managed::Object`] with /// [`CoturnTelnetConnection`]. diff --git a/crates/medea-coturn-telnet-client/src/proto.rs b/crates/medea-coturn-telnet-client/src/proto.rs index 731e4a265..0ea38a0bb 100644 --- a/crates/medea-coturn-telnet-client/src/proto.rs +++ b/crates/medea-coturn-telnet-client/src/proto.rs @@ -95,7 +95,7 @@ pub enum CoturnResponseParseError { /// Failed to represent provided bytes as [`String`]. #[display(fmt = "Cannot convert to String: {}", _0)] - BadString(Utf8Error), + NonUtf8String(Utf8Error), } impl TryFrom for CoturnCliResponse { diff --git a/src/media/ice_user.rs b/src/media/ice_user.rs index e06805a13..eb4a8575c 100644 --- a/src/media/ice_user.rs +++ b/src/media/ice_user.rs @@ -1,13 +1,15 @@ -//! Representation of [coturn]'s user. +//! Representation of [Coturn]'s user. //! -//! [coturn]: https://github.com/coturn/coturn +//! [Coturn]: https://github.com/coturn/coturn use derive_more::{AsRef, Display, From, Into}; use medea_client_api_proto::IceServer; use crate::api::control::RoomId; -/// Username for authorization on Turn server. +/// Username for authorization on [Coturn] server. +/// +/// [Coturn]: https://github.com/coturn/coturn #[derive(AsRef, Clone, Debug, Display, From, Into)] #[as_ref(forward)] pub struct IceUsername(String); @@ -17,10 +19,13 @@ pub struct IceUsername(String); pub struct IceUser { /// Address of Turn server. address: String, + /// Username for authorization. username: IceUsername, + /// Password for authorization. pass: String, + /// Non static users are meant to be saved and delete from some remote /// storage, while static users are hardcoded on Turn server and do not /// require any additional management. diff --git a/src/turn/cli.rs b/src/turn/cli.rs index c29db74b7..5f180ad4c 100644 --- a/src/turn/cli.rs +++ b/src/turn/cli.rs @@ -1,37 +1,48 @@ +//! [Coturn] server admin [Telnet] interface client. +//! +//! [Coturn]: https://github.com/coturn/coturn +//! [Telnet]: https://en.wikipedia.org/wiki/Telnet + use std::fmt; +use bytes::Bytes; use deadpool::managed::PoolConfig; use derive_more::{Display, From}; use failure::Fail; use medea_coturn_telnet_client::{ - pool::{Manager as PoolManager, Pool, PoolError}, + pool::{Manager as PoolManager, Pool, Error as PoolError}, CoturnTelnetError, }; use crate::media::IceUser; +/// Possible errors returned by [`CoturnTelnetClient`]. #[derive(Display, Debug, Fail, From)] pub enum CoturnCliError { - #[display(fmt = "Couldn't get connection from pool: {}", _0)] + /// Failed to retrieve connection from pool. + #[display(fmt = "Cannot retrieve connection from pool: {}", _0)] PoolError(PoolError), - #[display(fmt = "Coturn telnet connection returned error: {}", _0)] + /// Operation on retrieved connection failed. + #[display(fmt = "Connection returned error: {}", _0)] CliError(CoturnTelnetError), } -/// Abstraction over remote [Coturn] server telnet interface. +/// Abstraction over remote [Coturn] server admin [Telnet] interface. /// /// This struct can be cloned and transferred across thread boundaries. /// /// [Coturn]: https://github.com/coturn/coturn +/// [Telnet]: https://en.wikipedia.org/wiki/Telnet #[derive(Clone)] pub struct CoturnTelnetClient(Pool); impl CoturnTelnetClient { - /// Creates new [`CoturnTelnetClient`]. - pub fn new( - addr: (String, u16), - pass: String, + /// Creates new [`CoturnTelnetClient`] with the provided configuration. + #[inline] + pub fn new, P: Into>( + addr: (H, u16), + pass: P, pool_config: PoolConfig, ) -> Self { Self(Pool::from_config( @@ -40,18 +51,18 @@ impl CoturnTelnetClient { )) } - /// Forcefully closes provided [`IceUser`]s sessions on Coturn server. + /// Forcibly closes provided [`IceUser`]s sessions on [Coturn] server. + /// + /// [Coturn]: https://github.com/coturn/coturn pub async fn delete_sessions( &self, users: &[&IceUser], ) -> Result<(), CoturnCliError> { let mut conn = self.0.get().await?; - for user in users { - let sessions = - conn.print_sessions(user.user().clone().into()).await?; + for u in users { + let sessions = conn.print_sessions(u.user().clone().into()).await?; conn.delete_sessions(sessions).await?; } - Ok(()) } } diff --git a/src/turn/service.rs b/src/turn/service.rs index aba990b13..276cb42a2 100644 --- a/src/turn/service.rs +++ b/src/turn/service.rs @@ -1,6 +1,6 @@ -//! Implementation of managing [coturn] [TURN] server. +//! Implementation of managing [Coturn] [TURN] server. //! -//! [coturn]: https://github.com/coturn/coturn +//! [Coturn]: https://github.com/coturn/coturn //! [TURN]: https://webrtcglossary.com/turn/ use std::{fmt, sync::Arc}; @@ -29,8 +29,8 @@ pub enum TurnServiceErr { #[display(fmt = "Error accessing TurnAuthRepo: {}", _0)] TurnAuthRepoErr(TurnDatabaseErr), - #[display(fmt = "Error accessing TurnAuthRepo: {}", _0)] - CoturnCLiErr(CoturnCliError), + #[display(fmt = "Error operating CoturnTelnetClient: {}", _0)] + CoturnCliErr(CoturnCliError), #[display(fmt = "Timeout exceeded while trying to insert/delete IceUser")] #[from(ignore)] @@ -70,7 +70,9 @@ struct Service { /// Turn credentials repository. turn_db: TurnDatabase, - /// Connection to Coturn server admin interface. + /// Client of [Coturn] server admin interface. + /// + /// [Coturn]: https://github.com/coturn/coturn coturn_cli: CoturnTelnetClient, /// TurnAuthRepo password. @@ -132,7 +134,9 @@ impl TurnAuthService for Service { } /// Deletes provided [`IceUser`]s from [`TurnDatabase`] and closes their - /// sessions on Coturn TURN server. + /// sessions on [Coturn] server. + /// + /// [Coturn]: https://github.com/coturn/coturn async fn delete(&self, users: &[IceUser]) -> Result<(), TurnServiceErr> { if users.is_empty() { return Ok(()); @@ -172,7 +176,7 @@ pub fn new_turn_auth_service<'a>( )?; let coturn_cli = CoturnTelnetClient::new( - (cf.cli.host.to_string(), cf.cli.port), + (cf.cli.host.clone(), cf.cli.port), cf.cli.pass.to_string(), cf.cli.pool.into(), );