diff --git a/Cargo.lock b/Cargo.lock index b1eb6db..45639fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -36,9 +36,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "base64" @@ -81,9 +81,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.8.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c" +checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" [[package]] name = "byteorder" @@ -108,9 +108,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.72" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" [[package]] name = "cfg-if" @@ -168,9 +168,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" dependencies = [ "libc", ] @@ -213,9 +213,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.1" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" +checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -234,10 +234,11 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.5" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" +checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" dependencies = [ + "autocfg", "cfg-if 1.0.0", "crossbeam-utils", "lazy_static", @@ -247,9 +248,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.5" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" +checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" dependencies = [ "cfg-if 1.0.0", "lazy_static", @@ -320,6 +321,15 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "fastrand" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +dependencies = [ + "instant", +] + [[package]] name = "fnv" version = "1.0.7" @@ -338,9 +348,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.4" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" dependencies = [ "typenum", "version_check", @@ -348,9 +358,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.3" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" dependencies = [ "cfg-if 1.0.0", "libc", @@ -389,20 +399,20 @@ dependencies = [ [[package]] name = "http" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b" +checksum = "ff8670570af52249509a86f5e3e18a08c60b177071826898fde8997cf5f6bfbb" dependencies = [ "bytes", "fnv", - "itoa 0.4.8", + "itoa 1.0.2", ] [[package]] name = "httparse" -version = "1.5.1" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" +checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" [[package]] name = "iai" @@ -436,9 +446,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.7.0" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" +checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" dependencies = [ "autocfg", "hashbrown", @@ -446,9 +456,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.9" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if 1.0.0", ] @@ -470,15 +480,15 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" [[package]] name = "js-sys" -version = "0.3.55" +version = "0.3.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" +checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" dependencies = [ "wasm-bindgen", ] @@ -491,9 +501,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.112" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" [[package]] name = "linked-hash-map" @@ -503,18 +513,19 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] name = "lock_api" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" dependencies = [ + "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.14" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if 1.0.0", ] @@ -527,9 +538,9 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" @@ -555,12 +566,11 @@ dependencies = [ [[package]] name = "nix" -version = "0.23.1" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" +checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9" dependencies = [ "bitflags", - "cc", "cfg-if 1.0.0", "libc", "memoffset", @@ -568,9 +578,9 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ "autocfg", "num-traits", @@ -578,9 +588,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", ] @@ -597,9 +607,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.9.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" +checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" [[package]] name = "oorandom" @@ -674,18 +684,18 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] name = "privdrop" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c02cf257b10e4b807bccadb19630d5dea7e0369c3c5e84673ee8e58dc8da6a5" +checksum = "ad5b1f7e40f628a2f8f90e40d3f313be83066cc61997fdcb96cade6abf7cee93" dependencies = [ "libc", - "nix 0.23.1", + "nix 0.24.1", ] [[package]] @@ -714,32 +724,31 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.34" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f84e92c0f7c9d58328b85a78557813e4bd845130db68d7184635344399423b1" +checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.10" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" dependencies = [ "proc-macro2", ] [[package]] name = "rand" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", "rand_core", - "rand_hc", ] [[package]] @@ -761,20 +770,11 @@ dependencies = [ "getrandom", ] -[[package]] -name = "rand_hc" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" -dependencies = [ - "rand_core", -] - [[package]] name = "rayon" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" dependencies = [ "autocfg", "crossbeam-deque", @@ -784,31 +784,30 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.9.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" dependencies = [ "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "lazy_static", "num_cpus", ] [[package]] name = "redox_syscall" -version = "0.2.10" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" dependencies = [ "bitflags", ] [[package]] name = "regex" -version = "1.5.4" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" dependencies = [ "regex-syntax", ] @@ -821,9 +820,9 @@ checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" [[package]] name = "remove_dir_all" @@ -860,9 +859,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" [[package]] name = "same-file" @@ -881,15 +880,15 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "semver" -version = "1.0.4" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012" +checksum = "8cb243bdfdb5936c8dc3c45762a19d12ab4550cdc753bc247637d4ec35a040fd" [[package]] name = "serde" -version = "1.0.132" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9875c23cf305cd1fd7eb77234cbb705f21ea6a72c637a5c6db5fe4b8e7f008" +checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" dependencies = [ "serde_derive", ] @@ -906,9 +905,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.132" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc0db5cb2556c0e558887d9bbdcf6ac4471e83ff66cf696e5419024d1606276" +checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" dependencies = [ "proc-macro2", "quote", @@ -917,20 +916,20 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.73" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcbd0344bc6533bc7ec56df11d42fb70f1b912351c0825ccb7211b59d8af7cf5" +checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" dependencies = [ - "itoa 1.0.1", + "itoa 1.0.2", "ryu", "serde", ] [[package]] name = "serde_yaml" -version = "0.8.23" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a521f2940385c165a24ee286aa8599633d162077a54bdcae2a6fd5a7bfa7a0" +checksum = "707d15895415db6628332b737c838b88c598522e4dc70647e59b72312924aebc" dependencies = [ "indexmap", "ryu", @@ -963,9 +962,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" +checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" [[package]] name = "spin" @@ -981,9 +980,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "structopt" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40b9788f4202aa75c240ecc9c15c65185e6a39ccdeb0fd5d008b98825464c87c" +checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" dependencies = [ "clap", "lazy_static", @@ -1005,24 +1004,24 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.83" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a1dfb999630e338648c83e91c59a4e9fb7620f520c3194b6b89e276f2f1959" +checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] name = "tempfile" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ "cfg-if 1.0.0", + "fastrand", "libc", - "rand", "redox_syscall", "remove_dir_all", "winapi", @@ -1049,18 +1048,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.30" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.30" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" dependencies = [ "proc-macro2", "quote", @@ -1088,9 +1087,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ "tinyvec_macros", ] @@ -1122,15 +1121,21 @@ dependencies = [ [[package]] name = "typenum" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "unicode-bidi" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" + +[[package]] +name = "unicode-ident" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" [[package]] name = "unicode-normalization" @@ -1143,9 +1148,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" +checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" [[package]] name = "unicode-width" @@ -1153,12 +1158,6 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" -[[package]] -name = "unicode-xid" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" - [[package]] name = "untrusted" version = "0.7.1" @@ -1191,9 +1190,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "void" @@ -1251,9 +1250,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm-bindgen" -version = "0.2.78" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" +checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -1261,9 +1260,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.78" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" +checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" dependencies = [ "bumpalo", "lazy_static", @@ -1276,9 +1275,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.78" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" +checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1286,9 +1285,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.78" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" +checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" dependencies = [ "proc-macro2", "quote", @@ -1299,15 +1298,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.78" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" +checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" [[package]] name = "web-sys" -version = "0.3.55" +version = "0.3.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" +checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" dependencies = [ "js-sys", "wasm-bindgen", @@ -1376,6 +1375,6 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.4.3" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d68d9dcec5f9b43a30d38c49f91dfedfaac384cb8f085faca366c26207dd1619" +checksum = "94693807d016b2f2d2e14420eb3bfcca689311ff775dcf113d74ea624b7cdf07" diff --git a/benches/criterion.rs b/benches/criterion.rs index be484eb..b72cf28 100644 --- a/benches/criterion.rs +++ b/benches/criterion.rs @@ -82,11 +82,11 @@ fn decode_ethernet_with_vlan(c: &mut Criterion) { fn lookup_warm(c: &mut Criterion) { let mut table = ClaimTable::::new(60, 60); let addr = Address::from_str("1.2.3.4").unwrap(); - table.cache(addr, SocketAddr::from_str("1.2.3.4:3210").unwrap()); + table.cache(addr.clone(), SocketAddr::from_str("1.2.3.4:3210").unwrap()); let mut g = c.benchmark_group("table"); g.throughput(Throughput::Bytes(1400)); g.bench_function("lookup_warm", |b| { - b.iter(|| table.lookup(addr)); + b.iter(|| table.lookup(&addr)); }); g.finish(); } @@ -100,7 +100,7 @@ fn lookup_cold(c: &mut Criterion) { g.bench_function("lookup_cold", |b| { b.iter(|| { table.clear_cache(); - table.lookup(addr) + table.lookup(&addr) }); }); g.finish(); diff --git a/benches/valgrind.rs b/benches/valgrind.rs index b38f3cf..64dc73d 100644 --- a/benches/valgrind.rs +++ b/benches/valgrind.rs @@ -57,9 +57,9 @@ fn decode_ethernet_with_vlan() { fn lookup_warm() { let mut table = ClaimTable::::new(60, 60); let addr = Address::from_str("1.2.3.4").unwrap(); - table.cache(addr, SocketAddr::from_str("1.2.3.4:3210").unwrap()); + table.cache(addr.clone(), SocketAddr::from_str("1.2.3.4:3210").unwrap()); for _ in 0..1000 { - table.lookup(black_box(addr)); + table.lookup(black_box(&addr)); } } @@ -69,7 +69,7 @@ fn lookup_cold() { table.set_claims(SocketAddr::from_str("1.2.3.4:3210").unwrap(), smallvec![Range::from_str("1.2.3.4/32").unwrap()]); for _ in 0..1000 { table.clear_cache(); - table.lookup(black_box(addr)); + table.lookup(black_box(&addr)); } } @@ -121,13 +121,85 @@ fn full_communication_tun_router() { let mut payload = vec![0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2]; payload.append(&mut vec![0; 1400]); - for _ in 0..1000 { + for _ in 0..10000 { sim.put_payload(node1, payload.clone()); sim.simulate_all_messages(); assert_eq!(Some(&payload), black_box(sim.pop_payload(node2).as_ref())); } } +fn tun_router_send() { + log::set_max_level(log::LevelFilter::Error); + let config1 = Config { + device_type: Type::Tun, + auto_claim: false, + claims: vec!["1.1.1.1/32".to_string()], + ..Config::default() + }; + let config2 = Config { + device_type: Type::Tun, + auto_claim: false, + claims: vec!["2.2.2.2/32".to_string()], + ..Config::default() + }; + let mut sim = TunSimulator::new(); + let node1 = sim.add_node(false, &config1); + let node2 = sim.add_node(false, &config2); + + sim.connect(node1, node2); + sim.simulate_all_messages(); + assert!(sim.is_connected(node1, node2)); + assert!(sim.is_connected(node2, node1)); + sim.trigger_housekeep(); + + let mut payload = vec![0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2]; + payload.append(&mut vec![0; 1400]); + let node = sim.get_node(node1); + for _ in 0..10000 { + node.device().put_inbound(black_box(payload.clone())); + node.trigger_device_event(); + assert!(node.socket().pop_outbound().is_some()); + } +} + +fn tun_router_receive() { + log::set_max_level(log::LevelFilter::Error); + let config1 = Config { + device_type: Type::Tun, + auto_claim: false, + claims: vec!["1.1.1.1/32".to_string()], + ..Config::default() + }; + let config2 = Config { + device_type: Type::Tun, + auto_claim: false, + claims: vec!["2.2.2.2/32".to_string()], + ..Config::default() + }; + let mut sim = TunSimulator::new(); + let node1 = sim.add_node(false, &config1); + let node2 = sim.add_node(false, &config2); + + sim.connect(node1, node2); + sim.simulate_all_messages(); + assert!(sim.is_connected(node1, node2)); + assert!(sim.is_connected(node2, node1)); + sim.trigger_housekeep(); + + let mut payload = vec![0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2]; + payload.append(&mut vec![0; 1400]); + let node = sim.get_node(node1); + node.device().put_inbound(payload.clone()); + node.trigger_device_event(); + let msg = node.socket().pop_outbound().unwrap().1; + let node = sim.get_node(node2); + for _ in 0..10000 { + node.socket().put_inbound(node1, black_box(msg.clone())); + node.trigger_socket_event(); + assert!(node.device().pop_outbound().is_some()); + } +} + fn full_communication_tap_switch() { log::set_max_level(log::LevelFilter::Error); let config = Config { device_type: Type::Tap, ..Config::default() }; @@ -144,13 +216,65 @@ fn full_communication_tap_switch() { let mut payload = vec![2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5]; payload.append(&mut vec![0; 1400]); - for _ in 0..1000 { + for _ in 0..10000 { sim.put_payload(node1, payload.clone()); sim.simulate_all_messages(); assert_eq!(Some(&payload), black_box(sim.pop_payload(node2).as_ref())); } } +fn tap_switch_send() { + log::set_max_level(log::LevelFilter::Error); + let config = Config { device_type: Type::Tap, ..Config::default() }; + let mut sim = TapSimulator::new(); + + let node1 = sim.add_node(false, &config); + let node2 = sim.add_node(false, &config); + + sim.connect(node1, node2); + sim.simulate_all_messages(); + assert!(sim.is_connected(node1, node2)); + assert!(sim.is_connected(node2, node1)); + sim.trigger_housekeep(); + + let mut payload = vec![2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5]; + payload.append(&mut vec![0; 1400]); + let node = sim.get_node(node1); + for _ in 0..10000 { + node.device().put_inbound(black_box(payload.clone())); + node.trigger_device_event(); + assert!(node.socket().pop_outbound().is_some()); + } +} + +fn tap_switch_receive() { + log::set_max_level(log::LevelFilter::Error); + let config = Config { device_type: Type::Tap, ..Config::default() }; + let mut sim = TapSimulator::new(); + + let node1 = sim.add_node(false, &config); + let node2 = sim.add_node(false, &config); + + sim.connect(node1, node2); + sim.simulate_all_messages(); + assert!(sim.is_connected(node1, node2)); + assert!(sim.is_connected(node2, node1)); + sim.trigger_housekeep(); + + let mut payload = vec![2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5]; + payload.append(&mut vec![0; 1400]); + let node = sim.get_node(node1); + node.device().put_inbound(payload.clone()); + node.trigger_device_event(); + let msg = node.socket().pop_outbound().unwrap().1; + let node = sim.get_node(node2); + for _ in 0..10000 { + node.socket().put_inbound(node1, black_box(msg.clone())); + node.trigger_socket_event(); + assert!(node.device().pop_outbound().is_some()); + } +} + iai::main!( udp_send, decode_ipv4, @@ -162,6 +286,10 @@ iai::main!( crypto_chacha20, crypto_aes128, crypto_aes256, + tun_router_send, + tun_router_receive, full_communication_tun_router, + tap_switch_send, + tap_switch_receive, full_communication_tap_switch ); diff --git a/contrib/aws/common.py b/contrib/aws/common.py index 15c596f..e571877 100644 --- a/contrib/aws/common.py +++ b/contrib/aws/common.py @@ -361,7 +361,8 @@ runcmd: self.connections = [] eprint("Terminating instances...") for instance in self.instances: - instance.terminate() + if instance: + instance.terminate() for instance in self.instances: eprint("\t{}".format(instance.id)) instance.wait_until_terminated() diff --git a/contrib/aws/performance.py b/contrib/aws/performance.py index c18038d..89f4eeb 100755 --- a/contrib/aws/performance.py +++ b/contrib/aws/performance.py @@ -70,7 +70,7 @@ class PerfTest: eprint("\tSetting up vpncloud on receiver") self.receiver.start_vpncloud(crypto=crypto, ip=f"{self.receiver_ip_vpncloud}/24") eprint("\tSetting up vpncloud on sender") - self.sender.start_vpncloud(crypto=crypto, peers=[f"{self.receiver_ip_vpncloud}:3210"], ip=f"{self.sender_ip_vpncloud}/24") + self.sender.start_vpncloud(crypto=crypto, peers=[f"{self.receiver.private_ip}:3210"], ip=f"{self.sender_ip_vpncloud}/24") time.sleep(1.0) def stop_vpncloud(self): diff --git a/contrib/aws/quick_perf.py b/contrib/aws/quick_perf.py index e5d6524..2fb4c5a 100755 --- a/contrib/aws/quick_perf.py +++ b/contrib/aws/quick_perf.py @@ -12,7 +12,7 @@ env = EC2Environment( region = REGION, node_count = 2, instance_type = "m5.large", - use_spot = True, + use_spot = False, max_price = "0.08", # USD per hour per VM vpncloud_version = VERSION, vpncloud_file = FILE, @@ -45,11 +45,11 @@ class PerfTest: self.receiver.stop_iperf_server() return result - def start_vpncloud(self): + def start_vpncloud(self, crypto=None): eprint("\tSetting up vpncloud on receiver") - self.receiver.start_vpncloud(ip=f"{self.receiver_ip_vpncloud}/24") + self.receiver.start_vpncloud(crypto=crypto, ip=f"{self.receiver_ip_vpncloud}/24") eprint("\tSetting up vpncloud on sender") - self.sender.start_vpncloud(peers=[f"{self.receiver.private_ip}:3210"], ip=f"{self.sender_ip_vpncloud}/24") + self.sender.start_vpncloud(crypto=crypto, peers=[f"{self.receiver.private_ip}:3210"], ip=f"{self.sender_ip_vpncloud}/24") time.sleep(1.0) def stop_vpncloud(self): @@ -58,7 +58,7 @@ class PerfTest: def run(self): print() - self.start_vpncloud() + self.start_vpncloud(crypto="plain") throughput = self.run_iperf(self.receiver_ip_vpncloud)["throughput"] print(f"Throughput: {throughput / 1_000_000.0} MBit/s") native_ping_100 = self.run_ping(self.receiver.private_ip, 100)["rtt_avg"] diff --git a/src/engine/common.rs b/src/engine/common.rs index 0c549ad..a6ae106 100644 --- a/src/engine/common.rs +++ b/src/engine/common.rs @@ -57,7 +57,7 @@ impl GenericCloud::new( config.clone(), device.duplicate()?, - socket.clone(), + socket.try_clone().map_err(|e| Error::SocketIo("Failed to clone socket", e))?, traffic.clone(), peer_crypto.clone(), table.clone(), @@ -132,11 +132,11 @@ impl GenericCloud { } pub fn trigger_socket_event(&mut self) { - self.socket_thread.iteration() + self.socket_thread.iteration(); } pub fn trigger_device_event(&mut self) { - self.device_thread.iteration() + self.device_thread.iteration(); } pub fn trigger_housekeep(&mut self) { diff --git a/src/engine/device_thread.rs b/src/engine/device_thread.rs index f016101..46e85d6 100644 --- a/src/engine/device_thread.rs +++ b/src/engine/device_thread.rs @@ -102,8 +102,8 @@ impl DeviceThread Result<(), Error> { let (src, dst) = P::parse(self.buffer.message())?; debug!("Read data from interface: src: {}, dst: {}, {} bytes", src, dst, self.buffer.len()); - self.traffic.count_out_payload(dst, src, self.buffer.len()); - match self.table.lookup(dst) { + self.traffic.count_out_payload(dst.clone(), src, self.buffer.len()); + match self.table.lookup(&dst) { Some(addr) => { // Peer found for destination debug!("Found destination for {} => {}", dst, addr); @@ -129,7 +129,7 @@ impl DeviceThread bool { if self.device.read(&mut self.buffer).is_ok() { //try_fail!(result, "Failed to read from device: {}"); if let Err(e) = self.forward_packet() { @@ -141,17 +141,16 @@ impl DeviceThread SharedTable { self.cache.clear(); } - pub fn lookup(&mut self, addr: Address) -> Option { - if let Some(val) = self.cache.get(&addr) { + pub fn lookup(&mut self, addr: &Address) -> Option { + if let Some(val) = self.cache.get(addr) { return *val; } // if not found, use shared table and put into cache let val = self.table.lock().lookup(addr); - self.cache.insert(addr, val); + self.cache.insert(addr.clone(), val); val } @@ -173,10 +173,10 @@ impl SharedTable { self.cache.clear(); } - pub fn cache(&mut self, addr: Address, peer: SocketAddr) { - if self.cache.get(&addr) != Some(&Some(peer)) { - self.table.lock().cache(addr, peer); - self.cache.insert(addr, Some(peer)); + pub fn cache(&mut self, addr: &Address, peer: SocketAddr) { + if self.cache.get(addr) != Some(&Some(peer)) { + self.table.lock().cache(addr.clone(), peer); + self.cache.insert(addr.clone(), Some(peer)); } } diff --git a/src/engine/socket_thread.rs b/src/engine/socket_thread.rs index e2dd79e..afdea54 100644 --- a/src/engine/socket_thread.rs +++ b/src/engine/socket_thread.rs @@ -331,7 +331,7 @@ impl SocketThread SocketThread SocketThread bool { if let Ok(src) = self.socket.receive(&mut self.buffer) { match self.handle_message(src) { @@ -744,18 +744,17 @@ impl SocketThread IpAddr { s.local_addr().unwrap().ip() } -pub trait Socket: Sized + Clone + Send + Sync + 'static { +pub trait Socket: Sized + Send + Sync + 'static { fn receive(&mut self, buffer: &mut MsgBuffer) -> Result; fn send(&mut self, data: &[u8], addr: SocketAddr) -> Result; fn address(&self) -> Result; fn create_port_forwarding(&self) -> Option; + fn try_clone(&self) -> Result; } pub fn parse_listen(addr: &str, default_port: u16) -> SocketAddr { @@ -63,12 +64,6 @@ impl NetSocket { } } -impl Clone for NetSocket { - fn clone(&self) -> Self { - Self(self.0.clone()) - } -} - impl Socket for NetSocket { fn create_port_forwarding(&self) -> Option { PortForwarding::new(self.0.local_addr().unwrap().port()) @@ -90,6 +85,10 @@ impl Socket for NetSocket { addr.set_ip(get_ip()); Ok(addr) } + + fn try_clone(&self) -> Result { + Ok(Self(self.0.clone())) + } } thread_local! { @@ -173,6 +172,10 @@ impl Socket for MockSocket { fn create_port_forwarding(&self) -> Option { None } + + fn try_clone(&self) -> Result { + Ok(self.clone()) + } } #[cfg(feature = "bench")] diff --git a/src/table.rs b/src/table.rs index f91aece..8a86697 100644 --- a/src/table.rs +++ b/src/table.rs @@ -91,9 +91,9 @@ impl ClaimTable { self.housekeep() } - pub fn lookup(&mut self, addr: Address) -> Option { + pub fn lookup(&mut self, addr: &Address) -> Option { // HOT PATH - if let Some(entry) = self.cache.get(&addr) { + if let Some(entry) = self.cache.get(addr) { return Some(entry.peer); } // COLD PATH @@ -107,7 +107,7 @@ impl ClaimTable { } if let Some(entry) = found { self.cache.insert( - addr, + addr.clone(), CacheValue { peer: entry.peer, timeout: min(TS::now() + self.cache_timeout as Time, entry.timeout) }, ); return Some(entry.peer); diff --git a/src/traffic.rs b/src/traffic.rs index a047758..fe95264 100644 --- a/src/traffic.rs +++ b/src/traffic.rs @@ -228,7 +228,7 @@ impl TrafficStats { if let Some(entry) = self.payload.get_mut(key) { *entry += data } else { - self.payload.insert(*key, data.clone()); + self.payload.insert(key.clone(), data.clone()); } } self.dropped += &other.dropped diff --git a/src/types.rs b/src/types.rs index dba7d57..785b58e 100644 --- a/src/types.rs +++ b/src/types.rs @@ -20,7 +20,7 @@ pub const NODE_ID_BYTES: usize = 16; pub type NodeId = [u8; NODE_ID_BYTES]; -#[derive(Eq, Clone, Copy)] +#[derive(Eq, Clone)] pub struct Address { pub data: [u8; 16], pub len: u8, @@ -126,7 +126,7 @@ impl FromStr for Address { } } -#[derive(PartialEq, Eq, Hash, Clone, Copy)] +#[derive(PartialEq, Eq, Hash, Clone)] pub struct Range { pub base: Address, pub prefix_len: u8, @@ -135,7 +135,7 @@ pub struct Range { pub type RangeList = SmallVec<[Range; 4]>; impl Range { - pub fn matches(&self, addr: Address) -> bool { + pub fn matches(&self, addr: &Address) -> bool { if self.base.len != addr.len { return false; } diff --git a/src/wsproxy.rs b/src/wsproxy.rs index 1c55fda..251a86e 100644 --- a/src/wsproxy.rs +++ b/src/wsproxy.rs @@ -13,9 +13,14 @@ use std::{ io::{self, Cursor, Read, Write}, net::{Ipv6Addr, SocketAddr, SocketAddrV6, TcpListener, TcpStream, UdpSocket}, os::unix::io::{AsRawFd, RawFd}, - thread, sync::Arc, + thread, +}; +use tungstenite::{ + accept, connect, + protocol::WebSocket, + stream::{MaybeTlsStream, NoDelay}, + Message, }; -use tungstenite::{connect, protocol::WebSocket, Message, accept, stream::{MaybeTlsStream, NoDelay}}; use url::Url; macro_rules! io_error { @@ -107,10 +112,9 @@ pub fn run_proxy(listen: &str) -> Result<(), io::Error> { Ok(()) } -#[derive(Clone)] pub struct ProxyConnection { addr: SocketAddr, - socket: Arc>>, + socket: WebSocket>, } impl ProxyConnection { @@ -119,7 +123,7 @@ impl ProxyConnection { let (mut socket, _) = io_error!(connect(parsed_url), "Failed to connect to URL {}: {}", url)?; socket.get_mut().set_nodelay(true)?; let addr = "0.0.0.0:0".parse::().unwrap(); - let mut con = ProxyConnection { addr, socket: Arc::new(socket) }; + let mut con = ProxyConnection { addr, socket }; let addr_data = con.read_message()?; con.addr = read_addr(Cursor::new(&addr_data))?; Ok(con) @@ -127,12 +131,9 @@ impl ProxyConnection { fn read_message(&mut self) -> Result, io::Error> { loop { - unimplemented!(); - /* if let Message::Binary(data) = io_error!(self.socket.read_message(), "Failed to read from ws proxy: {}")? { return Ok(data); } - */ } } } @@ -141,7 +142,7 @@ impl AsRawFd for ProxyConnection { fn as_raw_fd(&self) -> RawFd { match self.socket.get_ref() { MaybeTlsStream::Plain(stream) => stream.as_raw_fd(), - _ => unimplemented!() + _ => unimplemented!(), } } } @@ -163,14 +164,23 @@ impl Socket for ProxyConnection { let mut msg = Vec::with_capacity(data.len() + 18); write_addr(addr, &mut msg)?; msg.write_all(data)?; - unimplemented!(); - /* io_error!(self.socket.write_message(Message::Binary(msg)), "Failed to write to ws proxy: {}")?; Ok(data.len()) - */ } fn address(&self) -> Result { Ok(self.addr) } + + fn try_clone(&self) -> Result { + let socket = match self.socket.get_ref() { + MaybeTlsStream::Plain(stream) => WebSocket::from_raw_socket( + MaybeTlsStream::Plain(stream.try_clone()?), + tungstenite::protocol::Role::Client, + Some(*self.socket.get_config()), + ), + _ => unimplemented!(), + }; + Ok(Self { addr: self.addr, socket }) + } }