Switch from `websocket` to `tungstenite` due to stability concerns (fixes #2)
							parent
							
								
									443712cb22
								
							
						
					
					
						commit
						b630d7b584
					
				|  | @ -39,11 +39,10 @@ dependencies = [ | |||
| 
 | ||||
| [[package]] | ||||
| name = "base64" | ||||
| version = "0.9.3" | ||||
| version = "0.10.1" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| dependencies = [ | ||||
|  "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
|  | @ -68,12 +67,31 @@ dependencies = [ | |||
| 
 | ||||
| [[package]] | ||||
| name = "bitflags" | ||||
| version = "0.9.1" | ||||
| version = "1.0.4" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| 
 | ||||
| [[package]] | ||||
| name = "bitflags" | ||||
| version = "1.0.4" | ||||
| name = "block-buffer" | ||||
| version = "0.7.2" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| dependencies = [ | ||||
|  "block-padding 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "block-padding" | ||||
| version = "0.1.3" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| dependencies = [ | ||||
|  "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "byte-tools" | ||||
| version = "0.3.1" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| 
 | ||||
| [[package]] | ||||
|  | @ -187,6 +205,14 @@ dependencies = [ | |||
|  "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "digest" | ||||
| version = "0.8.0" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| dependencies = [ | ||||
|  "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "env_logger" | ||||
| version = "0.5.13" | ||||
|  | @ -199,6 +225,11 @@ dependencies = [ | |||
|  "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "fake-simd" | ||||
| version = "0.1.2" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| 
 | ||||
| [[package]] | ||||
| name = "fixedbitset" | ||||
| version = "0.1.9" | ||||
|  | @ -236,11 +267,28 @@ name = "futures" | |||
| version = "0.1.25" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| 
 | ||||
| [[package]] | ||||
| name = "futures-cpupool" | ||||
| version = "0.1.8" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| dependencies = [ | ||||
|  "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "gcc" | ||||
| version = "0.3.55" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| 
 | ||||
| [[package]] | ||||
| name = "generic-array" | ||||
| version = "0.12.0" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| dependencies = [ | ||||
|  "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "glob" | ||||
| version = "0.2.11" | ||||
|  | @ -268,24 +316,6 @@ dependencies = [ | |||
|  "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "hyper" | ||||
| version = "0.10.15" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| dependencies = [ | ||||
|  "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "idna" | ||||
| version = "0.1.5" | ||||
|  | @ -296,6 +326,14 @@ dependencies = [ | |||
|  "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "input_buffer" | ||||
| version = "0.2.0" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| dependencies = [ | ||||
|  "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "iovec" | ||||
| version = "0.1.2" | ||||
|  | @ -314,11 +352,6 @@ dependencies = [ | |||
|  "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "language-tags" | ||||
| version = "0.2.2" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| 
 | ||||
| [[package]] | ||||
| name = "lazy_static" | ||||
| version = "1.2.0" | ||||
|  | @ -373,14 +406,6 @@ dependencies = [ | |||
|  "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "log" | ||||
| version = "0.3.9" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| dependencies = [ | ||||
|  "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "log" | ||||
| version = "0.4.6" | ||||
|  | @ -408,14 +433,6 @@ name = "memoffset" | |||
| version = "0.2.1" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| 
 | ||||
| [[package]] | ||||
| name = "mime" | ||||
| version = "0.2.6" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| dependencies = [ | ||||
|  "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "mio" | ||||
| version = "0.6.16" | ||||
|  | @ -485,8 +502,9 @@ dependencies = [ | |||
|  "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "tokio-tls 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "tokio-tungstenite 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "tungstenite 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "webrtc-sdp 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "websocket 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
|  | @ -604,6 +622,11 @@ dependencies = [ | |||
|  "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "opaque-debug" | ||||
| version = "0.2.2" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| 
 | ||||
| [[package]] | ||||
| name = "openssl" | ||||
| version = "0.10.15" | ||||
|  | @ -905,11 +928,6 @@ dependencies = [ | |||
|  "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "safemem" | ||||
| version = "0.3.0" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| 
 | ||||
| [[package]] | ||||
| name = "schannel" | ||||
| version = "0.1.14" | ||||
|  | @ -963,9 +981,15 @@ version = "0.7.0" | |||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| 
 | ||||
| [[package]] | ||||
| name = "sha1" | ||||
| version = "0.6.0" | ||||
| name = "sha-1" | ||||
| version = "0.8.1" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| dependencies = [ | ||||
|  "block-buffer 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "slab" | ||||
|  | @ -1106,6 +1130,17 @@ dependencies = [ | |||
|  "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "tokio-dns-unofficial" | ||||
| version = "0.3.1" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| dependencies = [ | ||||
|  "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "tokio 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "tokio-executor" | ||||
| version = "0.1.5" | ||||
|  | @ -1199,6 +1234,21 @@ dependencies = [ | |||
|  "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "tokio-tungstenite" | ||||
| version = "0.6.0" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| dependencies = [ | ||||
|  "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "tokio-dns-unofficial 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "tokio-tcp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "tokio-tls 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "tungstenite 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "tokio-udp" | ||||
| version = "0.1.3" | ||||
|  | @ -1239,13 +1289,26 @@ dependencies = [ | |||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "traitobject" | ||||
| version = "0.1.0" | ||||
| name = "tungstenite" | ||||
| version = "0.6.1" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| dependencies = [ | ||||
|  "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "input_buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "utf-8 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "typeable" | ||||
| version = "0.1.2" | ||||
| name = "typenum" | ||||
| version = "1.10.0" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| 
 | ||||
| [[package]] | ||||
|  | @ -1253,14 +1316,6 @@ name = "ucd-util" | |||
| version = "0.1.3" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| 
 | ||||
| [[package]] | ||||
| name = "unicase" | ||||
| version = "1.4.2" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| dependencies = [ | ||||
|  "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "unicode-bidi" | ||||
| version = "0.3.4" | ||||
|  | @ -1302,6 +1357,11 @@ dependencies = [ | |||
|  "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "utf-8" | ||||
| version = "0.7.5" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| 
 | ||||
| [[package]] | ||||
| name = "utf8-ranges" | ||||
| version = "1.0.2" | ||||
|  | @ -1335,27 +1395,6 @@ dependencies = [ | |||
|  "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "websocket" | ||||
| version = "0.21.1" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| dependencies = [ | ||||
|  "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "hyper 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "tokio-tls 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
|  "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "which" | ||||
| version = "1.0.5" | ||||
|  | @ -1425,10 +1464,12 @@ dependencies = [ | |||
| "checksum argparse 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3f8ebf5827e4ac4fd5946560e6a99776ea73b596d80898f357007317a7141e47" | ||||
| "checksum arrayvec 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "f405cc4c21cd8b784f6c8fc2adf9bc00f59558f0049b5ec21517f875963040cc" | ||||
| "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" | ||||
| "checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" | ||||
| "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" | ||||
| "checksum bindgen 0.42.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f199ccbabf5e9f9e13a3096534e80c9ce37aee440789dafaa47190e283245c" | ||||
| "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" | ||||
| "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" | ||||
| "checksum block-buffer 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "509de513cca6d92b6aacf9c61acfe7eaa160837323a81068d690cc1f8e5740da" | ||||
| "checksum block-padding 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d75255892aeb580d3c566f213a2b6fdc1c66667839f45719ee1d30ebf2aea591" | ||||
| "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" | ||||
| "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" | ||||
| "checksum bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "40ade3d27603c2cb345eb0912aec461a6dec7e06a4ae48589904e808335c7afa" | ||||
| "checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" | ||||
|  | @ -1442,23 +1483,26 @@ dependencies = [ | |||
| "checksum crossbeam-deque 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4fe1b6f945f824c7a25afe44f62e25d714c0cc523f8e99d8db5cd1026e1269d3" | ||||
| "checksum crossbeam-epoch 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2449aaa4ec7ef96e5fb24db16024b935df718e9ae1cec0a1e68feeca2efca7b8" | ||||
| "checksum crossbeam-utils 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c55913cc2799171a550e307918c0a360e8c16004820291bf3b638969b4a01816" | ||||
| "checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c" | ||||
| "checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" | ||||
| "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" | ||||
| "checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" | ||||
| "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" | ||||
| "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" | ||||
| "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.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" | ||||
| "checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" | ||||
| "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" | ||||
| "checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592" | ||||
| "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" | ||||
| "checksum handy_async 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "165d5c5434dd3b9b3b3fa7ad58a895f13ee34f9aa42f3e5d13bc0ac544be7232" | ||||
| "checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" | ||||
| "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" | ||||
| "checksum hyper 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)" = "df0caae6b71d266b91b4a83111a61d2b94ed2e2bea024c532b933dcff867e58c" | ||||
| "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" | ||||
| "checksum input_buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e1b822cc844905551931d6f81608ed5f50a79c1078a4e2b4d42dbc7c1eedfbf" | ||||
| "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" | ||||
| "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" | ||||
| "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" | ||||
| "checksum lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddba4c30a78328befecec92fc94970e53b3ae385827d28620f0f5bb2493081e0" | ||||
| "checksum libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)" = "10923947f84a519a45c8fefb7dd1b3e8c08747993381adee176d7a82b4195311" | ||||
|  | @ -1466,12 +1510,10 @@ dependencies = [ | |||
| "checksum libnice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d263bb062822dde86100f726fd6da6735723f9c5753a9aa23603011626483eb" | ||||
| "checksum libnice-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4c14f86d71d491b61486e5609bc6d5c5acf5d3f34e399b4881dde51c3e53f7cd" | ||||
| "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" | ||||
| "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" | ||||
| "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" | ||||
| "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" | ||||
| "checksum memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e1dd4eaac298c32ce07eb6ed9242eda7d82955b9170b7d6db59b2e02cc63fcb8" | ||||
| "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" | ||||
| "checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" | ||||
| "checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" | ||||
| "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" | ||||
|  | @ -1488,6 +1530,7 @@ dependencies = [ | |||
| "checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e" | ||||
| "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" | ||||
| "checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" | ||||
| "checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409" | ||||
| "checksum openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)" = "5e1309181cdcbdb51bc3b6bedb33dfac2a83b3d585033d3f6d9e22e8c1928613" | ||||
| "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" | ||||
| "checksum openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)" = "278c1ad40a89aa1e741a1eed089a2f60b18fab8089c3139b542140fc7d674106" | ||||
|  | @ -1523,7 +1566,6 @@ dependencies = [ | |||
| "checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" | ||||
| "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" | ||||
| "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" | ||||
| "checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9" | ||||
| "checksum schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56" | ||||
| "checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" | ||||
| "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" | ||||
|  | @ -1531,7 +1573,7 @@ dependencies = [ | |||
| "checksum security-framework-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab01dfbe5756785b5b4d46e0289e5a18071dfa9a7c2b24213ea00b9ef9b665bf" | ||||
| "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" | ||||
| "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" | ||||
| "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" | ||||
| "checksum sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23962131a91661d643c98940b20fcaffe62d776a823247be80a48fcb8b6fce68" | ||||
| "checksum slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5f9776d6b986f77b35c6cf846c11ad986ff128fe0b2b63a3628e3755e8d3102d" | ||||
| "checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" | ||||
| "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" | ||||
|  | @ -1546,6 +1588,7 @@ dependencies = [ | |||
| "checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" | ||||
| "checksum tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "aeeffbbb94209023feaef3c196a41cbcdafa06b4a6f893f68779bb5e53796f71" | ||||
| "checksum tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "331c8acc267855ec06eb0c94618dcbbfea45bed2d20b77252940095273fb58f6" | ||||
| "checksum tokio-dns-unofficial 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bb9bf62ca2c53bf2f2faec3e48a98b6d8c9577c27011cb0203a4beacdc8ab328" | ||||
| "checksum tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c117b6cf86bb730aab4834f10df96e4dd586eff2c3c27d3781348da49e255bde" | ||||
| "checksum tokio-fs 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "60ae25f6b17d25116d2cba342083abe5255d3c2c79cb21ea11aa049c53bf7c75" | ||||
| "checksum tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "7392fe0a70d5ce0c882c4778116c519bd5dbaa8a7c3ae3d04578b3afafdcda21" | ||||
|  | @ -1554,26 +1597,26 @@ dependencies = [ | |||
| "checksum tokio-threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "56c5556262383032878afad66943926a1d1f0967f17e94bd7764ceceb3b70e7f" | ||||
| "checksum tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4f37f0111d76cc5da132fe9bc0590b9b9cfd079bc7e75ac3846278430a299ff8" | ||||
| "checksum tokio-tls 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e53fdbf3156f588be1676022fe794232b24922d426e8c14f4e46891c1e31c440" | ||||
| "checksum tokio-tungstenite 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4e744ff297473d047436c108c99e478fd73c1dd27e2c08e352907dcd864c720f" | ||||
| "checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" | ||||
| "checksum tokio-uds 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "99ce87382f6c1a24b513a72c048b2c8efe66cb5161c9061d00bee510f08dc168" | ||||
| "checksum trackable 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "65defd0876240a5301307e55ada18dea77372391c65cee3a421fac482be3a25a" | ||||
| "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" | ||||
| "checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" | ||||
| "checksum tungstenite 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e9573852f935883137b7f0824832493ce7418bf290c8cf164b7aafc9b0a99aa0" | ||||
| "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" | ||||
| "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" | ||||
| "checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" | ||||
| "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" | ||||
| "checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" | ||||
| "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" | ||||
| "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" | ||||
| "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" | ||||
| "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" | ||||
| "checksum utf-8 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7" | ||||
| "checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" | ||||
| "checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" | ||||
| "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" | ||||
| "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" | ||||
| "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" | ||||
| "checksum webrtc-sdp 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9413222171d05c908151166439b4d682987e2f900b924a94fa3d27435679d281" | ||||
| "checksum websocket 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c9faed2bff8af2ea6b9f8b917d3d00b467583f6781fe3def174a9e33c879703" | ||||
| "checksum which 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e84a603e7e0b1ce1aa1ee2b109c7be00155ce52df5081590d1ffb93f4f515cb2" | ||||
| "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" | ||||
| "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" | ||||
|  |  | |||
|  | @ -14,7 +14,8 @@ tokio-codec = "0.1" | |||
| tokio-tls = "0.2" | ||||
| native-tls = "0.2" | ||||
| mumble-protocol = { version = "0.1", features = ["webrtc-extensions"] } | ||||
| websocket = "0.21.1" | ||||
| tokio-tungstenite = "0.6" | ||||
| tungstenite = "0.6" | ||||
| rtp = { git = "https://github.com/johni0702/rtp", rev = "ee8be93", features = ["openssl", "tokio"] } | ||||
| libnice = "0.1" | ||||
| webrtc-sdp = "0.1" | ||||
|  |  | |||
							
								
								
									
										16
									
								
								src/error.rs
								
								
								
								
							
							
						
						
									
										16
									
								
								src/error.rs
								
								
								
								
							|  | @ -1,5 +1,4 @@ | |||
| use futures::sync::mpsc; | ||||
| use websocket; | ||||
| 
 | ||||
| // FIXME clean this up
 | ||||
| 
 | ||||
|  | @ -7,12 +6,21 @@ use websocket; | |||
| pub enum Error { | ||||
|     Io(std::io::Error), | ||||
|     ServerTls(native_tls::Error), | ||||
|     ClientConnection(websocket::result::WebSocketError), | ||||
|     ClientConnection(tungstenite::Error), | ||||
|     Misc(Box<std::error::Error>), | ||||
| } | ||||
| 
 | ||||
| impl From<websocket::result::WebSocketError> for Error { | ||||
|     fn from(e: websocket::result::WebSocketError) -> Self { | ||||
| impl Error { | ||||
|     pub fn is_connection_closed(&self) -> bool { | ||||
|         match self { | ||||
|             Error::ClientConnection(tungstenite::Error::ConnectionClosed(_)) => true, | ||||
|             _ => false, | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| impl From<tungstenite::Error> for Error { | ||||
|     fn from(e: tungstenite::Error) -> Self { | ||||
|         Error::ClientConnection(e) | ||||
|     } | ||||
| } | ||||
|  |  | |||
							
								
								
									
										88
									
								
								src/main.rs
								
								
								
								
							
							
						
						
									
										88
									
								
								src/main.rs
								
								
								
								
							|  | @ -14,12 +14,13 @@ extern crate tokio; | |||
| extern crate tokio_codec; | ||||
| extern crate tokio_core; | ||||
| extern crate tokio_tls; | ||||
| extern crate tokio_tungstenite; | ||||
| extern crate tungstenite; | ||||
| extern crate webrtc_sdp; | ||||
| extern crate websocket; | ||||
| 
 | ||||
| use argparse::{ArgumentParser, Store}; | ||||
| use byteorder::{BigEndian, ByteOrder}; | ||||
| use bytes::{BufMut, BytesMut}; | ||||
| use bytes::{Buf, BufMut, BytesMut, IntoBuf}; | ||||
| use futures::{Future, Sink, Stream}; | ||||
| use mumble_protocol::control::ClientControlCodec; | ||||
| use mumble_protocol::control::ControlPacket; | ||||
|  | @ -27,14 +28,16 @@ use mumble_protocol::control::RawControlPacket; | |||
| use mumble_protocol::Clientbound; | ||||
| use std::convert::Into; | ||||
| use std::convert::TryInto; | ||||
| use std::net::Ipv6Addr; | ||||
| use std::net::ToSocketAddrs; | ||||
| use tokio::net::TcpListener; | ||||
| use tokio::net::TcpStream; | ||||
| use tokio_codec::Decoder; | ||||
| use tokio_core::reactor::Core; | ||||
| use tokio_tls::TlsConnector; | ||||
| use websocket::async::Server; | ||||
| use websocket::message::OwnedMessage; | ||||
| use websocket::server::InvalidConnection; | ||||
| use tokio_tungstenite::accept_async_with_config; | ||||
| use tungstenite::protocol::Message; | ||||
| use tungstenite::protocol::WebSocketConfig; | ||||
| 
 | ||||
| mod connection; | ||||
| mod error; | ||||
|  | @ -82,49 +85,48 @@ fn main() { | |||
| 
 | ||||
|     let mut core = Core::new().unwrap(); | ||||
|     let handle = core.handle(); | ||||
|     let server = Server::bind(("0.0.0.0", ws_port), &handle).unwrap(); | ||||
|     let f = server | ||||
|         .incoming() | ||||
|         .map_err(|InvalidConnection { error, .. }| error) | ||||
|         .for_each(move |(upgrade, addr)| { | ||||
|     let socket_addr = (Ipv6Addr::from(0), ws_port).into(); | ||||
|     let server = TcpListener::bind(&socket_addr).unwrap(); | ||||
|     let f = server.incoming().for_each(move |client| { | ||||
|         let addr = client.peer_addr().expect("peer to have an address"); | ||||
|         println!("New connection from {}", addr); | ||||
|             let server_sock = TcpStream::connect(&upstream_addr); | ||||
|             let f = upgrade | ||||
|                 .use_protocol("binary") // FIXME can we be more specific? *looks at chrome*
 | ||||
|                 .accept() | ||||
| 
 | ||||
|         // Connect to server
 | ||||
|         let server = TcpStream::connect(&upstream_addr) | ||||
|             .from_err() | ||||
|                 .join(server_sock.from_err().and_then(move |stream| { | ||||
|             .and_then(move |stream| { | ||||
|                 let connector: TlsConnector = native_tls::TlsConnector::builder() | ||||
|                     //.danger_accept_invalid_certs(true)
 | ||||
|                     .build() | ||||
|                     .unwrap() | ||||
|                     .into(); | ||||
|                 connector.connect(upstream_host, stream).from_err() | ||||
|                 })) | ||||
|                 .and_then(move |((client, _), server)| { | ||||
|             }) | ||||
|             .map(|stream| ClientControlCodec::new().framed(stream)); | ||||
| 
 | ||||
|         // Accept client
 | ||||
|         let websocket_config = WebSocketConfig { | ||||
|             max_send_queue: Some(10), // can be fairly small as voice is using WebRTC instead
 | ||||
|             max_message_size: Some(0x7f_ffff), // maximum size accepted by Murmur
 | ||||
|             max_frame_size: Some(0x7f_ffff), // maximum size accepted by Murmur
 | ||||
|         }; | ||||
|         let client = accept_async_with_config(client, Some(websocket_config)).from_err(); | ||||
| 
 | ||||
|         // Once both are done, begin proxy duty
 | ||||
|         let f = client | ||||
|             .join(server) | ||||
|             .and_then(move |(client, server)| { | ||||
|                 let (client_sink, client_stream) = client.split(); | ||||
|                     // buffered client sink to prevent temporary lag on the control
 | ||||
|                     // channel from lagging the otherwise independent audio channel
 | ||||
|                     let client_sink = | ||||
|                         client_sink | ||||
|                             .buffer(10) | ||||
|                             .with(|m: ControlPacket<Clientbound>| { | ||||
|                 let client_sink = client_sink.with(|m: ControlPacket<Clientbound>| { | ||||
|                     let m = RawControlPacket::from(m); | ||||
|                                 let bytes = &m.bytes; | ||||
|                                 let len = bytes.len(); | ||||
|                                 let mut buf = BytesMut::with_capacity(6 + len); | ||||
|                                 buf.put_u16_be(m.id); | ||||
|                                 buf.put_u32_be(len as u32); | ||||
|                                 buf.put(bytes); | ||||
|                                 Ok::<OwnedMessage, Error>(OwnedMessage::Binary( | ||||
|                                     buf.freeze().to_vec(), | ||||
|                                 )) | ||||
|                     let mut header = BytesMut::with_capacity(6); | ||||
|                     header.put_u16_be(m.id); | ||||
|                     header.put_u32_be(m.bytes.len() as u32); | ||||
|                     let buf = header.into_buf().chain(m.bytes); | ||||
|                     Ok::<_, Error>(Message::Binary(buf.collect())) | ||||
|                 }); | ||||
|                     let client_stream = client_stream | ||||
|                         .from_err() | ||||
|                         .take_while(|m| Ok(!m.is_close())) | ||||
|                         .filter_map(|m| match m { | ||||
|                             OwnedMessage::Binary(ref b) if b.len() >= 6 => { | ||||
|                 let client_stream = client_stream.from_err().filter_map(|m| match m { | ||||
|                     Message::Binary(ref b) if b.len() >= 6 => { | ||||
|                         let id = BigEndian::read_u16(b); | ||||
|                         // b[2..6] is length which is implicit in websocket msgs
 | ||||
|                         let bytes = b[6..].into(); | ||||
|  | @ -133,15 +135,21 @@ fn main() { | |||
|                     _ => None, | ||||
|                 }); | ||||
| 
 | ||||
|                     let server = ClientControlCodec::new().framed(server); | ||||
|                 let (server_sink, server_stream) = server.split(); | ||||
|                 let server_sink = server_sink.sink_from_err(); | ||||
|                 let server_stream = server_stream.from_err(); | ||||
| 
 | ||||
|                 Connection::new(client_sink, client_stream, server_sink, server_stream) | ||||
|             }) | ||||
|                 .map_err(move |e: Error| println!("Error on connection {}: {:?}", addr, e)) | ||||
|                 .map(move |_| println!("Client connection closed: {}", addr)); | ||||
|             .or_else(move |err| { | ||||
|                 if err.is_connection_closed() { | ||||
|                     Ok(()) | ||||
|                 } else { | ||||
|                     println!("Error on connection {}: {:?}", addr, err); | ||||
|                     Err(()) | ||||
|                 } | ||||
|             }) | ||||
|             .map(move |()| println!("Client connection closed: {}", addr)); | ||||
|         handle.spawn(f); | ||||
|         Ok(()) | ||||
|     }); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue