author int64 658 755k | date stringlengths 19 19 | timezone int64 -46,800 43.2k | hash stringlengths 40 40 | message stringlengths 5 490 | mods list | language stringclasses 20 values | license stringclasses 3 values | repo stringlengths 5 68 | original_message stringlengths 12 491 |
|---|---|---|---|---|---|---|---|---|---|
20,244 | 01.01.2020 13:52:26 | 18,000 | e084ce71fff1e04548d896b4cf725967b5270b99 | Minor Rita dependency updates | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -129,12 +129,12 @@ dependencies = [\n[[package]]\nname = \"actix_derive\"\n-version = \"0.4.0\"\n+version = \"0.5.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\ndependencies = [\n- \"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n[[package]]\n@@ -497,21 +497,6 @@ dependencies = [\n\"serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n-[[package]]\n-name = \"config\"\n-version = \"0.9.3\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-dependencies = [\n- \"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"serde-hjson 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n-]\n-\n[[package]]\nname = \"config\"\nversion = \"0.10.1\"\n@@ -661,16 +646,6 @@ dependencies = [\n\"strsim 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n-[[package]]\n-name = \"dotenv\"\n-version = \"0.14.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-dependencies = [\n- \"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n-]\n-\n[[package]]\nname = \"dotenv\"\nversion = \"0.15.0\"\n@@ -1239,11 +1214,6 @@ name = \"language-tags\"\nversion = \"0.2.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-[[package]]\n-name = \"lazy_static\"\n-version = \"0.2.11\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-\n[[package]]\nname = \"lazy_static\"\nversion = \"1.4.0\"\n@@ -1468,7 +1438,7 @@ dependencies = [\n[[package]]\nname = \"mockito\"\n-version = \"0.21.0\"\n+version = \"0.22.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\ndependencies = [\n\"assert-json-diff 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -2175,7 +2145,7 @@ dependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web-httpauth 0.2.0 (git+https://github.com/althea-mesh/actix-web-httpauth)\",\n- \"actix_derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"actix_derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"althea_kernel_interface 0.1.0\",\n\"althea_types 0.1.0\",\n\"arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -2186,10 +2156,10 @@ dependencies = [\n\"clarity 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"clu 0.0.1\",\n\"compressed_log 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"config 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"config 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"diesel 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"docopt 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"dotenv 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"dotenv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"eui48 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"exit_db 0.1.0\",\n@@ -2204,7 +2174,7 @@ dependencies = [\n\"lettre_email 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"minihttpse 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"mockito 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"mockito 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"mockstream 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"num256 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -2365,18 +2335,6 @@ dependencies = [\n\"serde_derive 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n-[[package]]\n-name = \"serde-hjson\"\n-version = \"0.8.2\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-dependencies = [\n- \"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)\",\n-]\n-\n[[package]]\nname = \"serde-hjson\"\nversion = \"0.9.1\"\n@@ -2857,14 +2815,6 @@ dependencies = [\n\"tokio-reactor 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n-[[package]]\n-name = \"toml\"\n-version = \"0.4.10\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-dependencies = [\n- \"serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)\",\n-]\n-\n[[package]]\nname = \"toml\"\nversion = \"0.5.5\"\n@@ -3205,7 +3155,7 @@ dependencies = [\n\"checksum actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\" = \"b0ac60f86c65a50b140139f499f4f7c6e49e4b5d88fbfba08e4e3975991f7bf4\"\n\"checksum actix-web-httpauth 0.2.0 (git+https://github.com/althea-mesh/actix-web-httpauth)\" = \"<none>\"\n\"checksum actix_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"4300e9431455322ae393d43a2ba1ef96b8080573c0fc23b196219efedfb6ba69\"\n-\"checksum actix_derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"0bf5f6d7bf2d220ae8b4a7ae02a572bb35b7c4806b24049af905ab8110de156c\"\n+\"checksum actix_derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"b95aceadaf327f18f0df5962fedc1bde2f870566a0b9f65c89508a3b1f79334c\"\n\"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2\"\n\"checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)\" = \"81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5\"\n\"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)\" = \"58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d\"\n@@ -3242,7 +3192,6 @@ dependencies = [\n\"checksum colored 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"433e7ac7d511768127ed85b0c4947f47a254131e37864b2dc13f52aa32cd37e5\"\n\"checksum compressed_log 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"9af3e5ff9d575755caa41a1e669c952345892f961aa0fd2e2f04e71c9f7fd278\"\n\"checksum config 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"19b076e143e1d9538dde65da30f8481c2a6c44040edb8e02b9bf1351edb92ce3\"\n-\"checksum config 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"f9107d78ed62b3fa5a86e7d18e647abed48cfd8f8fab6c72f4cdb982d196f7e6\"\n\"checksum cookie 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"99be24cfcf40d56ed37fd11c2123be833959bbc5bddecb46e1c2e442e15fa3e0\"\n\"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d\"\n\"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b\"\n@@ -3258,7 +3207,6 @@ dependencies = [\n\"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198\"\n\"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5\"\n\"checksum docopt 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"7f525a586d310c87df72ebcd98009e57f1cc030c8c268305287a476beb653969\"\n-\"checksum dotenv 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"4424bad868b0ffe6ae351ee463526ba625bbca817978293bbe6bb7dc1804a175\"\n\"checksum dotenv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f\"\n\"checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e\"\n\"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3\"\n@@ -3326,7 +3274,6 @@ dependencies = [\n\"checksum keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7\"\n\"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d\"\n\"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a\"\n-\"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)\" = \"76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73\"\n\"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646\"\n\"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f\"\n\"checksum lettre 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"c66afaa5dfadbb81d4e00fd1d1ab057c7cd4c799c5a44e0009386d553587e728\"\n@@ -3353,7 +3300,7 @@ dependencies = [\n\"checksum mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)\" = \"302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f\"\n\"checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)\" = \"966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125\"\n\"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919\"\n-\"checksum mockito 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"aee38c301104cc75a6628a4360be706fbdf84290c15a120b7e54eca5881c3450\"\n+\"checksum mockito 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"4e524e85ea7c80559354217a6470c14abc2411802a9996aed1821559b9e28e3c\"\n\"checksum mockstream 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"35bbe0c0c9d254b463b13734bc361d1423289547e052b1e77e5a77292496ba2e\"\n\"checksum native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"4b2df1a4c22fd44a62147fd8f13dd0f95c9d8ca7b2610299b2a2f9cf8964274e\"\n\"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)\" = \"42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88\"\n@@ -3448,7 +3395,6 @@ dependencies = [\n\"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3\"\n\"checksum serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)\" = \"9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8\"\n\"checksum serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)\" = \"1217f97ab8e8904b57dd22eb61cde455fa7446a9c1cf43966066da047c1f3702\"\n-\"checksum serde-hjson 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"0b833c5ad67d52ced5f5938b2980f32a9c1c5ef047f0b4fb3127e7a423c76153\"\n\"checksum serde-hjson 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"6a3a4e0ea8a88553209f6cc6cfe8724ecad22e1acf372793c27d995290fe74f8\"\n\"checksum serde-rlp 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"69472f967577700225f282233c0625f7b73c371c3953b72d6dcfb91bd0133ca9\"\n\"checksum serde_bytes 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)\" = \"defbb8a83d7f34cc8380751eeb892b825944222888aff18996ea7901f24aec88\"\n@@ -3494,7 +3440,6 @@ dependencies = [\n\"checksum tokio-timer 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)\" = \"1739638e364e558128461fc1ad84d997702c8e31c2e6b18fb99842268199e827\"\n\"checksum tokio-udp 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)\" = \"f02298505547f73e60f568359ef0d016d5acd6e830ab9bc7c4a5b3403440121b\"\n\"checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)\" = \"037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445\"\n-\"checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)\" = \"758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f\"\n\"checksum toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)\" = \"01d1404644c8b12b16bfcffa4322403a91a451584daaaa7c28d3152e6cbc98cf\"\n\"checksum tower-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"b32f72af77f1bfe3d3d4da8516a238ebe7039b51dd8637a09841ac7f16d2c987\"\n\"checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079\"\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/Cargo.toml",
"new_path": "rita/Cargo.toml",
"diff": "@@ -27,12 +27,12 @@ web30 = {git = \"https://github.com/althea-mesh/web30\", branch = \"master\"}\nactix = \"0.7\"\nactix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\nactix-web-httpauth = {git = \"https://github.com/althea-mesh/actix-web-httpauth\"}\n-actix_derive = \"0.4\"\n+actix_derive = \"0.5\"\nbytes = \"0.4\"\n-config = \"0.9\"\n+config = \"0.10\"\ndiesel = { version = \"1.4\", features = [\"postgres\", \"r2d2\"] }\ndocopt = \"1.1\"\n-dotenv = \"0.14\"\n+dotenv = \"0.15\"\nenv_logger = \"0.7\"\nfailure = \"0.1\"\nfutures01 = { package = \"futures\", version = \"0.1\"}\n@@ -42,7 +42,7 @@ ipnetwork = \"0.14\"\nlazy_static = \"1.4\"\nlog = { version = \"0.4\", features = [\"release_max_level_info\"] }\nminihttpse = \"0.1\"\n-mockito = \"0.21\"\n+mockito = \"0.22\"\nmockstream = \"0.0\"\nrand = \"0.7\"\nserde = \"1.0\"\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Minor Rita dependency updates |
20,244 | 01.01.2020 18:32:27 | 18,000 | 7f6cf79cceaf846c5b172052a68e83692cd0b7f0 | Fix Travis by using newer version of Cross
This isn't really a long term solution, just until Cross gets updated
in crates.io to handle it. | [
{
"change_type": "MODIFY",
"old_path": ".travis.yml",
"new_path": ".travis.yml",
"diff": "@@ -7,7 +7,7 @@ before_install:\n- sudo add-apt-repository universe\n- sudo apt-get -qq update\n- sudo apt-get install -y iperf3 libsqlite3-dev postgresql-client-11 postgresql-server-dev-11 libpq-dev python3-pip bridge-utils wireguard linux-source linux-headers-$(uname -r) curl git libssl-dev pkg-config build-essential ipset python3-setuptools python3-wheel\n- - cargo install cross --force\n+ - cargo install --git https://github.com/rust-embedded/cross --force\nenv:\nmatrix:\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Fix Travis by using newer version of Cross
This isn't really a long term solution, just until Cross gets updated
in crates.io to handle it. |
20,244 | 02.01.2020 08:23:28 | 18,000 | 627f4b668ef78556cf6a3fb59553140bcfa63679 | Cargo Cross from master has openssl issues
So the updated script does manage to run Cargo but does not actually
finish the build, we're just going to go back to the latest release
and allow beta to fail for now. | [
{
"change_type": "MODIFY",
"old_path": ".travis.yml",
"new_path": ".travis.yml",
"diff": "@@ -7,7 +7,7 @@ before_install:\n- sudo add-apt-repository universe\n- sudo apt-get -qq update\n- sudo apt-get install -y iperf3 libsqlite3-dev postgresql-client-11 postgresql-server-dev-11 libpq-dev python3-pip bridge-utils wireguard linux-source linux-headers-$(uname -r) curl git libssl-dev pkg-config build-essential ipset python3-setuptools python3-wheel\n- - cargo install --git https://github.com/rust-embedded/cross --force\n+ - cargo install cross --force\nenv:\nmatrix:\n@@ -32,6 +32,7 @@ script:\nmatrix:\nallow_failures:\n- rust: nightly\n+ - rust: beta\nfast_finish: true\ninclude:\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Cargo Cross from master has openssl issues
So the updated script does manage to run Cargo but does not actually
finish the build, we're just going to go back to the latest release
and allow beta to fail for now. |
20,244 | 03.01.2020 08:15:56 | 18,000 | 4faa274ddcd83e830318a4c77fbe7e731f7b97c6 | Update default bridge configuration for mcd
This updates the addresses for DAI related contracts to the new
multi collateral versions.
I've also decided to stick with .org as the common domain for the
full node clusters as that most closely aligns with our goals for
a free to use API cluster. | [
{
"change_type": "MODIFY",
"old_path": "settings/src/payment.rs",
"new_path": "settings/src/payment.rs",
"diff": "@@ -63,7 +63,7 @@ fn default_debts_file() -> String {\nfn default_bridge_addresses() -> TokenBridgeAddresses {\nTokenBridgeAddresses {\n- uniswap_address: Address::from_str(\"0x09cabEC1eAd1c0Ba254B09efb3EE13841712bE14\").unwrap(),\n+ uniswap_address: Address::from_str(\"0x2a1530C4C41db0B0b2bB646CB5Eb1A67b7158667\").unwrap(),\nxdai_foreign_bridge_address: Address::from_str(\n\"0x7301CFA0e1756B71869E93d4e4Dca5c7d0eb0AA6\",\n)\n@@ -71,11 +71,11 @@ fn default_bridge_addresses() -> TokenBridgeAddresses {\nxdai_home_bridge_address: Address::from_str(\"0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016\")\n.unwrap(),\nforeign_dai_contract_address: Address::from_str(\n- \"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359\",\n+ \"0x6b175474e89094c44da98b954eedeac495271d0f\",\n)\n.unwrap(),\neth_full_node_url: \"https://eth.althea.org\".into(),\n- xdai_full_node_url: \"https://dai.althea.net\".into(),\n+ xdai_full_node_url: \"https://dai.althea.org\".into(),\n}\n}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Update default bridge configuration for mcd
This updates the addresses for DAI related contracts to the new
multi collateral versions.
I've also decided to stick with .org as the common domain for the
full node clusters as that most closely aligns with our goals for
a free to use API cluster. |
20,244 | 03.01.2020 19:59:14 | 18,000 | 1b355220a186a5968c590f259120c5e836c3e4d4 | Better monitoring for exit edge cases
Just saw these come up in prod, figure we should keep an eye on them | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_exit/database/mod.rs",
"new_path": "rita/src/rita_exit/database/mod.rs",
"diff": "@@ -84,7 +84,10 @@ pub fn get_database_connection(\n.timeout(Duration::from_secs(1))\n.then(|result| match result {\nOk(v) => Ok(v),\n- Err(e) => Err(format_err!(\"{:?}\", e)),\n+ Err(e) => {\n+ error!(\"Failed to get DB connection with {:?}\", e);\n+ Err(format_err!(\"{:?}\", e))\n+ }\n}),\n)\n}\n@@ -339,7 +342,10 @@ fn low_balance_notification(\n}\n}\n(Some(_), false) => {}\n- (None, _) => error!(\"Client is registered but has no phone number!\"),\n+ (None, _) => error!(\n+ \"Client {} is registered but has no phone number!\",\n+ client.global.wg_public_key\n+ ),\n},\n(Some(true), Some(ExitVerifSettings::Email(val))) => match (\nclient.reg_details.email.clone(),\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Better monitoring for exit edge cases
Just saw these come up in prod, figure we should keep an eye on them |
20,244 | 03.01.2020 20:14:09 | 18,000 | b5660f402f545d346de5f15e5a92b49a122fd63b | Bump for Beta 11 RC3 | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -175,7 +175,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.28\",\n+ \"rita 0.5.29\",\n]\n[[package]]\n@@ -2140,7 +2140,7 @@ dependencies = [\n[[package]]\nname = \"rita\"\n-version = \"0.5.28\"\n+version = \"0.5.29\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/Cargo.toml",
"new_path": "rita/Cargo.toml",
"diff": "[package]\nname = \"rita\"\n-version = \"0.5.28\"\n+version = \"0.5.29\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/dashboard/own_info.rs",
"new_path": "rita/src/rita_common/dashboard/own_info.rs",
"diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 11 RC2\";\n+pub static READABLE_VERSION: &str = \"Beta 11 RC3\";\n#[derive(Serialize)]\npub struct OwnInfo {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Bump for Beta 11 RC3 |
20,244 | 03.01.2020 22:24:41 | 18,000 | 361f2769bb6bfae72dfb98f31bab84eb3ec32f42 | Fix tests for add_ipv4_addr | [
{
"change_type": "MODIFY",
"old_path": "althea_kernel_interface/src/ip_addr.rs",
"new_path": "althea_kernel_interface/src/ip_addr.rs",
"diff": "@@ -56,7 +56,7 @@ fn test_add_ipv4() {\nKI.set_mock(Box::new(move |program, args| {\nassert_eq!(program, \"ip\");\n- assert_eq!(args, &[\"addr\", \"add\", \"192.168.31.2/32\", \"dev\", \"eth0\"]);\n+ assert_eq!(args, &[\"addr\", \"add\", \"192.168.31.2/24\", \"dev\", \"eth0\"]);\nOk(Output {\nstdout: b\"\".to_vec(),\n@@ -71,7 +71,7 @@ fn test_add_ipv4() {\nKI.set_mock(Box::new(move |program, args| {\nassert_eq!(program, \"ip\");\n- assert_eq!(args, &[\"addr\", \"add\", \"192.168.31.2/32\", \"dev\", \"eth0\"]);\n+ assert_eq!(args, &[\"addr\", \"add\", \"192.168.31.2/24\", \"dev\", \"eth0\"]);\nOk(Output {\nstdout: b\"\".to_vec(),\n@@ -84,7 +84,7 @@ fn test_add_ipv4() {\nKI.set_mock(Box::new(move |program, args| {\nassert_eq!(program, \"ip\");\n- assert_eq!(args, &[\"addr\", \"add\", \"192.168.31.2/32\", \"dev\", \"eth0\"]);\n+ assert_eq!(args, &[\"addr\", \"add\", \"192.168.31.2/24\", \"dev\", \"eth0\"]);\nOk(Output {\nstdout: b\"\".to_vec(),\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Fix tests for add_ipv4_addr |
20,244 | 07.01.2020 07:58:47 | 18,000 | 24b5a09d20d05e1a5230fbb07a9e16cccd5c8488 | Log how much validated payments are worth
This will help reduce the error bars when inspecting payments
in and out for a node. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/payment_validator/mod.rs",
"new_path": "rita/src/rita_common/payment_validator/mod.rs",
"diff": "@@ -250,8 +250,8 @@ fn handle_tx_messaging(\n// we where successfully paid\n(true, false, true) => {\ninfo!(\n- \"payment {:#066x} from {} successfully validated!\",\n- txid, from_address\n+ \"payment {:#066x} from {} for {} wei successfully validated!\",\n+ txid, from_address, amount\n);\nDebtKeeper::from_registry().do_send(PaymentReceived {\nfrom: pmt.from,\n@@ -268,8 +268,8 @@ fn handle_tx_messaging(\n// we suceessfully paid someone\n(false, true, true) => {\ninfo!(\n- \"payment {:#066x} from {} successfully sent!\",\n- txid, from_address\n+ \"payment {:#066x} from {} for {} wei successfully sent!\",\n+ txid, from_address, amount\n);\nDebtKeeper::from_registry().do_send(PaymentSucceeded {\nto: pmt.to,\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Log how much validated payments are worth
This will help reduce the error bars when inspecting payments
in and out for a node. |
20,244 | 01.12.2019 08:07:37 | 18,000 | 0bd27fc9323f7c4f83ac033bb331a9cf234bf948 | Break out id_callback from tunnel manager
Last time I spent a whole morning trying to do this in one big refactor
but that didn't end up working out so now we're going to do it one bit
at a time. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/hello_handler/mod.rs",
"new_path": "rita/src/rita_common/hello_handler/mod.rs",
"diff": "//! peer listener gets udp ImHere -> TunnelManager tries to contact peer with hello\n//! -> hello manager actually manages that request -> hello manager calls back to tunnel manager\n-use tokio::net::TcpStream as TokioTcpStream;\n-\n-use ::actix::prelude::*;\n-use ::actix::registry::SystemService;\n-use actix_web::*;\n-\n-use futures01::future::ok as future_ok;\n-use futures01::Future;\n-\n-use althea_types::LocalIdentity;\n-\nuse crate::rita_common::peer_listener::Peer;\n-use crate::rita_common::tunnel_manager::{IdentityCallback, PortCallback, TunnelManager};\n-\n+use crate::rita_common::tunnel_manager::id_callback::IdentityCallback;\n+use crate::rita_common::tunnel_manager::{PortCallback, TunnelManager};\n+use actix::{Context, Message, Supervised, SystemService, Actor, ResponseFuture, Handler};\nuse actix_web::client::Connection;\n+use actix_web::{client, HttpMessage, Result};\n+use althea_types::LocalIdentity;\nuse failure::Error;\n+use futures01::future::ok as future_ok;\n+use futures01::Future;\n+use tokio::net::TcpStream as TokioTcpStream;\n#[derive(Default)]\npub struct HelloHandler;\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/network_endpoints/mod.rs",
"new_path": "rita/src/rita_common/network_endpoints/mod.rs",
"diff": "//! Network endptoints for common Rita functionality (such as exchanging hello messages)\n-use althea_types::{LocalIdentity, PaymentTx};\n-\n-use ::actix::registry::SystemService;\n+use crate::rita_common::payment_validator::{PaymentValidator, ToValidate, ValidateLater};\n+use crate::rita_common::peer_listener::Peer;\n+use crate::rita_common::tunnel_manager::id_callback::IdentityCallback;\n+use crate::rita_common::tunnel_manager::TunnelManager;\n+use crate::SETTING;\n+use actix::registry::SystemService;\nuse actix_web::http::StatusCode;\n-use actix_web::*;\n-\nuse futures01::{future, Future};\n-\n+use actix_web::{AsyncResponder, HttpRequest, HttpResponse, Json, Result};\n+use althea_types::{LocalIdentity, PaymentTx};\nuse failure::Error;\n-\n-use crate::SETTING;\nuse settings::RitaCommonSettings;\n-\n+use std::boxed::Box;\nuse std::net::SocketAddr;\n-\n-use crate::rita_common::payment_validator::{PaymentValidator, ToValidate, ValidateLater};\n-use crate::rita_common::peer_listener::Peer;\n-use crate::rita_common::tunnel_manager::{IdentityCallback, TunnelManager};\n-\nuse std::time::Instant;\n-use std::boxed::Box;\n-\n#[derive(Serialize)]\npub struct JsonStatusResponse {\nresponse: String,\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "rita/src/rita_common/tunnel_manager/id_callback.rs",
"diff": "+use crate::rita_common::peer_listener::Peer;\n+use crate::rita_common::tunnel_manager::Tunnel;\n+use crate::rita_common::tunnel_manager::TunnelManager;\n+use actix::{Context, Handler, Message};\n+use althea_types::LocalIdentity;\n+\n+pub struct IdentityCallback {\n+ pub local_identity: LocalIdentity,\n+ pub peer: Peer,\n+ pub our_port: Option<u16>,\n+}\n+\n+impl IdentityCallback {\n+ pub fn new(\n+ local_identity: LocalIdentity,\n+ peer: Peer,\n+ our_port: Option<u16>,\n+ ) -> IdentityCallback {\n+ IdentityCallback {\n+ local_identity,\n+ peer,\n+ our_port,\n+ }\n+ }\n+}\n+\n+impl Message for IdentityCallback {\n+ type Result = Option<(Tunnel, bool)>;\n+}\n+\n+// An attempt to contact a neighbor has succeeded or a neighbor has contacted us, either way\n+// we need to allocate a tunnel for them and place it onto our local storage. In the case\n+// that a neighbor contacts us we don't have a port already allocated and we need to choose one\n+// in the case that we have atempted to contact a neighbor we have already sent them a port that\n+// we now must attach to their tunnel entry. If we also return a bool for if the tunnel already\n+// exists\n+impl Handler<IdentityCallback> for TunnelManager {\n+ type Result = Option<(Tunnel, bool)>;\n+\n+ fn handle(&mut self, msg: IdentityCallback, _: &mut Context<Self>) -> Self::Result {\n+ let our_port = match msg.our_port {\n+ Some(port) => port,\n+ _ => match self.get_port(0) {\n+ Some(p) => p,\n+ None => {\n+ warn!(\"Failed to allocate tunnel port! All tunnel opening will fail\");\n+ return None;\n+ }\n+ },\n+ };\n+\n+ let res = self.open_tunnel(msg.local_identity, msg.peer, our_port);\n+ match res {\n+ Ok(res) => Some(res),\n+ Err(e) => {\n+ warn!(\"Open Tunnel failed with {:?}\", e);\n+ None\n+ }\n+ }\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/tunnel_manager/mod.rs",
"new_path": "rita/src/rita_common/tunnel_manager/mod.rs",
"diff": "//! up tunnels if they respond, likewise if someone calls us their hello goes through network_endpoints\n//! then into TunnelManager to open a tunnel for them.\n+pub mod id_callback;\n+\nuse crate::rita_common;\nuse crate::rita_common::hello_handler::Hello;\nuse crate::rita_common::peer_listener::Peer;\n@@ -427,62 +429,6 @@ impl Handler<TunnelUnMonitorFailure> for TunnelManager {\n}\n}\n-pub struct IdentityCallback {\n- pub local_identity: LocalIdentity,\n- pub peer: Peer,\n- pub our_port: Option<u16>,\n-}\n-\n-impl IdentityCallback {\n- pub fn new(\n- local_identity: LocalIdentity,\n- peer: Peer,\n- our_port: Option<u16>,\n- ) -> IdentityCallback {\n- IdentityCallback {\n- local_identity,\n- peer,\n- our_port,\n- }\n- }\n-}\n-\n-impl Message for IdentityCallback {\n- type Result = Option<(Tunnel, bool)>;\n-}\n-\n-// An attempt to contact a neighbor has succeeded or a neighbor has contacted us, either way\n-// we need to allocate a tunnel for them and place it onto our local storage. In the case\n-// that a neighbor contacts us we don't have a port already allocated and we need to choose one\n-// in the case that we have atempted to contact a neighbor we have already sent them a port that\n-// we now must attach to their tunnel entry. If we also return a bool for if the tunnel already\n-// exists\n-impl Handler<IdentityCallback> for TunnelManager {\n- type Result = Option<(Tunnel, bool)>;\n-\n- fn handle(&mut self, msg: IdentityCallback, _: &mut Context<Self>) -> Self::Result {\n- let our_port = match msg.our_port {\n- Some(port) => port,\n- _ => match self.get_port(0) {\n- Some(p) => p,\n- None => {\n- warn!(\"Failed to allocate tunnel port! All tunnel opening will fail\");\n- return None;\n- }\n- },\n- };\n-\n- let res = self.open_tunnel(msg.local_identity, msg.peer, our_port);\n- match res {\n- Ok(res) => Some(res),\n- Err(e) => {\n- warn!(\"Open Tunnel failed with {:?}\", e);\n- None\n- }\n- }\n- }\n-}\n-\n// An attempt to contact a neighbor has failed and we need to return the port to\n// the available ports list\npub struct PortCallback(pub u16);\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Break out id_callback from tunnel manager
Last time I spent a whole morning trying to do this in one big refactor
but that didn't end up working out so now we're going to do it one bit
at a time. |
20,244 | 03.12.2019 15:44:50 | 18,000 | 7b08640fd97bf1ebbda683740488e005d979ca3d | Handle bridge attach case | [
{
"change_type": "MODIFY",
"old_path": "althea_types/src/interop.rs",
"new_path": "althea_types/src/interop.rs",
"diff": "@@ -11,7 +11,7 @@ use std::net::Ipv4Addr;\nuse std::str::FromStr;\n#[cfg(feature = \"actix\")]\n-use actix::{ActorFuture, ActorStream, Message};\n+use actix::Message;\n/// This is how nodes are identified.\n#[derive(Debug, Serialize, Deserialize, Clone, Copy)]\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/light_client_handler/mod.rs",
"new_path": "rita/src/rita_client/light_client_handler/mod.rs",
"diff": "@@ -136,7 +136,7 @@ pub struct LightClientManager {\nimpl Default for LightClientManager {\nfn default() -> LightClientManager {\nLightClientManager {\n- start_address: \"192.168.80.1\".parse().unwrap(),\n+ start_address: \"192.168.20.1\".parse().unwrap(),\nprefix: 24,\nassigned_addresses: HashSet::new(),\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/rita_loop/mod.rs",
"new_path": "rita/src/rita_client/rita_loop/mod.rs",
"diff": "@@ -23,8 +23,8 @@ use failure::Error;\nuse futures01::future::Future;\nuse settings::client::RitaClientSettings;\nuse settings::RitaCommonSettings;\n+use std::net::{SocketAddr, UdpSocket};\nuse std::time::{Duration, Instant};\n-use std::net::{UdpSocket, SocketAddr};\ntype Resolver = resolver::Resolver;\n#[derive(Default)]\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/tunnel_manager/mod.rs",
"new_path": "rita/src/rita_common/tunnel_manager/mod.rs",
"diff": "@@ -284,7 +284,7 @@ impl Tunnel {\nif let Err(e) = KI.del_interface(&self.iface_name) {\nerror!(\"Failed to delete wg interface! {:?}\", e);\n}\n- if let Err(e) = KI.del_if_from_bridge(\"br-phone-net\", &self.iface_name) {\n+ if let Err(e) = KI.del_if_from_bridge(\"br-phone_net\", &self.iface_name) {\nerror!(\"Failed to delete wg interface! {:?}\", e);\n}\nTunnelManager::from_registry().do_send(PortCallback(self.listen_port));\n@@ -994,7 +994,7 @@ fn create_new_tunnel(\ntunnel.monitor(0);\n}\nSome(_) => {\n- // TODO insted of monitoring attach tunnel to br-phone-net\n+ KI.add_if_to_bridge(\"br-phone_net\", &tunnel.iface_name)?;\n}\n}\nOk((new_key, tunnel))\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Handle bridge attach case |
20,244 | 19.12.2019 05:22:31 | 18,000 | 227d12e33a57484617df29b52872d4b08fd16ac6 | Add assigned addresses to the assigned list | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/light_client_handler/mod.rs",
"new_path": "rita/src/rita_client/light_client_handler/mod.rs",
"diff": "@@ -173,6 +173,7 @@ impl Handler<GetAddress> for LightClientManager {\nwhile self.assigned_addresses.contains(&new_address) {\nnew_address = incrementv4(new_address, self.prefix)?;\n}\n+ self.assigned_addresses.insert(new_address);\nOk(new_address)\n}\n}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Add assigned addresses to the assigned list |
20,244 | 19.12.2019 05:22:46 | 18,000 | 7b74960d84d22b60c49a86bbb28fce3eb71790ec | Use more generic endpoint name
It's possible we will have non-phone devices use this endpoint some day
so best to make it generic now. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/rita_loop/mod.rs",
"new_path": "rita/src/rita_client/rita_loop/mod.rs",
"diff": "@@ -194,7 +194,7 @@ fn check_for_gateway_client_billing_corner_case() -> impl Future<Item = (), Erro\npub fn start_rita_client_endpoints(workers: usize) {\nserver::new(|| {\n- App::new().resource(\"/mobile_hello\", |r| {\n+ App::new().resource(\"/light_client_hello\", |r| {\nr.method(Method::POST).with(light_client_hello_response)\n})\n// .resource(\"/mobile_debt\", |r| {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Use more generic endpoint name
It's possible we will have non-phone devices use this endpoint some day
so best to make it generic now. |
20,244 | 19.12.2019 08:12:08 | 18,000 | f4558a523d50ffe7e0efa61061bc5df375f01579 | Add nat rules for tunnel
Originally the plan was to attach the new interface to a bridge
which would then have nat rules applied, this is easier than managing
bridge logic in exchange for potentially polluting the nat table in the
case that we have many phone clients | [
{
"change_type": "MODIFY",
"old_path": "althea_kernel_interface/src/open_tunnel.rs",
"new_path": "althea_kernel_interface/src/open_tunnel.rs",
"diff": "@@ -78,7 +78,7 @@ impl dyn KernelInterface {\nlet allowed_addresses = match allowed_ipv4_address {\nNone => \"::/0\".to_string(),\n- Some(addr) => format!(\"::/0,{}/32\", addr),\n+ Some(_) => format!(\"::/0,0.0.0.0/0\"),\n};\nlet socket_connect_str = socket_to_string(endpoint, phy_name);\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/light_client_handler/mod.rs",
"new_path": "rita/src/rita_client/light_client_handler/mod.rs",
"diff": "@@ -8,6 +8,7 @@ use crate::rita_common::peer_listener::Peer;\nuse crate::rita_common::tunnel_manager::id_callback::IdentityCallback;\nuse crate::rita_common::tunnel_manager::TunnelManager;\nuse crate::rita_common::utils::ip_increment::incrementv4;\n+use crate::KI;\nuse crate::SETTING;\nuse actix::{Actor, Context, Handler, Message, Supervised, SystemService};\nuse actix_web::http::StatusCode;\n@@ -22,6 +23,13 @@ use std::collections::HashSet;\nuse std::net::Ipv4Addr;\nuse std::net::SocketAddr;\n+/// Sets up a variant of the exit tunnel nat rules, assumes that the exit\n+/// tunnel is already created and doesn't change the system routing table\n+fn setup_light_client_forwarding(nic: &str) -> Result<(), Error> {\n+ KI.add_client_nat_rules(nic)?;\n+ Ok(())\n+}\n+\n/// Response to the light_client_hello endpoint on the Rita client module with a modified hello packet\n/// this modified packet includes an ipv4 address and opens a modified tunnel that is attached to the\n/// phone network bridge into a natted ipv4 network rather than into a Babel network.\n@@ -99,8 +107,7 @@ pub fn light_client_hello_response(\n))\n.from_err()\n.and_then(move |tunnel| {\n- //let tunnel = tunnel.unwrap();\n- let tunnel = match tunnel {\n+ let (tunnel, have_tunnel) = match tunnel {\nSome(val) => val,\nNone => return Err(format_err!(\"tunnel open failure!\")),\n};\n@@ -114,10 +121,11 @@ pub fn light_client_hello_response(\n))\n}\n},\n- wg_port: tunnel.0.listen_port,\n- have_tunnel: Some(tunnel.1),\n+ wg_port: tunnel.listen_port,\n+ have_tunnel: Some(have_tunnel),\ntunnel_address: light_client_address,\n};\n+ setup_light_client_forwarding(&tunnel.iface_name)?;\nlet response = HttpResponse::Ok().json(lci);\nOk(response)\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/tunnel_manager/mod.rs",
"new_path": "rita/src/rita_common/tunnel_manager/mod.rs",
"diff": "@@ -284,7 +284,7 @@ impl Tunnel {\nif let Err(e) = KI.del_interface(&self.iface_name) {\nerror!(\"Failed to delete wg interface! {:?}\", e);\n}\n- if let Err(e) = KI.del_if_from_bridge(\"br-phone_net\", &self.iface_name) {\n+ if let Err(e) = KI.delete_client_nat_rules(&self.iface_name) {\nerror!(\"Failed to delete wg interface! {:?}\", e);\n}\nTunnelManager::from_registry().do_send(PortCallback(self.listen_port));\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Add nat rules for tunnel
Originally the plan was to attach the new interface to a bridge
which would then have nat rules applied, this is easier than managing
bridge logic in exchange for potentially polluting the nat table in the
case that we have many phone clients |
20,244 | 19.12.2019 08:18:19 | 18,000 | 50f31b45c70d81d9a5f5285500f5e7e718a224df | Don't monitor light client tunnels
I missed this specific reference to monitor in the first pass.
This commit also removes some more references to phone-net which
has been removed from the design for the time being as mentioned
in | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/tunnel_manager/mod.rs",
"new_path": "rita/src/rita_common/tunnel_manager/mod.rs",
"diff": "@@ -993,9 +993,7 @@ fn create_new_tunnel(\n// attach babel, the argument indicates that this is attempt zero\ntunnel.monitor(0);\n}\n- Some(_) => {\n- KI.add_if_to_bridge(\"br-phone_net\", &tunnel.iface_name)?;\n- }\n+ Some(_) => {}\n}\nOk((new_key, tunnel))\n}\n@@ -1055,7 +1053,9 @@ fn tunnel_state_change(\n);\nmatch tunnel.state.registration_state {\nRegistrationState::NotRegistered => {\n+ if tunnel.light_client_details.is_none() {\ntunnel.monitor(0);\n+ }\ntunnel.state.registration_state = RegistrationState::Registered;\n}\nRegistrationState::Registered => {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Don't monitor light client tunnels
I missed this specific reference to monitor in the first pass.
This commit also removes some more references to phone-net which
has been removed from the design for the time being as mentioned
in 6ce85b72af5d6dcab8d8ad0382d0173b59bc1be2 |
20,244 | 20.12.2019 07:15:41 | 18,000 | 6f3a6383a9b4af7f36b6ffe3df0747e4f8ff065f | Rename module to match the code | [
{
"change_type": "RENAME",
"old_path": "rita/src/rita_client/light_client_handler/mod.rs",
"new_path": "rita/src/rita_client/light_client_manager/mod.rs",
"diff": ""
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/mod.rs",
"new_path": "rita/src/rita_client/mod.rs",
"diff": "pub mod dashboard;\npub mod exit_manager;\n-pub mod light_client_handler;\n+pub mod light_client_manager;\npub mod rita_loop;\npub mod traffic_watcher;\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/rita_loop/mod.rs",
"new_path": "rita/src/rita_client/rita_loop/mod.rs",
"diff": "//! tunnel if the signup was successful on the selected exit.\nuse crate::rita_client::exit_manager::ExitManager;\n-use crate::rita_client::light_client_handler::light_client_hello_response;\n+use crate::rita_client::light_client_manager::light_client_hello_response;\nuse crate::rita_client::traffic_watcher::TrafficWatcher;\nuse crate::rita_client::traffic_watcher::WeAreGatewayClient;\nuse crate::rita_common::tunnel_manager::GetNeighbors;\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Rename module to match the code |
20,244 | 31.12.2019 14:14:14 | 18,000 | 03153d92caed8262f6bdd4a92a97965b58dc6552 | Fix light client tunnel opening logic
The tunnel opening logic previously would allocate an ip on every request
instead of for every unique requesting device.
It would also fail to insert the proper route, and re-insert routes when
not needed. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/light_client_manager/mod.rs",
"new_path": "rita/src/rita_client/light_client_manager/mod.rs",
"diff": "@@ -19,6 +19,7 @@ use futures01::future::Either;\nuse futures01::{future, Future};\nuse settings::RitaCommonSettings;\nuse std::boxed::Box;\n+use std::collections::HashMap;\nuse std::collections::HashSet;\nuse std::net::Ipv4Addr;\nuse std::net::SocketAddr;\n@@ -36,11 +37,12 @@ fn setup_light_client_forwarding(client_addr: Ipv4Addr, nic: &str) -> Result<(),\n// Key points to note here is that the routes and addresses\n// get cleaned up on their own whent the interface is deleted I'm not\n// so sure about the iptables rules yet\n+ trace!(\"adding light client nat rules\");\nKI.add_client_nat_rules(nic)?;\nKI.add_ipv4(\"192.168.20.0\".parse().unwrap(), nic)?;\n- KI.set_route(\n- &format!(\"{}/32\", client_addr),\n- &vec![\"dev\".to_string(), nic.to_string()],\n+ KI.run_command(\n+ \"ip\",\n+ &[\"route\", \"add\", &format!(\"{}/32\", client_addr), \"dev\", nic],\n)?;\nOk(())\n}\n@@ -51,13 +53,12 @@ fn setup_light_client_forwarding(client_addr: Ipv4Addr, nic: &str) -> Result<(),\npub fn light_client_hello_response(\nreq: (Json<LocalIdentity>, HttpRequest),\n) -> Box<dyn Future<Item = HttpResponse, Error = Error>> {\n+ let their_id = *req.0;\nBox::new(\nLightClientManager::from_registry()\n- .send(GetAddress())\n+ .send(GetAddress(their_id))\n.from_err()\n.and_then(move |light_client_address| {\n- let their_id = *req.0;\n-\nlet err_mesg = \"Malformed light client hello tcp packet!\";\nlet socket = match req.1.connection_info().remote() {\nSome(val) => match val.parse::<SocketAddr>() {\n@@ -140,10 +141,23 @@ pub fn light_client_hello_response(\nhave_tunnel: Some(have_tunnel),\ntunnel_address: light_client_address,\n};\n+ // Two bools -> 4 state truth table, in 3 of\n+ // those states we need to re-add these rules\n+ // router phone\n+ // false false we need to add rules to new tunnel\n+ // true false tunnel will be re-created so new rules\n+ // false true new tunnel on our side new rules\n+ // true true only case where we don't need to run this\n+ if let Some(they_have_tunnel) = their_id.have_tunnel {\n+ if !(have_tunnel && they_have_tunnel) {\nsetup_light_client_forwarding(\nlight_client_address,\n&tunnel.iface_name,\n)?;\n+ }\n+ } else {\n+ error!(\"Light clients should never send the none tunnel option!\");\n+ }\nlet response = HttpResponse::Ok().json(lci);\nOk(response)\n@@ -156,7 +170,7 @@ pub fn light_client_hello_response(\npub struct LightClientManager {\nstart_address: Ipv4Addr,\nprefix: u8,\n- assigned_addresses: HashSet<Ipv4Addr>,\n+ assigned_addresses: HashMap<LocalIdentity, Ipv4Addr>,\n}\nimpl Default for LightClientManager {\n@@ -164,7 +178,7 @@ impl Default for LightClientManager {\nLightClientManager {\nstart_address: \"192.168.20.1\".parse().unwrap(),\nprefix: 24,\n- assigned_addresses: HashSet::new(),\n+ assigned_addresses: HashMap::new(),\n}\n}\n}\n@@ -182,7 +196,7 @@ impl SystemService for LightClientManager {\nfn service_started(&mut self, _ctx: &mut Context<Self>) {}\n}\n-pub struct GetAddress();\n+pub struct GetAddress(LocalIdentity);\nimpl Message for GetAddress {\ntype Result = Result<Ipv4Addr, Error>;\n@@ -191,17 +205,30 @@ impl Message for GetAddress {\nimpl Handler<GetAddress> for LightClientManager {\ntype Result = Result<Ipv4Addr, Error>;\n- fn handle(&mut self, _msg: GetAddress, _: &mut Context<Self>) -> Self::Result {\n+ fn handle(&mut self, msg: GetAddress, _: &mut Context<Self>) -> Self::Result {\n+ let requester_id = msg.0;\ntrace!(\"Assigning light client address\");\n+ // we already have an ip for this id on record, send the same one out\n+ if let Some(ip) = self.assigned_addresses.get(&requester_id) {\n+ return Ok(*ip);\n+ }\n+ let assigned_ips = {\n+ let mut set = HashSet::new();\n+ for (_id, ip) in self.assigned_addresses.iter() {\n+ set.insert(ip);\n+ }\n+ set\n+ };\n+\n// get the first unused address this is kinda inefficient, I'm sure we could do this in all O(1) operations\n// but at the cost of more memory usage, which I'd rather avoid. Either way it's trivial\n// both in terms of memory and cpu at the scale of only 16 bits of address space (ipv4 private range size)\nlet mut new_address: Ipv4Addr = self.start_address;\n- while self.assigned_addresses.contains(&new_address) {\n+ while assigned_ips.contains(&new_address) {\ntrace!(\"light client address {} is already assigned\", new_address);\nnew_address = incrementv4(new_address, self.prefix)?;\n}\n- self.assigned_addresses.insert(new_address);\n+ self.assigned_addresses.insert(requester_id, new_address);\ntrace!(\n\"finished selecting light client address, it is {}\",\nnew_address\n@@ -221,6 +248,16 @@ impl Handler<ReturnAddress> for LightClientManager {\nfn handle(&mut self, msg: ReturnAddress, _: &mut Context<Self>) -> Self::Result {\nlet returned_address = msg.0;\n- self.assigned_addresses.remove(&returned_address);\n+ let mut key_to_remove: Option<LocalIdentity> = None;\n+ for (key, ip) in self.assigned_addresses.iter() {\n+ if *ip == returned_address {\n+ key_to_remove = Some(*key);\n+ }\n+ }\n+ if let Some(val) = key_to_remove {\n+ self.assigned_addresses.remove(&val);\n+ } else {\n+ error!(\"Failed to free address {}\", returned_address);\n+ }\n}\n}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Fix light client tunnel opening logic
The tunnel opening logic previously would allocate an ip on every request
instead of for every unique requesting device.
It would also fail to insert the proper route, and re-insert routes when
not needed. |
20,244 | 06.01.2020 09:56:52 | 18,000 | 3f821c5516185db686497fa5d41ec3fcd1156185 | add_ipv4_addr() is needed on this branch
This change was originally made in another branch for another feature,
that feature got into master and I rebased this branch onto it. Resulting
in a dependency.
The ipv4 dialer address feature got yanked from master so now this needs to be
pulled over here. | [
{
"change_type": "MODIFY",
"old_path": "althea_kernel_interface/src/ip_addr.rs",
"new_path": "althea_kernel_interface/src/ip_addr.rs",
"diff": "use super::KernelInterface;\n+use failure::Error;\n+use std::net::Ipv4Addr;\n+\nimpl dyn KernelInterface {\n/// Returns a bool based on device state, \"UP\" or \"DOWN\", \"UNKNOWN\" is\n/// interpreted as DOWN\n@@ -17,6 +20,82 @@ impl dyn KernelInterface {\n_ => None,\n}\n}\n+\n+ /// Adds an ipv4 address to a given interface, true is returned when\n+ /// the ip is added, false if it is already there and Error if the interface\n+ /// does not exist or some other error has occured\n+ pub fn add_ipv4(&self, ip: Ipv4Addr, dev: &str) -> Result<bool, Error> {\n+ // upwrap here because it's ok if we panic when the system does not have 'ip' installed\n+ let output = self\n+ .run_command(\"ip\", &[\"addr\", \"add\", &format!(\"{}/32\", ip), \"dev\", dev])\n+ .unwrap();\n+ // Get the first line, check if it has \"file exists\"\n+ match String::from_utf8(output.stderr) {\n+ Ok(stdout) => match stdout.lines().next() {\n+ Some(line) => {\n+ if line.contains(\"File exists\") {\n+ Ok(false)\n+ } else {\n+ Err(format_err!(\"Error setting ip {}\", line))\n+ }\n+ }\n+ None => Ok(true),\n+ },\n+ Err(e) => Err(format_err!(\"Could not decode stderr from ip with {:?}\", e)),\n+ }\n+ }\n+}\n+\n+#[test]\n+fn test_add_ipv4() {\n+ use crate::KI;\n+\n+ use std::os::unix::process::ExitStatusExt;\n+ use std::process::ExitStatus;\n+ use std::process::Output;\n+\n+ KI.set_mock(Box::new(move |program, args| {\n+ assert_eq!(program, \"ip\");\n+ assert_eq!(args, &[\"addr\", \"add\", \"192.168.31.2/32\", \"dev\", \"eth0\"]);\n+\n+ Ok(Output {\n+ stdout: b\"\".to_vec(),\n+ stderr: b\"RTNETLINK answers: File exists\".to_vec(),\n+ status: ExitStatus::from_raw(0),\n+ })\n+ }));\n+ let val = KI\n+ .add_ipv4(\"192.168.31.2\".parse().unwrap(), \"eth0\")\n+ .expect(\"Failure to run ip test\");\n+ assert_eq!(false, val);\n+\n+ KI.set_mock(Box::new(move |program, args| {\n+ assert_eq!(program, \"ip\");\n+ assert_eq!(args, &[\"addr\", \"add\", \"192.168.31.2/32\", \"dev\", \"eth0\"]);\n+\n+ Ok(Output {\n+ stdout: b\"\".to_vec(),\n+ stderr: b\"Cannot find device \\\"eth0\\\"\".to_vec(),\n+ status: ExitStatus::from_raw(0),\n+ })\n+ }));\n+ let val = KI.add_ipv4(\"192.168.31.2\".parse().unwrap(), \"eth0\");\n+ assert!(val.is_err());\n+\n+ KI.set_mock(Box::new(move |program, args| {\n+ assert_eq!(program, \"ip\");\n+ assert_eq!(args, &[\"addr\", \"add\", \"192.168.31.2/32\", \"dev\", \"eth0\"]);\n+\n+ Ok(Output {\n+ stdout: b\"\".to_vec(),\n+ stderr: b\"\".to_vec(),\n+ status: ExitStatus::from_raw(0),\n+ })\n+ }));\n+ let val = KI\n+ .add_ipv4(\"192.168.31.2\".parse().unwrap(), \"eth0\")\n+ .expect(\"Failure to run ip test\");\n+ assert_eq!(true, val);\n}\n#[test]\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | add_ipv4_addr() is needed on this branch
This change was originally made in another branch for another feature,
that feature got into master and I rebased this branch onto it. Resulting
in a dependency.
The ipv4 dialer address feature got yanked from master so now this needs to be
pulled over here. |
20,249 | 30.12.2019 14:22:31 | 28,800 | e76f002ce08d02ea1db552f6cecbc705dcc2b730 | Fix /exits/sync endpoint | [
{
"change_type": "MODIFY",
"old_path": "rita/src/client.rs",
"new_path": "rita/src/client.rs",
"diff": "@@ -254,7 +254,7 @@ fn start_client_dashboard() {\n)\n.route(\"/debts\", Method::GET, get_debts)\n.route(\"/debts/reset\", Method::POST, reset_debt)\n- .route(\"/exits/sync\", Method::GET, exits_sync)\n+ .route(\"/exits/sync\", Method::POST, exits_sync)\n.route(\"/exits\", Method::GET, get_exit_info)\n.route(\"/exits\", Method::POST, add_exits)\n.route(\"/exits/{name}/register\", Method::POST, register_to_exit)\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/dashboard/exits.rs",
"new_path": "rita/src/rita_client/dashboard/exits.rs",
"diff": "@@ -5,14 +5,14 @@ use crate::rita_common::dashboard::Dashboard;\nuse crate::ARGS;\nuse crate::KI;\nuse crate::SETTING;\n-use ::actix::{Handler, Message, ResponseFuture, SystemService};\n-use ::actix_web::client;\n-use ::actix_web::http::StatusCode;\n-use ::actix_web::AsyncResponder;\n-use ::actix_web::Path;\n-use ::actix_web::{HttpRequest, HttpResponse, Json};\n+use actix::{Handler, Message, ResponseFuture, SystemService};\n+use actix_web::client;\nuse actix_web::error::PayloadError;\n+use actix_web::http::StatusCode;\n+use actix_web::AsyncResponder;\nuse actix_web::HttpMessage;\n+use actix_web::Path;\n+use actix_web::{HttpRequest, HttpResponse, Json};\nuse althea_types::ExitState;\nuse babel_monitor::do_we_have_route;\nuse babel_monitor::open_babel_stream;\n@@ -190,24 +190,27 @@ pub fn exits_sync(\nOk(mut new_exits) => {\ninfo!(\"exit_sync list: {:#?}\", new_exits);\n- let exits = &mut SETTING.get_exit_client_mut().exits;\n+ let mut exit_client = SETTING.get_exit_client_mut();\n// if the entry already exists copy the registration info over\nfor new_exit in new_exits.iter_mut() {\nlet nick = new_exit.0;\nlet new_settings = new_exit.1;\n- if let Some(old_exit) = exits.get(nick) {\n+ if let Some(old_exit) = exit_client.exits.get(nick) {\nnew_settings.info = old_exit.info.clone();\n}\n}\n- exits.extend(new_exits);\n+ exit_client.exits.extend(new_exits);\n+ let exits = exit_client.exits.clone();\n+ drop(exit_client);\n// try and save the config and fail if we can't\nif let Err(e) = SETTING.write().unwrap().write(&ARGS.flag_config) {\n+ trace!(\"Failed to write settings\");\nreturn Box::new(future::err(e));\n}\n- Box::new(future::ok(HttpResponse::Ok().json(exits.clone())))\n+ Box::new(future::ok(HttpResponse::Ok().json(exits)))\n}\nErr(e) => {\nlet mut ret = HashMap::<String, String>::new();\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Fix /exits/sync endpoint |
20,244 | 08.01.2020 17:07:22 | 18,000 | 306b9f3f81271edd7861360cc53c18838c800b25 | Log enforcement with wgkey
Since we've standardized on this for metadata | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/debt_keeper/mod.rs",
"new_path": "rita/src/rita_common/debt_keeper/mod.rs",
"diff": "@@ -586,7 +586,7 @@ impl DebtKeeper {\ninfo!(\n\"debt {} is below close threshold {} for {}. suspending forwarding\",\n- debt_data.debt, close_threshold, ident.mesh_ip\n+ debt_data.debt, close_threshold, ident.wg_public_key\n);\ndebt_data.action = DebtAction::SuspendTunnel;\nOk(DebtAction::SuspendTunnel)\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Log enforcement with wgkey
Since we've standardized on this for metadata |
20,244 | 09.01.2020 07:25:51 | 18,000 | 22e46a686fabbe6a8d2544d478d41152b18154ed | Put price in light client hello
Normally prices are advertised by Babel, but for light clients there's
no babel between them and the router at all. Likewise the pricing is
very simple as it's the exit destination price plus the routers own
fee. | [
{
"change_type": "MODIFY",
"old_path": "althea_types/src/interop.rs",
"new_path": "althea_types/src/interop.rs",
"diff": "@@ -276,6 +276,9 @@ pub struct LightClientLocalIdentity {\npub have_tunnel: Option<bool>, // If we have an existing tunnel, None if we don't know\npub global: Identity,\npub tunnel_address: Ipv4Addr, // we have to replicate dhcp ourselves due to the android vpn api\n+ pub price: u128, // the local_fee of the node passing light client traffic, much bigger\n+ // than the actual babel price field for ergonomics around downcasting\n+ // the number after upcasting when we compute it.\n}\n#[cfg(feature = \"actix\")]\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/light_client_manager/mod.rs",
"new_path": "rita/src/rita_client/light_client_manager/mod.rs",
"diff": "//! especially since the client traffic exits unencrypted at one point on the participating Rita Client router. Sadly this is unavoidable as\n//! far as I can tell due to the restrictive nature of how and when Android allows ipv6 routing.\n+use crate::rita_client::traffic_watcher::GetExitDestPrice;\n+use crate::rita_client::traffic_watcher::TrafficWatcher;\nuse crate::rita_common::debt_keeper;\nuse crate::rita_common::debt_keeper::DebtKeeper;\nuse crate::rita_common::debt_keeper::Traffic;\n@@ -60,11 +62,13 @@ pub fn light_client_hello_response(\nreq: (Json<LocalIdentity>, HttpRequest),\n) -> Box<dyn Future<Item = HttpResponse, Error = Error>> {\nlet their_id = *req.0;\n+ let a = LightClientManager::from_registry().send(GetAddress(their_id));\n+ let b = TrafficWatcher::from_registry().send(GetExitDestPrice);\n+\nBox::new(\n- LightClientManager::from_registry()\n- .send(GetAddress(their_id))\n+ a.join(b)\n.from_err()\n- .and_then(move |light_client_address| {\n+ .and_then(move |(light_client_address, exit_dest_price)| {\nlet err_mesg = \"Malformed light client hello tcp packet!\";\nlet socket = match req.1.connection_info().remote() {\nSome(val) => match val.parse::<SocketAddr>() {\n@@ -102,6 +106,11 @@ pub fn light_client_hello_response(\n}\n};\n+ let exit_dest_price = match exit_dest_price {\n+ Ok(val) => val,\n+ Err(_e) => 0,\n+ };\n+\ntrace!(\n\"Got light client Hello from {:?}\",\nreq.1.connection_info().remote()\n@@ -146,6 +155,7 @@ pub fn light_client_hello_response(\nwg_port: tunnel.listen_port,\nhave_tunnel: Some(have_tunnel),\ntunnel_address: light_client_address,\n+ price: SETTING.get_payment().local_fee as u128 + exit_dest_price,\n};\n// Two bools -> 4 state truth table, in 3 of\n// those states we need to re-add these rules\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/traffic_watcher/mod.rs",
"new_path": "rita/src/rita_client/traffic_watcher/mod.rs",
"diff": "@@ -55,6 +55,8 @@ pub struct TrafficWatcher {\n/// handles the gateway exit client corner case where we need to reconcile client\n/// and relay debts\ngateway_exit_client: bool,\n+ /// cached exit destination price value\n+ last_exit_dest_price: u128,\n}\nimpl Actor for TrafficWatcher {\n@@ -67,6 +69,7 @@ impl SystemService for TrafficWatcher {\nself.last_read_input = 0;\nself.last_read_output = 0;\nself.gateway_exit_client = false;\n+ self.last_exit_dest_price = 0;\n}\n}\nimpl Default for TrafficWatcher {\n@@ -75,6 +78,7 @@ impl Default for TrafficWatcher {\nlast_read_input: 0,\nlast_read_output: 0,\ngateway_exit_client: false,\n+ last_exit_dest_price: 0,\n}\n}\n}\n@@ -307,6 +311,9 @@ pub fn watch(\n// the exit for this because TODO assumes symetric route\nlet exit_dest_price: i128 = exit_route_price + i128::from(exit_price);\n+ // send the exit dest price over to the light client manager for consumption there\n+ history.last_exit_dest_price = exit_dest_price as u128;\n+\ninfo!(\"Exit destination price {}\", exit_dest_price);\ntrace!(\"Exit ip: {:?}\", exit.mesh_ip);\ntrace!(\"Exit destination:\\n{:#?}\", exit_route);\n@@ -364,3 +371,20 @@ pub fn watch(\nOk(())\n}\n+\n+/// Grabs the exit desination price cached in the TrafficWatcher object\n+/// this allows users to avoid the rather complicated procedure of computing it\n+/// themselves\n+pub struct GetExitDestPrice;\n+\n+impl Message for GetExitDestPrice {\n+ type Result = Result<u128, Error>;\n+}\n+\n+impl Handler<GetExitDestPrice> for TrafficWatcher {\n+ type Result = Result<u128, Error>;\n+\n+ fn handle(&mut self, _msg: GetExitDestPrice, _: &mut Context<Self>) -> Self::Result {\n+ Ok(self.last_exit_dest_price)\n+ }\n+}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Put price in light client hello
Normally prices are advertised by Babel, but for light clients there's
no babel between them and the router at all. Likewise the pricing is
very simple as it's the exit destination price plus the routers own
fee. |
20,244 | 15.01.2020 09:54:45 | 18,000 | de6574d252fa979977f7779abb58a9f39e0e2aa5 | Bump version for Beta 11 RC4 | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -175,7 +175,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.29\",\n+ \"rita 0.5.30\",\n]\n[[package]]\n@@ -2140,7 +2140,7 @@ dependencies = [\n[[package]]\nname = \"rita\"\n-version = \"0.5.29\"\n+version = \"0.5.30\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/Cargo.toml",
"new_path": "rita/Cargo.toml",
"diff": "[package]\nname = \"rita\"\n-version = \"0.5.29\"\n+version = \"0.5.30\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/dashboard/own_info.rs",
"new_path": "rita/src/rita_common/dashboard/own_info.rs",
"diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 11 RC3\";\n+pub static READABLE_VERSION: &str = \"Beta 11 RC4\";\n#[derive(Serialize)]\npub struct OwnInfo {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Bump version for Beta 11 RC4 |
20,244 | 17.01.2020 16:16:37 | 18,000 | a424e4b96f157b73503a7d46bcb992f8e43ebc58 | Fix phone billing
There was a rather obvious error in retrospect here where instead
of computing based on the last seen usage we use the cumulative
usage of the tunnel to calculate debts | [
{
"change_type": "MODIFY",
"old_path": "althea_kernel_interface/src/wg_iface_counter.rs",
"new_path": "althea_kernel_interface/src/wg_iface_counter.rs",
"diff": "@@ -11,7 +11,7 @@ use althea_types::WgKey;\nuse super::{KernelInterface, KernelInterfaceError};\n-#[derive(Clone, Debug)]\n+#[derive(Clone, Debug, Copy)]\npub struct WgUsage {\npub upload: u64,\npub download: u64,\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/light_client_manager/mod.rs",
"new_path": "rita/src/rita_client/light_client_manager/mod.rs",
"diff": "@@ -291,6 +291,7 @@ fn return_addresses(tunnels: &[Tunnel], assigned_addresses: &mut HashMap<LocalId\n/// client usage is.\npub struct Watch {\npub tunnels: Vec<Tunnel>,\n+ pub exit_dest_price: u128,\n}\nimpl Message for Watch {\n@@ -301,7 +302,7 @@ impl Handler<Watch> for LightClientManager {\ntype Result = ();\nfn handle(&mut self, msg: Watch, _: &mut Context<Self>) -> Self::Result {\n- let our_price = SETTING.get_payment().local_fee;\n+ let our_price = msg.exit_dest_price;\nlet tunnels = msg.tunnels;\nlet mut debts: HashMap<Identity, i128> = HashMap::new();\nfor tunnel in tunnels.iter() {\n@@ -312,8 +313,13 @@ impl Handler<Watch> for LightClientManager {\n// interface is not supported\nassert!(counter.len() == 1);\n// get only the first element\n- let (_key, usage) = counter.iter().next().unwrap();\n- let debt = ((usage.upload + usage.download) * our_price as u64) as i128;\n+ let (key, usage) = counter.iter().next().unwrap();\n+ // unwrap is safe before prepare usage history will ensure an entry exits\n+ let last_seen_usage = self.last_seen_bytes.get_mut(&key).unwrap();\n+ let round_upload = usage.upload - last_seen_usage.upload;\n+ let round_download = usage.download - last_seen_usage.download;\n+ *last_seen_usage = *usage;\n+ let debt = ((round_upload + round_download) * our_price as u64) as i128;\nsubtract_or_insert_and_subtract(&mut debts, tunnel.neigh_id.global, debt);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/rita_loop/mod.rs",
"new_path": "rita/src/rita_client/rita_loop/mod.rs",
"diff": "@@ -8,6 +8,7 @@ use crate::rita_client::exit_manager::ExitManager;\nuse crate::rita_client::light_client_manager::light_client_hello_response;\nuse crate::rita_client::light_client_manager::LightClientManager;\nuse crate::rita_client::light_client_manager::Watch;\n+use crate::rita_client::traffic_watcher::GetExitDestPrice;\nuse crate::rita_client::traffic_watcher::TrafficWatcher;\nuse crate::rita_client::traffic_watcher::WeAreGatewayClient;\nuse crate::rita_common::tunnel_manager::GetNeighbors;\n@@ -86,14 +87,23 @@ impl Handler<Tick> for RitaLoop {\nArbiter::spawn(check_for_gateway_client_billing_corner_case());\n+ let dest_price = TrafficWatcher::from_registry().send(GetExitDestPrice);\n+ let tunnels = TunnelManager::from_registry().send(GetTunnels);\nArbiter::spawn(\n- TunnelManager::from_registry()\n- .send(GetTunnels)\n- .timeout(CLIENT_LOOP_TIMEOUT)\n+ dest_price\n+ .join(tunnels)\n.then(move |res| {\n- let tunnels = res.unwrap().unwrap();\n+ // unwrap top level actix error, ok to crash if this fails\n+ let (exit_dest_price, tunnels) = res.unwrap();\n+ // these can't ever happen as the function only returns a Result for Actix\n+ // type checking\n+ let tunnels = tunnels.unwrap();\n+ let exit_dest_price = exit_dest_price.unwrap();\nLightClientManager::from_registry()\n- .send(Watch { tunnels })\n+ .send(Watch {\n+ tunnels,\n+ exit_dest_price,\n+ })\n.then(|_res| Ok(()))\n}),\n);\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/traffic_watcher/mod.rs",
"new_path": "rita/src/rita_client/traffic_watcher/mod.rs",
"diff": "@@ -274,7 +274,9 @@ pub fn watch(\n}\n// unwrap is safe because we check that len is not equal to zero\n// then we toss the exit's wg key as we don't need it\n- res.iter().last().unwrap().1.clone()\n+ // create an iterator, take the last (and only) value, then grab the\n+ // counter and not the key from the hashmap entry\n+ *res.iter().last().unwrap().1\n}\nErr(e) => {\nwarn!(\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Fix phone billing
There was a rather obvious error in retrospect here where instead
of computing based on the last seen usage we use the cumulative
usage of the tunnel to calculate debts |
20,244 | 18.01.2020 08:08:13 | 28,800 | 15d1ab65e415a4e9f3bcd948bb27aa7075f0902f | Default node list should also be DAI
When I changed the default blockchain I forgot the default node list as well | [
{
"change_type": "MODIFY",
"old_path": "settings/src/payment.rs",
"new_path": "settings/src/payment.rs",
"diff": "@@ -47,10 +47,7 @@ fn default_balance_warning_level() -> Uint256 {\n}\nfn default_node_list() -> Vec<String> {\n- vec![\n- \"https://eth.althea.org:443\".to_string(),\n- \"https://mainnet.infura.io/v3/6b080f02d7004a8394444cdf232a7081\".to_string(),\n- ]\n+ vec![\"https://dai.althea.org:443\".to_string()]\n}\nfn default_system_chain() -> SystemChain {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Default node list should also be DAI
When I changed the default blockchain I forgot the default node list as well |
20,244 | 18.01.2020 20:08:31 | 18,000 | 839b24f1181fde463bf5e141fb194335149eed9d | Listen for light client hellos on ipv4
After some testing on a larger variety of devices I've continued
to have issues getting fe80 addresses to really work properly so I'm
going to try this strategy of just doing it over ipv4 | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/rita_loop/mod.rs",
"new_path": "rita/src/rita_client/rita_loop/mod.rs",
"diff": "@@ -214,20 +214,22 @@ fn check_for_gateway_client_billing_corner_case() -> impl Future<Item = (), Erro\n}\npub fn start_rita_client_endpoints(workers: usize) {\n+ // listen on the light client gateway ip if it's not none\n+ if let Some(gateway_ip) = SETTING.get_network().light_client_router_ip {\n+ trace!(\"Listening for light client hellos on {}\", gateway_ip);\nserver::new(|| {\nApp::new().resource(\"/light_client_hello\", |r| {\nr.method(Method::POST).with(light_client_hello_response)\n})\n- // .resource(\"/mobile_debt\", |r| {\n- // r.method(Method::POST).with(get_client_debt)\n- // })\n})\n.workers(workers)\n.bind(format!(\n- \"[::0]:{}\",\n+ \"{}:{}\",\n+ gateway_ip,\nSETTING.get_network().light_client_hello_port\n))\n.unwrap()\n.shutdown_timeout(0)\n.start();\n}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "settings/src/network.rs",
"new_path": "settings/src/network.rs",
"diff": "use std::collections::HashSet;\n-use std::net::{IpAddr, Ipv6Addr};\n+use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};\nuse althea_types::WgKey;\n@@ -59,6 +59,9 @@ pub struct NetworkSettings {\n/// network\n#[serde(default = \"default_light_client_hello_port\")]\npub light_client_hello_port: u16,\n+ /// This devices address on the inside of the AltheaPhone network, this is set by the firmware builder. If it's\n+ /// none it was never set by the firmware builder and light client operations simply aren't enabled\n+ pub light_client_router_ip: Option<Ipv4Addr>,\n/// Port on which rita contacts other althea nodes over the mesh (needs to be constant across an\n/// entire althea deployment)\npub rita_contact_port: u16,\n@@ -138,6 +141,7 @@ impl Default for NetworkSettings {\nrita_contact_port: 4874,\nrita_hello_port: 4876,\nlight_client_hello_port: default_light_client_hello_port(),\n+ light_client_router_ip: None,\nrita_dashboard_port: 4877,\nrita_dashboard_password: None,\nbounty_port: 8888,\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Listen for light client hellos on ipv4
After some testing on a larger variety of devices I've continued
to have issues getting fe80 addresses to really work properly so I'm
going to try this strategy of just doing it over ipv4 |
20,244 | 20.01.2020 09:49:04 | 18,000 | a55f3d0cd6a7bf28aa7174062c3292db549acee2 | Bump exit enforcement timeout to 10 seconds
Having some trouble with this on slow exits, considering that we now
have a 60 second timeout for payments on all x86 based targets this
should still be safe
We also add an assert to really make sure that is the case | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/payment_validator/mod.rs",
"new_path": "rita/src/rita_common/payment_validator/mod.rs",
"diff": "@@ -31,9 +31,9 @@ use web30::types::TransactionResponse;\n// far less dynamic network conditions and it's far more important that we validate payments\n// even at the cost of memory or the risk of an emergency restart if we slow down too much\n#[cfg(not(any(feature = \"long_timeouts\", target_arch = \"x86_64\")))]\n-const TRANSACTION_VERIFICATION_TIMEOUT: Duration = Duration::from_secs(4);\n+pub const TRANSACTION_VERIFICATION_TIMEOUT: Duration = Duration::from_secs(4);\n#[cfg(any(feature = \"long_timeouts\", target_arch = \"x86_64\"))]\n-const TRANSACTION_VERIFICATION_TIMEOUT: Duration = Duration::from_secs(60);\n+pub const TRANSACTION_VERIFICATION_TIMEOUT: Duration = Duration::from_secs(60);\n// Discard payments after 15 minutes of failing to find txid\npub const PAYMENT_TIMEOUT: Duration = Duration::from_secs(900u64);\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_exit/database/mod.rs",
"new_path": "rita/src/rita_exit/database/mod.rs",
"diff": "use crate::rita_common::debt_keeper::DebtAction;\nuse crate::rita_common::debt_keeper::DebtKeeper;\nuse crate::rita_common::debt_keeper::GetDebtsList;\n+use crate::rita_common::payment_validator::TRANSACTION_VERIFICATION_TIMEOUT;\nuse crate::rita_exit::database::database_tools::client_conflict;\nuse crate::rita_exit::database::database_tools::client_exists;\nuse crate::rita_exit::database::database_tools::delete_client;\n@@ -625,8 +626,10 @@ pub fn enforce_exit_clients(\n// as it seems that http requests and anything that touches shelling out slow down\n// the most in these situations. Hopefully we can figure out more about why the\n// futures loop starts acting stragely.\n- if start.elapsed().as_secs() > 2 {\n- let fail_mesg = \"Exit enforcement took more than 2 seconds!\";\n+ const PANIC_TIME: u64 = 10;\n+ assert!(TRANSACTION_VERIFICATION_TIMEOUT > Duration::from_secs(PANIC_TIME));\n+ if start.elapsed().as_secs() > PANIC_TIME {\n+ let fail_mesg = format!(\"Exit enforcement took more than {} seconds!\", PANIC_TIME);\nerror!(\"{}\", fail_mesg);\npanic!(\"{}\", fail_mesg);\n}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Bump exit enforcement timeout to 10 seconds
Having some trouble with this on slow exits, considering that we now
have a 60 second timeout for payments on all x86 based targets this
should still be safe
We also add an assert to really make sure that is the case |
20,244 | 23.01.2020 08:29:34 | 18,000 | 8e053d701e7157f916ce9a4ec19ac0fa3337c8f4 | Update DAO url default for xdai
The third and hopefully final place where I forgot to update a default
to match the new dai default currency
Added some notes to hopefully prevent this sort of oversight in the future | [
{
"change_type": "MODIFY",
"old_path": "settings/src/dao.rs",
"new_path": "settings/src/dao.rs",
"diff": "@@ -13,8 +13,9 @@ fn default_use_oracle_price() -> bool {\ntrue\n}\n+// if you are changing this double check the default currency and the default node url\nfn default_oracle_url() -> Option<String> {\n- Some(\"https://updates.althea.net/prices\".to_string())\n+ Some(\"https://updates.althea.net/xdaiprices\".to_string())\n}\n#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq, Default)]\n"
},
{
"change_type": "MODIFY",
"old_path": "settings/src/payment.rs",
"new_path": "settings/src/payment.rs",
"diff": "@@ -46,10 +46,12 @@ fn default_balance_warning_level() -> Uint256 {\n(10_000_000_000_000_000u64).into()\n}\n+// make sure this matches default system chain and default DAO url\nfn default_node_list() -> Vec<String> {\nvec![\"https://dai.althea.org:443\".to_string()]\n}\n+// make sure this matches default node list and default DAO url\nfn default_system_chain() -> SystemChain {\nSystemChain::Xdai\n}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Update DAO url default for xdai
The third and hopefully final place where I forgot to update a default
to match the new dai default currency
Added some notes to hopefully prevent this sort of oversight in the future |
20,244 | 23.01.2020 12:07:19 | 28,800 | 01b33f8d42a7b55149191949432e9538d158e461 | Discard identities with negative or zero debt
This change will have no functional effect except to reduce the on
disk size of the stored debts list.
Which still needs a timeout for a real cleanup function | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/debt_keeper/mod.rs",
"new_path": "rita/src/rita_common/debt_keeper/mod.rs",
"diff": "@@ -94,14 +94,14 @@ fn debt_data_to_ser(input: DebtData) -> DebtDataSer {\nfn ser_to_debt_data(input: DebtDataSer) -> DebtData {\nlet mut ret = DebtData::new();\n- for (i, mut d) in input {\n+ for (i, d) in input {\n// Don't load negative debts, essentailly means that all debt will be\n// forgiven on reboot, but each node will still try and pay it's debts\n// in good faith. Although it's tempting to remove this and not let people\n// get away with unpaid bills service not working for arbitrary bad data reasons\n// is much worse\n- if d.debt < Int256::from(0) {\n- d.debt = Int256::from(0);\n+ if d.debt <= Int256::from(0) {\n+ continue;\n}\nret.insert(i, d);\n}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Discard identities with negative or zero debt
This change will have no functional effect except to reduce the on
disk size of the stored debts list.
Which still needs a timeout for a real cleanup function |
20,244 | 23.01.2020 13:12:01 | 28,800 | dd28b1dca6e69a2b4c4fbf9c9d49e8f947e7bbad | Our price is the local fee plus exit dest price
When I refactored this I just used the exit destination price, not the exit
destination price plus our own fee like we advertise to the client. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/light_client_manager/mod.rs",
"new_path": "rita/src/rita_client/light_client_manager/mod.rs",
"diff": "@@ -302,7 +302,8 @@ impl Handler<Watch> for LightClientManager {\ntype Result = ();\nfn handle(&mut self, msg: Watch, _: &mut Context<Self>) -> Self::Result {\n- let our_price = msg.exit_dest_price;\n+ trace!(\"Starting light client traffic watcher\");\n+ let our_price = SETTING.get_payment().local_fee as u128 + msg.exit_dest_price;\nlet tunnels = msg.tunnels;\nlet mut debts: HashMap<Identity, i128> = HashMap::new();\nfor tunnel in tunnels.iter() {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Our price is the local fee plus exit dest price
When I refactored this I just used the exit destination price, not the exit
destination price plus our own fee like we advertise to the client. |
20,244 | 24.01.2020 15:10:01 | 18,000 | fc587ca74c5a0041b12b0815afca751a3009fd82 | Note the number of active light clients | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/light_client_manager/mod.rs",
"new_path": "rita/src/rita_client/light_client_manager/mod.rs",
"diff": "@@ -279,6 +279,7 @@ fn return_addresses(tunnels: &[Tunnel], assigned_addresses: &mut HashMap<LocalId\nfor id in addresses_to_remove {\nassigned_addresses.remove(&id);\n}\n+ info!(\"{} LC ACTIVE\", assigned_addresses.len());\n}\n/// Traffic watcher implementation for light clients, this is conceptually\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Note the number of active light clients |
20,244 | 24.01.2020 18:09:14 | 18,000 | 1175fef6a02332fe13595a2149aab7c1fbce4310 | Bump for Beta 11 RC5 | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -175,7 +175,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.30\",\n+ \"rita 0.5.31\",\n]\n[[package]]\n@@ -2140,7 +2140,7 @@ dependencies = [\n[[package]]\nname = \"rita\"\n-version = \"0.5.30\"\n+version = \"0.5.31\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/dashboard/own_info.rs",
"new_path": "rita/src/rita_common/dashboard/own_info.rs",
"diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 11 RC4\";\n+pub static READABLE_VERSION: &str = \"Beta 11 RC5\";\n#[derive(Serialize)]\npub struct OwnInfo {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Bump for Beta 11 RC5 |
20,244 | 25.01.2020 09:10:58 | 18,000 | a04f956612f1e989ab6fe1dd50433e6b304fca42 | Clean up payment validator imports | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/payment_validator/mod.rs",
"new_path": "rita/src/rita_common/payment_validator/mod.rs",
"diff": "//! off to debt keeper to be removed from the owed balance. Payments may time out after a\n//! configured period.\n-use crate::rita_common;\nuse crate::rita_common::debt_keeper::DebtKeeper;\n+use crate::rita_common::debt_keeper::PaymentReceived;\nuse crate::rita_common::debt_keeper::PaymentSucceeded;\nuse crate::rita_common::rita_loop::get_web3_server;\nuse crate::rita_common::usage_tracker::UpdatePayments;\nuse crate::rita_common::usage_tracker::UsageTracker;\nuse crate::SETTING;\n-use ::actix::{Actor, Arbiter, Context, Handler, Message, Supervised, SystemService};\n+use actix::{Actor, Arbiter, Context, Handler, Message, Supervised, SystemService};\nuse althea_types::PaymentTx;\nuse futures01::future::Either;\nuse futures01::{future, Future};\nuse num256::Uint256;\n-use rita_common::debt_keeper::PaymentReceived;\nuse settings::RitaCommonSettings;\nuse std::collections::HashSet;\nuse std::time::{Duration, Instant};\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Clean up payment validator imports |
20,244 | 25.01.2020 20:32:06 | 18,000 | 8c33e2217c8b3d946c394913b9d2bc38dfbfd406 | Fix light client tunnel cleanup
Light client tunnel cleanup would clean system nat rules, this is
not only uneeded but would break normal client traffic. This patch
corrects this by assuming the exit tunnel rules are already in place
and only adding and removing interface specific rules. | [
{
"change_type": "MODIFY",
"old_path": "althea_kernel_interface/src/exit_client_tunnel.rs",
"new_path": "althea_kernel_interface/src/exit_client_tunnel.rs",
"diff": "@@ -246,4 +246,36 @@ impl dyn KernelInterface {\nOk(())\n}\n+\n+ pub fn add_light_client_nat_rules(&self, lan_nic: &str) -> Result<(), Error> {\n+ self.add_iptables_rule(\n+ \"iptables\",\n+ &[\n+ \"-D\", \"FORWARD\", \"-i\", &lan_nic, \"-o\", \"wg_exit\", \"-j\", \"ACCEPT\",\n+ ],\n+ )?;\n+ self.add_iptables_rule(\n+ \"iptables\",\n+ &[\n+ \"-D\", \"FORWARD\", \"-i\", \"wg_exit\", \"-o\", &lan_nic, \"-j\", \"ACCEPT\",\n+ ],\n+ )?;\n+ Ok(())\n+ }\n+\n+ pub fn delete_light_client_nat_rules(&self, lan_nic: &str) -> Result<(), Error> {\n+ self.add_iptables_rule(\n+ \"iptables\",\n+ &[\n+ \"-D\", \"FORWARD\", \"-i\", &lan_nic, \"-o\", \"wg_exit\", \"-j\", \"ACCEPT\",\n+ ],\n+ )?;\n+ self.add_iptables_rule(\n+ \"iptables\",\n+ &[\n+ \"-D\", \"FORWARD\", \"-i\", \"wg_exit\", \"-o\", &lan_nic, \"-j\", \"ACCEPT\",\n+ ],\n+ )?;\n+ Ok(())\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/light_client_manager/mod.rs",
"new_path": "rita/src/rita_client/light_client_manager/mod.rs",
"diff": "@@ -46,7 +46,7 @@ fn setup_light_client_forwarding(client_addr: Ipv4Addr, nic: &str) -> Result<(),\n// get cleaned up on their own whent the interface is deleted I'm not\n// so sure about the iptables rules yet\ntrace!(\"adding light client nat rules\");\n- KI.add_client_nat_rules(nic)?;\n+ KI.add_light_client_nat_rules(nic)?;\nKI.add_ipv4(\"192.168.20.0\".parse().unwrap(), nic)?;\nKI.run_command(\n\"ip\",\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/tunnel_manager/mod.rs",
"new_path": "rita/src/rita_common/tunnel_manager/mod.rs",
"diff": "@@ -284,7 +284,7 @@ impl Tunnel {\nif let Err(e) = KI.del_interface(&self.iface_name) {\nerror!(\"Failed to delete wg interface! {:?}\", e);\n}\n- if let Err(e) = KI.delete_client_nat_rules(&self.iface_name) {\n+ if let Err(e) = KI.delete_light_client_nat_rules(&self.iface_name) {\nerror!(\"Failed to delete wg interface! {:?}\", e);\n}\nTunnelManager::from_registry().do_send(PortCallback(self.listen_port));\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Fix light client tunnel cleanup
Light client tunnel cleanup would clean system nat rules, this is
not only uneeded but would break normal client traffic. This patch
corrects this by assuming the exit tunnel rules are already in place
and only adding and removing interface specific rules. |
20,244 | 25.01.2020 20:39:13 | 18,000 | 85fbacedc3eb32826a2c50de578a3faee5b3d1a1 | eui48 is a dead dependency
Deleting it doesn't cause any compile issues so I guess it's been
hanging around for no good reason for a long time. | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -142,14 +142,6 @@ name = \"adler32\"\nversion = \"1.0.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-[[package]]\n-name = \"aho-corasick\"\n-version = \"0.6.10\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-dependencies = [\n- \"memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n-]\n-\n[[package]]\nname = \"aho-corasick\"\nversion = \"0.7.6\"\n@@ -163,7 +155,6 @@ name = \"althea_kernel_interface\"\nversion = \"0.1.0\"\ndependencies = [\n\"althea_types 0.1.0\",\n- \"eui48 0.4.0 (git+https://github.com/althea-mesh/eui48)\",\n\"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -186,7 +177,6 @@ dependencies = [\n\"arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"clarity 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"eui48 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"num256 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -776,25 +766,6 @@ dependencies = [\n\"backtrace 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n-[[package]]\n-name = \"eui48\"\n-version = \"0.4.0\"\n-source = \"git+https://github.com/althea-mesh/eui48#0a1c7c4806014a09da605b8539ce8ea4ed988d2d\"\n-dependencies = [\n- \"regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)\",\n-]\n-\n-[[package]]\n-name = \"eui48\"\n-version = \"0.4.6\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-dependencies = [\n- \"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)\",\n-]\n-\n[[package]]\nname = \"exit_db\"\nversion = \"0.1.0\"\n@@ -2087,18 +2058,6 @@ name = \"redox_syscall\"\nversion = \"0.1.56\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-[[package]]\n-name = \"regex\"\n-version = \"0.2.11\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-dependencies = [\n- \"aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)\",\n-]\n-\n[[package]]\nname = \"regex\"\nversion = \"1.3.3\"\n@@ -2121,14 +2080,6 @@ dependencies = [\n\"regex-syntax 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n-[[package]]\n-name = \"regex-syntax\"\n-version = \"0.5.6\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-dependencies = [\n- \"ucd-util 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)\",\n-]\n-\n[[package]]\nname = \"regex-syntax\"\nversion = \"0.6.13\"\n@@ -2174,7 +2125,6 @@ dependencies = [\n\"docopt 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"dotenv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"eui48 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"exit_db 0.1.0\",\n\"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -2428,7 +2378,6 @@ dependencies = [\n\"arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"clarity 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"config 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n- \"eui48 0.4.0 (git+https://github.com/althea-mesh/eui48)\",\n\"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)\",\n@@ -2616,14 +2565,6 @@ dependencies = [\n\"winapi-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n-[[package]]\n-name = \"thread_local\"\n-version = \"0.3.6\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-dependencies = [\n- \"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n-]\n-\n[[package]]\nname = \"thread_local\"\nversion = \"1.0.1\"\n@@ -2937,11 +2878,6 @@ name = \"ucd-trie\"\nversion = \"0.1.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-[[package]]\n-name = \"ucd-util\"\n-version = \"0.1.7\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-\n[[package]]\nname = \"unicase\"\nversion = \"2.6.0\"\n@@ -2987,11 +2923,6 @@ dependencies = [\n\"percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n-[[package]]\n-name = \"utf8-ranges\"\n-version = \"1.0.4\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-\n[[package]]\nname = \"uuid\"\nversion = \"0.7.4\"\n@@ -3170,7 +3101,6 @@ dependencies = [\n\"checksum actix_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"4300e9431455322ae393d43a2ba1ef96b8080573c0fc23b196219efedfb6ba69\"\n\"checksum actix_derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"b95aceadaf327f18f0df5962fedc1bde2f870566a0b9f65c89508a3b1f79334c\"\n\"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2\"\n-\"checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)\" = \"81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5\"\n\"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)\" = \"58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d\"\n\"checksum arc-swap 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"d7b8a9123b8027467bce0099fe556c628a53c8d83df0507084c31e9ba2e39aff\"\n\"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)\" = \"cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9\"\n@@ -3236,8 +3166,6 @@ dependencies = [\n\"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36\"\n\"checksum error 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)\" = \"a6e606f14042bb87cc02ef6a14db6c90ab92ed6f62d87e69377bc759fd7987cc\"\n\"checksum error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"6930e04918388a9a2e41d518c25cf679ccafe26733fb4127dbf21993f2575d46\"\n-\"checksum eui48 0.4.0 (git+https://github.com/althea-mesh/eui48)\" = \"<none>\"\n-\"checksum eui48 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)\" = \"8c4cf866e4d3e5e773691f5f61615a224a7b0b72b7daf994fc56d1b82dab0b6b\"\n\"checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)\" = \"f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9\"\n\"checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)\" = \"0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08\"\n\"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed\"\n@@ -3383,10 +3311,8 @@ dependencies = [\n\"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c\"\n\"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2\"\n\"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)\" = \"2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84\"\n-\"checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)\" = \"9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384\"\n\"checksum regex 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)\" = \"b5508c1941e4e7cb19965abef075d35a9a8b5cdf0846f30b4050e9b55dc55e87\"\n\"checksum regex-cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"32c86351f6af6bbf23b4c5f73ee4fdfe92d298fdf28572ea4f69494cabe38699\"\n-\"checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)\" = \"7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7\"\n\"checksum regex-syntax 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)\" = \"e734e891f5b408a29efbf8309e656876276f49ab6a6ac208600b4419bd893d90\"\n\"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e\"\n\"checksum resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"b263b4aa1b5de9ffc0054a2386f96992058bb6870aab516f8cdeb8a667d56dcb\"\n@@ -3438,7 +3364,6 @@ dependencies = [\n\"checksum tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)\" = \"b3196bfbffbba3e57481b6ea32249fbaf590396a52505a2615adbb79d9d826d3\"\n\"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9\"\n\"checksum termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f\"\n-\"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)\" = \"c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b\"\n\"checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)\" = \"d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14\"\n\"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)\" = \"db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f\"\n\"checksum tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)\" = \"5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6\"\n@@ -3465,14 +3390,12 @@ dependencies = [\n\"checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887\"\n\"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9\"\n\"checksum ucd-trie 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"8f00ed7be0c1ff1e24f46c3d2af4859f7e863672ba3a6e92e7cff702bf9f06c2\"\n-\"checksum ucd-util 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)\" = \"5ccdc2daea7cf8bc50cd8710d170a9d816678e54943829c5082bb1594312cf8e\"\n\"checksum unicase 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6\"\n\"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5\"\n\"checksum unicode-normalization 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)\" = \"5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4\"\n\"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc\"\n\"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)\" = \"826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c\"\n\"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)\" = \"dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a\"\n-\"checksum utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba\"\n\"checksum uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a\"\n\"checksum v_escape 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)\" = \"660b101c07b5d0863deb9e7fb3138777e858d6d2a79f9e6049a27d1cc77c6da6\"\n\"checksum v_escape_derive 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)\" = \"c2ca2a14bc3fc5b64d188b087a7d3a927df87b152e941ccfbc66672e20c467ae\"\n"
},
{
"change_type": "MODIFY",
"old_path": "althea_kernel_interface/Cargo.toml",
"new_path": "althea_kernel_interface/Cargo.toml",
"diff": "@@ -11,7 +11,6 @@ failure = \"0.1\"\nitertools = \"0.8\"\nlazy_static = \"1.4\"\nlog = \"0.4\"\n-eui48 = { git = \"https://github.com/althea-mesh/eui48\", features = [\"serde\"] }\nalthea_types = { path = \"../althea_types\" }\n[dependencies.regex]\n"
},
{
"change_type": "MODIFY",
"old_path": "althea_types/Cargo.toml",
"new_path": "althea_types/Cargo.toml",
"diff": "@@ -12,7 +12,6 @@ serde = \"1.0\"\nserde_json = \"1.0\"\nhex = \"0.4\"\nsodiumoxide = \"0.2\"\n-eui48 = { version = \"0.4\", features = [\"serde\"] }\nactix = { version = \"0.7\", optional = true}\nclarity = \"0.1\"\narrayvec = {version= \"0.5\", features = [\"serde\"]}\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/Cargo.toml",
"new_path": "rita/Cargo.toml",
"diff": "@@ -56,7 +56,6 @@ byteorder = { version = \"1.3\", features = [\"i128\"] }\nopenssl-probe = \"0.1\"\nnum-traits=\"0.2\"\nclarity = \"0.1\"\n-eui48 = \"0.4\"\narrayvec = {version= \"0.5\", features = [\"serde\"]}\nlettre = \"0.9\"\nlettre_email = \"0.9\"\n@@ -74,7 +73,6 @@ default-features = false\nfeatures = [\"std\"]\n[features]\n-default = []\n# Features for big iron devices with more ram\nserver = [\"long_timeouts\"]\nlong_timeouts = []\n"
},
{
"change_type": "MODIFY",
"old_path": "settings/Cargo.toml",
"new_path": "settings/Cargo.toml",
"diff": "@@ -8,7 +8,6 @@ edition = \"2018\"\nconfig = \"0.10\"\nalthea_types = { path = \"../althea_types\", features = [\"actix\"]}\nalthea_kernel_interface = { path = \"../althea_kernel_interface\" }\n-eui48 = {git=\"https://github.com/althea-mesh/eui48.git\"}\nnum256 = \"0.2\"\nserde = \"1.0\"\nserde_derive = \"1.0\"\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | eui48 is a dead dependency
Deleting it doesn't cause any compile issues so I guess it's been
hanging around for no good reason for a long time. |
20,244 | 26.01.2020 21:24:49 | 18,000 | 56d151420a91f4fbb7da418044f764b55af7a024 | Use the Zero identity | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/debt_keeper/mod.rs",
"new_path": "rita/src/rita_common/debt_keeper/mod.rs",
"diff": "@@ -21,6 +21,7 @@ use ::actix::prelude::{Actor, Context, Handler, Message, Supervised, SystemServi\nuse althea_types::{Identity, PaymentTx};\nuse failure::Error;\nuse num256::{Int256, Uint256};\n+use num_traits::identities::Zero;\nuse num_traits::Signed;\nuse serde_json::Error as SerdeError;\nuse settings::RitaCommonSettings;\n@@ -346,8 +347,8 @@ impl Handler<SendUpdate> for DebtKeeper {\nimpl Default for DebtKeeper {\nfn default() -> DebtKeeper {\n- assert!(SETTING.get_payment().pay_threshold >= Int256::from(0));\n- assert!(SETTING.get_payment().close_threshold <= Int256::from(0));\n+ assert!(SETTING.get_payment().pay_threshold >= Int256::zero());\n+ assert!(SETTING.get_payment().close_threshold <= Int256::zero());\nlet file = File::open(SETTING.get_payment().debts_file.clone());\n// if the loading process goes wrong for any reason, we just start again\nlet blank_debt_keeper = DebtKeeper {\n@@ -391,8 +392,8 @@ impl Default for DebtKeeper {\nimpl DebtKeeper {\n#[cfg(test)]\npub fn new() -> Self {\n- assert!(SETTING.get_payment().pay_threshold >= Int256::from(0));\n- assert!(SETTING.get_payment().close_threshold <= Int256::from(0));\n+ assert!(SETTING.get_payment().pay_threshold >= Int256::zero());\n+ assert!(SETTING.get_payment().close_threshold <= Int256::zero());\nDebtKeeper {\nlast_save: None,\n@@ -460,7 +461,7 @@ impl DebtKeeper {\n}\nfn payment_received(&mut self, ident: &Identity, amount: Uint256) -> Result<(), Error> {\n- let signed_zero = Int256::from(0);\n+ let signed_zero = Int256::zero();\nlet unsigned_zero = Uint256::from(0u32);\nlet debt_data = self.get_debt_data_mut(ident);\n@@ -474,7 +475,7 @@ impl DebtKeeper {\n// add in the latest amount to the pile before processing\ndebt_data.incoming_payments += amount;\n- let they_owe_us = debt_data.debt < Int256::from(0);\n+ let they_owe_us = debt_data.debt < Int256::zero();\n// unwrap is safe because the abs of a signed 256 bit int can't overflow a unsigned 256 bit int or be negative\nlet incoming_greater_than_debt =\ndebt_data.incoming_payments > debt_data.debt.abs().to_uint256().unwrap();\n@@ -550,7 +551,7 @@ impl DebtKeeper {\nlet debt_data = self.get_debt_data_mut(ident);\n// the debt we started this round with\n- if debt_data.debt != Int256::from(0) {\n+ if debt_data.debt != Int256::zero() {\ninfo!(\n\"debt update for {}: debt: {}, payment balance: {}\",\nident.wg_public_key, debt_data.debt, debt_data.incoming_payments,\n@@ -584,7 +585,7 @@ impl DebtKeeper {\n(true, false, _) => {\n// before we suspend check if there is any unapplied credit\n// if there is send a zero payment to apply it.\n- let zero = Uint256::from(0u32);\n+ let zero = Uint256::zero();\nif debt_data.incoming_payments > zero {\ndebt_data.action = DebtAction::OpenTunnel;\nself.payment_received(ident, zero)?;\n@@ -636,7 +637,7 @@ impl DebtKeeper {\n// never use their credit until they run totally out of money. In practice I've seen\n// routers where this unapplied credit is several dollars worth, so it's best to remit\n// that to the users by applying it here.\n- let zero = Uint256::from(0u32);\n+ let zero = Uint256::zero();\nif debt_data.incoming_payments > zero {\ndebt_data.action = DebtAction::OpenTunnel;\nself.payment_received(ident, zero)?;\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Use the Zero identity |
20,244 | 27.01.2020 10:16:41 | 18,000 | 1e5398f500aa0c491b570a53ae0dfdf2723caaa4 | Bump for Beta 11 RC6 | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -166,7 +166,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.30\",\n+ \"rita 0.5.32\",\n]\n[[package]]\n@@ -2104,7 +2104,7 @@ dependencies = [\n[[package]]\nname = \"rita\"\n-version = \"0.5.30\"\n+version = \"0.5.32\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/Cargo.toml",
"new_path": "rita/Cargo.toml",
"diff": "[package]\nname = \"rita\"\n-version = \"0.5.30\"\n+version = \"0.5.32\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/dashboard/own_info.rs",
"new_path": "rita/src/rita_common/dashboard/own_info.rs",
"diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 11 RC5\";\n+pub static READABLE_VERSION: &str = \"Beta 11 RC6\";\n#[derive(Serialize)]\npub struct OwnInfo {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Bump for Beta 11 RC6 |
20,244 | 31.01.2020 15:17:56 | 18,000 | 8402149a1c50c30dccfa09f819336570f77e630d | InterfaceMode can implement copy
This will assist in some compiler optimizations | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/dashboard/interfaces.rs",
"new_path": "rita/src/rita_client/dashboard/interfaces.rs",
"diff": "@@ -18,7 +18,7 @@ pub struct InterfaceToSet {\npub mode: InterfaceMode,\n}\n-#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]\n+#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Copy)]\npub enum InterfaceMode {\nMesh,\nLAN,\n@@ -377,7 +377,7 @@ pub fn get_current_interface_mode(\nlet iface = entry.0;\nlet mode = entry.1;\nif iface.contains(target_iface) {\n- return mode.clone();\n+ return *mode;\n}\n}\nInterfaceMode::Unknown\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | InterfaceMode can implement copy
This will assist in some compiler optimizations |
20,244 | 31.01.2020 15:30:12 | 18,000 | 9b98fd3777b20f2616e84a26dd3440ecdb326805 | Should be exit_dest_price
Just to keep consistent terminology | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/dashboard/prices.rs",
"new_path": "rita/src/rita_client/dashboard/prices.rs",
"diff": "@@ -30,7 +30,7 @@ pub fn set_auto_pricing(path: Path<bool>) -> Result<HttpResponse, Error> {\n#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]\npub struct Prices {\n- exit_dest_fee: u128,\n+ exit_dest_price: u128,\ndao_fee: Uint256,\nsimulated_tx_fee: u8,\n}\n@@ -38,12 +38,12 @@ pub struct Prices {\npub fn get_prices(_req: HttpRequest) -> Box<dyn Future<Item = Json<Prices>, Error = Error>> {\ndebug!(\"/prices GET hit\");\nlet f = TrafficWatcher::from_registry().send(GetExitDestPrice);\n- let b = f.from_err().and_then(|exit_dest_fee| {\n- let exit_dest_fee = exit_dest_fee.unwrap();\n+ let b = f.from_err().and_then(|exit_dest_price| {\n+ let exit_dest_price = exit_dest_price.unwrap();\nlet simulated_tx_fee = SETTING.get_payment().simulated_transaction_fee;\nlet dao_fee = SETTING.get_dao().dao_fee.clone();\nlet p = Prices {\n- exit_dest_fee,\n+ exit_dest_price,\ndao_fee,\nsimulated_tx_fee,\n};\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Should be exit_dest_price
Just to keep consistent terminology |
20,244 | 31.01.2020 17:11:20 | 18,000 | d509d97968301e44c35c06563605300a73dd3142 | Fix simulated txfee copy | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/simulated_txfee_manager/mod.rs",
"new_path": "rita/src/rita_common/simulated_txfee_manager/mod.rs",
"diff": "@@ -159,7 +159,7 @@ impl Handler<Tick> for SimulatedTxFeeManager {\n// we will just underpay when that occurs\nArbiter::spawn(transaction_status.then(move |res| match res {\nOk(txid) => {\n- info!(\"Successfully paid the subnet dao {:#066x}!\", txid);\n+ info!(\"Successfully paid the simulated txfee {:#066x}!\", txid);\nUsageTracker::from_registry().do_send(UpdatePayments {\npayment: PaymentTx {\nto: txfee_identity,\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Fix simulated txfee copy |
20,244 | 01.02.2020 06:20:44 | 18,000 | 0db85178f3faf79ca0643cc41252558c486c8f72 | Use zero property here | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/debt_keeper/mod.rs",
"new_path": "rita/src/rita_common/debt_keeper/mod.rs",
"diff": "@@ -465,7 +465,7 @@ impl DebtKeeper {\nfn payment_received(&mut self, ident: &Identity, amount: Uint256) -> Result<(), Error> {\nlet signed_zero = Int256::zero();\n- let unsigned_zero = Uint256::from(0u32);\n+ let unsigned_zero = Uint256::zero();\nlet debt_data = self.get_debt_data_mut(ident);\ninfo!(\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Use zero property here |
20,244 | 03.02.2020 18:41:20 | 28,800 | 089eec776fdd1abb2bce9e5ddbdbc7078c0577b7 | Bump for Beta 11 RC7 | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -166,7 +166,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.32\",\n+ \"rita 0.5.33\",\n]\n[[package]]\n@@ -2104,7 +2104,7 @@ dependencies = [\n[[package]]\nname = \"rita\"\n-version = \"0.5.32\"\n+version = \"0.5.33\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/Cargo.toml",
"new_path": "rita/Cargo.toml",
"diff": "[package]\nname = \"rita\"\n-version = \"0.5.32\"\n+version = \"0.5.33\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/dashboard/own_info.rs",
"new_path": "rita/src/rita_common/dashboard/own_info.rs",
"diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 11 RC6\";\n+pub static READABLE_VERSION: &str = \"Beta 11 RC7\";\n#[derive(Serialize)]\npub struct OwnInfo {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Bump for Beta 11 RC7 |
20,244 | 04.02.2020 07:53:20 | 18,000 | 31b73b234885097bb7e5fb1be79e1a8cd488e5fa | Use a constant for xdai payment multiplier
I had some trouble keeping this number the same across all the locations
it was used. So this commit refactors it into a constant | [
{
"change_type": "MODIFY",
"old_path": "rita/src/client.rs",
"new_path": "rita/src/client.rs",
"diff": "@@ -31,6 +31,7 @@ use docopt::Docopt;\nuse env_logger;\nuse openssl_probe;\nuse settings::client::{RitaClientSettings, RitaSettingsStruct};\n+use settings::payment::XDAI_FEE_MULTIPLIER;\nuse settings::RitaCommonSettings;\nuse std::env;\nuse std::sync::{Arc, RwLock};\n@@ -189,12 +190,12 @@ fn wait_for_settings(settings_file: &str) -> RitaSettingsStruct {\n}\nfn main() {\n- // Remove in Beta 12 updates payment multiplier for xday routers\n+ // Remove in Beta 12 updates payment multiplier for xdai routers\n// scope to ensure the reference is dropped before continuing\n{\nlet mut payment = SETTING.get_payment_mut();\nif payment.system_chain == SystemChain::Xdai {\n- payment.dynamic_fee_multiplier = 9000u32;\n+ payment.dynamic_fee_multiplier = XDAI_FEE_MULTIPLIER;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/dashboard/system_chain.rs",
"new_path": "rita/src/rita_client/dashboard/system_chain.rs",
"diff": "@@ -5,6 +5,7 @@ use ::actix_web::Path;\nuse ::actix_web::{HttpRequest, HttpResponse};\nuse althea_types::SystemChain;\nuse failure::Error;\n+use settings::payment::XDAI_FEE_MULTIPLIER;\nuse settings::FileWrite;\nuse settings::RitaCommonSettings;\n@@ -43,7 +44,7 @@ pub fn set_system_blockchain(path: Path<String>) -> Result<HttpResponse, Error>\noracle_url = \"https://updates.altheamesh.com/xdaiprices\".to_string();\n// reset balance so that things take effect immediatley in the UI\npayment.balance = 0u32.into();\n- payment.dynamic_fee_multiplier = 9000u32\n+ payment.dynamic_fee_multiplier = XDAI_FEE_MULTIPLIER;\n}\nSystemChain::Rinkeby => {\npayment.node_list =\n"
},
{
"change_type": "MODIFY",
"old_path": "settings/src/payment.rs",
"new_path": "settings/src/payment.rs",
"diff": "@@ -3,6 +3,8 @@ use clarity::{Address, PrivateKey};\nuse num256::{Int256, Uint256};\nuse std::str::FromStr;\n+pub const XDAI_FEE_MULTIPLIER: u32 = 9000;\n+\nfn default_local_fee() -> u32 {\n300_000u32 // 300kWei per byte\n}\n@@ -19,7 +21,7 @@ fn default_pay_threshold() -> Int256 {\n}\nfn default_dynamic_fee_multiplier() -> u32 {\n- 300\n+ XDAI_FEE_MULTIPLIER\n}\nfn default_fudge_factor() -> u8 {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Use a constant for xdai payment multiplier
I had some trouble keeping this number the same across all the locations
it was used. So this commit refactors it into a constant |
20,244 | 04.02.2020 14:30:02 | 18,000 | 757649352acbe003c5165f5f9e1d4e56e8d6b2ff | Handle AltheaMobile being toggled off
Devices that have never had the light client network don't have the option
value populated. But new devices where the network is toggled off do
have a value there but just can't bind to a non-existant network | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/rita_loop/mod.rs",
"new_path": "rita/src/rita_client/rita_loop/mod.rs",
"diff": "@@ -217,7 +217,7 @@ pub fn start_rita_client_endpoints(workers: usize) {\n// listen on the light client gateway ip if it's not none\nif let Some(gateway_ip) = SETTING.get_network().light_client_router_ip {\ntrace!(\"Listening for light client hellos on {}\", gateway_ip);\n- server::new(|| {\n+ let unstarted_server = server::new(|| {\nApp::new().resource(\"/light_client_hello\", |r| {\nr.method(Method::POST).with(light_client_hello_response)\n})\n@@ -227,9 +227,11 @@ pub fn start_rita_client_endpoints(workers: usize) {\n\"{}:{}\",\ngateway_ip,\nSETTING.get_network().light_client_hello_port\n- ))\n- .unwrap()\n- .shutdown_timeout(0)\n- .start();\n+ ));\n+ if let Ok(val) = unstarted_server {\n+ val.shutdown_timeout(0).start();\n+ } else {\n+ trace!(\"Failed to bind to light client ip, probably toggled off!\")\n+ }\n}\n}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Handle AltheaMobile being toggled off
Devices that have never had the light client network don't have the option
value populated. But new devices where the network is toggled off do
have a value there but just can't bind to a non-existant network |
20,244 | 05.02.2020 13:32:04 | 18,000 | 1231ebc603b8eefc6f15c31b1bca7a8901cc06af | Better comment for bandwidth_limit_enabled
I had to go look at what this did, so the comment needs work
and the variable itself maybe needs renaming. | [
{
"change_type": "MODIFY",
"old_path": "settings/src/network.rs",
"new_path": "settings/src/network.rs",
"diff": "@@ -115,7 +115,9 @@ pub struct NetworkSettings {\n#[serde(default)]\n/// Set to true by the dashboard when the user indicates they've made a backup\npub backup_created: bool,\n- /// Determines if this device will try and shape interface speeds\n+ /// Determines if this device will try and shape interface speeds when latency\n+ /// spikes are detected. You probably don't want to have this on in networks\n+ /// where there is significant jitter that's not caused by traffic load\n#[serde(default = \"default_bandwidth_limit_enabled\")]\npub bandwidth_limit_enabled: bool,\n/// The minimum to which this device will shape an interface\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Better comment for bandwidth_limit_enabled
I had to go look at what this did, so the comment needs work
and the variable itself maybe needs renaming. |
20,244 | 05.02.2020 13:45:04 | 18,000 | c059ae482c7175942f4099684c4f691a93468d01 | Finish phase out of insecure status and registration
This is finally all done and can be removed, no live routers
depend on this anymore | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_exit/network_endpoints/mod.rs",
"new_path": "rita/src/rita_exit/network_endpoints/mod.rs",
"diff": "@@ -188,55 +188,6 @@ pub fn secure_setup_request(\n}\n}\n-pub fn setup_request(\n- their_id: (Json<ExitClientIdentity>, HttpRequest),\n-) -> Box<dyn Future<Item = Json<ExitState>, Error = Error>> {\n- info!(\n- \"Received setup request from, {}\",\n- their_id.0.global.wg_public_key\n- );\n- let client_mesh_ip = their_id.0.global.mesh_ip;\n- let client = their_id.0.into_inner();\n- let remote_mesh_socket: SocketAddr = their_id\n- .1\n- .connection_info()\n- .remote()\n- .expect(\"Failed in setup request\")\n- .parse()\n- .expect(\"Failed in setup request\");\n-\n- let remote_mesh_ip = remote_mesh_socket.ip();\n- if remote_mesh_ip == client_mesh_ip {\n- Box::new(signup_client(client).then(|result| match result {\n- Ok(exit_state) => Ok(Json(exit_state)),\n- Err(e) => {\n- error!(\"Signup client failed with {:?}\", e);\n- Ok(Json(ExitState::Denied {\n- message: \"There was an internal server error!\".to_string(),\n- }))\n- }\n- }))\n- } else {\n- Box::new(future::ok(Json(ExitState::Denied {\n- message: \"The request ip does not match the signup ip\".to_string(),\n- })))\n- }\n-}\n-\n-pub fn status_request(\n- their_id: Json<ExitClientIdentity>,\n-) -> Box<dyn Future<Item = Json<ExitState>, Error = Error>> {\n- trace!(\n- \"Received requester identity for status, {}\",\n- their_id.global.wg_public_key\n- );\n- let client = their_id.into_inner();\n-\n- Box::new(\n- get_database_connection().and_then(move |conn| Ok(Json(client_status(client, &conn)?))),\n- )\n-}\n-\npub fn secure_status_request(\nrequest: Json<EncryptedExitClientIdentity>,\n) -> Box<dyn Future<Item = Json<EncryptedExitState>, Error = Error>> {\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_exit/rita_loop/mod.rs",
"new_path": "rita/src/rita_exit/rita_loop/mod.rs",
"diff": "@@ -207,11 +207,9 @@ pub fn start_rita_exit_endpoints(workers: usize) {\n// Exit stuff, huge threadpool to offset Pgsql blocking\nserver::new(|| {\nApp::new()\n- .resource(\"/setup\", |r| r.method(Method::POST).with(setup_request))\n.resource(\"/secure_setup\", |r| {\nr.method(Method::POST).with(secure_setup_request)\n})\n- .resource(\"/status\", |r| r.method(Method::POST).with(status_request))\n.resource(\"/secure_status\", |r| {\nr.method(Method::POST).with(secure_status_request)\n})\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Finish phase out of insecure status and registration
This is finally all done and can be removed, no live routers
depend on this anymore |
20,244 | 05.02.2020 13:47:47 | 18,000 | 3714cba1fbebeab9132ff9a9355ded72cc85a525 | Remove the /rtt endpoint from the exit
This one was doomed from the start, it uses tcp and that's just too slow | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_exit/network_endpoints/mod.rs",
"new_path": "rita/src/rita_exit/network_endpoints/mod.rs",
"diff": "@@ -18,7 +18,7 @@ use actix::SystemService;\nuse actix_web::AsyncResponder;\nuse althea_types::Identity;\nuse althea_types::{\n- EncryptedExitClientIdentity, EncryptedExitState, ExitClientIdentity, ExitState, RTTimestamps,\n+ EncryptedExitClientIdentity, EncryptedExitState, ExitClientIdentity, ExitState,\n};\nuse failure::Error;\nuse futures01::future;\n@@ -30,7 +30,6 @@ use sodiumoxide::crypto::box_::curve25519xsalsa20poly1305::Nonce;\nuse sodiumoxide::crypto::box_::curve25519xsalsa20poly1305::PublicKey;\nuse sodiumoxide::crypto::box_::curve25519xsalsa20poly1305::SecretKey;\nuse std::net::SocketAddr;\n-use std::time::SystemTime;\n/// helper function for returning from secure_setup_request()\nfn secure_setup_return(\n@@ -231,16 +230,6 @@ pub fn get_exit_info_http(_req: HttpRequest) -> Result<Json<ExitState>, Error> {\n}))\n}\n-/// An endpoint handler for the inner tunnel RTT. It responds with the request arrival and\n-/// transmission time timestamps; presently the two values are very close because no exit-side\n-/// processing happens yet.\n-pub fn rtt(_req: HttpRequest) -> Result<Json<RTTimestamps>> {\n- Ok(Json(RTTimestamps {\n- exit_rx: SystemTime::now(),\n- exit_tx: SystemTime::now(),\n- }))\n-}\n-\n/// Used by clients to get their debt from the exits. While it is in theory possible for the\n/// client to totally compute their own bill it's not possible for the exit and the client\n/// to agree on the billed amount in the presence of packet loss. Normally Althea is pay per forward\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_exit/rita_loop/mod.rs",
"new_path": "rita/src/rita_exit/rita_loop/mod.rs",
"diff": "@@ -216,7 +216,6 @@ pub fn start_rita_exit_endpoints(workers: usize) {\n.resource(\"/exit_info\", |r| {\nr.method(Method::GET).with(get_exit_info_http)\n})\n- .resource(\"/rtt\", |r| r.method(Method::GET).with(rtt))\n.resource(\"/client_debt\", |r| {\nr.method(Method::POST).with(get_client_debt)\n})\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Remove the /rtt endpoint from the exit
This one was doomed from the start, it uses tcp and that's just too slow |
20,244 | 05.02.2020 14:31:15 | 18,000 | 76b4209dc2ca110cece2718b27aa00df1f7d2d77 | Reduce unneeded database loads in status request path
The exit was performing a db request to check if a user entry existed
and then just a few lines later requesting that same entry. We can save
the round trip time and grab it while we check if it exists | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_exit/database/database_tools.rs",
"new_path": "rita/src/rita_exit/database/database_tools.rs",
"diff": "@@ -96,7 +96,7 @@ pub fn update_client(client: &ExitClientIdentity, conn: &PgConnection) -> Result\npub fn get_client(\nclient: &ExitClientIdentity,\nconn: &PgConnection,\n-) -> Result<models::Client, Error> {\n+) -> Result<Option<models::Client>, Error> {\nuse self::schema::clients::dsl::{clients, eth_address, mesh_ip, wg_pubkey};\nlet ip = client.global.mesh_ip;\nlet wg = client.global.wg_public_key;\n@@ -112,8 +112,9 @@ pub fn get_client(\n\"More than one exact match with wg: {} eth: {} ip: {}\",\nwg, key, ip\n);\n+ return Ok(None);\n}\n- Ok(entry[0].clone())\n+ Ok(Some(entry[0].clone()))\n}\nErr(e) => {\nerror!(\"We failed to lookup the client {:?} with{:?}\", mesh_ip, e);\n@@ -184,7 +185,7 @@ pub fn text_sent(client: &ExitClientIdentity, conn: &PgConnection, val: i32) ->\nOk(())\n}\n-pub fn client_exists(client: &ExitClientIdentity, conn: &PgConnection) -> Result<bool, Error> {\n+fn client_exists(client: &ExitClientIdentity, conn: &PgConnection) -> Result<bool, Error> {\nuse self::schema::clients::dsl::*;\ntrace!(\"Checking if client exists\");\nlet ip = client.global.mesh_ip;\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_exit/database/mod.rs",
"new_path": "rita/src/rita_exit/database/mod.rs",
"diff": "@@ -7,7 +7,6 @@ use crate::rita_common::debt_keeper::DebtKeeper;\nuse crate::rita_common::debt_keeper::GetDebtsList;\nuse crate::rita_common::payment_validator::TRANSACTION_VERIFICATION_TIMEOUT;\nuse crate::rita_exit::database::database_tools::client_conflict;\n-use crate::rita_exit::database::database_tools::client_exists;\nuse crate::rita_exit::database::database_tools::delete_client;\nuse crate::rita_exit::database::database_tools::get_client;\nuse crate::rita_exit::database::database_tools::get_next_client_ip;\n@@ -151,9 +150,9 @@ fn create_or_update_user_record(\nuser_country: String,\n) -> Result<models::Client, Error> {\nuse self::schema::clients::dsl::clients;\n- if client_exists(&client, conn)? {\n+ if let Some(val) = get_client(&client, conn)? {\nupdate_client(&client, conn)?;\n- Ok(get_client(&client, conn)?)\n+ Ok(val)\n} else {\ninfo!(\n\"record for {} does not exist, creating\",\n@@ -247,11 +246,9 @@ pub fn signup_client(client: ExitClientIdentity) -> impl Future<Item = ExitState\npub fn client_status(client: ExitClientIdentity, conn: &PgConnection) -> Result<ExitState, Error> {\ntrace!(\"Checking if record exists for {:?}\", client.global.mesh_ip);\n- if client_exists(&client, &conn)? {\n+ if let Some(their_record) = get_client(&client, &conn)? {\ntrace!(\"record exists, updating\");\n- let their_record = get_client(&client, &conn)?;\n-\nif !verif_done(&their_record) {\nreturn Ok(ExitState::Pending {\ngeneral_details: get_exit_info(),\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Reduce unneeded database loads in status request path
The exit was performing a db request to check if a user entry existed
and then just a few lines later requesting that same entry. We can save
the round trip time and grab it while we check if it exists |
20,244 | 05.02.2020 15:23:30 | 18,000 | 495d0bb6a5bcb652d541fde94beffc8822b57f0e | Remove utility functions from rita_exit::database::mod.rs
I'd like the mod.rs file to only contain the high level logic
for each major database comonent. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_exit/database/database_tools.rs",
"new_path": "rita/src/rita_exit/database/database_tools.rs",
"diff": "use crate::rita_common::utils::ip_increment::increment;\nuse crate::rita_exit::database::secs_since_unix_epoch;\n+use crate::rita_exit::database::struct_tools::client_to_new_db_client;\nuse crate::rita_exit::database::ONE_DAY;\n+use crate::DB_POOL;\nuse crate::SETTING;\n-use ::actix_web::Result;\n+use actix_web::Result;\nuse althea_kernel_interface::ExitClient;\nuse althea_types::ExitClientIdentity;\nuse diesel;\nuse diesel::dsl::{delete, exists};\nuse diesel::prelude::{ExpressionMethods, PgConnection, QueryDsl, RunQueryDsl};\n+use diesel::r2d2::ConnectionManager;\n+use diesel::r2d2::PooledConnection;\nuse diesel::select;\nuse exit_db::{models, schema};\nuse failure::Error;\n+use futures01::future;\n+use futures01::future::Future;\nuse settings::exit::RitaExitSettings;\nuse std::net::IpAddr;\nuse std::net::Ipv4Addr;\n+use std::time::Duration;\n+use std::time::Instant;\n+use tokio::timer::Delay;\n+use tokio::util::FutureExt;\n/// Takes a list of clients and returns a sorted list of ip addresses spefically v4 since it\n/// can implement comparison operators\n@@ -303,3 +313,58 @@ pub fn update_low_balance_notification_time(\nOk(())\n}\n+\n+/// Gets the Postgres database connection from the threadpool, gracefully waiting using futures delay if there\n+/// is no connection available.\n+pub fn get_database_connection(\n+) -> impl Future<Item = PooledConnection<ConnectionManager<PgConnection>>, Error = Error> {\n+ match DB_POOL.read().unwrap().try_get() {\n+ Some(connection) => Box::new(future::ok(connection))\n+ as Box<\n+ dyn Future<Item = PooledConnection<ConnectionManager<PgConnection>>, Error = Error>,\n+ >,\n+ None => {\n+ trace!(\"No available db connection sleeping!\");\n+ let when = Instant::now() + Duration::from_millis(100);\n+ Box::new(\n+ Delay::new(when)\n+ .map_err(move |e| panic!(\"timer failed; err={:?}\", e))\n+ .and_then(move |_| get_database_connection())\n+ .timeout(Duration::from_secs(1))\n+ .then(|result| match result {\n+ Ok(v) => Ok(v),\n+ Err(e) => {\n+ error!(\"Failed to get DB connection with {:?}\", e);\n+ Err(format_err!(\"{:?}\", e))\n+ }\n+ }),\n+ )\n+ }\n+ }\n+}\n+\n+pub fn create_or_update_user_record(\n+ conn: &PgConnection,\n+ client: &ExitClientIdentity,\n+ user_country: String,\n+) -> Result<models::Client, Error> {\n+ use self::schema::clients::dsl::clients;\n+ if let Some(val) = get_client(&client, conn)? {\n+ update_client(&client, &val, conn)?;\n+ Ok(val)\n+ } else {\n+ info!(\n+ \"record for {} does not exist, creating\",\n+ client.global.wg_public_key\n+ );\n+\n+ let new_ip = get_next_client_ip(conn)?;\n+\n+ let c = client_to_new_db_client(&client, new_ip, user_country);\n+\n+ info!(\"Inserting new client {}\", client.global.wg_public_key);\n+ diesel::insert_into(clients).values(&c).execute(conn)?;\n+\n+ Ok(c)\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_exit/database/mod.rs",
"new_path": "rita/src/rita_exit/database/mod.rs",
"diff": "@@ -7,9 +7,10 @@ use crate::rita_common::debt_keeper::DebtKeeper;\nuse crate::rita_common::debt_keeper::GetDebtsList;\nuse crate::rita_common::payment_validator::TRANSACTION_VERIFICATION_TIMEOUT;\nuse crate::rita_exit::database::database_tools::client_conflict;\n+use crate::rita_exit::database::database_tools::create_or_update_user_record;\nuse crate::rita_exit::database::database_tools::delete_client;\nuse crate::rita_exit::database::database_tools::get_client;\n-use crate::rita_exit::database::database_tools::get_next_client_ip;\n+use crate::rita_exit::database::database_tools::get_database_connection;\nuse crate::rita_exit::database::database_tools::set_client_timestamp;\nuse crate::rita_exit::database::database_tools::update_client;\nuse crate::rita_exit::database::database_tools::update_low_balance_notification_time;\n@@ -28,24 +29,19 @@ use crate::rita_exit::database::struct_tools::to_exit_client;\nuse crate::rita_exit::database::struct_tools::to_identity;\nuse crate::rita_exit::database::struct_tools::verif_done;\nuse crate::rita_exit::rita_loop::EXIT_LOOP_TIMEOUT;\n-use crate::DB_POOL;\nuse crate::KI;\nuse crate::SETTING;\nuse ::actix::SystemService;\nuse althea_kernel_interface::ExitClient;\nuse althea_types::{ExitClientDetails, ExitClientIdentity, ExitDetails, ExitState, ExitVerifMode};\nuse diesel;\n-use diesel::prelude::{PgConnection, RunQueryDsl};\n-use diesel::r2d2::ConnectionManager;\n-use diesel::r2d2::PooledConnection;\n-use exit_db::{models, schema};\n+use diesel::prelude::PgConnection;\n+use exit_db::schema;\nuse failure::Error;\nuse futures01::future;\nuse futures01::future::join_all;\nuse futures01::Future;\nuse ipnetwork::IpNetwork;\n-use rand;\n-use rand::Rng;\nuse settings::exit::ExitVerifSettings;\nuse settings::exit::RitaExitSettings;\nuse settings::RitaCommonSettings;\n@@ -54,10 +50,9 @@ use std::collections::HashSet;\nuse std::net::IpAddr;\nuse std::time::Instant;\nuse std::time::{Duration, SystemTime, UNIX_EPOCH};\n-use tokio::timer::Delay;\nuse tokio::util::FutureExt;\n-mod database_tools;\n+pub mod database_tools;\npub mod db_client;\nmod email;\nmod geoip;\n@@ -67,35 +62,6 @@ pub mod struct_tools;\n/// one day in seconds\npub const ONE_DAY: i64 = 86400;\n-/// Gets the Postgres database connection from the threadpool, gracefully waiting using futures delay if there\n-/// is no connection available.\n-pub fn get_database_connection(\n-) -> impl Future<Item = PooledConnection<ConnectionManager<PgConnection>>, Error = Error> {\n- match DB_POOL.read().unwrap().try_get() {\n- Some(connection) => Box::new(future::ok(connection))\n- as Box<\n- dyn Future<Item = PooledConnection<ConnectionManager<PgConnection>>, Error = Error>,\n- >,\n- None => {\n- trace!(\"No available db connection sleeping!\");\n- let when = Instant::now() + Duration::from_millis(100);\n- Box::new(\n- Delay::new(when)\n- .map_err(move |e| panic!(\"timer failed; err={:?}\", e))\n- .and_then(move |_| get_database_connection())\n- .timeout(Duration::from_secs(1))\n- .then(|result| match result {\n- Ok(v) => Ok(v),\n- Err(e) => {\n- error!(\"Failed to get DB connection with {:?}\", e);\n- Err(format_err!(\"{:?}\", e))\n- }\n- }),\n- )\n- }\n- }\n-}\n-\npub fn get_exit_info() -> ExitDetails {\nExitDetails {\nserver_internal_ip: SETTING.get_exit_network().own_internal_ip.into(),\n@@ -121,58 +87,6 @@ pub fn secs_since_unix_epoch() -> i64 {\nsince_the_epoch.as_secs() as i64\n}\n-fn client_to_new_db_client(\n- client: &ExitClientIdentity,\n- new_ip: IpAddr,\n- country: String,\n-) -> models::Client {\n- let mut rng = rand::thread_rng();\n- let rand_code: u64 = rng.gen_range(0, 999_999);\n- models::Client {\n- wg_port: i32::from(client.wg_port),\n- mesh_ip: client.global.mesh_ip.to_string(),\n- wg_pubkey: client.global.wg_public_key.to_string(),\n- eth_address: client.global.eth_address.to_string(),\n- nickname: client.global.nickname.unwrap_or_default().to_string(),\n- internal_ip: new_ip.to_string(),\n- email: client.reg_details.email.clone().unwrap_or_default(),\n- phone: client.reg_details.phone.clone().unwrap_or_default(),\n- country,\n- email_code: format!(\"{:06}\", rand_code),\n- text_sent: 0,\n- verified: false,\n- email_sent_time: 0,\n- last_seen: 0,\n- last_balance_warning_time: 0,\n- }\n-}\n-\n-fn create_or_update_user_record(\n- conn: &PgConnection,\n- client: &ExitClientIdentity,\n- user_country: String,\n-) -> Result<models::Client, Error> {\n- use self::schema::clients::dsl::clients;\n- if let Some(val) = get_client(&client, conn)? {\n- update_client(&client, &val, conn)?;\n- Ok(val)\n- } else {\n- info!(\n- \"record for {} does not exist, creating\",\n- client.global.wg_public_key\n- );\n-\n- let new_ip = get_next_client_ip(conn)?;\n-\n- let c = client_to_new_db_client(&client, new_ip, user_country);\n-\n- info!(\"Inserting new client {}\", client.global.wg_public_key);\n- diesel::insert_into(clients).values(&c).execute(conn)?;\n-\n- Ok(c)\n- }\n-}\n-\n/// Handles a new client registration api call. Performs a geoip lookup\n/// on their registration ip to make sure that they are coming from a valid gateway\n/// ip and then sends out an email of phone message\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_exit/database/struct_tools.rs",
"new_path": "rita/src/rita_exit/database/struct_tools.rs",
"diff": "use althea_kernel_interface::ExitClient;\n+use althea_types::ExitClientIdentity;\nuse althea_types::Identity;\nuse arrayvec::ArrayString;\nuse exit_db::models;\nuse exit_db::models::Client;\nuse failure::Error;\n+use rand::Rng;\nuse std::collections::HashSet;\n+use std::net::IpAddr;\npub fn to_identity(client: &Client) -> Result<Identity, Error> {\ntrace!(\"Converting client {:?}\", client);\n@@ -56,3 +59,29 @@ pub fn display_hashset(input: &HashSet<String>) -> String {\n}\nout\n}\n+\n+pub fn client_to_new_db_client(\n+ client: &ExitClientIdentity,\n+ new_ip: IpAddr,\n+ country: String,\n+) -> models::Client {\n+ let mut rng = rand::thread_rng();\n+ let rand_code: u64 = rng.gen_range(0, 999_999);\n+ models::Client {\n+ wg_port: i32::from(client.wg_port),\n+ mesh_ip: client.global.mesh_ip.to_string(),\n+ wg_pubkey: client.global.wg_public_key.to_string(),\n+ eth_address: client.global.eth_address.to_string(),\n+ nickname: client.global.nickname.unwrap_or_default().to_string(),\n+ internal_ip: new_ip.to_string(),\n+ email: client.reg_details.email.clone().unwrap_or_default(),\n+ phone: client.reg_details.phone.clone().unwrap_or_default(),\n+ country,\n+ email_code: format!(\"{:06}\", rand_code),\n+ text_sent: 0,\n+ verified: false,\n+ email_sent_time: 0,\n+ last_seen: 0,\n+ last_balance_warning_time: 0,\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_exit/network_endpoints/mod.rs",
"new_path": "rita/src/rita_exit/network_endpoints/mod.rs",
"diff": "use crate::rita_common::debt_keeper::DebtKeeper;\nuse crate::rita_common::debt_keeper::GetDebtsList;\n+use crate::rita_exit::database::database_tools::get_database_connection;\n#[cfg(feature = \"development\")]\nuse crate::rita_exit::database::db_client::DbClient;\n#[cfg(feature = \"development\")]\nuse crate::rita_exit::database::db_client::TruncateTables;\n-use crate::rita_exit::database::get_database_connection;\nuse crate::rita_exit::database::{client_status, get_exit_info, signup_client};\nuse crate::SETTING;\nuse ::actix_web::{AsyncResponder, HttpRequest, HttpResponse, Json, Result};\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_exit/rita_loop/mod.rs",
"new_path": "rita/src/rita_exit/rita_loop/mod.rs",
"diff": "//! actix work together on this on properly, not that I've every seen simple actors like the loop crash\n//! very often.\n+use crate::rita_exit::database::database_tools::get_database_connection;\nuse crate::rita_exit::database::struct_tools::clients_to_ids;\nuse crate::rita_exit::database::{\n- cleanup_exit_clients, enforce_exit_clients, get_database_connection, setup_clients,\n- validate_clients_region,\n+ cleanup_exit_clients, enforce_exit_clients, setup_clients, validate_clients_region,\n};\nuse crate::rita_exit::network_endpoints::*;\nuse crate::rita_exit::traffic_watcher::{TrafficWatcher, Watch};\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Remove utility functions from rita_exit::database::mod.rs
I'd like the mod.rs file to only contain the high level logic
for each major database comonent. |
20,244 | 05.02.2020 17:19:26 | 18,000 | a1afcc8a1f3ec047bc12f607561f7f2b91893069 | Better debug message for exit suspension | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_exit/database/mod.rs",
"new_path": "rita/src/rita_exit/database/mod.rs",
"diff": "@@ -523,7 +523,7 @@ pub fn enforce_exit_clients(\nNone => {\n// this can happen when clients are connected but not registered\n// to this specific exit\n- trace!(\"Could not find {:?} to suspend!\", debt_entry.identity);\n+ trace!(\"Could not find {} {} {} to suspend!\", debt_entry.identity.wg_public_key, debt_entry.identity.eth_address, debt_entry.identity.mesh_ip);\n}\n}\n}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Better debug message for exit suspension |
20,244 | 06.02.2020 08:15:09 | 18,000 | 4d18c30c7dffb7ead54ad2ef3b1d57aabc6ac3bd | Bump for Beta 11 RC8 | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -166,7 +166,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.33\",\n+ \"rita 0.5.34\",\n]\n[[package]]\n@@ -2104,7 +2104,7 @@ dependencies = [\n[[package]]\nname = \"rita\"\n-version = \"0.5.33\"\n+version = \"0.5.34\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/Cargo.toml",
"new_path": "rita/Cargo.toml",
"diff": "[package]\nname = \"rita\"\n-version = \"0.5.33\"\n+version = \"0.5.34\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/dashboard/own_info.rs",
"new_path": "rita/src/rita_common/dashboard/own_info.rs",
"diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 11 RC7\";\n+pub static READABLE_VERSION: &str = \"Beta 11 RC8\";\n#[derive(Serialize)]\npub struct OwnInfo {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Bump for Beta 11 RC8 |
20,244 | 06.02.2020 09:52:29 | 18,000 | dd37a5a4f6011581b158de3bb33961341039003b | Use client loop timeout on status requests
For the sake of consistency we should have a single safe timeout
for these loops. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/exit_manager/mod.rs",
"new_path": "rita/src/rita_client/exit_manager/mod.rs",
"diff": "//! Signup is complete and the user may use the connection\nuse crate::rita_client::rita_loop::Tick;\n+use crate::rita_client::rita_loop::CLIENT_LOOP_TIMEOUT;\nuse crate::rita_client::traffic_watcher::{QueryExitDebts, TrafficWatcher};\nuse crate::rita_common::oracle::low_balance;\nuse crate::KI;\n@@ -190,7 +191,7 @@ fn send_exit_status_request(\nstream.from_err().and_then(move |stream| {\nclient::post(&endpoint)\n- .timeout(Duration::from_secs(1))\n+ .timeout(CLIENT_LOOP_TIMEOUT)\n.with_connection(Connection::from_stream(stream))\n.json(ident)\n.unwrap()\n@@ -486,7 +487,7 @@ impl Handler<Tick> for ExitManager {\n})\n})\n})\n- .timeout(Duration::from_secs(4))\n+ .timeout(CLIENT_LOOP_TIMEOUT)\n.then(|ret| {\nif let Err(e) = ret {\nerror!(\"Failed to watch client traffic with {:?}\", e)\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Use client loop timeout on status requests
For the sake of consistency we should have a single safe timeout
for these loops. |
20,244 | 08.02.2020 21:45:40 | -3,600 | f23a76451fba913f033b2e8a15f8c16b8c56ffd5 | Handle xdai zero gas prices with minimum gas price
Sometimes xdai nodes want to return zero gas price averages. Even when
that's clearly not accepted by any of the nodes. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/oracle/mod.rs",
"new_path": "rita/src/rita_common/oracle/mod.rs",
"diff": "@@ -28,6 +28,8 @@ use std::time::Duration;\nuse std::time::Instant;\nuse web30::client::Web3;\n+const MIN_GAS: u128 = 1_000_000_000;\n+\npub struct Oracle {\n/// An instant representing the start of a short period where the balance can\n/// actually go to zero. This is becuase full nodes (incluing Infura) have an infuriating\n@@ -222,7 +224,7 @@ fn update_gas_price(web3: &Web3, full_node: String) {\nlet res = web3\n.eth_gas_price()\n.then(move |gas_price| match gas_price {\n- Ok(value) => {\n+ Ok(mut value) => {\ninfo!(\n\"Got response from {} for gas price request {:?}\",\nfull_node, value\n@@ -230,6 +232,12 @@ fn update_gas_price(web3: &Web3, full_node: String) {\n// Dynamic fee computation\nlet mut payment_settings = SETTING.get_payment_mut();\n+ // somtimes xdai advertises zero gas prices, it's not actually serious about these prices\n+ // as no one will accept transactions with zero gas, it's just very very low.\n+ if value == Uint256::zero() {\n+ info!(\"gas price is zero setting to! {}\", MIN_GAS);\n+ value = MIN_GAS.into();\n+ }\n// use 105% of the gas price provided by the full node, this is designed\n// to keep us above the median price provided by the full node.\n// This should ensure that we maintain a higher-than-median priority even\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Handle xdai zero gas prices with minimum gas price
Sometimes xdai nodes want to return zero gas price averages. Even when
that's clearly not accepted by any of the nodes. |
20,244 | 08.02.2020 17:14:31 | 18,000 | 119dce3ce3cf5cb86c5677754179eee2cfbbcc46 | Fix defaults for Localization settings
Derive default uses the default values for the native types, not the
default values that we assign in Serde | [
{
"change_type": "MODIFY",
"old_path": "settings/src/localization.rs",
"new_path": "settings/src/localization.rs",
"diff": "@@ -6,7 +6,7 @@ fn default_wyre_account_id() -> String {\n\"AC_2J6LWQEGW8P\".to_string()\n}\n-#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq, Default)]\n+#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]\npub struct LocalizationSettings {\n// A flag indicating whether or not the dashboard should give users the option to purchase\n// cryptocurrency through Wyre as part of the funding flow.\n@@ -16,3 +16,12 @@ pub struct LocalizationSettings {\n#[serde(default = \"default_wyre_account_id\")]\npub wyre_account_id: String,\n}\n+\n+impl Default for LocalizationSettings {\n+ fn default() -> LocalizationSettings {\n+ LocalizationSettings {\n+ wyre_enabled: default_wyre_enabled(),\n+ wyre_account_id: default_wyre_account_id(),\n+ }\n+ }\n+}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Fix defaults for Localization settings
Derive default uses the default values for the native types, not the
default values that we assign in Serde |
20,244 | 08.02.2020 17:33:42 | 18,000 | 213310dbd66c8b9bf1779dafc4d9e5525423a56a | Bump for Beta 11 RC9 | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -166,7 +166,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.34\",\n+ \"rita 0.5.35\",\n]\n[[package]]\n@@ -2104,7 +2104,7 @@ dependencies = [\n[[package]]\nname = \"rita\"\n-version = \"0.5.34\"\n+version = \"0.5.35\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/Cargo.toml",
"new_path": "rita/Cargo.toml",
"diff": "[package]\nname = \"rita\"\n-version = \"0.5.34\"\n+version = \"0.5.35\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/dashboard/own_info.rs",
"new_path": "rita/src/rita_common/dashboard/own_info.rs",
"diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 11 RC8\";\n+pub static READABLE_VERSION: &str = \"Beta 11 RC9\";\n#[derive(Serialize)]\npub struct OwnInfo {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Bump for Beta 11 RC9 |
20,244 | 09.02.2020 07:00:27 | 18,000 | aab5251647817681d869ba3b02c3b403ab1799c9 | Maintain error payment warning
Now we are sending constant debt updates to process incoming payments
so this error message is mostly going off for no reason.
By guarding it for zero payments (the way we handle incoming payments
now) we can still monitor the error case properly. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/debt_keeper/mod.rs",
"new_path": "rita/src/rita_common/debt_keeper/mod.rs",
"diff": "@@ -476,7 +476,7 @@ impl DebtKeeper {\n// just a counter, no convergence importance\ndebt_data.total_payment_received += amount.clone();\n// add in the latest amount to the pile before processing\n- debt_data.incoming_payments += amount;\n+ debt_data.incoming_payments += amount.clone();\nlet they_owe_us = debt_data.debt < Int256::zero();\n// unwrap is safe because the abs of a signed 256 bit int can't overflow a unsigned 256 bit int or be negative\n@@ -502,9 +502,11 @@ impl DebtKeeper {\ndebt_data.incoming_payments = unsigned_zero;\n}\n(false, _) => {\n+ if amount > Uint256::zero() {\nerror!(\"Why did we get a payment when they don't owe us anything?\");\n}\n}\n+ }\ninfo!(\n\"new incoming payments for {:?}: {:?}\",\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Maintain error payment warning
Now we are sending constant debt updates to process incoming payments
so this error message is mostly going off for no reason.
By guarding it for zero payments (the way we handle incoming payments
now) we can still monitor the error case properly. |
20,244 | 09.02.2020 09:46:11 | 18,000 | 10aeae39aca49b5608cdfaa1daaaf196754e9fab | Fix the withdraw_all endpoint
Using gas prices below 250gewi broke this endpoint because it's
gas computation wasn't precise enough. This should clean it up
nicely.
Also handled an edge case where the dashboard updated to withdrawing
before the transaction actually went through | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/dashboard/wallet.rs",
"new_path": "rita/src/rita_common/dashboard/wallet.rs",
"diff": "@@ -58,13 +58,22 @@ pub fn withdraw_all(path: Path<Address>) -> Box<dyn Future<Item = HttpResponse,\nlet payment_settings = SETTING.get_payment();\nlet system_chain = payment_settings.system_chain;\nlet withdraw_chain = payment_settings.withdraw_chain;\n- let gas_price = payment_settings.gas_price.clone();\n+ let mut gas_price = payment_settings.gas_price.clone();\nlet balance = payment_settings.balance.clone();\ndrop(payment_settings);\nOracle::from_registry().do_send(ZeroWindowStart());\n- let tx_gas = 21000u32.into();\n+ let tx_gas: Uint256 =\n+ if (system_chain, withdraw_chain) == (SystemChain::Xdai, SystemChain::Ethereum) {\n+ // this is the hardcoded gas price over in token bridge so we have to use it\n+ gas_price = 10_000_000_000u128.into();\n+ // this is a contract call\n+ 80000u32.into()\n+ } else {\n+ 21000u32.into()\n+ };\n+\nlet tx_cost = gas_price * tx_gas;\nlet amount = balance - tx_cost;\nmatch (system_chain, withdraw_chain) {\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/token_bridge/mod.rs",
"new_path": "rita/src/rita_common/token_bridge/mod.rs",
"diff": "@@ -525,6 +525,12 @@ impl Handler<Withdraw> for TokenBridge {\nlet amount = msg.amount.clone();\nlet withdraw_all = msg.withdraw_all;\n+ trace!(\n+ \"Withdraw handler amount {} withdraw_all {}\",\n+ amount,\n+ withdraw_all\n+ );\n+\nlet bridge = self.bridge.clone();\nif let SystemChain::Xdai = system_chain {\n@@ -537,15 +543,15 @@ impl Handler<Withdraw> for TokenBridge {\n}\n_ => {\nArbiter::spawn(bridge.xdai_to_dai_bridge(amount.clone()).then(move |res| {\n+ if res.is_err() {\n+ error!(\"Error in State::Deposit Withdraw handler: {:?}\", res);\n+ } else {\n+ // Only change to Withdraw if there was no error\nTokenBridge::from_registry().do_send(DetailedStateChange(\nDetailedBridgeState::XdaiToDai {\namount: amount.clone(),\n},\n));\n- if res.is_err() {\n- error!(\"Error in State::Deposit Withdraw handler: {:?}\", res);\n- } else {\n- // Only change to Withdraw if there was no error\nTokenBridge::from_registry().do_send(StateChange(State::Withdrawing {\nto,\namount,\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Fix the withdraw_all endpoint
Using gas prices below 250gewi broke this endpoint because it's
gas computation wasn't precise enough. This should clean it up
nicely.
Also handled an edge case where the dashboard updated to withdrawing
before the transaction actually went through |
20,244 | 09.02.2020 10:39:43 | 18,000 | 807d662c330b0a5c4e30ccb49d4a10dbc27f5564 | Fix another logging message | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/simulated_txfee_manager/mod.rs",
"new_path": "rita/src/rita_common/simulated_txfee_manager/mod.rs",
"diff": "@@ -78,10 +78,9 @@ impl Handler<AddTxToTotal> for SimulatedTxFeeManager {\nfn handle(&mut self, msg: AddTxToTotal, _: &mut Context<Self>) -> Self::Result {\nlet to_add = msg.0 / SETTING.get_payment().simulated_transaction_fee.into();\n- trace!(\n+ info!(\n\"Simulated txfee total is {} with {} to add\",\n- self.amount_owed,\n- to_add\n+ self.amount_owed, to_add\n);\nself.amount_owed += to_add;\n}\n@@ -172,7 +171,7 @@ impl Handler<Tick> for SimulatedTxFeeManager {\nOk(())\n}\nErr(e) => {\n- warn!(\"Failed to pay subnet dao! {:?}\", e);\n+ warn!(\"Failed to pay simulated txfee! {:?}\", e);\nOk(())\n}\n}));\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Fix another logging message |
20,244 | 09.02.2020 15:44:40 | 18,000 | 946ea8c15e2546d83510504d6be65f9bc608c943 | Bump oracle timeout | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/oracle/mod.rs",
"new_path": "rita/src/rita_common/oracle/mod.rs",
"diff": "//! operates by simply grabbing a text file from a configured server and adjusting prices\n//! to match. More advanced pricing systems may be broken out into their own file some day\n+use crate::rita_common::rita_loop::fast_loop::FAST_LOOP_TIMEOUT;\nuse crate::rita_common::rita_loop::get_web3_server;\nuse crate::rita_common::token_bridge::ReloadAddresses;\nuse crate::rita_common::token_bridge::TokenBridge;\n@@ -76,7 +77,7 @@ impl Handler<ZeroWindowStart> for Oracle {\n/// How long we wait for a response from the full node\n/// this value must be less than or equal to the FAST_LOOP_SPEED\n/// in the rita_common fast loop\n-pub const ORACLE_TIMEOUT: Duration = Duration::from_secs(2);\n+pub const ORACLE_TIMEOUT: Duration = FAST_LOOP_TIMEOUT;\n#[derive(Message)]\npub struct Update();\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/payment_validator/mod.rs",
"new_path": "rita/src/rita_common/payment_validator/mod.rs",
"diff": "@@ -197,9 +197,10 @@ pub fn validate_transaction(ts: &ToValidate) {\nErr(e) => {\n// full node failure, we don't actually know anything about the transaction\nwarn!(\n- \"Failed to get blocknum to validate {:#066x} transaction with {:?}\",\n+ \"Failed to get blocknum to validate {:#066x} transaction with {:?} our timeout is {}\",\npmt.txid.unwrap(),\n- e\n+ e,\n+ TRANSACTION_VERIFICATION_TIMEOUT.as_secs()\n);\nEither::B(future::ok(()))\n}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Bump oracle timeout |
20,244 | 10.02.2020 06:28:57 | 18,000 | 247d33de3640df757efbd494c3839fc97e597689 | Clean up locking on exit status path
I don't think this is much of an optimizaiton really compared to
the previous format. But it does make the aquisition and drop
behavior more clear to the reader. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_exit/database/mod.rs",
"new_path": "rita/src/rita_exit/database/mod.rs",
"diff": "@@ -63,12 +63,14 @@ pub mod struct_tools;\npub const ONE_DAY: i64 = 86400;\npub fn get_exit_info() -> ExitDetails {\n+ let exit_network = SETTING.get_exit_network();\n+ let payment = SETTING.get_payment();\nExitDetails {\n- server_internal_ip: SETTING.get_exit_network().own_internal_ip.into(),\n- wg_exit_port: SETTING.get_exit_network().wg_tunnel_port,\n- exit_price: SETTING.get_exit_network().exit_price,\n- exit_currency: SETTING.get_payment().system_chain,\n- netmask: SETTING.get_exit_network().netmask,\n+ server_internal_ip: exit_network.own_internal_ip.into(),\n+ wg_exit_port: exit_network.wg_tunnel_port,\n+ exit_price: exit_network.exit_price,\n+ exit_currency: payment.system_chain,\n+ netmask: exit_network.netmask,\ndescription: SETTING.get_description(),\nverif_mode: match SETTING.get_verif_settings() {\nSome(ExitVerifSettings::Email(_mailer_settings)) => ExitVerifMode::Email,\n@@ -177,10 +179,10 @@ pub fn client_status(client: ExitClientIdentity, conn: &PgConnection) -> Result<\nlet current_ip = their_record.internal_ip.parse()?;\n- let current_subnet = IpNetwork::new(\n- SETTING.get_exit_network().own_internal_ip.into(),\n- SETTING.get_exit_network().netmask,\n- )?;\n+ let exit_network = SETTING.get_exit_network();\n+ let current_subnet =\n+ IpNetwork::new(exit_network.own_internal_ip.into(), exit_network.netmask)?;\n+ drop(exit_network);\nif !current_subnet.contains(current_ip) {\nreturn Ok(ExitState::Registering {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Clean up locking on exit status path
I don't think this is much of an optimizaiton really compared to
the previous format. But it does make the aquisition and drop
behavior more clear to the reader. |
20,244 | 10.02.2020 09:43:27 | 18,000 | 4552f09522f54ed58b7f96aedc1734869525ad8c | Actually tick simulated txfees
Currently totals are added up correctly but never paid out since
the tick is never run. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/rita_loop/slow_loop.rs",
"new_path": "rita/src/rita_common/rita_loop/slow_loop.rs",
"diff": "use crate::rita_common::dao_manager::DAOManager;\nuse crate::rita_common::dao_manager::Tick as DAOTick;\n+use crate::rita_common::simulated_txfee_manager::SimulatedTxFeeManager;\n+use crate::rita_common::simulated_txfee_manager::Tick as TxFeeTick;\nuse crate::rita_common::token_bridge::Tick as TokenBridgeTick;\nuse crate::rita_common::token_bridge::TokenBridge;\nuse crate::rita_common::tunnel_manager::{TriggerGC, TunnelManager};\n@@ -79,6 +81,8 @@ impl Handler<Tick> for RitaSlowLoop {\n// Check DAO payments\nDAOManager::from_registry().do_send(DAOTick);\n+ SimulatedTxFeeManager::from_registry().do_send(TxFeeTick);\n+\nTunnelManager::from_registry().do_send(TriggerGC(Duration::from_secs(\nSETTING.get_network().tunnel_timeout_seconds,\n)));\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/simulated_txfee_manager/mod.rs",
"new_path": "rita/src/rita_common/simulated_txfee_manager/mod.rs",
"diff": "@@ -86,7 +86,7 @@ impl Handler<AddTxToTotal> for SimulatedTxFeeManager {\n}\n}\n-/// Very basic loop for DAO manager payments\n+/// Very basic loop for simulated txfee payments\npub struct Tick;\nimpl Message for Tick {\ntype Result = ();\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Actually tick simulated txfees
Currently totals are added up correctly but never paid out since
the tick is never run. |
20,244 | 10.02.2020 15:41:05 | 18,000 | 0ef15be649559236920caa9b9bb839ca1bb6e9e1 | Don't try to pay the fee if you don't need to
This is a pretty bad logic error. We didn't actually check if we should pay
because the trace! statement qualified as a usage. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/simulated_txfee_manager/mod.rs",
"new_path": "rita/src/rita_common/simulated_txfee_manager/mod.rs",
"diff": "@@ -115,6 +115,9 @@ impl Handler<Tick> for SimulatedTxFeeManager {\nsimulated_transaction_fee,\nsimulated_transaction_fee_address\n);\n+ if !should_pay {\n+ return;\n+ }\nlet txfee_identity = Identity {\neth_address: simulated_transaction_fee_address,\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Don't try to pay the fee if you don't need to
This is a pretty bad logic error. We didn't actually check if we should pay
because the trace! statement qualified as a usage. |
20,244 | 10.02.2020 15:52:06 | 18,000 | 92fc43ccf5187bf3574a1f703b2539a031f6b93d | Drop payment settinsgs for DAO and Txfee managers
Pretty pointless micro-opt but I noticed it so here it is | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/dao_manager/mod.rs",
"new_path": "rita/src/rita_common/dao_manager/mod.rs",
"diff": "@@ -92,6 +92,8 @@ impl Handler<Tick> for DAOManager {\nlet we_have_a_dao = !dao_addresses.is_empty();\nlet should_pay =\n(Int256::from(self.last_payment_time.elapsed().as_secs()) * dao_fee) > pay_threshold;\n+ let net_version = payment_settings.net_version;\n+ drop(payment_settings);\ntrace!(\"We should pay the subnet dao {}\", should_pay);\ntrace!(\"We have a dao to pay {}\", we_have_a_dao);\n@@ -129,7 +131,7 @@ impl Handler<Tick> for DAOManager {\n};\nlet transaction_signed = tx.sign(\nð_private_key.expect(\"No private key configured!\"),\n- payment_settings.net_version,\n+ net_version,\n);\nlet transaction_bytes = match transaction_signed.to_bytes() {\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/simulated_txfee_manager/mod.rs",
"new_path": "rita/src/rita_common/simulated_txfee_manager/mod.rs",
"diff": "@@ -109,6 +109,8 @@ impl Handler<Tick> for SimulatedTxFeeManager {\nlet simulated_transaction_fee = payment_settings.simulated_transaction_fee;\nlet amount_to_pay = self.amount_owed.clone();\nlet should_pay = amount_to_pay > pay_threshold.abs().to_uint256().unwrap();\n+ let net_version = payment_settings.net_version;\n+ drop(payment_settings);\ntrace!(\n\"We should pay the simulated tx fee {} of 1/{} % to {}\",\nshould_pay,\n@@ -144,7 +146,7 @@ impl Handler<Tick> for SimulatedTxFeeManager {\n};\nlet transaction_signed = tx.sign(\nð_private_key.expect(\"No private key configured!\"),\n- payment_settings.net_version,\n+ net_version,\n);\nlet transaction_bytes = match transaction_signed.to_bytes() {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Drop payment settinsgs for DAO and Txfee managers
Pretty pointless micro-opt but I noticed it so here it is |
20,244 | 10.02.2020 16:47:53 | 18,000 | e96b292afc0e2299b5bcef1cc51c0de408605f0b | Bump for Beta 11 RC10 | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -166,7 +166,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.35\",\n+ \"rita 0.5.36\",\n]\n[[package]]\n@@ -2104,7 +2104,7 @@ dependencies = [\n[[package]]\nname = \"rita\"\n-version = \"0.5.35\"\n+version = \"0.5.36\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/Cargo.toml",
"new_path": "rita/Cargo.toml",
"diff": "[package]\nname = \"rita\"\n-version = \"0.5.35\"\n+version = \"0.5.36\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/dashboard/own_info.rs",
"new_path": "rita/src/rita_common/dashboard/own_info.rs",
"diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 11 RC9\";\n+pub static READABLE_VERSION: &str = \"Beta 11 RC10\";\n#[derive(Serialize)]\npub struct OwnInfo {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Bump for Beta 11 RC10 |
20,244 | 10.02.2020 20:46:16 | 18,000 | c1fa25edb9219eec8bd4d7da8a75cda714216b2d | Very long timeouts are a bad idea
60 second timeouts are causing very significant slow downs in the rita
common loop. Too many of these futures are still being driven when they
should have been terminated earlier.
Sadly this doesn't look like a viable path for more robust payment
validation. | [
{
"change_type": "MODIFY",
"old_path": "rita/Cargo.toml",
"new_path": "rita/Cargo.toml",
"diff": "@@ -74,6 +74,6 @@ features = [\"std\"]\n[features]\n# Features for big iron devices with more ram\n-server = [\"long_timeouts\"]\n+server = []\nlong_timeouts = []\ndevelopment = []\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/payment_validator/mod.rs",
"new_path": "rita/src/rita_common/payment_validator/mod.rs",
"diff": "use crate::rita_common::debt_keeper::DebtKeeper;\nuse crate::rita_common::debt_keeper::PaymentReceived;\nuse crate::rita_common::debt_keeper::PaymentSucceeded;\n+use crate::rita_common::rita_loop::fast_loop::FAST_LOOP_TIMEOUT;\nuse crate::rita_common::rita_loop::get_web3_server;\nuse crate::rita_common::usage_tracker::UpdatePayments;\nuse crate::rita_common::usage_tracker::UsageTracker;\n@@ -25,14 +26,7 @@ use std::time::{Duration, Instant};\nuse web30::client::Web3;\nuse web30::types::TransactionResponse;\n-// How long we will wait for full node responses, set to a much more conservative\n-// value on the client to prevent memory usage growth, but on the server we experience\n-// far less dynamic network conditions and it's far more important that we validate payments\n-// even at the cost of memory or the risk of an emergency restart if we slow down too much\n-#[cfg(not(any(feature = \"long_timeouts\", target_arch = \"x86_64\")))]\n-pub const TRANSACTION_VERIFICATION_TIMEOUT: Duration = Duration::from_secs(4);\n-#[cfg(any(feature = \"long_timeouts\", target_arch = \"x86_64\"))]\n-pub const TRANSACTION_VERIFICATION_TIMEOUT: Duration = Duration::from_secs(60);\n+pub const TRANSACTION_VERIFICATION_TIMEOUT: Duration = FAST_LOOP_TIMEOUT;\n// Discard payments after 15 minutes of failing to find txid\npub const PAYMENT_TIMEOUT: Duration = Duration::from_secs(900u64);\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Very long timeouts are a bad idea
60 second timeouts are causing very significant slow downs in the rita
common loop. Too many of these futures are still being driven when they
should have been terminated earlier.
Sadly this doesn't look like a viable path for more robust payment
validation. |
20,244 | 10.02.2020 21:06:13 | 18,000 | 584440c72072dafa7b575627533dbaf11e4b5871 | Simplify payment validation using join
We can really reduce the verbosity of this handler and optimize the
underlying requests by using join here. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/payment_validator/mod.rs",
"new_path": "rita/src/rita_common/payment_validator/mod.rs",
"diff": "@@ -17,8 +17,7 @@ use crate::rita_common::usage_tracker::UsageTracker;\nuse crate::SETTING;\nuse actix::{Actor, Arbiter, Context, Handler, Message, Supervised, SystemService};\nuse althea_types::PaymentTx;\n-use futures01::future::Either;\n-use futures01::{future, Future};\n+use futures01::Future;\nuse num256::Uint256;\nuse settings::RitaCommonSettings;\nuse std::collections::HashSet;\n@@ -163,42 +162,24 @@ pub fn validate_transaction(ts: &ToValidate) {\nlet long_life_ts = ts.clone();\n- let res = web3.eth_block_number().then(move |block| {\n- match block {\n- Ok(block_num) => {\n- Either::A(\n- web3.eth_get_transaction_by_hash(txid.clone())\n- .then(move |tx_status| match tx_status {\n- Ok(status) => match status {\n- Some(transaction) => {\n+ let res = web3\n+ .eth_block_number()\n+ .join(web3.eth_get_transaction_by_hash(txid.clone()))\n+ .and_then(move |(block_num, tx_status)| {\n+ if let Some(transaction) = tx_status {\nhandle_tx_messaging(txid, transaction, long_life_ts, block_num);\n- Ok(())\n}\n- None => Ok(()),\n- },\n- Err(e) => {\n- // full node failure, we don't actually know anything about the transaction\n+ Ok(())\n+ })\n+ .then(|res| {\n+ if let Err(e) = res {\nwarn!(\n\"Failed to validate {:#066x} transaction with {:?}\",\npmt.txid.unwrap(),\ne\n);\n- Ok(())\n- }\n- }),\n- )\n- }\n- Err(e) => {\n- // full node failure, we don't actually know anything about the transaction\n- warn!(\n- \"Failed to get blocknum to validate {:#066x} transaction with {:?} our timeout is {}\",\n- pmt.txid.unwrap(),\n- e,\n- TRANSACTION_VERIFICATION_TIMEOUT.as_secs()\n- );\n- Either::B(future::ok(()))\n- }\n}\n+ Ok(())\n});\nArbiter::spawn(res);\n}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Simplify payment validation using join
We can really reduce the verbosity of this handler and optimize the
underlying requests by using join here. |
20,244 | 11.02.2020 08:05:27 | 18,000 | a7d65beb23b0d13692d80bc1e222fcbd2c4be6de | transaction_validation_timeout can be greater than panic_time
Now that we are checking over in payment validatior this is just an
alarm for general slow functioning. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/payment_validator/mod.rs",
"new_path": "rita/src/rita_common/payment_validator/mod.rs",
"diff": "@@ -173,8 +173,6 @@ impl Handler<Validate> for PaymentValidator {\nif !item.checked {\nlet msg = \"We failed to check txid {:#066x} against full nodes for the full duration of it's timeout period, please check full nodes\";\nerror!(\"{}\", msg);\n- // servers process many transactions and would rather fail than take extra payment\n- #[cfg(feature = \"server\")]\npanic!(msg)\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_exit/database/mod.rs",
"new_path": "rita/src/rita_exit/database/mod.rs",
"diff": "use crate::rita_common::debt_keeper::DebtAction;\nuse crate::rita_common::debt_keeper::DebtKeeper;\nuse crate::rita_common::debt_keeper::GetDebtsList;\n-use crate::rita_common::payment_validator::TRANSACTION_VERIFICATION_TIMEOUT;\nuse crate::rita_exit::database::database_tools::client_conflict;\nuse crate::rita_exit::database::database_tools::create_or_update_user_record;\nuse crate::rita_exit::database::database_tools::delete_client;\n@@ -562,7 +561,6 @@ pub fn enforce_exit_clients(\n// the most in these situations. Hopefully we can figure out more about why the\n// futures loop starts acting stragely.\nconst PANIC_TIME: u64 = 10;\n- assert!(TRANSACTION_VERIFICATION_TIMEOUT > Duration::from_secs(PANIC_TIME));\nif start.elapsed().as_secs() > PANIC_TIME {\nlet fail_mesg = format!(\"Exit enforcement took more than {} seconds!\", PANIC_TIME);\nerror!(\"{}\", fail_mesg);\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | transaction_validation_timeout can be greater than panic_time
Now that we are checking over in payment validatior this is just an
alarm for general slow functioning. |
20,244 | 11.02.2020 08:43:56 | 18,000 | cb3caac4c2be8f5799ea755886869e0416e66d99 | Do not mark transactions as checked multiple times | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/payment_validator/mod.rs",
"new_path": "rita/src/rita_common/payment_validator/mod.rs",
"diff": "@@ -204,9 +204,11 @@ pub fn validate_transaction(ts: &ToValidate) {\n.eth_block_number()\n.join(web3.eth_get_transaction_by_hash(txid.clone()))\n.and_then(move |(block_num, tx_status)| {\n+ if !long_life_ts.checked {\nPaymentValidator::from_registry().do_send(Checked {\ntx: long_life_ts.clone(),\n});\n+ }\nif let Some(transaction) = tx_status {\nhandle_tx_messaging(txid, transaction, long_life_ts, block_num);\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Do not mark transactions as checked multiple times |
20,244 | 11.02.2020 16:03:37 | 18,000 | e16b66ff7579ddcc9e996253618c058ad6dcda38 | Display client_can_use_free_tier to dashbaord
The dashboard message is misleading when free tier is disabled. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/dashboard/own_info.rs",
"new_path": "rita/src/rita_common/dashboard/own_info.rs",
"diff": "@@ -21,6 +21,7 @@ pub struct OwnInfo {\npub rita_version: String,\npub version: String,\npub is_gateway: bool,\n+ pub client_can_use_free_tier: bool,\n}\npub fn get_own_info(_req: HttpRequest) -> Result<Json<OwnInfo>, Error> {\n@@ -30,10 +31,11 @@ pub fn get_own_info(_req: HttpRequest) -> Result<Json<OwnInfo>, Error> {\nlet balance = payment_settings.balance.clone();\nlet pay_threshold = payment_settings.pay_threshold.clone();\nlet close_threshold = payment_settings.close_threshold.clone();\n+ let local_fee = payment_settings.local_fee;\n+ let client_can_use_free_tier = payment_settings.client_can_use_free_tier;\nlet network_settings = SETTING.get_network();\n- let local_fee = SETTING.get_payment().local_fee;\n- let metric_factor = SETTING.get_network().metric_factor;\n+ let metric_factor = network_settings.metric_factor;\nlet device = network_settings.device.clone();\nlet is_gateway = network_settings.is_gateway;\n@@ -49,6 +51,7 @@ pub fn get_own_info(_req: HttpRequest) -> Result<Json<OwnInfo>, Error> {\nrita_version: env!(\"CARGO_PKG_VERSION\").to_string(),\nversion: READABLE_VERSION.to_string(),\nis_gateway,\n+ client_can_use_free_tier,\n};\nOk(Json(reply))\n}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Display client_can_use_free_tier to dashbaord
The dashboard message is misleading when free tier is disabled. |
20,244 | 12.02.2020 10:05:42 | 18,000 | ae393c2515b56480a20c1d6236c0aab96021824c | Log wgkey of payment sender | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/network_endpoints/mod.rs",
"new_path": "rita/src/rita_common/network_endpoints/mod.rs",
"diff": "@@ -53,9 +53,7 @@ pub fn make_payments(\nlet txid = txid.unwrap();\ninfo!(\n\"Got Payment from {:?} for {} with txid {:#066x}\",\n- pmt.1.connection_info().remote(),\n- pmt.0.amount,\n- txid,\n+ pmt.0.from.wg_public_key, pmt.0.amount, txid,\n);\nlet ts = ToValidate {\npayment: pmt.0.into_inner(),\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Log wgkey of payment sender |
20,244 | 12.02.2020 10:30:27 | 18,000 | 990a3a391aec6798d4077299fdd8eb63dca87d21 | Better display for validated transactions queue | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/payment_validator/mod.rs",
"new_path": "rita/src/rita_common/payment_validator/mod.rs",
"diff": "use crate::rita_common::debt_keeper::DebtKeeper;\nuse crate::rita_common::debt_keeper::PaymentReceived;\nuse crate::rita_common::debt_keeper::PaymentSucceeded;\n-use crate::rita_common::rita_loop::fast_loop::FAST_LOOP_TIMEOUT;\nuse crate::rita_common::rita_loop::get_web3_server;\nuse crate::rita_common::usage_tracker::UpdatePayments;\nuse crate::rita_common::usage_tracker::UsageTracker;\n@@ -21,11 +20,12 @@ use futures01::Future;\nuse num256::Uint256;\nuse settings::RitaCommonSettings;\nuse std::collections::HashSet;\n+use std::fmt;\nuse std::time::{Duration, Instant};\nuse web30::client::Web3;\nuse web30::types::TransactionResponse;\n-pub const TRANSACTION_VERIFICATION_TIMEOUT: Duration = FAST_LOOP_TIMEOUT;\n+pub const TRANSACTION_VERIFICATION_TIMEOUT: Duration = Duration::from_secs(2);\n// Discard payments after 15 minutes of failing to find txid\npub const PAYMENT_TIMEOUT: Duration = Duration::from_secs(900u64);\n@@ -46,6 +46,19 @@ pub struct ToValidate {\npub checked: bool,\n}\n+impl fmt::Display for ToValidate {\n+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {\n+ match &self.payment.txid {\n+ Some(txid) => write!(\n+ f,\n+ \"(txid: {:#066x}, from: {}\",\n+ txid, self.payment.from.wg_public_key\n+ ),\n+ None => write!(f, \"(txid: None, from: {}\", self.payment.from.wg_public_key),\n+ }\n+ }\n+}\n+\npub struct PaymentValidator {\nunvalidated_transactions: HashSet<ToValidate>,\nsuccessful_transactions: HashSet<Uint256>,\n@@ -355,7 +368,7 @@ fn payment_is_old(chain_height: Uint256, tx_height: Option<Uint256>) -> bool {\nfn print_txids(list: &HashSet<ToValidate>) -> String {\nlet mut output = String::new();\nfor item in list.iter() {\n- output += &format!(\"{:#066x} ,\", item.payment.txid.clone().unwrap());\n+ output += &format!(\"{} ,\", item);\n}\noutput\n}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Better display for validated transactions queue |
20,244 | 12.02.2020 10:35:46 | 18,000 | 6427dd1eff96ca8c21281b3525c5d8aababe07a8 | Enforce tx verification timeout
This is an oversight from the join refactor | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/payment_validator/mod.rs",
"new_path": "rita/src/rita_common/payment_validator/mod.rs",
"diff": "@@ -22,6 +22,7 @@ use settings::RitaCommonSettings;\nuse std::collections::HashSet;\nuse std::fmt;\nuse std::time::{Duration, Instant};\n+use tokio::util::FutureExt;\nuse web30::client::Web3;\nuse web30::types::TransactionResponse;\n@@ -216,6 +217,7 @@ pub fn validate_transaction(ts: &ToValidate) {\nlet res = web3\n.eth_block_number()\n.join(web3.eth_get_transaction_by_hash(txid.clone()))\n+ .timeout(TRANSACTION_VERIFICATION_TIMEOUT)\n.and_then(move |(block_num, tx_status)| {\nif !long_life_ts.checked {\nPaymentValidator::from_registry().do_send(Checked {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Enforce tx verification timeout
This is an oversight from the join refactor |
20,244 | 12.02.2020 11:29:25 | 18,000 | da1cf5b2b8549e1f5ad9b638b0f40b670700a75f | Use display not debug to display wg_keys | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/network_endpoints/mod.rs",
"new_path": "rita/src/rita_common/network_endpoints/mod.rs",
"diff": "@@ -52,7 +52,7 @@ pub fn make_payments(\n}\nlet txid = txid.unwrap();\ninfo!(\n- \"Got Payment from {:?} for {} with txid {:#066x}\",\n+ \"Got Payment from {} for {} with txid {:#066x}\",\npmt.0.from.wg_public_key, pmt.0.amount, txid,\n);\nlet ts = ToValidate {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Use display not debug to display wg_keys |
20,244 | 16.02.2020 08:31:02 | 18,000 | f769ceb7790473b13f8fc1c0ed8b4739dbe1e4e7 | and_then() only checks for Actix failures
The previous commit was incomplete, we also need to check the return
value of the function explicitly. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/payment_validator/mod.rs",
"new_path": "rita/src/rita_common/payment_validator/mod.rs",
"diff": "@@ -141,11 +141,13 @@ impl Handler<Remove> for PaymentValidator {\n// during this session\nif msg.success && was_present {\nself.successful_transactions\n- .insert(msg.tx.payment.txid.unwrap());\n+ .insert(msg.tx.payment.clone().txid.unwrap());\n}\nif was_present {\n+ info!(\"Transaction {} was removed\", msg.tx);\nOk(())\n} else {\n+ error!(\"Transaction {} was double removed\", msg.tx);\nErr(format_err!(\"No such transaction present!\"))\n}\n}\n@@ -166,7 +168,7 @@ impl Handler<Checked> for PaymentValidator {\nif self.unvalidated_transactions.take(&msg.tx).is_some() {\nlet mut checked_tx = msg.tx;\nchecked_tx.checked = true;\n- trace!(\"We successfully checked tx {:?}\", checked_tx);\n+ info!(\"We successfully checked tx {:?}\", checked_tx);\nself.unvalidated_transactions.insert(checked_tx);\n} else {\nerror!(\"Tried to mark a tx {:?} we don't have as checked!\", msg.tx);\n@@ -304,7 +306,8 @@ fn handle_tx_messaging(\ntx: ts,\nsuccess: true,\n})\n- .and_then(|_| {\n+ .and_then(|res| {\n+ if res.is_ok() {\nDebtKeeper::from_registry().do_send(PaymentReceived {\nfrom: pmt.from,\namount: pmt.amount.clone(),\n@@ -312,6 +315,7 @@ fn handle_tx_messaging(\n// update the usage tracker with the details of this payment\nUsageTracker::from_registry().do_send(UpdatePayments { payment: pmt });\n+ }\nOk(())\n})\n.then(|_| Ok(()));\n@@ -328,13 +332,15 @@ fn handle_tx_messaging(\ntx: ts,\nsuccess: true,\n})\n- .and_then(|_| {\n+ .and_then(|res| {\n+ if res.is_ok() {\nDebtKeeper::from_registry().do_send(PaymentSucceeded {\nto: pmt.to,\namount: pmt.amount.clone(),\n});\n// update the usage tracker with the details of this payment\nUsageTracker::from_registry().do_send(UpdatePayments { payment: pmt });\n+ }\nOk(())\n})\n.then(|_| Ok(()));\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | and_then() only checks for Actix failures
The previous commit was incomplete, we also need to check the return
value of the function explicitly. |
20,244 | 17.02.2020 08:00:46 | 18,000 | d130cd61bb471dc4292536bd01ecfc68d9d0e4c9 | Clean up bad port toggles
External nics are created pretty much only by port toggling these days.
After observing a few devices in the field I noticed that they had duplicated
the external nic into the peer interfaces list. It must not have been removed
properly. This should clean that up. | [
{
"change_type": "MODIFY",
"old_path": "clu/src/lib.rs",
"new_path": "clu/src/lib.rs",
"diff": "@@ -141,6 +141,7 @@ fn linux_init(config: Arc<RwLock<settings::client::RitaSettingsStruct>>) -> Resu\n}\n}\n+ // generates a keypair if we don't already have a valid one\nif wg_privkey_option.is_none() || wg_pubkey_option.is_none() {\ninfo!(\"Existing wireguard keypair is invalid, generating from scratch\");\nlet keypair = KI.create_wg_keypair().expect(\"failed to generate wg keys\");\n@@ -157,6 +158,15 @@ fn linux_init(config: Arc<RwLock<settings::client::RitaSettingsStruct>>) -> Resu\n.expect(\"How did we get here without generating a key above?\"),\n)?;\n+ // Sometimes due to a bad port toggle the external nic can still be populated\n+ // as a peer_interface, this cleans that up.\n+ if let Some(external_nic) = network_settings.external_nic.clone() {\n+ let res = network_settings.peer_interfaces.remove(&external_nic);\n+ if res {\n+ warn!(\"Duplicate interface removed!\");\n+ }\n+ }\n+\n// Yield the mut lock\ndrop(network_settings);\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Clean up bad port toggles
External nics are created pretty much only by port toggling these days.
After observing a few devices in the field I noticed that they had duplicated
the external nic into the peer interfaces list. It must not have been removed
properly. This should clean that up. |
20,244 | 17.02.2020 18:26:50 | 18,000 | af4f9315a607fc1a4571e3b5294c6fbfdc71485e | Description is deprecated | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/peer_listener/message.rs",
"new_path": "rita/src/rita_common/peer_listener/message.rs",
"diff": "@@ -41,14 +41,6 @@ impl From<io::Error> for MessageError {\n}\n}\n-#[test]\n-fn test_message_error() {\n- assert_eq!(\n- MessageError::InvalidPayloadError.description(),\n- \"Invalid payload detected\"\n- );\n-}\n-\nconst MSG_IM_HERE: u8 = 0x5b;\nconst MSG_IM_HERE_LEN: u16 = 19;\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Description is deprecated |
20,244 | 18.02.2020 17:48:02 | 18,000 | 07faa54b60e6268fef8a530033e8a27672d1c909 | Send json serialized ID with heartbeat
The previous heartbeat implementation only sent the WireGuard key.
It would also panic in many (improbable) sitautions. This patch
fixes those two issues and provides a heartbeat implementation
that will not crash and provides enough info for a good organizer
dashboard. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/rita_loop/mod.rs",
"new_path": "rita/src/rita_client/rita_loop/mod.rs",
"diff": "@@ -38,6 +38,8 @@ pub struct RitaLoop;\npub const CLIENT_LOOP_SPEED: u64 = 5;\npub const CLIENT_LOOP_TIMEOUT: Duration = Duration::from_secs(4);\n+pub const HEARBEAT_MESSAGE_PORT: u16 = 33333;\n+\nimpl Actor for RitaLoop {\ntype Context = Context<Self>;\n@@ -127,30 +129,7 @@ pub fn send_udp_heartbeat() {\nOk(Ok(dnsresult)) => {\nif !dnsresult.is_empty() {\nfor dns_socket in dnsresult {\n- let local = SocketAddr::from(([0, 0, 0, 0], 33333));\n- let socket =\n- UdpSocket::bind(&local).expect(\"Couldn't bind to UDP heartbeat socket\");\n-\n- let remote_ip = dns_socket.ip();\n- let remote = SocketAddr::new(remote_ip, 33333);\n-\n- trace!(\"Sending heartbeat to {:?}\", remote_ip);\n-\n- let message = SETTING\n- .get_network()\n- .wg_public_key\n- .clone()\n- .expect(\"No key?\")\n- .to_string()\n- .into_bytes();\n-\n- socket\n- .set_write_timeout(Some(Duration::new(0, 100)))\n- .expect(\"Couldn't set socket timeout\");\n-\n- socket\n- .send_to(&message, &remote)\n- .expect(\"Couldn't send heartbeat\");\n+ send_udp_heartbeat_packet(dns_socket);\n}\n} else {\ntrace!(\"Got zero length dns response: {:?}\", dnsresult);\n@@ -172,6 +151,39 @@ pub fn send_udp_heartbeat() {\nArbiter::spawn(res);\n}\n+fn send_udp_heartbeat_packet(dns_socket: SocketAddr) {\n+ let local_socketaddr = SocketAddr::from(([0, 0, 0, 0], HEARBEAT_MESSAGE_PORT));\n+ let local_socket = match UdpSocket::bind(&local_socketaddr) {\n+ Ok(s) => s,\n+ Err(e) => {\n+ error!(\"Couldn't bind to UDP heartbeat socket {:?}\", e);\n+ return;\n+ }\n+ };\n+\n+ let remote_ip = dns_socket.ip();\n+ let remote = SocketAddr::new(remote_ip, HEARBEAT_MESSAGE_PORT);\n+\n+ trace!(\"Sending heartbeat to {:?}\", remote_ip);\n+\n+ let message = match SETTING.get_identity() {\n+ Some(i) => i,\n+ None => return,\n+ };\n+ let json_message = match serde_json::to_vec(&message) {\n+ Ok(m) => m,\n+ Err(_) => return,\n+ };\n+\n+ local_socket\n+ .set_write_timeout(Some(Duration::new(0, 100)))\n+ .expect(\"Couldn't set socket timeout\");\n+\n+ local_socket\n+ .send_to(&json_message, &remote)\n+ .expect(\"Couldn't send heartbeat\");\n+}\n+\npub fn check_rita_client_actors() {\nassert!(crate::rita_client::rita_loop::RitaLoop::from_registry().connected());\nassert!(crate::rita_client::exit_manager::ExitManager::from_registry().connected());\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Send json serialized ID with heartbeat
The previous heartbeat implementation only sent the WireGuard key.
It would also panic in many (improbable) sitautions. This patch
fixes those two issues and provides a heartbeat implementation
that will not crash and provides enough info for a good organizer
dashboard. |
20,244 | 18.02.2020 17:51:55 | 18,000 | 4e5d8862562477d0a0dd914fbe20a842021c48bb | Enable request compression support for Actix-web | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -69,6 +69,7 @@ dependencies = [\n\"cookie 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"h2 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)\",\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/Cargo.toml",
"new_path": "rita/Cargo.toml",
"diff": "@@ -25,7 +25,7 @@ settings = { path = \"../settings\" }\nauto-bridge = {git = \"https://github.com/althea-net/auto_bridge\", tag = \"v0.1.5\"}\nweb30 = {git = \"https://github.com/althea-mesh/web30\", branch = \"master\"}\nactix = \"0.7\"\n-actix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\n+actix-web = { version = \"0.7\", default_features = false, features= [\"ssl\", \"flate2-rust\"] }\nactix-web-httpauth = {git = \"https://github.com/althea-mesh/actix-web-httpauth\"}\nactix_derive = \"0.5\"\nbytes = \"0.4\"\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Enable request compression support for Actix-web |
20,244 | 18.02.2020 17:59:18 | 18,000 | 2695d007ebbabc1c9d18b0d4224b5d88e038ef27 | Bump for Beta 11 RC11 | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -167,7 +167,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.36\",\n+ \"rita 0.5.37\",\n]\n[[package]]\n@@ -2095,7 +2095,7 @@ dependencies = [\n[[package]]\nname = \"rita\"\n-version = \"0.5.36\"\n+version = \"0.5.37\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/Cargo.toml",
"new_path": "rita/Cargo.toml",
"diff": "[package]\nname = \"rita\"\n-version = \"0.5.36\"\n+version = \"0.5.37\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/dashboard/own_info.rs",
"new_path": "rita/src/rita_common/dashboard/own_info.rs",
"diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 11 RC10\";\n+pub static READABLE_VERSION: &str = \"Beta 11 RC11\";\n#[derive(Serialize)]\npub struct OwnInfo {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Bump for Beta 11 RC11 |
20,244 | 25.02.2020 10:02:29 | 18,000 | ac170491238345ac73937deeec8ca3d71ac3a23f | Add display for Identity
This type should really have a display impl since we use it everywhere. | [
{
"change_type": "MODIFY",
"old_path": "althea_types/src/interop.rs",
"new_path": "althea_types/src/interop.rs",
"diff": "@@ -22,6 +22,23 @@ pub struct Identity {\npub nickname: Option<ArrayString<[u8; 32]>>,\n}\n+impl Display for Identity {\n+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {\n+ match self.nickname {\n+ Some(nick) => write!(\n+ f,\n+ \"nickname: {}, mesh_ip: {}, eth_address: {}, wg_pubkey {}\",\n+ nick, self.mesh_ip, self.eth_address, self.wg_public_key\n+ ),\n+ None => write!(\n+ f,\n+ \"mesh_ip: {}, eth_address: {}, wg_pubkey {}\",\n+ self.mesh_ip, self.eth_address, self.wg_public_key\n+ ),\n+ }\n+ }\n+}\n+\nimpl Identity {\npub fn new(\nmesh_ip: IpAddr,\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Add display for Identity
This type should really have a display impl since we use it everywhere. |
20,244 | 26.02.2020 13:34:45 | 18,000 | 771abcddf43c84addc2d34c68a3b02fd5a9494bf | Move OracleUpdate to AltheaTypes
This makes it much easier to import Oracle update into other Rust
crates. | [
{
"change_type": "MODIFY",
"old_path": "althea_types/src/interop.rs",
"new_path": "althea_types/src/interop.rs",
"diff": "@@ -345,3 +345,19 @@ impl FromStr for ReleaseStatus {\n}\n}\n}\n+\n+#[derive(Debug, Clone, Serialize, Deserialize)]\n+pub struct OracleUpdate {\n+ pub client: u32,\n+ pub gateway: u32,\n+ pub max: u32,\n+ pub dao_fee: u128,\n+ pub warning: u128,\n+ pub system_chain: Option<SystemChain>,\n+ pub withdraw_chain: Option<SystemChain>,\n+ /// A release feed to be applied to the /etc/opkg/customfeeds.config, None means do not\n+ /// change the currently configured release feed\n+ pub release_feed: Option<String>,\n+ /// A json payload to be merged into the existing settings\n+ pub merge_json: serde_json::Value,\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/oracle/mod.rs",
"new_path": "rita/src/rita_common/oracle/mod.rs",
"diff": "@@ -17,7 +17,7 @@ use actix_web::error::PayloadError;\nuse actix_web::{client, Either, HttpMessage, Result};\nuse althea_kernel_interface::opkg_feeds::get_release_feed;\nuse althea_kernel_interface::opkg_feeds::set_release_feed;\n-use althea_types::SystemChain;\n+use althea_types::OracleUpdate;\nuse bytes::Bytes;\nuse clarity::Address;\nuse futures01::{future, Future};\n@@ -287,22 +287,6 @@ fn update_gas_price(\n);\n}\n-#[derive(Debug, Clone, Serialize, Deserialize)]\n-struct OracleUpdate {\n- client: u32,\n- gateway: u32,\n- max: u32,\n- dao_fee: u128,\n- warning: u128,\n- system_chain: Option<SystemChain>,\n- withdraw_chain: Option<SystemChain>,\n- /// A release feed to be applied to the /etc/opkg/customfeeds.config, None means do not\n- /// change the currently configured release feed\n- release_feed: Option<String>,\n- /// A json payload to be merged into the existing settings\n- merge_json: serde_json::Value,\n-}\n-\n/// This is a hacky version of the eventual on chain subnet DAO structure, since we can't get\n/// settings from the chain instead we use the subnet dao url to grab settings from a simple file server\n/// and then apply them. This is also taking the place of a pricing plugin, we eventually hope that routers\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Move OracleUpdate to AltheaTypes
This makes it much easier to import Oracle update into other Rust
crates. |
20,244 | 27.02.2020 12:28:15 | 18,000 | 2adcb20d74ab2acfec47a3e56ca6f0818f961711 | Add GetNetworkInfo to NetworkMonitor
Network monitor does the hard work of bringing together all
the major bits of network info pertaining to our Babel and Rita
peers. There are several components which can use this info without
having to go out to Babel themselves. | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/network_monitor/mod.rs",
"new_path": "rita/src/rita_common/network_monitor/mod.rs",
"diff": "@@ -160,6 +160,7 @@ fn has_packet_loss(sample: u16) -> bool {\npub struct NetworkMonitor {\nlatency_history: HashMap<String, RunningLatencyStats>,\npacket_loss_history: HashMap<String, RunningPacketLossStats>,\n+ last_babel_dump: Option<NetworkInfo>,\n}\nimpl Actor for NetworkMonitor {\n@@ -183,6 +184,7 @@ impl NetworkMonitor {\nNetworkMonitor {\nlatency_history: HashMap::new(),\npacket_loss_history: HashMap::new(),\n+ last_babel_dump: None,\n}\n}\n}\n@@ -249,17 +251,34 @@ impl Handler<GetStats> for NetworkMonitor {\n}\n}\n-#[derive(Message)]\n-pub struct Tick {\n+pub struct GetNetworkInfo;\n+\n+impl Message for GetNetworkInfo {\n+ type Result = Result<NetworkInfo, Error>;\n+}\n+\n+impl Handler<GetNetworkInfo> for NetworkMonitor {\n+ type Result = Result<NetworkInfo, Error>;\n+\n+ fn handle(&mut self, _msg: GetNetworkInfo, _ctx: &mut Context<Self>) -> Self::Result {\n+ match self.last_babel_dump.clone() {\n+ Some(dump) => Ok(dump),\n+ None => Err(format_err!(\"No babel info ready!\")),\n+ }\n+ }\n+}\n+\n+#[derive(Message, Clone)]\n+pub struct NetworkInfo {\npub babel_neighbors: Vec<BabelNeighbor>,\npub babel_routes: Vec<BabelRoute>,\npub rita_neighbors: Vec<RitaNeighbor>,\n}\n-impl Handler<Tick> for NetworkMonitor {\n+impl Handler<NetworkInfo> for NetworkMonitor {\ntype Result = ();\n- fn handle(&mut self, msg: Tick, _ctx: &mut Context<Self>) -> Self::Result {\n+ fn handle(&mut self, msg: NetworkInfo, _ctx: &mut Context<Self>) -> Self::Result {\nlet babel_neighbors = msg.babel_neighbors;\nlet babel_routes = msg.babel_routes;\nlet rita_neighbors = msg.rita_neighbors;\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/rita_loop/fast_loop.rs",
"new_path": "rita/src/rita_common/rita_loop/fast_loop.rs",
"diff": "use crate::rita_common::debt_keeper::{DebtKeeper, SendUpdate};\n+use crate::rita_common::network_monitor::NetworkInfo as NetworkMonitorTick;\nuse crate::rita_common::network_monitor::NetworkMonitor;\n-use crate::rita_common::network_monitor::Tick as NetworkMonitorTick;\nuse crate::rita_common::oracle::{Oracle, Update};\nuse crate::rita_common::payment_validator::{PaymentValidator, Validate};\nuse crate::rita_common::peer_listener::GetPeers;\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Add GetNetworkInfo to NetworkMonitor
Network monitor does the hard work of bringing together all
the major bits of network info pertaining to our Babel and Rita
peers. There are several components which can use this info without
having to go out to Babel themselves. |
20,244 | 27.02.2020 12:28:15 | 18,000 | b82c02b1aa8a2b52f579ad75cbe45bc38cd70aaf | Clippy on Babel monitor
Serde Derive was required to compile babel monitor as standalone
instead of as a depencency of another crate with that macro in scope.
Several clippy nits fixed. Ignored the cognitive complexity one
for parsing routes and neighs due to the nature of getting data
into those large structs. | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -274,6 +274,7 @@ dependencies = [\n\"ipnetwork 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)\",\n+ \"serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)\",\n]\n"
},
{
"change_type": "MODIFY",
"old_path": "babel_monitor/Cargo.toml",
"new_path": "babel_monitor/Cargo.toml",
"diff": "@@ -13,3 +13,4 @@ log = \"0.4\"\nfutures = \"0.1\"\ntokio = \"0.1\"\nserde = \"1.0\"\n+serde_derive = \"1.0\"\n"
},
{
"change_type": "MODIFY",
"old_path": "babel_monitor/src/lib.rs",
"new_path": "babel_monitor/src/lib.rs",
"diff": "//! it provides abastractions over the major data this interface provides and an async\n//! way to efficiently communicate with it.\n+#![warn(clippy::all)]\n+#![allow(clippy::pedantic)]\n+#![forbid(unsafe_code)]\n+\n+#[macro_use]\n+extern crate serde_derive;\n#[macro_use]\nextern crate failure;\n#[macro_use]\n@@ -14,7 +20,7 @@ use futures::future::result as future_result;\nuse futures::future::Either;\nuse futures::future::Future;\nuse ipnetwork::IpNetwork;\n-use serde::Serialize;\n+use std::f32;\nuse std::iter::Iterator;\nuse std::net::IpAddr;\nuse std::net::SocketAddr;\n@@ -55,9 +61,9 @@ use crate::BabelMonitorError::{\n// If a function doesn't need internal state of the Babel object\n// we don't want to place it as a member function.\nfn find_babel_val(val: &str, line: &str) -> Result<String, Error> {\n- let mut iter = line.split(\" \");\n+ let mut iter = line.split(' ');\nwhile let Some(entry) = iter.next() {\n- if entry.to_string() == val {\n+ if entry == val {\nmatch iter.next() {\nSome(v) => return Ok(v.to_string()),\nNone => continue,\n@@ -65,7 +71,7 @@ fn find_babel_val(val: &str, line: &str) -> Result<String, Error> {\n}\n}\nwarn!(\"find_babel_val warn! Can not find {} in {}\", val, line);\n- return Err(VariableNotFound(String::from(val), String::from(line)).into());\n+ Err(VariableNotFound(String::from(val), String::from(line)).into())\n}\n#[derive(Debug, Clone, Serialize)]\n@@ -147,7 +153,7 @@ fn read_babel(\n// prevent infinite recursion in error cases\nwarn!(\"Babel read timed out! {}\", output);\nreturn Box::new(future::err(\n- ReadFailed(format!(\"Babel read timed out!\")).into(),\n+ ReadFailed(\"Babel read timed out!\".to_string()).into(),\n))\nas Box<dyn Future<Item = (TcpStream, String), Error = Error>>;\n} else if full_buffer {\n@@ -194,7 +200,7 @@ fn read_babel_sync(output: &str) -> Result<String, BabelMonitorError> {\n\"Babel returned bad/no; full output:\\n{}\\nEND OF BABEL OUTPUT\",\nret\n);\n- return Err(ReadFailed(ret).into());\n+ return Err(ReadFailed(ret));\n}\n_ => continue,\n}\n@@ -203,7 +209,7 @@ fn read_babel_sync(output: &str) -> Result<String, BabelMonitorError> {\n\"Terminator was never found; full output:\\n{:?}\\nEND OF BABEL OUTPUT\",\nret\n);\n- return Err(NoTerminator(ret).into());\n+ Err(NoTerminator(ret))\n}\npub fn run_command(\n@@ -244,9 +250,9 @@ fn validate_preamble(preamble: String) -> Result<(), Error> {\n// Note you have changed the config interface, bump to 1.1 in babel\nif preamble.contains(\"ALTHEA 0.1\") {\ntrace!(\"Attached OK to Babel with preamble: {}\", preamble);\n- return Ok(());\n+ Ok(())\n} else {\n- return Err(InvalidPreamble(preamble).into());\n+ Err(InvalidPreamble(preamble).into())\n}\n}\n@@ -261,7 +267,7 @@ pub fn get_local_fee(stream: TcpStream) -> impl Future<Item = (TcpStream, u32),\n}\nfn get_local_fee_sync(babel_output: String) -> Result<u32, Error> {\n- let fee_entry = match babel_output.split(\"\\n\").nth(0) {\n+ let fee_entry = match babel_output.split('\\n').nth(0) {\nSome(entry) => entry,\n// Even an empty string wouldn't yield None\nNone => return Err(LocalFeeNotFound(String::from(\"<Babel output is None>\")).into()),\n@@ -330,7 +336,7 @@ pub fn redistribute_ip(\n);\nrun_command(stream, &command).then(move |result| {\nif let Err(e) = result {\n- return Either::A(future_result(Err(e).into()));\n+ return Either::A(future_result(Err(e)));\n}\nlet (stream, _out) = result.unwrap();\nEither::B(read_babel(stream, String::new(), 0))\n@@ -362,10 +368,11 @@ pub fn parse_neighs(\n})\n}\n+#[allow(clippy::cognitive_complexity)]\nfn parse_neighs_sync(output: String) -> Result<Vec<Neighbor>, Error> {\nlet mut vector: Vec<Neighbor> = Vec::with_capacity(5);\nlet mut found_neigh = false;\n- for entry in output.split(\"\\n\") {\n+ for entry in output.split('\\n') {\nif entry.contains(\"add neighbour\") {\nfound_neigh = true;\nlet neigh = Neighbor {\n@@ -453,7 +460,7 @@ fn parse_neighs_sync(output: String) -> Result<Vec<Neighbor>, Error> {\nvector.push(neigh);\n}\n}\n- if vector.len() == 0 && found_neigh {\n+ if vector.is_empty() && found_neigh {\nbail!(\"All Babel neigh parsing failed!\")\n}\nOk(vector)\n@@ -471,12 +478,13 @@ pub fn parse_routes(\n})\n}\n+#[allow(clippy::cognitive_complexity)]\npub fn parse_routes_sync(babel_out: String) -> Result<Vec<Route>, Error> {\nlet mut vector: Vec<Route> = Vec::with_capacity(20);\nlet mut found_route = false;\ntrace!(\"Got from babel dump: {}\", babel_out);\n- for entry in babel_out.split(\"\\n\") {\n+ for entry in babel_out.split('\\n') {\nif entry.contains(\"add route\") {\ntrace!(\"Parsing 'add route' entry: {}\", entry);\nfound_route = true;\n@@ -569,7 +577,7 @@ pub fn parse_routes_sync(babel_out: String) -> Result<Vec<Route>, Error> {\nvector.push(route);\n}\n}\n- if vector.len() == 0 && found_route {\n+ if vector.is_empty() && found_route {\nbail!(\"All Babel route parsing failed!\")\n}\nOk(vector)\n@@ -582,7 +590,7 @@ pub fn parse_routes_sync(babel_out: String) -> Result<Vec<Route>, Error> {\npub fn get_route_via_neigh(\nneigh_mesh_ip: IpAddr,\ndest_mesh_ip: IpAddr,\n- routes: &Vec<Route>,\n+ routes: &[Route],\n) -> Result<Route, Error> {\n// First find the neighbors route to itself to get the local address\nfor neigh_route in routes.iter() {\n@@ -604,7 +612,7 @@ pub fn get_route_via_neigh(\nErr(NoNeighbor(neigh_mesh_ip.to_string()).into())\n}\n/// Checks if Babel has an installed route to the given destination\n-pub fn do_we_have_route(mesh_ip: &IpAddr, routes: &Vec<Route>) -> Result<bool, Error> {\n+pub fn do_we_have_route(mesh_ip: &IpAddr, routes: &[Route]) -> Result<bool, Error> {\nfor route in routes.iter() {\nif let IpNetwork::V6(ref ip) = route.prefix {\nif ip.ip() == *mesh_ip && route.installed {\n@@ -615,7 +623,7 @@ pub fn do_we_have_route(mesh_ip: &IpAddr, routes: &Vec<Route>) -> Result<bool, E\nOk(false)\n}\n/// Returns the installed route to a given destination\n-pub fn get_installed_route(mesh_ip: &IpAddr, routes: &Vec<Route>) -> Result<Route, Error> {\n+pub fn get_installed_route(mesh_ip: &IpAddr, routes: &[Route]) -> Result<Route, Error> {\nlet mut exit_route = None;\nfor route in routes.iter() {\n// Only ip6\n@@ -636,7 +644,7 @@ pub fn get_installed_route(mesh_ip: &IpAddr, routes: &Vec<Route>) -> Result<Rout\nmod tests {\nuse super::*;\n- static TABLE: &'static str =\n+ static TABLE: &str =\n\"local fee 1024\\n\\\nmetric factor 1900\\n\\\nadd interface lo up false\\n\\\n@@ -663,31 +671,31 @@ add route 241fee0 prefix fdc5:5bcb:24ac:b35a:4b7f:146a:a2a1:bdc4/128 from ::/0 i\ne6:95:6e:ff:fe:44:c4:12 metric 328 price 426000 fee 354600 refmetric 217 full-path-rtt 39.874 via fe80::6459:f009:c4b4:9971 if wg36\nok\\n\";\n- static PREAMBLE: &'static str =\n+ static PREAMBLE: &str =\n\"ALTHEA 0.1\\nversion babeld-1.8.0-24-g6335378\\nhost raspberrypi\\nmy-id \\\nba:27:eb:ff:fe:09:06:dd\\nok\\n\";\n- static XROUTE_LINE: &'static str =\n+ static XROUTE_LINE: &str =\n\"add xroute 10.28.119.131/32-::/0 prefix 10.28.119.131/32 from ::/0 metric 0\";\n- static ROUTE_LINE: &'static str =\n+ static ROUTE_LINE: &str =\n\"add route 14f06d8 prefix 10.28.20.151/32 from 0.0.0.0/0 installed yes id \\\nba:27:eb:ff:fe:c1:2d:d5 metric 1306 price 4008 refmetric 0 full-path-rtt 18.674 via \\\nfe80::e9d0:498f:6c61:be29 if wlan0\";\n- static PROBLEM_ROUTE_LINE: &'static str =\n+ static PROBLEM_ROUTE_LINE: &str =\n\"add route 241fee0 prefix fdc5:5bcb:24ac:b35a:4b7f:146a:a2a1:bdc4/128 \\\nfrom ::/0 installed no id e6:95:6e:ff:fe:44:c4:12 metric 331 price 426000 fee 354600 refmetric 220 full-path-rtt \\\n38.286 via fe80::6459:f009:c4b4:9971 if wg36\";\n- static NEIGH_LINE: &'static str =\n+ static NEIGH_LINE: &str =\n\"add neighbour 14f05f0 address fe80::e9d0:498f:6c61:be29 if wlan0 reach ffff rxcost \\\n256 txcost 256 rtt 29.264 rttcost 1050 cost 1306\";\n- static IFACE_LINE: &'static str =\n+ static IFACE_LINE: &str =\n\"add interface wlan0 up true ipv6 fe80::1a8b:ec1:8542:1bd8 ipv4 10.28.119.131\";\n- static PRICE_LINE: &'static str = \"local price 1024\";\n+ static PRICE_LINE: &str = \"local price 1024\";\n#[test]\nfn line_parse() {\n@@ -760,7 +768,9 @@ ok\\n\";\nlet route = routes.get(0).unwrap();\nassert_eq!(route.price, 3072);\n- assert_eq!(route.full_path_rtt, 22.805);\n+ // assert that these are equal within the minimum comparison difference\n+ // of float values\n+ assert!(route.full_path_rtt - 22.805 < f32::EPSILON);\n}\n#[test]\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Clippy on Babel monitor
Serde Derive was required to compile babel monitor as standalone
instead of as a depencency of another crate with that macro in scope.
Several clippy nits fixed. Ignored the cognitive complexity one
for parsing routes and neighs due to the nature of getting data
into those large structs. |
20,244 | 27.02.2020 13:33:40 | 18,000 | c026f3ae16a1ace89b72bc5fd2cd328ed12971bf | Simplify BabelMonitor parsing routines
This removes the cognitive complexity nit from BabelMonitor with some
fancy trait binding. That being said I'm not totally satisfied that it's
perfect, so I've placed it in this seperate commit from the clippy changes
for easy reversion | [
{
"change_type": "MODIFY",
"old_path": "babel_monitor/src/lib.rs",
"new_path": "babel_monitor/src/lib.rs",
"diff": "@@ -20,11 +20,14 @@ use futures::future::result as future_result;\nuse futures::future::Either;\nuse futures::future::Future;\nuse ipnetwork::IpNetwork;\n+use std::error::Error as ErrorTrait;\nuse std::f32;\n+use std::fmt::Debug;\nuse std::iter::Iterator;\nuse std::net::IpAddr;\nuse std::net::SocketAddr;\nuse std::str;\n+use std::str::FromStr;\nuse std::time::Duration;\nuse std::time::Instant;\nuse tokio::io::read;\n@@ -74,7 +77,23 @@ fn find_babel_val(val: &str, line: &str) -> Result<String, Error> {\nErr(VariableNotFound(String::from(val), String::from(line)).into())\n}\n-#[derive(Debug, Clone, Serialize)]\n+fn find_and_parse_babel_val<T: FromStr>(val: &str, line: &str) -> Result<T, Error>\n+where\n+ <T as FromStr>::Err: Debug + ErrorTrait + Sync + Send + 'static,\n+{\n+ match find_babel_val(val, line) {\n+ Ok(string_val) => match string_val.parse() {\n+ Ok(parsed_val) => Ok(parsed_val),\n+ Err(e) => {\n+ warn!(\"Error parsing {} from {} with {:?}\", val, line, e);\n+ Err(e.into())\n+ }\n+ },\n+ Err(e) => Err(e),\n+ }\n+}\n+\n+#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct Route {\npub id: String,\npub iface: String,\n@@ -368,7 +387,6 @@ pub fn parse_neighs(\n})\n}\n-#[allow(clippy::cognitive_complexity)]\nfn parse_neighs_sync(output: String) -> Result<Vec<Neighbor>, Error> {\nlet mut vector: Vec<Neighbor> = Vec::with_capacity(5);\nlet mut found_neigh = false;\n@@ -380,14 +398,8 @@ fn parse_neighs_sync(output: String) -> Result<Vec<Neighbor>, Error> {\nOk(val) => val,\nErr(_) => continue,\n},\n- address: match find_babel_val(\"address\", entry) {\n- Ok(entry) => match entry.parse() {\n- Ok(parsed_data) => parsed_data,\n- Err(e) => {\n- warn!(\"Error parsing address for neigh {:?} from {}\", e, entry);\n- continue;\n- }\n- },\n+ address: match find_and_parse_babel_val(\"address\", entry) {\n+ Ok(entry) => entry,\nErr(_) => continue,\n},\niface: match find_babel_val(\"if\", entry) {\n@@ -404,56 +416,26 @@ fn parse_neighs_sync(output: String) -> Result<Vec<Neighbor>, Error> {\n},\nErr(_) => continue,\n},\n- txcost: match find_babel_val(\"txcost\", entry) {\n- Ok(entry) => match entry.parse() {\n- Ok(parsed_data) => parsed_data,\n- Err(e) => {\n- warn!(\"Error parsing txcost for neigh {:?} from {}\", e, entry);\n- continue;\n- }\n- },\n+ txcost: match find_and_parse_babel_val(\"txcost\", entry) {\n+ Ok(entry) => entry,\nErr(_) => continue,\n},\n- rxcost: match find_babel_val(\"rxcost\", entry) {\n- Ok(entry) => match entry.parse() {\n- Ok(parsed_data) => parsed_data,\n- Err(e) => {\n- warn!(\"Error parsing rxcost for neigh {:?} from {}\", e, entry);\n- continue;\n- }\n- },\n+ rxcost: match find_and_parse_babel_val(\"rxcost\", entry) {\n+ Ok(entry) => entry,\nErr(_) => continue,\n},\n- rtt: match find_babel_val(\"rtt\", entry) {\n- Ok(entry) => match entry.parse() {\n- Ok(parsed_data) => parsed_data,\n- Err(e) => {\n- warn!(\"Error parsing rtt for neigh {:?} from {}\", e, entry);\n- continue;\n- }\n- },\n+ rtt: match find_and_parse_babel_val(\"rtt\", entry) {\n+ Ok(entry) => entry,\n// it's possible that our neigh does not have rtt enabled, handle\nErr(_) => 0.0,\n},\n- rttcost: match find_babel_val(\"rttcost\", entry) {\n- Ok(entry) => match entry.parse() {\n- Ok(parsed_data) => parsed_data,\n- Err(e) => {\n- warn!(\"Error parsing rtt for neigh {:?} from {}\", e, entry);\n- continue;\n- }\n- },\n+ rttcost: match find_and_parse_babel_val(\"rttcost\", entry) {\n+ Ok(entry) => entry,\n// it's possible that our neigh does not have rtt enabled, handle\nErr(_) => 0,\n},\n- cost: match find_babel_val(\"cost\", entry) {\n- Ok(entry) => match entry.parse() {\n- Ok(parsed_data) => parsed_data,\n- Err(e) => {\n- warn!(\"Error parsing cost for neigh {:?} from {}\", e, entry);\n- continue;\n- }\n- },\n+ cost: match find_and_parse_babel_val(\"cost\", entry) {\n+ Ok(entry) => entry,\nErr(_) => continue,\n},\n};\n@@ -478,7 +460,6 @@ pub fn parse_routes(\n})\n}\n-#[allow(clippy::cognitive_complexity)]\npub fn parse_routes_sync(babel_out: String) -> Result<Vec<Route>, Error> {\nlet mut vector: Vec<Route> = Vec::with_capacity(20);\nlet mut found_route = false;\n@@ -502,74 +483,32 @@ pub fn parse_routes_sync(babel_out: String) -> Result<Vec<Route>, Error> {\nOk(value) => value.contains(\"yes\"),\nErr(_) => continue,\n},\n- neigh_ip: match find_babel_val(\"via\", entry) {\n- Ok(value) => match value.parse() {\n- Ok(parsed_data) => parsed_data,\n- Err(e) => {\n- warn!(\"Error parsing neigh_ip for route {:?} from {}\", e, entry);\n- continue;\n- }\n- },\n+ neigh_ip: match find_and_parse_babel_val(\"via\", entry) {\n+ Ok(value) => value,\nErr(_) => continue,\n},\n- prefix: match find_babel_val(\"prefix\", entry) {\n- Ok(value) => match value.parse() {\n- Ok(parsed_data) => parsed_data,\n- Err(e) => {\n- warn!(\"Error parsing prefix for route {:?} from {}\", e, entry);\n- continue;\n- }\n- },\n+ prefix: match find_and_parse_babel_val(\"prefix\", entry) {\n+ Ok(value) => value,\nErr(_) => continue,\n},\n- metric: match find_babel_val(\"metric\", entry) {\n- Ok(value) => match value.parse() {\n- Ok(parsed_data) => parsed_data,\n- Err(e) => {\n- warn!(\"Error parsing metric for route {:?} from {}\", e, entry);\n- continue;\n- }\n- },\n+ metric: match find_and_parse_babel_val(\"metric\", entry) {\n+ Ok(value) => value,\nErr(_) => continue,\n},\n- refmetric: match find_babel_val(\"refmetric\", entry) {\n- Ok(value) => match value.parse() {\n- Ok(parsed_data) => parsed_data,\n- Err(e) => {\n- warn!(\"Error parsing refmetric {:?} from {}\", e, entry);\n- continue;\n- }\n- },\n+ refmetric: match find_and_parse_babel_val(\"refmetric\", entry) {\n+ Ok(value) => value,\nErr(_) => continue,\n},\n- full_path_rtt: match find_babel_val(\"full-path-rtt\", entry) {\n- Ok(value) => match value.parse() {\n- Ok(parsed_data) => parsed_data,\n- Err(e) => {\n- warn!(\"Error parsing full_path_rtt {:?} from {}\", e, entry);\n- continue;\n- }\n- },\n+ full_path_rtt: match find_and_parse_babel_val(\"full-path-rtt\", entry) {\n+ Ok(value) => value,\nErr(_) => continue,\n},\n- price: match find_babel_val(\"price\", entry) {\n- Ok(value) => match value.parse() {\n- Ok(parsed_data) => parsed_data,\n- Err(e) => {\n- warn!(\"Error parsing price {:?} from {}\", e, entry);\n- continue;\n- }\n- },\n+ price: match find_and_parse_babel_val(\"price\", entry) {\n+ Ok(value) => value,\nErr(_) => continue,\n},\n- fee: match find_babel_val(\"fee\", entry) {\n- Ok(value) => match value.parse() {\n- Ok(parsed_data) => parsed_data,\n- Err(e) => {\n- warn!(\"Error parsing fee {:?} from {}\", e, entry);\n- continue;\n- }\n- },\n+ fee: match find_and_parse_babel_val(\"fee\", entry) {\n+ Ok(value) => value,\nErr(_) => continue,\n},\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/network_monitor/mod.rs",
"new_path": "rita/src/rita_common/network_monitor/mod.rs",
"diff": "@@ -279,16 +279,17 @@ impl Handler<NetworkInfo> for NetworkMonitor {\ntype Result = ();\nfn handle(&mut self, msg: NetworkInfo, _ctx: &mut Context<Self>) -> Self::Result {\n- let babel_neighbors = msg.babel_neighbors;\n- let babel_routes = msg.babel_routes;\n- let rita_neighbors = msg.rita_neighbors;\n+ let babel_neighbors = &msg.babel_neighbors;\n+ let babel_routes = &msg.babel_routes;\n+ let rita_neighbors = &msg.rita_neighbors;\nobserve_network(\n- &babel_neighbors,\n- &rita_neighbors,\n+ babel_neighbors,\n+ rita_neighbors,\n&mut self.latency_history,\n&mut self.packet_loss_history,\n);\n- network_stats(&babel_routes, &babel_neighbors);\n+ network_stats(babel_routes, babel_neighbors);\n+ self.last_babel_dump = Some(msg);\n}\n}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Simplify BabelMonitor parsing routines
This removes the cognitive complexity nit from BabelMonitor with some
fancy trait binding. That being said I'm not totally satisfied that it's
perfect, so I've placed it in this seperate commit from the clippy changes
for easy reversion |
20,244 | 01.03.2020 07:31:40 | 18,000 | f2f57905fc9fb2fb3269507c53496f6cfed15dc8 | Fix ciphertext spelling
Very minor error, but it was bothering me | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_exit/network_endpoints/mod.rs",
"new_path": "rita/src/rita_exit/network_endpoints/mod.rs",
"diff": "@@ -60,10 +60,10 @@ fn decrypt_exit_client_id(\nlet their_wg_pubkey = val.pubkey;\nlet their_nacl_pubkey = val.pubkey.into();\nlet their_nonce = Nonce(val.nonce);\n- let chipertext = val.encrypted_exit_client_id;\n+ let ciphertext = val.encrypted_exit_client_id;\nlet decrypted_bytes =\n- match box_::open(&chipertext, &their_nonce, &their_nacl_pubkey, our_secretkey) {\n+ match box_::open(&ciphertext, &their_nonce, &their_nacl_pubkey, our_secretkey) {\nOk(value) => value,\nErr(e) => {\nerror!(\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Fix ciphertext spelling
Very minor error, but it was bothering me |
20,244 | 01.03.2020 10:49:27 | 18,000 | b6d4f95a3b8433ddb75e313dd3c0ac10ab4242d3 | Direct heartbeat at stats subdomain
Sending this directly to the main domain is a great way to cause
problems eventually with a large number of udp packets we have to
redirect away from our website servers. | [
{
"change_type": "MODIFY",
"old_path": "settings/src/logging.rs",
"new_path": "settings/src/logging.rs",
"diff": "@@ -11,7 +11,7 @@ fn default_logging_dest_url() -> String {\n}\nfn default_heartbeat_url() -> String {\n- \"althea.net:33333\".to_string()\n+ \"stats.altheamesh.com:33333\".to_string()\n}\n/// Remote logging settings. Used to control remote logs being\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Direct heartbeat at stats subdomain
Sending this directly to the main domain is a great way to cause
problems eventually with a large number of udp packets we have to
redirect away from our website servers. |
20,244 | 01.03.2020 12:35:45 | 18,000 | 469e374e689343e6bf14279bff29f72aa40643b2 | Bump for Beta 12 RC1 | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -166,7 +166,7 @@ dependencies = [\nname = \"althea_rs\"\nversion = \"0.1.11\"\ndependencies = [\n- \"rita 0.5.37\",\n+ \"rita 0.5.38\",\n]\n[[package]]\n@@ -2095,7 +2095,7 @@ dependencies = [\n[[package]]\nname = \"rita\"\n-version = \"0.5.37\"\n+version = \"0.5.38\"\ndependencies = [\n\"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)\",\n\"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)\",\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/Cargo.toml",
"new_path": "rita/Cargo.toml",
"diff": "[package]\nname = \"rita\"\n-version = \"0.5.37\"\n+version = \"0.5.38\"\nauthors = [\"Jehan <jehan.tremback@gmail.com>\", \"Ben <wangben3@gmail.com>\"]\nbuild = \"build.rs\"\nedition = \"2018\"\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/dashboard/own_info.rs",
"new_path": "rita/src/rita_common/dashboard/own_info.rs",
"diff": "@@ -6,7 +6,7 @@ use failure::Error;\nuse num256::{Int256, Uint256};\nuse settings::RitaCommonSettings;\n-pub static READABLE_VERSION: &str = \"Beta 11 RC11\";\n+pub static READABLE_VERSION: &str = \"Beta 12 RC1\";\n#[derive(Serialize)]\npub struct OwnInfo {\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Bump for Beta 12 RC1 |
20,244 | 09.03.2020 12:08:39 | 14,400 | b4bfb60ca84c8e2444c15e86edbd6d25f216a3e6 | Speed up tests using git archive
This reduces the amount of time spent inserting the repo into the
docker container and also decreases the complexity of creating that
tarball in the first place by implicitly only sending checked in files | [
{
"change_type": "MODIFY",
"old_path": "integration-tests/container/Dockerfile",
"new_path": "integration-tests/container/Dockerfile",
"diff": "@@ -13,5 +13,5 @@ ENV NODES=$NODES\n# we pull in the git tar instead of the local folder becuase the raw code is much much smaller\n# note that changes have to be checked in to be pulled in and tested! we pull this in near\n# the bottom to maximize caching of earlier containers\n-ADD rita.tar.gz /rita\n-CMD PATH=$PATH:$HOME/.cargo/bin SPEEDTEST_THROUGHPUT=\"200\" SPEEDTEST_DURATION=\"15\" INITIAL_POLL_INTERVAL=5 BACKOFF_FACTOR=\"1.5\" VERBOSE=1 /rita/integration-tests/rita.sh\n+ADD rita.tar.gz /\n+CMD PATH=$PATH:$HOME/.cargo/bin SPEEDTEST_THROUGHPUT=\"200\" SPEEDTEST_DURATION=\"15\" INITIAL_POLL_INTERVAL=5 BACKOFF_FACTOR=\"1.5\" VERBOSE=1 /althea_rs/integration-tests/rita.sh\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/test.sh",
"new_path": "scripts/test.sh",
"diff": "@@ -17,15 +17,7 @@ docker system prune -a -f\nDIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\nDOCKERFOLDER=$DIR/../integration-tests/container/\nREPOFOLDER=$DIR/..\n-tar --exclude $REPOFOLDER/target \\\n- --exclude $REPOFOLDER/**/target \\\n- --exclude $REPOFOLDER/integration-tests/althea_rs_a \\\n- --exclude $REPOFOLDER/integration-tests/althea_rs_b \\\n- --exclude $REPOFOLDER/integration-tests/target_a \\\n- --exclude $REPOFOLDER/integration-tests/target_b \\\n- --exclude $REPOFOLDER/integration-tests/deps \\\n- --exclude $REPOFOLDER/integration-tests/container/rita.tar.gz \\\n- --exclude $REPOFOLDER/scripts --dereference --hard-dereference -czf $DOCKERFOLDER/rita.tar.gz $REPOFOLDER\n+git archive --format=tar.gz -o $DOCKERFOLDER/rita.tar.gz --prefix=althea_rs/ HEAD\npushd $DOCKERFOLDER\ntime docker build -t rita-test --build-arg NODES=$NODES .\ntime docker run --privileged -it rita-test\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Speed up tests using git archive
This reduces the amount of time spent inserting the repo into the
docker container and also decreases the complexity of creating that
tarball in the first place by implicitly only sending checked in files |
20,244 | 14.03.2020 18:34:22 | 14,400 | 68d12f3f738df9ebe9b2d12bd61c174dd5cf8d94 | Log duplicate validation attempts
I want to get some more insight into this | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/payment_validator/mod.rs",
"new_path": "rita/src/rita_common/payment_validator/mod.rs",
"diff": "@@ -297,17 +297,17 @@ fn handle_tx_messaging(\nmatch (to_us, from_us, is_in_chain) {\n// we where successfully paid\n(true, false, true) => {\n- info!(\n- \"payment {:#066x} from {} for {} wei successfully validated!\",\n- txid, from_address, amount\n- );\nlet res = PaymentValidator::from_registry()\n.send(Remove {\ntx: ts,\nsuccess: true,\n})\n- .and_then(|res| {\n+ .and_then(move |res| {\nif res.is_ok() {\n+ info!(\n+ \"payment {:#066x} from {} for {} wei successfully validated!\",\n+ txid, from_address, amount\n+ );\nDebtKeeper::from_registry().do_send(PaymentReceived {\nfrom: pmt.from,\namount: pmt.amount.clone(),\n@@ -315,6 +315,11 @@ fn handle_tx_messaging(\n// update the usage tracker with the details of this payment\nUsageTracker::from_registry().do_send(UpdatePayments { payment: pmt });\n+ } else {\n+ info!(\n+ \"payment {:#066x} from {} for {} wei duplicate validation attempt!\",\n+ txid, from_address, amount\n+ );\n}\nOk(())\n})\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Log duplicate validation attempts
I want to get some more insight into this |
20,244 | 27.02.2020 10:39:13 | 18,000 | 6373b22d1d7883c6840a1865fe20961be25eaa1f | Add heartbeat types
This creates a much more expansive type container for the heartbeat
message which includes a small amount of topology and routing data
to balance the needs of keeping the message small and providing enough
detail to the heartbeat server to really help network operators. | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -183,6 +183,7 @@ version = \"0.1.0\"\ndependencies = [\n\"actix\",\n\"arrayvec 0.5.1\",\n+ \"babel_monitor\",\n\"base64 0.11.0\",\n\"clarity\",\n\"failure\",\n"
},
{
"change_type": "MODIFY",
"old_path": "althea_types/Cargo.toml",
"new_path": "althea_types/Cargo.toml",
"diff": "@@ -7,6 +7,7 @@ license = \"Apache-2.0\"\n[dependencies]\n+babel_monitor = { path = \"../babel_monitor\" }\nnum256 = \"0.2\"\nbase64 = \"0.11\"\nserde_derive = \"1.0\"\n"
},
{
"change_type": "MODIFY",
"old_path": "althea_types/src/interop.rs",
"new_path": "althea_types/src/interop.rs",
"diff": "use crate::wg_key::WgKey;\nuse arrayvec::ArrayString;\n+use babel_monitor::Neighbor;\n+use babel_monitor::Route;\nuse clarity::Address;\nuse failure::Error;\nuse num256::Uint256;\n@@ -375,3 +377,22 @@ pub struct OracleUpdate {\n/// A json payload to be merged into the existing settings\npub merge_json: serde_json::Value,\n}\n+\n+#[derive(Debug, Clone, Serialize, Deserialize)]\n+pub struct HeartBeatMessage {\n+ pub id: Identity,\n+ pub oracle: Address,\n+ pub balance: Uint256,\n+ pub exit_dest_price: Uint256,\n+ pub upstream_to_current_exit: Identity,\n+ pub exit_connection_route: Route,\n+ pub exit_connection_neighbor: Neighbor,\n+}\n+\n+/// Wrapper for secure box containing a HeartBeatMessage\n+#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Hash, Clone)]\n+pub struct EncryptedHeartBeatMessage {\n+ pub pubkey: WgKey,\n+ pub nonce: [u8; 24],\n+ pub encrypted_heart_beat_messsage: Vec<u8>,\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "babel_monitor/src/lib.rs",
"new_path": "babel_monitor/src/lib.rs",
"diff": "@@ -108,7 +108,7 @@ pub struct Route {\npub fee: u32,\n}\n-#[derive(Debug, Clone)]\n+#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct Neighbor {\npub id: String,\npub address: IpAddr,\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Add heartbeat types
This creates a much more expansive type container for the heartbeat
message which includes a small amount of topology and routing data
to balance the needs of keeping the message small and providing enough
detail to the heartbeat server to really help network operators. |
20,244 | 27.02.2020 16:55:02 | 18,000 | 400b73d7b7618d0227106c2ca58e43ef0d750f4c | Improved HeartBeat
This adds a number of features to the HeartBeat system, and breaks
it out into it's own file. | [
{
"change_type": "MODIFY",
"old_path": "althea_types/src/interop.rs",
"new_path": "althea_types/src/interop.rs",
"diff": "@@ -380,13 +380,25 @@ pub struct OracleUpdate {\n#[derive(Debug, Clone, Serialize, Deserialize)]\npub struct HeartBeatMessage {\n+ /// The identity of the sender\npub id: Identity,\n- pub oracle: Address,\n+ /// The organizer address set on the device if any\n+ pub organizer_address: Option<Address>,\n+ /// The devices current balance, we could in theory query this\n+ /// using the address in the id anyways, consider dropping\npub balance: Uint256,\n- pub exit_dest_price: Uint256,\n- pub upstream_to_current_exit: Identity,\n- pub exit_connection_route: Route,\n- pub exit_connection_neighbor: Neighbor,\n+ /// The full price this node is paying for each byte of traffic\n+ /// in the usual unit of wei/byte\n+ pub exit_dest_price: u64,\n+ /// The identity of the upstream neighbor, being defined as the one\n+ /// closer to the exit\n+ pub upstream_id: Identity,\n+ /// The babel Route to the exit, including details such as metric and\n+ /// full path rtt\n+ pub exit_route: Route,\n+ /// The babel Neighbor over which our traffic flows, this gives us the Reach\n+ /// (packet loss over 16 seconds) as well as the neighbor RTT\n+ pub exit_neighbor: Neighbor,\n}\n/// Wrapper for secure box containing a HeartBeatMessage\n"
},
{
"change_type": "MODIFY",
"old_path": "babel_monitor/src/lib.rs",
"new_path": "babel_monitor/src/lib.rs",
"diff": "@@ -61,8 +61,6 @@ use crate::BabelMonitorError::{\nTokioError, VariableNotFound,\n};\n-// If a function doesn't need internal state of the Babel object\n-// we don't want to place it as a member function.\nfn find_babel_val(val: &str, line: &str) -> Result<String, Error> {\nlet mut iter = line.split(' ');\nwhile let Some(entry) = iter.next() {\n@@ -550,6 +548,17 @@ pub fn get_route_via_neigh(\n}\nErr(NoNeighbor(neigh_mesh_ip.to_string()).into())\n}\n+\n+/// Very simple utility function to get a neighbor given a route that traverses that neighbor\n+pub fn get_neigh_given_route(route: &Route, neighs: &[Neighbor]) -> Option<Neighbor> {\n+ for neigh in neighs.iter() {\n+ if route.neigh_ip == neigh.address {\n+ return Some(neigh.clone());\n+ }\n+ }\n+ None\n+}\n+\n/// Checks if Babel has an installed route to the given destination\npub fn do_we_have_route(mesh_ip: &IpAddr, routes: &[Route]) -> Result<bool, Error> {\nfor route in routes.iter() {\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "rita/src/rita_client/heartbeat/mod.rs",
"diff": "+//! Manages the Heartbeat from the router. This is a piece of metric data that is controlled by the system logging setting\n+//! if logging is enabled the system will send a heartbeat in the Rita client loop every CLIENT_LOOP_SPEED seconds. This\n+//! heartbeat contains data about routing, balance, and implicit in it's sending data that the router is up and functioning.\n+//! This data is sent as a udp fire and forget packet. Take note that if this packet is larger than the MTU you may run into\n+//! issues, so be careful expanding it.\n+\n+use crate::rita_client::rita_loop::CLIENT_LOOP_TIMEOUT;\n+use crate::rita_common::network_monitor::GetNetworkInfo;\n+use crate::rita_common::network_monitor::NetworkMonitor;\n+use crate::rita_common::tunnel_manager::Neighbor as RitaNeighbor;\n+use crate::rita_common::utils::option_deref;\n+use crate::SETTING;\n+use actix::actors::resolver;\n+use actix::{Arbiter, SystemService};\n+use althea_types::HeartBeatMessage;\n+use althea_types::Identity;\n+use althea_types::WgKey;\n+use babel_monitor::get_installed_route;\n+use babel_monitor::get_neigh_given_route;\n+use babel_monitor::Neighbor;\n+use babel_monitor::Route;\n+use failure::Error;\n+use futures01::future::Future;\n+use settings::client::ExitServer;\n+use settings::client::RitaClientSettings;\n+use settings::RitaCommonSettings;\n+use std::net::{SocketAddr, UdpSocket};\n+use std::time::Duration;\n+\n+type Resolver = resolver::Resolver;\n+\n+pub fn send_udp_heartbeat() {\n+ let dns_request = Resolver::from_registry()\n+ .send(resolver::Resolve::host(\n+ SETTING.get_log().heartbeat_url.clone(),\n+ ))\n+ .timeout(CLIENT_LOOP_TIMEOUT);\n+ let network_info = NetworkMonitor::from_registry()\n+ .send(GetNetworkInfo {})\n+ .timeout(CLIENT_LOOP_TIMEOUT);\n+ // Check for the basics first, before doing any of the hard futures work\n+ let (our_id, selected_exit_details) =\n+ if let (Some(id), Some(exit)) = (SETTING.get_identity(), get_selected_exit()) {\n+ let exit_info = exit.info;\n+ match exit_info.general_details() {\n+ Some(details) => (id, details.clone()),\n+ None => return,\n+ }\n+ } else {\n+ return;\n+ };\n+\n+ let res = dns_request.join(network_info).then(move |res| match res {\n+ Ok((Ok(dnsresult), Ok(network_info))) => {\n+ if dnsresult.is_empty() {\n+ trace!(\"Got zero length dns response: {:?}\", dnsresult);\n+ }\n+\n+ if let Ok(route) = get_selected_exit_route(&network_info.babel_routes) {\n+ let neigh_option = get_neigh_given_route(&route, &network_info.babel_neighbors);\n+ let neigh_option =\n+ get_rita_neigh_option(neigh_option, &network_info.rita_neighbors);\n+ if let Some((neigh, rita_neigh)) = neigh_option {\n+ for dns_socket in dnsresult {\n+ send_udp_heartbeat_packet(\n+ dns_socket,\n+ our_id,\n+ selected_exit_details.exit_price,\n+ route.clone(),\n+ neigh.clone(),\n+ rita_neigh.identity.global,\n+ );\n+ }\n+ }\n+ }\n+ Ok(())\n+ }\n+ Err(e) => {\n+ warn!(\"Failed to resolve domain and get network info! {:?}\", e);\n+ Ok(())\n+ }\n+ Ok((Err(e), _)) => {\n+ warn!(\"DNS resolution failed with {:?}\", e);\n+ Ok(())\n+ }\n+ Ok((_, Err(e))) => {\n+ warn!(\"Could not get network info with {:?}\", e);\n+ Ok(())\n+ }\n+ });\n+\n+ Arbiter::spawn(res);\n+}\n+\n+fn get_selected_exit_route(route_dump: &[Route]) -> Result<Route, Error> {\n+ let exit_client = SETTING.get_exit_client();\n+ let exit_mesh_ip = if let Some(e) = exit_client.get_current_exit() {\n+ e.id.mesh_ip\n+ } else {\n+ return Err(format_err!(\"No Exit\"));\n+ };\n+ get_installed_route(&exit_mesh_ip, route_dump)\n+}\n+\n+fn get_selected_exit() -> Option<ExitServer> {\n+ let exit_client = SETTING.get_exit_client();\n+ let exit = if let Some(e) = exit_client.get_current_exit() {\n+ e\n+ } else {\n+ return None;\n+ };\n+ Some(exit.clone())\n+}\n+\n+fn get_rita_neigh_option(\n+ neigh: Option<Neighbor>,\n+ rita_neighbors: &[RitaNeighbor],\n+) -> Option<(Neighbor, RitaNeighbor)> {\n+ match neigh {\n+ Some(neigh) => match get_rita_neighbor(&neigh, rita_neighbors) {\n+ Some(rita_neigh) => Some((neigh, rita_neigh)),\n+ None => None,\n+ },\n+ None => None,\n+ }\n+}\n+\n+fn get_rita_neighbor(neigh: &Neighbor, rita_neighbors: &[RitaNeighbor]) -> Option<RitaNeighbor> {\n+ for rita_neighbor in rita_neighbors.iter() {\n+ if rita_neighbor.iface_name.contains(&neigh.iface) {\n+ return Some(rita_neighbor.clone());\n+ }\n+ }\n+ None\n+}\n+\n+fn send_udp_heartbeat_packet(\n+ dns_socket: SocketAddr,\n+ our_id: Identity,\n+ exit_price: u64,\n+ exit_route: Route,\n+ exit_neighbor: Neighbor,\n+ exit_neighbor_id: Identity,\n+) {\n+ let remote_ip = dns_socket.ip();\n+ let remote_port = dns_socket.port();\n+ let remote = dns_socket;\n+\n+ let local_socketaddr = SocketAddr::from(([0, 0, 0, 0], remote_port));\n+ let local_socket = match UdpSocket::bind(&local_socketaddr) {\n+ Ok(s) => s,\n+ Err(e) => {\n+ error!(\"Couldn't bind to UDP heartbeat socket {:?}\", e);\n+ return;\n+ }\n+ };\n+\n+ trace!(\"Sending heartbeat to {:?}\", remote_ip);\n+\n+ let message = HeartBeatMessage {\n+ id: our_id,\n+ organizer_address: option_deref(SETTING.get_dao().dao_addresses.get(0)),\n+ balance: SETTING.get_payment().balance.clone(),\n+ exit_dest_price: exit_price + exit_route.price as u64,\n+ upstream_id: exit_neighbor_id,\n+ exit_route,\n+ exit_neighbor,\n+ };\n+ let json_message = match serde_json::to_vec(&message) {\n+ Ok(m) => m,\n+ Err(_) => return,\n+ };\n+\n+ if let Err(e) = local_socket.set_write_timeout(Some(Duration::new(0, 100))) {\n+ trace!(\"Failed to set socket timeout {:?}, skipping!\", e);\n+ return;\n+ }\n+\n+ match local_socket.send_to(&json_message, &remote) {\n+ Ok(bytes) => trace!(\"Sent {} heartbeat bytes\", bytes),\n+ Err(e) => error!(\"Failed to send heartbeat with {:?}\", e),\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/mod.rs",
"new_path": "rita/src/rita_client/mod.rs",
"diff": "pub mod dashboard;\npub mod exit_manager;\n+pub mod heartbeat;\npub mod light_client_manager;\npub mod rita_loop;\npub mod traffic_watcher;\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/rita_loop/mod.rs",
"new_path": "rita/src/rita_client/rita_loop/mod.rs",
"diff": "//! tunnel if the signup was successful on the selected exit.\nuse crate::rita_client::exit_manager::ExitManager;\n+use crate::rita_client::heartbeat::send_udp_heartbeat;\nuse crate::rita_client::light_client_manager::light_client_hello_response;\nuse crate::rita_client::light_client_manager::LightClientManager;\nuse crate::rita_client::light_client_manager::Watch;\n@@ -15,7 +16,6 @@ use crate::rita_common::tunnel_manager::GetNeighbors;\nuse crate::rita_common::tunnel_manager::GetTunnels;\nuse crate::rita_common::tunnel_manager::TunnelManager;\nuse crate::SETTING;\n-use actix::actors::resolver;\nuse actix::{\nActor, ActorContext, Addr, Arbiter, AsyncContext, Context, Handler, Message, Supervised,\nSystemService,\n@@ -27,9 +27,7 @@ use failure::Error;\nuse futures01::future::Future;\nuse settings::client::RitaClientSettings;\nuse settings::RitaCommonSettings;\n-use std::net::{SocketAddr, UdpSocket};\nuse std::time::{Duration, Instant};\n-type Resolver = resolver::Resolver;\n#[derive(Default)]\npub struct RitaLoop;\n@@ -38,8 +36,6 @@ pub struct RitaLoop;\npub const CLIENT_LOOP_SPEED: u64 = 5;\npub const CLIENT_LOOP_TIMEOUT: Duration = Duration::from_secs(4);\n-pub const HEARBEAT_MESSAGE_PORT: u16 = 33333;\n-\nimpl Actor for RitaLoop {\ntype Context = Context<Self>;\n@@ -119,71 +115,6 @@ impl Handler<Tick> for RitaLoop {\n}\n}\n-pub fn send_udp_heartbeat() {\n- let res = Resolver::from_registry()\n- .send(resolver::Resolve::host(\n- SETTING.get_log().heartbeat_url.clone(),\n- ))\n- .timeout(Duration::from_secs(1))\n- .then(move |res| match res {\n- Ok(Ok(dnsresult)) => {\n- if !dnsresult.is_empty() {\n- for dns_socket in dnsresult {\n- send_udp_heartbeat_packet(dns_socket);\n- }\n- } else {\n- trace!(\"Got zero length dns response: {:?}\", dnsresult);\n- }\n- Ok(())\n- }\n-\n- Err(e) => {\n- warn!(\"Actor mailbox failure from DNS resolver! {:?}\", e);\n- Ok(())\n- }\n-\n- Ok(Err(e)) => {\n- warn!(\"DNS resolution failed with {:?}\", e);\n- Ok(())\n- }\n- });\n-\n- Arbiter::spawn(res);\n-}\n-\n-fn send_udp_heartbeat_packet(dns_socket: SocketAddr) {\n- let local_socketaddr = SocketAddr::from(([0, 0, 0, 0], HEARBEAT_MESSAGE_PORT));\n- let local_socket = match UdpSocket::bind(&local_socketaddr) {\n- Ok(s) => s,\n- Err(e) => {\n- error!(\"Couldn't bind to UDP heartbeat socket {:?}\", e);\n- return;\n- }\n- };\n-\n- let remote_ip = dns_socket.ip();\n- let remote = SocketAddr::new(remote_ip, HEARBEAT_MESSAGE_PORT);\n-\n- trace!(\"Sending heartbeat to {:?}\", remote_ip);\n-\n- let message = match SETTING.get_identity() {\n- Some(i) => i,\n- None => return,\n- };\n- let json_message = match serde_json::to_vec(&message) {\n- Ok(m) => m,\n- Err(_) => return,\n- };\n-\n- local_socket\n- .set_write_timeout(Some(Duration::new(0, 100)))\n- .expect(\"Couldn't set socket timeout\");\n-\n- local_socket\n- .send_to(&json_message, &remote)\n- .expect(\"Couldn't send heartbeat\");\n-}\n-\npub fn check_rita_client_actors() {\nassert!(crate::rita_client::rita_loop::RitaLoop::from_registry().connected());\nassert!(crate::rita_client::exit_manager::ExitManager::from_registry().connected());\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/utils/mod.rs",
"new_path": "rita/src/rita_common/utils/mod.rs",
"diff": "pub mod ip_increment;\n+\n+#[allow(dead_code)]\n+pub fn option_deref<T: Copy>(item: Option<&T>) -> Option<T> {\n+ match item {\n+ Some(i) => Some(*i),\n+ None => None,\n+ }\n+}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Improved HeartBeat
This adds a number of features to the HeartBeat system, and breaks
it out into it's own file. |
20,244 | 28.02.2020 06:38:27 | 18,000 | fa7a47565cad9c05565cb51237b4060b8769160a | Use slices to copy heartbeat data
This leaves the compiler more room to optimize the copying process | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/heartbeat/mod.rs",
"new_path": "rita/src/rita_client/heartbeat/mod.rs",
"diff": "@@ -189,15 +189,10 @@ fn send_udp_heartbeat_packet(\nlet ciphertext = box_::seal(&plaintext, &nonce, &their_publickey, &our_secretkey);\nlet mut packet_contents = Vec::new();\n- for byte in our_publickey.as_ref().iter() {\n- packet_contents.push(*byte);\n- }\n- for byte in nonce.0.iter() {\n- packet_contents.push(*byte);\n- }\n- for byte in ciphertext.iter() {\n- packet_contents.push(*byte);\n- }\n+ // build the packet from slices\n+ packet_contents.extend_from_slice(our_publickey.as_ref());\n+ packet_contents.extend_from_slice(&nonce.0);\n+ packet_contents.extend_from_slice(&ciphertext);\nif let Err(e) = local_socket.set_write_timeout(Some(Duration::new(0, 100))) {\ntrace!(\"Failed to set socket timeout {:?}, skipping!\", e);\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Use slices to copy heartbeat data
This leaves the compiler more room to optimize the copying process |
20,244 | 01.03.2020 07:05:48 | 18,000 | bef0e7cf14b1396e72e7eddc2ae1e3e47ccbac79 | Heartbeat instead of HeartBeat | [
{
"change_type": "MODIFY",
"old_path": "althea_types/src/interop.rs",
"new_path": "althea_types/src/interop.rs",
"diff": "@@ -379,7 +379,7 @@ pub struct OracleUpdate {\n}\n#[derive(Debug, Clone, Serialize, Deserialize)]\n-pub struct HeartBeatMessage {\n+pub struct HeartbeatMessage {\n/// The identity of the sender\npub id: Identity,\n/// The organizer address set on the device if any\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/heartbeat/mod.rs",
"new_path": "rita/src/rita_client/heartbeat/mod.rs",
"diff": "@@ -15,7 +15,7 @@ use crate::rita_common::utils::option_deref;\nuse crate::SETTING;\nuse actix::actors::resolver;\nuse actix::{Arbiter, SystemService};\n-use althea_types::HeartBeatMessage;\n+use althea_types::HeartbeatMessage;\nuse althea_types::Identity;\nuse althea_types::WgKey;\nuse babel_monitor::get_installed_route;\n@@ -173,7 +173,7 @@ fn send_udp_heartbeat_packet(\ntrace!(\"Sending heartbeat to {:?}\", remote_ip);\n- let message = HeartBeatMessage {\n+ let message = HeartbeatMessage {\nid: our_id,\norganizer_address: option_deref(SETTING.get_dao().dao_addresses.get(0)),\nbalance: SETTING.get_payment().balance.clone(),\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Heartbeat instead of HeartBeat |
20,244 | 22.03.2020 09:03:17 | 14,400 | 9e1f68a8f5209da96f7928d9c98f7a69a5719d60 | Use lazy_static for hardcoded heartbeat key | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/heartbeat/mod.rs",
"new_path": "rita/src/rita_client/heartbeat/mod.rs",
"diff": "@@ -33,7 +33,11 @@ use std::time::Duration;\ntype Resolver = resolver::Resolver;\n-const HEARTBEAT_SERVER_KEY: &str = \"hizclQFo/ArWY+/9+AJ0LBY2dTiQK4smy5icM7GA5ng=\";\n+lazy_static! {\n+ pub static ref HEARTBEAT_SERVER_KEY: WgKey = \"hizclQFo/ArWY+/9+AJ0LBY2dTiQK4smy5icM7GA5ng=\"\n+ .parse()\n+ .unwrap();\n+}\npub fn send_udp_heartbeat() {\nlet dns_request = Resolver::from_registry()\n@@ -154,7 +158,7 @@ fn send_udp_heartbeat_packet(\n.wg_private_key\n.expect(\"No private key?\")\n.into();\n- let their_publickey: WgKey = HEARTBEAT_SERVER_KEY.parse().unwrap();\n+ let their_publickey: WgKey = *HEARTBEAT_SERVER_KEY;\nlet their_publickey = their_publickey.into();\ndrop(network_settings);\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Use lazy_static for hardcoded heartbeat key |
20,244 | 22.03.2020 10:27:24 | 14,400 | 274ef13f3a2add886840f7a2f692f37a8c00d408 | Gitlab ci
No integration tests here sadly. They don't seem to have vm executors
in any workable state | [
{
"change_type": "ADD",
"old_path": null,
"new_path": ".gitlab-ci.yml",
"diff": "+image: rust:latest\n+\n+before_script:\n+ - apt-get -qq update\n+ - apt-get install -y libsqlite3-dev curl git libssl-dev build-essential libpq-dev\n+ - rustup component add rustfmt\n+ - rustup component add clippy\n+\n+\n+stages:\n+ - build\n+ - lint\n+ - test\n+\n+build_rita_exit_x86:\n+ stage: build\n+ script:\n+ - \"cd rita && cargo build --bin rita_exit\"\n+\n+build_rita:\n+ stage: build\n+ script:\n+ - \"cd rita && cargo build --bin rita\"\n+\n+lint_opt_level:\n+ stage: lint\n+ script:\n+ - 'grep -q ''opt-level = \"z\"'' Cargo.toml'\n+lint_audit:\n+ stage: lint\n+ script:\n+ - \"cargo install cargo-audit --force && cargo audit\"\n+lint_geiger:\n+ stage: lint\n+ script:\n+ - \"cargo install cargo-geiger --force && cargo geiger\"\n+lint_fmt:\n+ stage: lint\n+ script:\n+ - cargo fmt --all -- --check\n+\n+\n+test_rita_exit_x86:\n+ stage: test\n+ script:\n+ - \"cd rita && RUST_TEST_THREADS=1 cargo test --verbose --bin rita_exit\"\n+\n+test_rita_x86:\n+ stage: test\n+ script:\n+ - \"cd rita && RUST_TEST_THREADS=1 cargo test --bin rita --verbose\"\n+\n+# integration_test_basic:\n+# stage: integration_test\n+# script:\n+# - ./integration-tests/rita.sh\n+# variables:\n+# SPEEDTEST_THROUGHPUT: \"20\"\n+# SPEEDTEST_DURATION: \"15\"\n+# INITIAL_POLL_INTERVAL: 5\n+# BACKOFF_FACTOR: \"1.5\"\n+# VERBOSE: 1\n+# POSTGRES_USER: postgres\n+# POSTGRES_BIN: /usr/lib/postgresql/9.6/bin/postgres\n+# POSTGRES_DATABASE: /var/ramfs/postgresql/9.6/main\n+# POSTGRES_CONFIG: /etc/postgresql/9.6/main/postgresql.conf\n+\n+# integration_test_backwards_to_master:\n+# stage: integration_test\n+# script:\n+# - ./integration-tests/rita.sh\n+# variables:\n+# REVISION_B: master\n+# REMOTE_A: \"..\"\n+# REMOTE_B: \"https://github.com/althea-mesh/althea_rs.git\"\n+# COMPAT_LAYOUT: \"inner_ring_old\"\n+# SPEEDTEST_THROUGHPUT: \"20\"\n+# SPEEDTEST_DURATION: \"15\"\n+# INITIAL_POLL_INTERVAL: 5\n+# BACKOFF_FACTOR: \"1.5\"\n+# VERBOSE: 1\n+# POSTGRES_USER: postgres\n+# POSTGRES_BIN: /usr/lib/postgresql/9.6/bin/postgres\n+# POSTGRES_DATABASE: /var/ramfs/postgresql/9.6/main\n+# POSTGRES_CONFIG: /etc/postgresql/9.6/main/postgresql.conf\n+\n+# integration_test_backwards_to_release:\n+# stage: integration_test\n+# script:\n+# - ./integration-tests/rita.sh\n+# variables:\n+# REVISION_B: release\n+# REMOTE_A: \"..\"\n+# REMOTE_B: \"https://github.com/althea-mesh/althea_rs.git\"\n+# COMPAT_LAYOUT: \"inner_ring_old\"\n+# SPEEDTEST_THROUGHPUT: \"20\"\n+# SPEEDTEST_DURATION: \"15\"\n+# INITIAL_POLL_INTERVAL: 5\n+# BACKOFF_FACTOR: \"1.5\"\n+# VERBOSE: 1\n+# POSTGRES_USER: postgres\n+# POSTGRES_BIN: /usr/lib/postgresql/9.6/bin/postgres\n+# POSTGRES_DATABASE: /var/ramfs/postgresql/9.6/main\n+# POSTGRES_CONFIG: /etc/postgresql/9.6/main/postgresql.conf\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "scripts/cross",
"diff": "+#!/bin/sh\n+\n+# copy cargo and rustup into /builds directory which is in a shared volume\n+cp -r /opt/cargo /builds/${CI_PROJECT_PATH}/shared/\n+cp -r /opt/rustup /builds/${CI_PROJECT_PATH}/shared/\n+\n+# start real cross with modified path\n+RUSTUP_HOME=/builds/${CI_PROJECT_PATH}/shared/rustup CARGO_HOME=/builds/${CI_PROJECT_PATH}/shared/cargo real-cross \"$@\"\n\\ No newline at end of file\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Gitlab ci
No integration tests here sadly. They don't seem to have vm executors
in any workable state |
20,244 | 22.03.2020 09:44:49 | 14,400 | e375b679744991b4fd708329c2daaac2fa974112 | Link in Antenna forwarding client
There are some dependency hardships here. To prevent circular dependency
hell we have to patch out the gitlab version of althea-types to our own
local version.
Otherwise pretty straightforward, bring in the forwarding client and start
it up | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -91,7 +91,7 @@ dependencies = [\n\"percent-encoding 1.0.1\",\n\"rand 0.6.5\",\n\"regex\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n\"serde_json\",\n\"serde_urlencoded\",\n\"sha1\",\n@@ -139,7 +139,7 @@ checksum = \"b95aceadaf327f18f0df5962fedc1bde2f870566a0b9f65c89508a3b1f79334c\"\ndependencies = [\n\"proc-macro2 1.0.9\",\n\"quote 1.0.3\",\n- \"syn 1.0.16\",\n+ \"syn 1.0.17\",\n]\n[[package]]\n@@ -163,7 +163,7 @@ version = \"0.1.0\"\ndependencies = [\n\"althea_types\",\n\"failure\",\n- \"itertools\",\n+ \"itertools 0.9.0\",\n\"lazy_static\",\n\"log\",\n\"oping\",\n@@ -189,7 +189,39 @@ dependencies = [\n\"failure\",\n\"hex\",\n\"num256\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n+ \"serde_derive\",\n+ \"serde_json\",\n+ \"sodiumoxide\",\n+]\n+\n+[[package]]\n+name = \"antenna-forwarding-client\"\n+version = \"0.1.0\"\n+source = \"git+ssh://git@gitlab.com/althea-net/organizer-tools.git#48f0489e7c3c649aaebc035542cf3a50a0bcfbfe\"\n+dependencies = [\n+ \"althea_kernel_interface\",\n+ \"althea_types\",\n+ \"antenna-forwarding-protocol\",\n+ \"env_logger\",\n+ \"failure\",\n+ \"get_if_addrs\",\n+ \"log\",\n+ \"oping\",\n+ \"serde 1.0.105\",\n+ \"serde_json\",\n+ \"sodiumoxide\",\n+]\n+\n+[[package]]\n+name = \"antenna-forwarding-protocol\"\n+version = \"0.1.0\"\n+source = \"git+ssh://git@gitlab.com/althea-net/organizer-tools.git#48f0489e7c3c649aaebc035542cf3a50a0bcfbfe\"\n+dependencies = [\n+ \"althea_types\",\n+ \"clarity\",\n+ \"failure\",\n+ \"serde 1.0.105\",\n\"serde_derive\",\n\"serde_json\",\n\"sodiumoxide\",\n@@ -197,9 +229,9 @@ dependencies = [\n[[package]]\nname = \"arc-swap\"\n-version = \"0.4.4\"\n+version = \"0.4.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d7b8a9123b8027467bce0099fe556c628a53c8d83df0507084c31e9ba2e39aff\"\n+checksum = \"d663a8e9a99154b5fb793032533f6328da35e23aac63d5c152279aa8ba356825\"\n[[package]]\nname = \"arrayvec\"\n@@ -216,7 +248,7 @@ version = \"0.5.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8\"\ndependencies = [\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n]\n[[package]]\n@@ -238,7 +270,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"9c356497fd3417158bcb318266ac83c391219ca3a5fa659049f42e0041ab57d6\"\ndependencies = [\n\"extend\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n\"serde_json\",\n]\n@@ -292,7 +324,7 @@ dependencies = [\n\"futures 0.1.29\",\n\"ipnetwork 0.14.0\",\n\"log\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n\"serde_derive\",\n\"tokio\",\n]\n@@ -321,9 +353,9 @@ dependencies = [\n[[package]]\nname = \"backtrace-sys\"\n-version = \"0.1.33\"\n+version = \"0.1.34\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e17b52e737c40a7d75abca20b29a19a0eb7ba9fc72c5a72dd282a0a3c2c0dc35\"\n+checksum = \"ca797db0057bae1a7aa2eef3283a874695455cecf08a43bfb8507ee0ebc1ed69\"\ndependencies = [\n\"cc\",\n\"libc\",\n@@ -361,7 +393,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"5753e2a71534719bf3f4e57006c3a4f0d2c672a4b676eec84161f763eca87dbf\"\ndependencies = [\n\"byteorder\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n]\n[[package]]\n@@ -426,13 +458,10 @@ dependencies = [\n]\n[[package]]\n-name = \"c2-chacha\"\n-version = \"0.2.3\"\n+name = \"c_linked_list\"\n+version = \"1.1.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb\"\n-dependencies = [\n- \"ppv-lite86\",\n-]\n+checksum = \"4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b\"\n[[package]]\nname = \"cc\"\n@@ -470,7 +499,7 @@ dependencies = [\n\"num-traits 0.2.11\",\n\"num256\",\n\"secp256k1\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n\"serde-rlp\",\n\"serde_bytes\",\n\"serde_derive\",\n@@ -500,7 +529,7 @@ dependencies = [\n\"log\",\n\"rand 0.7.3\",\n\"regex\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n\"serde_derive\",\n\"serde_json\",\n\"settings\",\n@@ -532,7 +561,7 @@ dependencies = [\n\"flate2\",\n\"futures 0.1.29\",\n\"log\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n\"serde_derive\",\n\"serde_json\",\n]\n@@ -546,7 +575,7 @@ dependencies = [\n\"lazy_static\",\n\"nom 5.1.1\",\n\"rust-ini\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n\"serde-hjson\",\n\"serde_json\",\n\"toml\",\n@@ -675,7 +704,7 @@ checksum = \"45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3\"\ndependencies = [\n\"proc-macro2 1.0.9\",\n\"quote 1.0.3\",\n- \"syn 1.0.16\",\n+ \"syn 1.0.17\",\n]\n[[package]]\n@@ -701,7 +730,7 @@ checksum = \"7f525a586d310c87df72ebcd98009e57f1cc030c8c268305287a476beb653969\"\ndependencies = [\n\"lazy_static\",\n\"regex\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n\"strsim\",\n]\n@@ -842,7 +871,7 @@ dependencies = [\n\"diesel\",\n\"dotenv\",\n\"failure\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n\"serde_derive\",\n\"serde_json\",\n]\n@@ -856,7 +885,7 @@ dependencies = [\n\"proc-macro-error\",\n\"proc-macro2 1.0.9\",\n\"quote 1.0.3\",\n- \"syn 1.0.16\",\n+ \"syn 1.0.17\",\n]\n[[package]]\n@@ -877,7 +906,7 @@ checksum = \"030a733c8287d6213886dd487564ff5c8f6aae10278b3588ed177f9d18f8d231\"\ndependencies = [\n\"proc-macro2 1.0.9\",\n\"quote 1.0.3\",\n- \"syn 1.0.16\",\n+ \"syn 1.0.17\",\n\"synstructure\",\n]\n@@ -910,9 +939,9 @@ dependencies = [\n[[package]]\nname = \"flate2\"\n-version = \"1.0.13\"\n+version = \"1.0.14\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6bd6d6f4752952feb71363cffc9ebac9411b75b87c6ab6058c40c8900cf43c0f\"\n+checksum = \"2cfff41391129e0a856d6d822600b8d71179d46879e310417eb9c762eb178b42\"\ndependencies = [\n\"cfg-if\",\n\"crc32fast\",\n@@ -1036,7 +1065,7 @@ dependencies = [\n\"proc-macro-hack\",\n\"proc-macro2 1.0.9\",\n\"quote 1.0.3\",\n- \"syn 1.0.16\",\n+ \"syn 1.0.17\",\n]\n[[package]]\n@@ -1095,6 +1124,28 @@ dependencies = [\n\"typenum\",\n]\n+[[package]]\n+name = \"get_if_addrs\"\n+version = \"0.5.3\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"abddb55a898d32925f3148bd281174a68eeb68bbfd9a5938a57b18f506ee4ef7\"\n+dependencies = [\n+ \"c_linked_list\",\n+ \"get_if_addrs-sys\",\n+ \"libc\",\n+ \"winapi 0.2.8\",\n+]\n+\n+[[package]]\n+name = \"get_if_addrs-sys\"\n+version = \"0.1.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"0d04f9fb746cf36b191c00f3ede8bde9c8e64f9f4b05ae2694a9ccf5e3f5ab48\"\n+dependencies = [\n+ \"gcc\",\n+ \"libc\",\n+]\n+\n[[package]]\nname = \"getrandom\"\nversion = \"0.1.14\"\n@@ -1135,7 +1186,7 @@ dependencies = [\n\"pest\",\n\"pest_derive\",\n\"quick-error\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n\"serde_json\",\n\"walkdir\",\n]\n@@ -1146,7 +1197,7 @@ version = \"0.5.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"e1de41fb8dba9714efd92241565cdff73f78508c95697dd56787d3cba27e2353\"\ndependencies = [\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n]\n[[package]]\n@@ -1300,7 +1351,7 @@ version = \"0.14.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"b3d862c86f7867f19b693ec86765e0252d82e53d4240b9b629815675a0714ad1\"\ndependencies = [\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n]\n[[package]]\n@@ -1312,6 +1363,15 @@ dependencies = [\n\"either\",\n]\n+[[package]]\n+name = \"itertools\"\n+version = \"0.9.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b\"\n+dependencies = [\n+ \"either\",\n+]\n+\n[[package]]\nname = \"itoa\"\nversion = \"0.4.5\"\n@@ -1365,7 +1425,7 @@ dependencies = [\n\"log\",\n\"native-tls\",\n\"nom 4.2.3\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n\"serde_derive\",\n\"serde_json\",\n]\n@@ -1400,9 +1460,9 @@ dependencies = [\n[[package]]\nname = \"libc\"\n-version = \"0.2.67\"\n+version = \"0.2.68\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018\"\n+checksum = \"dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0\"\n[[package]]\nname = \"libflate\"\n@@ -1515,11 +1575,11 @@ checksum = \"3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400\"\n[[package]]\nname = \"memoffset\"\n-version = \"0.5.3\"\n+version = \"0.5.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9\"\n+checksum = \"b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8\"\ndependencies = [\n- \"rustc_version\",\n+ \"autocfg 1.0.0\",\n]\n[[package]]\n@@ -1698,7 +1758,7 @@ dependencies = [\n\"autocfg 1.0.0\",\n\"num-integer\",\n\"num-traits 0.2.11\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n]\n[[package]]\n@@ -1719,7 +1779,7 @@ checksum = \"0c8b15b261814f992e33760b1fca9fe8b693d8a65299f20c9901688636cfb746\"\ndependencies = [\n\"proc-macro2 1.0.9\",\n\"quote 1.0.3\",\n- \"syn 1.0.16\",\n+ \"syn 1.0.17\",\n]\n[[package]]\n@@ -1745,9 +1805,9 @@ dependencies = [\n[[package]]\nname = \"num-rational\"\n-version = \"0.2.3\"\n+version = \"0.2.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"da4dc79f9e6c81bef96148c8f6b8e72ad4541caa4a24373e900a36da07de03a3\"\n+checksum = \"5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef\"\ndependencies = [\n\"autocfg 1.0.0\",\n\"num-bigint\",\n@@ -1784,7 +1844,7 @@ dependencies = [\n\"num\",\n\"num-derive\",\n\"num-traits 0.2.11\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n\"serde_derive\",\n]\n@@ -1968,15 +2028,15 @@ dependencies = [\n[[package]]\nname = \"pest_generator\"\n-version = \"2.1.2\"\n+version = \"2.1.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"27e5277315f6b4f27e0e6744feb5d5ba1891e7164871033d3c8344c6783b349a\"\n+checksum = \"99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55\"\ndependencies = [\n\"pest\",\n\"pest_meta\",\n\"proc-macro2 1.0.9\",\n\"quote 1.0.3\",\n- \"syn 1.0.16\",\n+ \"syn 1.0.17\",\n]\n[[package]]\n@@ -2000,13 +2060,13 @@ dependencies = [\n\"either\",\n\"failure\",\n\"fnv\",\n- \"itertools\",\n+ \"itertools 0.8.2\",\n\"lazy_static\",\n\"nom 5.1.1\",\n\"quick-xml\",\n\"regex\",\n\"regex-cache\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n\"serde_derive\",\n]\n@@ -2046,7 +2106,7 @@ dependencies = [\n\"proc-macro-error-attr\",\n\"proc-macro2 1.0.9\",\n\"quote 1.0.3\",\n- \"syn 1.0.16\",\n+ \"syn 1.0.17\",\n\"version_check 0.9.1\",\n]\n@@ -2058,27 +2118,22 @@ checksum = \"e4002d9f55991d5e019fb940a90e1a95eb80c24e77cb2462dd4dc869604d543a\"\ndependencies = [\n\"proc-macro2 1.0.9\",\n\"quote 1.0.3\",\n- \"syn 1.0.16\",\n+ \"syn 1.0.17\",\n\"syn-mid\",\n\"version_check 0.9.1\",\n]\n[[package]]\nname = \"proc-macro-hack\"\n-version = \"0.5.11\"\n+version = \"0.5.14\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5\"\n-dependencies = [\n- \"proc-macro2 1.0.9\",\n- \"quote 1.0.3\",\n- \"syn 1.0.16\",\n-]\n+checksum = \"fcfdefadc3d57ca21cf17990a28ef4c0f7c61383a28cb7604cf4a18e6ede1420\"\n[[package]]\nname = \"proc-macro-nested\"\n-version = \"0.1.3\"\n+version = \"0.1.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e\"\n+checksum = \"8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694\"\n[[package]]\nname = \"proc-macro2\"\n@@ -2205,7 +2260,7 @@ checksum = \"6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03\"\ndependencies = [\n\"getrandom\",\n\"libc\",\n- \"rand_chacha 0.2.1\",\n+ \"rand_chacha 0.2.2\",\n\"rand_core 0.5.1\",\n\"rand_hc 0.2.0\",\n]\n@@ -2222,11 +2277,11 @@ dependencies = [\n[[package]]\nname = \"rand_chacha\"\n-version = \"0.2.1\"\n+version = \"0.2.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853\"\n+checksum = \"f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402\"\ndependencies = [\n- \"c2-chacha\",\n+ \"ppv-lite86\",\n\"rand_core 0.5.1\",\n]\n@@ -2342,9 +2397,9 @@ checksum = \"2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84\"\n[[package]]\nname = \"regex\"\n-version = \"1.3.4\"\n+version = \"1.3.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"322cf97724bea3ee221b78fe25ac9c46114ebb51747ad5babd51a2fc6a8235a8\"\n+checksum = \"8900ebc1363efa7ea1c399ccc32daed870b4002651e0bed86e72d501ebbe0048\"\ndependencies = [\n\"aho-corasick\",\n\"memchr\",\n@@ -2366,9 +2421,9 @@ dependencies = [\n[[package]]\nname = \"regex-syntax\"\n-version = \"0.6.16\"\n+version = \"0.6.17\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"1132f845907680735a84409c3bebc64d1364a5683ffbce899550cd09d5eaefc1\"\n+checksum = \"7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae\"\n[[package]]\nname = \"remove_dir_all\"\n@@ -2399,6 +2454,7 @@ dependencies = [\n\"actix_derive 0.5.0\",\n\"althea_kernel_interface\",\n\"althea_types\",\n+ \"antenna-forwarding-client\",\n\"arrayvec 0.5.1\",\n\"auto-bridge\",\n\"babel_monitor\",\n@@ -2434,7 +2490,7 @@ dependencies = [\n\"r2d2\",\n\"rand 0.7.3\",\n\"regex\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n\"serde_derive\",\n\"serde_json\",\n\"settings\",\n@@ -2495,9 +2551,9 @@ dependencies = [\n[[package]]\nname = \"ryu\"\n-version = \"1.0.2\"\n+version = \"1.0.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8\"\n+checksum = \"535622e6be132bccd223f4bb2b8ac8d53cda3c7a6394944d3b2b33fb974f9d76\"\n[[package]]\nname = \"safemem\"\n@@ -2516,9 +2572,9 @@ dependencies = [\n[[package]]\nname = \"schannel\"\n-version = \"0.1.17\"\n+version = \"0.1.18\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"507a9e6e8ffe0a4e0ebb9a10293e62fdf7657c06f1b8bb07a8fcf697d2abf295\"\n+checksum = \"039c25b130bd8c1321ee2d7de7fde2659fa9c2744e4bb29711cfc852ea53cd19\"\ndependencies = [\n\"lazy_static\",\n\"winapi 0.3.8\",\n@@ -2526,9 +2582,9 @@ dependencies = [\n[[package]]\nname = \"scheduled-thread-pool\"\n-version = \"0.2.3\"\n+version = \"0.2.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f5de7bc31f28f8e6c28df5e1bf3d10610f5fdc14cc95f272853512c70a2bd779\"\n+checksum = \"0988d7fdf88d5e5fcf5923a0f1e8ab345f3e98ab4bc6bc45a2d5ff7f7458fbf6\"\ndependencies = [\n\"parking_lot 0.10.0\",\n]\n@@ -2600,9 +2656,9 @@ checksum = \"9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8\"\n[[package]]\nname = \"serde\"\n-version = \"1.0.104\"\n+version = \"1.0.105\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449\"\n+checksum = \"e707fbbf255b8fc8c3b99abb91e7257a622caeb20a9818cbadbeeede4e0932ff\"\ndependencies = [\n\"serde_derive\",\n]\n@@ -2629,7 +2685,7 @@ dependencies = [\n\"byteorder\",\n\"error\",\n\"num\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n]\n[[package]]\n@@ -2638,18 +2694,18 @@ version = \"0.10.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"defbb8a83d7f34cc8380751eeb892b825944222888aff18996ea7901f24aec88\"\ndependencies = [\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n]\n[[package]]\nname = \"serde_derive\"\n-version = \"1.0.104\"\n+version = \"1.0.105\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64\"\n+checksum = \"ac5d00fc561ba2724df6758a17de23df5914f20e41cb00f94d5b7ae42fffaff8\"\ndependencies = [\n\"proc-macro2 1.0.9\",\n\"quote 1.0.3\",\n- \"syn 1.0.16\",\n+ \"syn 1.0.17\",\n]\n[[package]]\n@@ -2660,7 +2716,7 @@ checksum = \"9371ade75d4c2d6cb154141b9752cf3781ec9c05e0e5cf35060e1e70ee7b9c25\"\ndependencies = [\n\"itoa\",\n\"ryu\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n]\n[[package]]\n@@ -2680,7 +2736,7 @@ checksum = \"642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a\"\ndependencies = [\n\"dtoa\",\n\"itoa\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n\"url\",\n]\n@@ -2698,7 +2754,7 @@ dependencies = [\n\"log\",\n\"num256\",\n\"owning_ref\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n\"serde_derive\",\n\"serde_json\",\n\"toml\",\n@@ -2786,7 +2842,7 @@ checksum = \"585232e78a4fc18133eef9946d3080befdf68b906c51b621531c37e91787fa2b\"\ndependencies = [\n\"libc\",\n\"libsodium-sys\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n]\n[[package]]\n@@ -2829,9 +2885,9 @@ dependencies = [\n[[package]]\nname = \"syn\"\n-version = \"1.0.16\"\n+version = \"1.0.17\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859\"\n+checksum = \"0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03\"\ndependencies = [\n\"proc-macro2 1.0.9\",\n\"quote 1.0.3\",\n@@ -2846,7 +2902,7 @@ checksum = \"7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a\"\ndependencies = [\n\"proc-macro2 1.0.9\",\n\"quote 1.0.3\",\n- \"syn 1.0.16\",\n+ \"syn 1.0.17\",\n]\n[[package]]\n@@ -2857,7 +2913,7 @@ checksum = \"67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545\"\ndependencies = [\n\"proc-macro2 1.0.9\",\n\"quote 1.0.3\",\n- \"syn 1.0.16\",\n+ \"syn 1.0.17\",\n\"unicode-xid 0.2.0\",\n]\n@@ -3138,7 +3194,7 @@ version = \"0.5.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a\"\ndependencies = [\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n]\n[[package]]\n@@ -3237,9 +3293,9 @@ checksum = \"6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9\"\n[[package]]\nname = \"ucd-trie\"\n-version = \"0.1.2\"\n+version = \"0.1.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8f00ed7be0c1ff1e24f46c3d2af4859f7e863672ba3a6e92e7cff702bf9f06c2\"\n+checksum = \"56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c\"\n[[package]]\nname = \"unicase\"\n@@ -3319,7 +3375,7 @@ dependencies = [\n\"nom 4.2.3\",\n\"proc-macro2 1.0.9\",\n\"quote 1.0.3\",\n- \"syn 1.0.16\",\n+ \"syn 1.0.17\",\n]\n[[package]]\n@@ -3382,7 +3438,7 @@ dependencies = [\n\"futures-timer\",\n\"log\",\n\"num256\",\n- \"serde 1.0.104\",\n+ \"serde 1.0.105\",\n\"serde_derive\",\n\"serde_json\",\n\"tokio\",\n"
},
{
"change_type": "MODIFY",
"old_path": "Cargo.toml",
"new_path": "Cargo.toml",
"diff": "@@ -21,3 +21,8 @@ codegen-units = 1\nincremental = false\n[patch.crates-io]\n+\n+[patch.'ssh://git@gitlab.com/althea-net/althea_rs.git']\n+althea_kernel_interface = { path = \"althea_kernel_interface\" }\n+althea_types = { path = \"althea_types\"}\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "althea_kernel_interface/Cargo.toml",
"new_path": "althea_kernel_interface/Cargo.toml",
"diff": "@@ -9,7 +9,7 @@ edition = \"2018\"\n[dependencies]\noping = \"0.3\"\nfailure = \"0.1\"\n-itertools = \"0.8\"\n+itertools = \"0.9\"\nlazy_static = \"1.4\"\nlog = \"0.4\"\nalthea_types = { path = \"../althea_types\" }\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/Cargo.toml",
"new_path": "rita/Cargo.toml",
"diff": "@@ -15,18 +15,20 @@ path = \"src/client.rs\"\n[dependencies]\nalthea_kernel_interface = { path = \"../althea_kernel_interface\" }\n-althea_types = { path = \"../althea_types\", features = [\"actix\"]}\n+althea_types = { path = \"../althea_types\", features = [\"actix\"], version=\"0.1\"}\nbabel_monitor = { path = \"../babel_monitor\" }\nclu = { path = \"../clu\" }\nexit_db = { path = \"../exit_db\" }\nnum256 = \"0.2\"\nsettings = { path = \"../settings\" }\n-\n+antenna-forwarding-client = {git = \"ssh://git@gitlab.com/althea-net/organizer-tools.git\", version = \"0.1\"}\nauto-bridge = {git = \"https://github.com/althea-net/auto_bridge\", tag = \"v0.1.5\"}\n+actix-web-httpauth = {git = \"https://github.com/althea-mesh/actix-web-httpauth\"}\n+clarity = \"0.1\"\nweb30 = {git = \"https://github.com/althea-mesh/web30\", branch = \"master\"}\n+\nactix = \"0.7\"\nactix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\n-actix-web-httpauth = {git = \"https://github.com/althea-mesh/actix-web-httpauth\"}\nactix_derive = \"0.5\"\nbytes = \"0.4\"\nconfig = \"0.10\"\n@@ -55,7 +57,6 @@ trust-dns-resolver = \"0.10\"\nbyteorder = { version = \"1.3\", features = [\"i128\"] }\nopenssl-probe = \"0.1\"\nnum-traits=\"0.2\"\n-clarity = \"0.1\"\narrayvec = {version= \"0.5\", features = [\"serde\"]}\nlettre = \"0.9\"\nlettre_email = \"0.9\"\n"
},
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_client/rita_loop/mod.rs",
"new_path": "rita/src/rita_client/rita_loop/mod.rs",
"diff": "use crate::rita_client::exit_manager::ExitManager;\nuse crate::rita_client::heartbeat::send_udp_heartbeat;\n+use crate::rita_client::heartbeat::HEARTBEAT_SERVER_KEY;\nuse crate::rita_client::light_client_manager::light_client_hello_response;\nuse crate::rita_client::light_client_manager::LightClientManager;\nuse crate::rita_client::light_client_manager::Watch;\n@@ -23,14 +24,24 @@ use actix::{\nuse actix_web::http::Method;\nuse actix_web::{server, App};\nuse althea_types::ExitState;\n+use antenna_forwarding_client::start_antenna_forwarding_proxy;\nuse failure::Error;\nuse futures01::future::Future;\nuse settings::client::RitaClientSettings;\nuse settings::RitaCommonSettings;\nuse std::time::{Duration, Instant};\n-#[derive(Default)]\n-pub struct RitaLoop;\n+pub struct RitaLoop {\n+ antenna_forwarder_started: bool,\n+}\n+\n+impl Default for RitaLoop {\n+ fn default() -> Self {\n+ RitaLoop {\n+ antenna_forwarder_started: false,\n+ }\n+ }\n+}\n// the speed in seconds for the client loop\npub const CLIENT_LOOP_SPEED: u64 = 5;\n@@ -104,6 +115,21 @@ impl Handler<Tick> for RitaLoop {\nif SETTING.get_log().enabled {\nsend_udp_heartbeat();\n+\n+ if !self.antenna_forwarder_started {\n+ let network = SETTING.get_network();\n+ let our_id = SETTING.get_identity().unwrap();\n+ let logging = SETTING.get_log();\n+ start_antenna_forwarding_proxy(\n+ logging.forwarding_checkin_url.clone(),\n+ our_id,\n+ *HEARTBEAT_SERVER_KEY,\n+ network.wg_public_key.unwrap(),\n+ network.wg_private_key.unwrap(),\n+ network.peer_interfaces.clone(),\n+ );\n+ self.antenna_forwarder_started = true;\n+ }\n}\ninfo!(\n"
},
{
"change_type": "MODIFY",
"old_path": "settings/src/logging.rs",
"new_path": "settings/src/logging.rs",
"diff": "@@ -14,6 +14,10 @@ fn default_heartbeat_url() -> String {\n\"stats.altheamesh.com:33333\".to_string()\n}\n+fn default_forwarding_checkin_url() -> String {\n+ \"stats.altheamesh.com:33334\".to_string()\n+}\n+\n/// Remote logging settings. Used to control remote logs being\n/// forwarded to the dest_url address, https is used to encrypt\n/// the logs as they travel over the internet so don't use non-https\n@@ -29,6 +33,9 @@ pub struct LoggingSettings {\n/// Address and port of UDP heartbeat monitoring server\n#[serde(default = \"default_heartbeat_url\")]\npub heartbeat_url: String,\n+ /// Address and port of the tcp checkin socket for the antenna forwarding server\n+ #[serde(default = \"default_forwarding_checkin_url\")]\n+ pub forwarding_checkin_url: String,\n}\nimpl Default for LoggingSettings {\n@@ -38,6 +45,7 @@ impl Default for LoggingSettings {\nlevel: default_logging_level(),\ndest_url: default_logging_dest_url(),\nheartbeat_url: default_heartbeat_url(),\n+ forwarding_checkin_url: default_forwarding_checkin_url(),\n}\n}\n}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Link in Antenna forwarding client
There are some dependency hardships here. To prevent circular dependency
hell we have to patch out the gitlab version of althea-types to our own
local version.
Otherwise pretty straightforward, bring in the forwarding client and start
it up |
20,244 | 23.03.2020 09:59:08 | 14,400 | 428b19ef0eee4309888603e4930ad9f19201739a | Test script should replicate travis
Now that we're not running Travis all the time we need this | [
{
"change_type": "MODIFY",
"old_path": "scripts/test.sh",
"new_path": "scripts/test.sh",
"diff": "#!/bin/bash\n-set -eux\n+#set -eux\nNODES=${NODES:='None'}\nRUST_TEST_THREADS=1 cargo test --all\n+cross test --target x86_64-unknown-linux-musl --verbose -p rita --bin rita -- --test-threads=1\n+cross test --target mips-unknown-linux-gnu --verbose -p rita --bin rita -- --test-threads=1\n+cross test --target mipsel-unknown-linux-gnu --verbose -p rita --bin rita -- --test-threads=1\n+cross test --target mips64-unknown-linux-gnuabi64 --verbose -p rita --bin rita -- --test-threads=1\n+cross test --target mips64el-unknown-linux-gnuabi64 --verbose -p rita --bin rita -- --test-threads=1\n+cross test --target aarch64-unknown-linux-gnu --verbose -p rita --bin rita -- --test-threads=1\n+cross test --target armv7-unknown-linux-gnueabi --verbose -p rita --bin rita -- --test-threads=1\n+cross test --target armv7-unknown-linux-gnueabihf --verbose -p rita --bin rita -- --test-threads=1\nif ! modprobe wireguard ; then\necho \"The container can't load modules into the host kernel\"\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Test script should replicate travis
Now that we're not running Travis all the time we need this |
20,244 | 23.03.2020 13:14:07 | 14,400 | 3201c911236f6c6e1886cb22e97347503b735042 | Improve tests for antenna protocol | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -219,6 +219,7 @@ dependencies = [\n\"althea_types\",\n\"clarity\",\n\"failure\",\n+ \"rand 0.7.3\",\n\"serde 1.0.105\",\n\"serde_derive\",\n\"serde_json\",\n"
},
{
"change_type": "MODIFY",
"old_path": "antenna_forwarding_protocol/Cargo.toml",
"new_path": "antenna_forwarding_protocol/Cargo.toml",
"diff": "@@ -12,3 +12,6 @@ serde = \"1.0\"\nsodiumoxide = \"0.2\"\nfailure = \"0.1\"\nclarity = \"0.1\"\n+\n+[dev-dependencies]\n+rand = \"0.7\"\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "antenna_forwarding_protocol/src/lib.rs",
"new_path": "antenna_forwarding_protocol/src/lib.rs",
"diff": "@@ -145,15 +145,12 @@ impl ForwardingProtocolMessage for ConnectionMessage {\nconnection_id.clone_from_slice(&payload[20..28]);\nlet connection_id = u64::from_be_bytes(connection_id);\n+ let payload_bytes = packet_len as usize - 8;\n+ let end = 28 + payload_bytes;\nlet mut message_value = Vec::new();\n- message_value.clone_from_slice(&payload[28..28 + packet_len as usize]);\n+ message_value.extend_from_slice(&payload[28..28 + payload_bytes]);\n- let bytes_read = 28 + packet_len as usize;\n-\n- Ok((\n- bytes_read,\n- ConnectionMessage::new(connection_id, message_value),\n- ))\n+ Ok((end, ConnectionMessage::new(connection_id, message_value)))\n}\nfn get_type(&self) -> u16 {\n@@ -492,6 +489,8 @@ impl ForwardingProtocolMessage for ForwardingCloseMessage {\nmod tests {\n// Note this useful idiom: importing names from outer (for mod tests) scope.\nuse super::*;\n+ use rand;\n+ use rand::Rng;\nfn get_test_id() -> Identity {\nIdentity {\n@@ -510,6 +509,25 @@ mod tests {\nForwardMessage::new(\"192.168.10.1\".parse().unwrap(), 6823, 443)\n}\n+ fn get_random_test_vector() -> Vec<u8> {\n+ let mut rng = rand::thread_rng();\n+ // should be small enough to be fast but long enough\n+ // to cause issues\n+ let len: u16 = rng.gen();\n+ let mut out = Vec::new();\n+ for _ in 0..len {\n+ let byte: u8 = rng.gen();\n+ out.push(byte);\n+ }\n+ out\n+ }\n+\n+ fn get_random_stream_id() -> u64 {\n+ let mut rng = rand::thread_rng();\n+ let out: u64 = rng.gen();\n+ out\n+ }\n+\n#[test]\nfn test_message_types() {\nassert_eq!(\n@@ -523,11 +541,11 @@ mod tests {\n);\nassert_eq!(\nCONNECTION_CLOSE_MESSAGE_TYPE,\n- ConnectionClose::new(50).get_type()\n+ ConnectionClose::new(get_random_stream_id()).get_type()\n);\nassert_eq!(\nCONNECTION_MESSAGE_TYPE,\n- ConnectionMessage::new(50, vec![0]).get_type()\n+ ConnectionMessage::new(get_random_stream_id(), get_random_test_vector()).get_type()\n);\nassert_eq!(\nFORWARDING_CLOSE_MESSAGE_TYPE,\n@@ -541,6 +559,7 @@ mod tests {\nlet out = message.get_message();\nlet (size, parsed) = IdentificationMessage::read_message(&out).expect(\"Failed to parse!\");\nassert_eq!(parsed, message);\n+ assert_eq!(size, out.len());\n}\n#[test]\n@@ -549,6 +568,7 @@ mod tests {\nlet out = message.get_message();\nlet (size, parsed) = ForwardMessage::read_message(&out).expect(\"Failed to parse!\");\nassert_eq!(parsed, message);\n+ assert_eq!(size, out.len());\n}\n#[test]\n@@ -557,22 +577,25 @@ mod tests {\nlet out = message.get_message();\nlet (size, parsed) = ErrorMessage::read_message(&out).expect(\"Failed to parse!\");\nassert_eq!(parsed, message);\n+ assert_eq!(size, out.len());\n}\n#[test]\nfn test_connecton_close_message() {\n- let message = ConnectionClose::new(50);\n+ let message = ConnectionClose::new(get_random_stream_id());\nlet out = message.get_message();\nlet (size, parsed) = ConnectionClose::read_message(&out).expect(\"Failed to parse!\");\nassert_eq!(parsed, message);\n+ assert_eq!(size, out.len());\n}\n#[test]\nfn test_connecton_message() {\n- let message = ConnectionMessage::new(50, vec![0]);\n+ let message = ConnectionMessage::new(get_random_stream_id(), get_random_test_vector());\nlet out = message.get_message();\nlet (size, parsed) = ConnectionMessage::read_message(&out).expect(\"Failed to parse!\");\nassert_eq!(parsed, message);\n+ assert_eq!(size, out.len());\n}\n#[test]\n@@ -581,5 +604,56 @@ mod tests {\nlet out = message.get_message();\nlet (size, parsed) = ForwardingCloseMessage::read_message(&out).expect(\"Failed to parse!\");\nassert_eq!(parsed, message);\n+ assert_eq!(size, out.len());\n+ }\n+\n+ #[test]\n+ fn test_multiple_connection_messages() {\n+ let mut multi_message = Vec::new();\n+ let message1 = ConnectionClose::new(get_random_stream_id());\n+ multi_message.extend_from_slice(&message1.get_message());\n+ let message2 = ConnectionMessage::new(get_random_stream_id(), get_random_test_vector());\n+ multi_message.extend_from_slice(&message2.get_message());\n+ let message3 = IdentificationMessage::new(get_test_id());\n+ multi_message.extend_from_slice(&message3.get_message());\n+ let (size1, parsed) =\n+ ConnectionClose::read_message(&multi_message[0..]).expect(\"Failed to parse!\");\n+ assert_eq!(parsed, message1);\n+ let (size2, parsed) =\n+ ConnectionMessage::read_message(&multi_message[size1..]).expect(\"Failed to parse!\");\n+ assert_eq!(parsed, message2);\n+ let (size3, parsed) = IdentificationMessage::read_message(&multi_message[size1 + size2..])\n+ .expect(\"Failed to parse!\");\n+ assert_eq!(parsed, message3);\n+ assert_eq!(size1 + size2 + size3, multi_message.len());\n+ }\n+\n+ #[test]\n+ fn test_multiple_message_types() {\n+ let mut multi_message = Vec::new();\n+ let message1 = ConnectionMessage::new(get_random_stream_id(), get_random_test_vector());\n+ multi_message.extend_from_slice(&message1.get_message());\n+ let message2 = ConnectionMessage::new(get_random_stream_id(), get_random_test_vector());\n+ multi_message.extend_from_slice(&message2.get_message());\n+ let message3 = ConnectionMessage::new(get_random_stream_id(), get_random_test_vector());\n+ multi_message.extend_from_slice(&message3.get_message());\n+ let (size1, parsed) =\n+ ConnectionMessage::read_message(&multi_message[0..]).expect(\"Failed to parse!\");\n+ assert_eq!(parsed, message1);\n+ let (size2, parsed) =\n+ ConnectionMessage::read_message(&multi_message[size1..]).expect(\"Failed to parse!\");\n+ assert_eq!(parsed, message2);\n+ let (size3, parsed) = ConnectionMessage::read_message(&multi_message[size1 + size2..])\n+ .expect(\"Failed to parse!\");\n+ assert_eq!(parsed, message3);\n+ assert_eq!(size1 + size2 + size3, multi_message.len());\n+ }\n+\n+ #[test]\n+ fn test_junk() {\n+ let mut junk = Vec::new();\n+ junk.extend_from_slice(&get_random_test_vector());\n+ assert!(ConnectionMessage::read_message(&junk).is_err());\n+ assert!(ConnectionMessage::read_message(&junk).is_err());\n}\n}\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Improve tests for antenna protocol |
20,244 | 23.03.2020 15:35:34 | 14,400 | 390ad8a82b90137af3a5c23dcd7d819a978f487f | Don't log double sent payments either | [
{
"change_type": "MODIFY",
"old_path": "rita/src/rita_common/payment_validator/mod.rs",
"new_path": "rita/src/rita_common/payment_validator/mod.rs",
"diff": "@@ -328,16 +328,16 @@ fn handle_tx_messaging(\n}\n// we suceessfully paid someone\n(false, true, true) => {\n- info!(\n- \"payment {:#066x} from {} for {} wei successfully sent!\",\n- txid, from_address, amount\n- );\nlet res = PaymentValidator::from_registry()\n.send(Remove {\ntx: ts,\nsuccess: true,\n})\n- .and_then(|res| {\n+ .and_then(move |res| {\n+ info!(\n+ \"payment {:#066x} from {} for {} wei successfully sent!\",\n+ txid, from_address, amount\n+ );\nif res.is_ok() {\nDebtKeeper::from_registry().do_send(PaymentSucceeded {\nto: pmt.to,\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Don't log double sent payments either |
20,244 | 25.03.2020 08:45:51 | 14,400 | a5cc5106ead8a729eec2a55231a8ed44c1b14bb6 | Add KeepAlive message
We need to send these once every 5 seconds or so and use that to
quickly recycle/reopen connections if needed | [
{
"change_type": "MODIFY",
"old_path": "antenna_forwarding_protocol/src/lib.rs",
"new_path": "antenna_forwarding_protocol/src/lib.rs",
"diff": "@@ -18,7 +18,8 @@ use std::net::IpAddr;\n/// an excessively long protocol magic value that preceeds all\n/// control traffic. A u32 would probably be sufficient to ensure\n/// that we never try to interpret an actual packet as a control packet\n-/// but I don't see a reason to be stingy.\n+/// but I don't see a reason to be stingy. This is totally random, but you\n+/// can never change it once there's a device deployed with it\nconst MAGIC: u128 = 266_244_417_876_907_680_150_892_848_205_622_258_774;\npub const IDENTIFICATION_MESSAGE_TYPE: u16 = 0;\n@@ -27,6 +28,7 @@ pub const ERROR_MESSAGE_TYPE: u16 = 2;\npub const CONNECTION_CLOSE_MESSAGE_TYPE: u16 = 3;\npub const CONNECTION_MESSAGE_TYPE: u16 = 4;\npub const FORWARDING_CLOSE_MESSAGE_TYPE: u16 = 5;\n+pub const KEEPALIVE_MESSAGE_TYPE: u16 = 6;\npub trait ForwardingProtocolMessage {\nfn get_message(&self) -> Vec<u8>;\n@@ -89,6 +91,10 @@ pub struct ConnectionMessage {\n#[derive(Clone, Serialize, Deserialize, Debug, Default, Eq, PartialEq)]\npub struct ForwardingCloseMessage;\n+/// Used to determine the liveness of each end\n+#[derive(Clone, Serialize, Deserialize, Debug, Default, Eq, PartialEq)]\n+pub struct KeepAliveMessage;\n+\nimpl ConnectionMessage {\npub fn new(stream_id: u64, payload: Vec<u8>) -> ConnectionMessage {\nConnectionMessage { stream_id, payload }\n@@ -485,6 +491,70 @@ impl ForwardingProtocolMessage for ForwardingCloseMessage {\n}\n}\n+impl KeepAliveMessage {\n+ pub fn new() -> KeepAliveMessage {\n+ KeepAliveMessage\n+ }\n+}\n+\n+impl ForwardingProtocolMessage for KeepAliveMessage {\n+ /// Gets an error message that is sent when the antenna forwarding\n+ /// can not start successfully\n+ fn get_message(&self) -> Vec<u8> {\n+ // serialize the payload first so that we know it's length\n+ let payload = self;\n+ let payload = serde_json::to_vec(&payload).unwrap();\n+\n+ let mut message = Vec::new();\n+ message.extend_from_slice(&MAGIC.to_be_bytes());\n+ // message type number index 17-18\n+ message.extend_from_slice(&self.get_type().to_be_bytes());\n+ // length, index 18-19\n+ let len_bytes = payload.len() as u16;\n+ message.extend_from_slice(&len_bytes.to_be_bytes());\n+ // copy in the serialized struct\n+ message.extend_from_slice(&payload);\n+ message\n+ }\n+\n+ /// takes a byte slice that may potentially contain a ForwardMessage and\n+ /// deserializes it\n+ fn read_message(payload: &[u8]) -> Result<(usize, KeepAliveMessage), Error> {\n+ if payload.len() < 20 {\n+ return Err(format_err!(\"Packet too short!\"));\n+ }\n+\n+ let mut packet_magic: [u8; 16] = [0; 16];\n+ packet_magic.clone_from_slice(&payload[0..16]);\n+ let packet_magic = u128::from_be_bytes(packet_magic);\n+\n+ let mut packet_type: [u8; 2] = [0; 2];\n+ packet_type.clone_from_slice(&payload[16..18]);\n+ let packet_type = u16::from_be_bytes(packet_type);\n+\n+ let mut packet_len: [u8; 2] = [0; 2];\n+ packet_len.clone_from_slice(&payload[18..20]);\n+ let packet_len = u16::from_be_bytes(packet_len);\n+\n+ if packet_magic != MAGIC {\n+ return Err(format_err!(\"Packet magic incorrect!\"));\n+ } else if packet_type != KEEPALIVE_MESSAGE_TYPE {\n+ return Err(format_err!(\"Wrong packet type!\"));\n+ }\n+\n+ let bytes_read = 20 + packet_len as usize;\n+\n+ match serde_json::from_slice(&payload[20..(20 + packet_len as usize)]) {\n+ Ok(message) => Ok((bytes_read, message)),\n+ Err(serde_error) => Err(serde_error.into()),\n+ }\n+ }\n+\n+ fn get_type(&self) -> u16 {\n+ KEEPALIVE_MESSAGE_TYPE\n+ }\n+}\n+\n#[cfg(test)]\nmod tests {\n// Note this useful idiom: importing names from outer (for mod tests) scope.\n@@ -551,6 +621,7 @@ mod tests {\nFORWARDING_CLOSE_MESSAGE_TYPE,\nForwardingCloseMessage::new().get_type()\n);\n+ assert_eq!(KEEPALIVE_MESSAGE_TYPE, KeepAliveMessage::new().get_type());\n}\n#[test]\n@@ -607,6 +678,15 @@ mod tests {\nassert_eq!(size, out.len());\n}\n+ #[test]\n+ fn test_keepalive_message() {\n+ let message = KeepAliveMessage::new();\n+ let out = message.get_message();\n+ let (size, parsed) = KeepAliveMessage::read_message(&out).expect(\"Failed to parse!\");\n+ assert_eq!(parsed, message);\n+ assert_eq!(size, out.len());\n+ }\n+\n#[test]\nfn test_multiple_connection_messages() {\nlet mut multi_message = Vec::new();\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Add KeepAlive message
We need to send these once every 5 seconds or so and use that to
quickly recycle/reopen connections if needed |
20,244 | 26.03.2020 14:52:11 | 14,400 | cc41daf96c30f5007ca155cba27df23c276116d7 | Working forwarding!
This fixes a lot of the reading logic, improves spinlock efficiency, adds effective
ipv4 routing discovery and modificaiton and generally gets us to a very basic working
system.
Needs some tweaks to properly forward SSL connections and also some code cleanup | [
{
"change_type": "MODIFY",
"old_path": "Cargo.lock",
"new_path": "Cargo.lock",
"diff": "@@ -205,8 +205,10 @@ dependencies = [\n\"env_logger\",\n\"failure\",\n\"get_if_addrs\",\n+ \"lazy_static\",\n\"log\",\n\"oping\",\n+ \"rand 0.7.3\",\n\"serde 1.0.105\",\n\"serde_json\",\n\"sodiumoxide\",\n"
},
{
"change_type": "MODIFY",
"old_path": "antenna_forwarding_client/Cargo.toml",
"new_path": "antenna_forwarding_client/Cargo.toml",
"diff": "@@ -16,3 +16,5 @@ serde_json = \"1.0\"\nserde = \"1.0\"\nfailure = \"0.1\"\nget_if_addrs = \"0.5\"\n+lazy_static = \"1.4\"\n+rand = \"0.7\"\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "antenna_forwarding_client/src/lib.rs",
"new_path": "antenna_forwarding_client/src/lib.rs",
"diff": "extern crate log;\n#[macro_use]\nextern crate failure;\n+#[macro_use]\n+extern crate lazy_static;\n+use althea_kernel_interface::KernelInterface;\n+use althea_kernel_interface::LinuxCommandRunner;\nuse althea_types::Identity;\nuse althea_types::WgKey;\n+use antenna_forwarding_protocol::write_all_spinlock;\nuse antenna_forwarding_protocol::ConnectionClose;\nuse antenna_forwarding_protocol::ConnectionMessage;\nuse antenna_forwarding_protocol::ErrorMessage;\n@@ -16,20 +21,31 @@ use antenna_forwarding_protocol::ForwardMessage;\nuse antenna_forwarding_protocol::ForwardingCloseMessage;\nuse antenna_forwarding_protocol::ForwardingProtocolMessage;\nuse antenna_forwarding_protocol::IdentificationMessage;\n+use antenna_forwarding_protocol::BUFFER_SIZE;\n+use antenna_forwarding_protocol::SPINLOCK_TIME;\nuse failure::Error;\nuse oping::Ping;\n+use rand::thread_rng;\n+use rand::Rng;\nuse std::collections::HashMap;\nuse std::collections::HashSet;\n+use std::io::ErrorKind::WouldBlock;\nuse std::io::Read;\nuse std::io::Write;\nuse std::net::IpAddr;\n+use std::net::Ipv4Addr;\nuse std::net::Shutdown;\nuse std::net::SocketAddr;\nuse std::net::TcpStream;\n+use std::process::ExitStatus;\nuse std::thread;\nuse std::time::Duration;\nuse std::time::Instant;\n+lazy_static! {\n+ pub static ref KI: Box<dyn KernelInterface> = Box::new(LinuxCommandRunner {});\n+}\n+\n/// The network operation timeout for this library\nconst NET_TIMEOUT: Duration = Duration::from_secs(5);\n/// The timeout time for pinging a local antenna, 25ms is very\n@@ -63,20 +79,51 @@ pub fn start_antenna_forwarding_proxy(\ntrace!(\"connected to {}\", checkin_address);\nstream\n.set_read_timeout(Some(NET_TIMEOUT))\n- .expect(\"Failed to get nonblocking socket!\");\n+ .expect(\"Failed to set read timeout on socket!\");\n// send our identifier\n- let _res = stream.write_all(&IdentificationMessage::new(our_id).get_message());\n- let mut buf = Vec::new();\n- let res = stream.read_to_end(&mut buf);\n+ let _res = write_all_spinlock(\n+ &mut stream,\n+ &IdentificationMessage::new(our_id).get_message(),\n+ );\n+ let mut buf: [u8; BUFFER_SIZE] = [0; BUFFER_SIZE];\n+ let res = stream.read(&mut buf);\nmatch res {\nOk(bytes) => match ForwardMessage::read_message(&buf) {\nOk(msg) => {\n+ // we start nonblocking operation here, so that we\n+ // can easily wait for the forward response after\n+ // sending our ID message, now we need non-blocking\n+ // to process messages\n+ stream\n+ .set_nonblocking(true)\n+ .expect(\"Failed to get nonblocking socket!\");\n+\ntrace!(\"Got fwd message {}\", checkin_address);\n- let (start, forward_message) = msg;\n- let s =\n- setup_networking(forward_message, &mut stream, &interfaces_to_search);\n- if let Ok(s) = s {\n- forward_connections(s, buf, bytes, stream, start);\n+ let (bytes_read, forward_message) = msg;\n+\n+ // todo it would be technically correct to have packets\n+ // after the forward packet, but we don't package things that\n+ // way on the server, we should handle the possibility\n+ if bytes > bytes_read {\n+ error!(\"Extra messages after forward packet dropped!\");\n+ }\n+\n+ let s = setup_networking(forward_message, &interfaces_to_search);\n+ match s {\n+ Ok(s) => forward_connections(s, stream),\n+ Err(e) => {\n+ // the error message never reaches the server because the server\n+ // will fail to read it, even if it enters the buffer once the\n+ // connection is terminated.\n+ stream.set_nodelay(true).expect(\"Failed to disble Nagle\");\n+ let a = write_all_spinlock(\n+ &mut stream,\n+ &ErrorMessage::new(format!(\"{:?}\", e)).get_message(),\n+ );\n+ let b = stream.shutdown(Shutdown::Both);\n+ warn!(\"Error forwarding write {:?} shutdown {:?}\", a, b);\n+ drop(stream);\n+ }\n}\n}\nErr(e) => warn!(\"Failed to read forward message with {:?}\", e),\n@@ -95,39 +142,90 @@ pub fn start_antenna_forwarding_proxy(\n/// Actually forwards the connection by managing the reading and writing from\n/// various tcp sockets\n-fn forward_connections(\n- antenna_sockaddr: SocketAddr,\n- buffer: Vec<u8>,\n- bytes_read: usize,\n- server_stream: TcpStream,\n- start: usize,\n-) {\n+fn forward_connections(antenna_sockaddr: SocketAddr, server_stream: TcpStream) {\n+ trace!(\"Forwarding connections!\");\nlet mut server_stream = server_stream;\n- let mut buffer = buffer;\n- let mut bytes_read = bytes_read;\n+ let mut bytes_read;\nlet mut streams: HashMap<u64, TcpStream> = HashMap::new();\n- let mut start = start;\n+ let mut start;\nlet mut last_message = Instant::now();\nloop {\n+ let mut streams_to_remove: Vec<u64> = Vec::new();\n+ // First we we have to iterate over all of these connections\n+ // and read to send messages up the server pipe. We need to do\n+ // this first becuase we may exit in the next section if there's\n+ // nothing to write\n+ for (stream_id, antenna_stream) in streams.iter_mut() {\n+ let mut buffer: [u8; BUFFER_SIZE] = [0; BUFFER_SIZE];\n+ // in theory we will figure out if the connection is closed here\n+ // and then send a closed message\n+ match antenna_stream.read(&mut buffer) {\n+ Ok(bytes) => {\n+ if bytes != 0 {\n+ trace!(\n+ \"We have {} bytes to write from a antenna input socket\",\n+ bytes\n+ );\n+ let msg = ConnectionMessage::new(*stream_id, buffer[0..bytes].to_vec());\n+ write_all_spinlock(&mut server_stream, &msg.get_message())\n+ .expect(&format!(\"Failed to write with stream {}\", *stream_id));\n+ }\n+ }\n+ Err(e) => {\n+ if e.kind() != WouldBlock {\n+ error!(\"Could not read client socket with {:?}\", e);\n+ let msg = ConnectionClose::new(*stream_id);\n+ write_all_spinlock(&mut server_stream, &msg.get_message())\n+ .expect(&format!(\"Failed to close stream {}\", *stream_id));\n+ let _ = antenna_stream.shutdown(Shutdown::Write);\n+ streams_to_remove.push(*stream_id);\n+ }\n+ }\n+ }\n+ }\n+ for i in streams_to_remove {\n+ streams.remove(&i);\n+ }\n+\n+ let mut buffer: [u8; BUFFER_SIZE] = [0; BUFFER_SIZE];\n+ match server_stream.read(&mut buffer) {\n+ Ok(bytes) => {\n+ if bytes > 0 {\n+ trace!(\"Got {} bytes from the server\", bytes);\n+ }\n+ bytes_read = bytes;\n+ start = 0;\n+ }\n+ Err(e) => {\n+ if e.kind() != WouldBlock {\n+ error!(\"Failed to read from server with {:?}\", e);\n+ }\n+ continue;\n+ }\n+ }\n+\nwhile start < bytes_read {\nlet connection = ConnectionMessage::read_message(&buffer[start..bytes_read]);\nlet close = ConnectionClose::read_message(&buffer[start..bytes_read]);\nlet halt = ForwardingCloseMessage::read_message(&buffer[start..bytes_read]);\nmatch (connection, close, halt) {\n(Ok((new_start, connection_message)), Err(_), Err(_)) => {\n+ trace!(\"Got connection message\");\nlast_message = Instant::now();\nstart = new_start;\nlet stream_id = &connection_message.stream_id;\nif let Some(antenna_stream) = streams.get_mut(stream_id) {\n+ trace!(\"Message for {}\", stream_id);\nantenna_stream\n.write_all(&connection_message.payload)\n.expect(\"Failed to talk to antenna!\");\n} else {\n+ trace!(\"Opening stream for {}\", stream_id);\n// we don't have a stream, we need to dial out to the server now\nlet mut new_stream = TcpStream::connect(antenna_sockaddr)\n.expect(\"Could not contact antenna!\");\nnew_stream\n- .set_nonblocking(false)\n+ .set_nonblocking(true)\n.expect(\"Could not get nonblocking connection\");\nnew_stream\n.write_all(&connection_message.payload)\n@@ -136,6 +234,7 @@ fn forward_connections(\n}\n}\n(Err(_), Ok((new_start, close_message)), Err(_)) => {\n+ trace!(\"Got close message\");\nlast_message = Instant::now();\nstart = new_start;\nlet stream_id = &close_message.stream_id;\n@@ -148,6 +247,7 @@ fn forward_connections(\nstreams.remove(stream_id);\n}\n(Err(_), Err(_), Ok((_new_start, _halt_message))) => {\n+ trace!(\"Got halt message\");\n// we have a close lets get out of here.\nfor (_id, stream) in streams {\nstream\n@@ -160,10 +260,6 @@ fn forward_connections(\nreturn;\n}\n(Err(_), Err(_), Err(_)) => {\n- // todo this might not be needed, this handles trailing bytes\n- // but if everything reads correctly the start should = bytes_read\n- // and break the loop\n- trace!(\"No more messages, leaving\");\nbreak;\n}\n(Ok(_), Ok(_), Ok(_)) => panic!(\"Impossible!\"),\n@@ -173,15 +269,11 @@ fn forward_connections(\n}\n}\n- if let Ok(bytes) = server_stream.read_to_end(&mut buffer) {\n- bytes_read = bytes;\n- start = 0;\n- }\n-\nif Instant::now() - last_message > FORWARD_TIMEOUT {\nerror!(\"Fowarding session timed out!\");\nbreak;\n}\n+ thread::sleep(SPINLOCK_TIME);\n}\n}\n@@ -189,17 +281,14 @@ fn forward_connections(\n/// returns a socketaddr for the antenna\nfn setup_networking(\nmsg: ForwardMessage,\n- server_stream: &mut TcpStream,\ninterfaces: &HashSet<String>,\n) -> Result<SocketAddr, Error> {\nlet antenna_ip = msg.ip;\n- let antenna_iface = match find_antenna(antenna_ip, interfaces) {\n- Ok(iface) => iface,\n+ match find_antenna(antenna_ip, interfaces) {\n+ Ok(_iface) => {}\nErr(e) => {\nerror!(\"Could not find anntenna {:?}\", e);\n- let _ = server_stream.write_all(&ErrorMessage::new(format!(\"{:?}\", e)).get_message());\n- let _ = server_stream.shutdown(Shutdown::Both);\n- bail!(\"Can't find antenna!\");\n+ return Err(e);\n}\n};\nOk(SocketAddr::new(antenna_ip, 443))\n@@ -208,15 +297,67 @@ fn setup_networking(\n/// Finds the antenna on the appropriate physical interface by iterating\n/// over the list of provided interfaces, attempting a ping\n/// and repeating until the appropriate interface is located\n-/// TODO actually setup routing to said antenna, maybe implicitly exit when\n-/// we find the antenna? becuase then routing will be setup\n+/// TODO handle overlapping edge cases for gateway ip, lan ip, br-pbs etc\nfn find_antenna(ip: IpAddr, interfaces: &HashSet<String>) -> Result<String, Error> {\n+ let our_ip = get_local_ip(ip);\n+ for iface in interfaces {\n+ trace!(\"Trying interface {}, with test ip {}\", iface, our_ip);\n+ // this acts as a wildcard deletion across all interfaces, which is frankly really\n+ // dangerous if our default route overlaps, of if you enter an exit route ip\n+ let _ = KI.run_command(\"ip\", &[\"route\", \"del\", &format!(\"{}/32\", ip)]);\nfor iface in interfaces {\n+ let _ = KI.run_command(\n+ \"ip\",\n+ &[\"addr\", \"del\", &format!(\"{}/32\", our_ip), \"dev\", iface],\n+ );\n+ }\n+ let res = KI.run_command(\n+ \"ip\",\n+ &[\"addr\", \"add\", &format!(\"{}/32\", our_ip), \"dev\", iface],\n+ );\n+ trace!(\"Added our own test ip with {:?}\", res);\n+ // you need to use src here to disambiguate the sending address\n+ // otherwise the first avaialble ipv4 address on the interface will\n+ // be used\n+ match KI.run_command(\n+ \"ip\",\n+ &[\n+ \"route\",\n+ \"add\",\n+ &format!(\"{}/32\", ip),\n+ \"dev\",\n+ iface,\n+ \"src\",\n+ &our_ip.to_string(),\n+ ],\n+ ) {\n+ Ok(r) => {\n+ // exit status 512 is the code for 'file exists' meaning we are not\n+ // checking the interface we thought we where. At this point there's\n+ // no option but to exit\n+ if let Some(code) = r.status.code() {\n+ if code == 512 {\n+ error!(\"Failed to add route\");\n+ bail!(\"IP setup failed\");\n+ }\n+ }\n+ trace!(\"added route with {:?}\", r);\n+ }\n+ Err(e) => {\n+ trace!(\"Failed to add route with {:?}\", e);\n+ continue;\n+ }\n+ }\nlet mut pinger = Ping::new();\n- pinger.set_device(&iface)?;\npinger.set_timeout((PING_TIMEOUT.as_millis() as f64 / 1000f64) as f64)?;\npinger.add_host(&ip.to_string())?;\n- let mut response = pinger.send()?;\n+ let mut response = match pinger.send() {\n+ Ok(res) => res,\n+ Err(e) => {\n+ trace!(\"Failed to ping with {:?}\", e);\n+ continue;\n+ }\n+ };\nif let Some(res) = response.next() {\ntrace!(\"got ping response {:?}\", res);\nif res.dropped == 0 {\n@@ -226,3 +367,24 @@ fn find_antenna(ip: IpAddr, interfaces: &HashSet<String>) -> Result<String, Erro\n}\nErr(format_err!(\"Failed to find Antenna!\"))\n}\n+\n+/// Generates a random non overlapping ip within a /24 subnet of the provided\n+/// target antenna ip.\n+fn get_local_ip(target_ip: IpAddr) -> IpAddr {\n+ match target_ip {\n+ IpAddr::V4(address) => {\n+ let mut rng = rand::thread_rng();\n+ let mut bytes = address.octets();\n+ let mut new_ip: u8 = rng.gen();\n+ // keep trying until we get a different number\n+ // only editing the last byte is implicitly working\n+ // within a /24\n+ while new_ip == bytes[3] {\n+ new_ip = rng.gen()\n+ }\n+ bytes[3] = new_ip;\n+ Ipv4Addr::new(bytes[0], bytes[1], bytes[2], bytes[3]).into()\n+ }\n+ IpAddr::V6(_address) => unimplemented!(),\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "antenna_forwarding_protocol/src/lib.rs",
"new_path": "antenna_forwarding_protocol/src/lib.rs",
"diff": "@@ -13,7 +13,36 @@ extern crate failure;\nuse althea_types::Identity;\nuse failure::Error;\n+use std::io::ErrorKind::WouldBlock;\n+use std::io::Write;\nuse std::net::IpAddr;\n+use std::net::TcpStream;\n+use std::thread;\n+use std::time::Duration;\n+\n+/// The amount of time to sleep a thread that's spinlocking on somthing\n+pub const SPINLOCK_TIME: Duration = Duration::from_millis(10);\n+\n+/// The size of the memory buffer for reading and writing packets\n+/// currently 100kbytes\n+pub const BUFFER_SIZE: usize = 100_000;\n+\n+/// Writes data to a stream keeping in mind that we may encounter\n+/// a buffer limit and have to partially complete our write\n+pub fn write_all_spinlock(stream: &mut TcpStream, buffer: &[u8]) -> Result<(), Error> {\n+ loop {\n+ let res = stream.write_all(buffer);\n+ match res {\n+ Ok(_val) => return Ok(()),\n+ Err(e) => {\n+ if e.kind() != WouldBlock {\n+ return Err(e.into());\n+ }\n+ }\n+ }\n+ thread::sleep(SPINLOCK_TIME);\n+ }\n+}\n/// an excessively long protocol magic value that preceeds all\n/// control traffic. A u32 would probably be sufficient to ensure\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Working forwarding!
This fixes a lot of the reading logic, improves spinlock efficiency, adds effective
ipv4 routing discovery and modificaiton and generally gets us to a very basic working
system.
Needs some tweaks to properly forward SSL connections and also some code cleanup |
20,244 | 28.03.2020 13:27:05 | 14,400 | f61a8e4eef51164f83be17b2603a5bc9006b6df0 | Add more tests and clean up forwarding protocol logic
I'm chasing an issue where we have a packet with an incorrect size
value. Trying to determine if that's happening here or at a different
level. | [
{
"change_type": "MODIFY",
"old_path": "antenna_forwarding_protocol/src/lib.rs",
"new_path": "antenna_forwarding_protocol/src/lib.rs",
"diff": "@@ -27,6 +27,9 @@ pub const SPINLOCK_TIME: Duration = Duration::from_millis(10);\n/// currently 100kbytes\npub const BUFFER_SIZE: usize = 100_000;\n+/// The size in bytes of our packet header, 16 byte magic, 2 byte type, 2 byte len\n+pub const HEADER_LEN: usize = 20;\n+\n/// Writes data to a stream keeping in mind that we may encounter\n/// a buffer limit and have to partially complete our write\npub fn write_all_spinlock(stream: &mut TcpStream, buffer: &[u8]) -> Result<(), Error> {\n@@ -152,7 +155,7 @@ impl ForwardingProtocolMessage for ConnectionMessage {\n/// Attempts to read the stream id of what may potentially be a\n/// connection close message, returns bytes read and struct\nfn read_message(payload: &[u8]) -> Result<(usize, ConnectionMessage), Error> {\n- if payload.len() < 20 {\n+ if payload.len() < HEADER_LEN {\nreturn Err(format_err!(\"Packet too short!\"));\n}\n@@ -172,8 +175,12 @@ impl ForwardingProtocolMessage for ConnectionMessage {\nreturn Err(format_err!(\"Packet magic incorrect!\"));\n} else if packet_type != CONNECTION_MESSAGE_TYPE {\nreturn Err(format_err!(\"Wrong packet type!\"));\n- } else if packet_len < 8 {\n- return Err(format_err!(\"Incorrect length for close message\"));\n+ } else if packet_len as usize + HEADER_LEN > payload.len() {\n+ return Err(format_err!(\n+ \"Our slice is {} bytes, but our packet_len {} bytes\",\n+ payload.len(),\n+ packet_len as usize + HEADER_LEN\n+ ));\n}\nlet mut connection_id: [u8; 8] = [0; 8];\n@@ -181,9 +188,9 @@ impl ForwardingProtocolMessage for ConnectionMessage {\nlet connection_id = u64::from_be_bytes(connection_id);\nlet payload_bytes = packet_len as usize - 8;\n- let end = 28 + payload_bytes;\n+ let end = HEADER_LEN + 8 + payload_bytes;\nlet mut message_value = Vec::new();\n- message_value.extend_from_slice(&payload[28..28 + payload_bytes]);\n+ message_value.extend_from_slice(&payload[28..end]);\nOk((end, ConnectionMessage::new(connection_id, message_value)))\n}\n@@ -219,7 +226,7 @@ impl ForwardingProtocolMessage for ConnectionClose {\n/// Attempts to read the stream id of what may potentially be a\n/// connection close message\nfn read_message(payload: &[u8]) -> Result<(usize, ConnectionClose), Error> {\n- if payload.len() < 20 {\n+ if payload.len() < HEADER_LEN {\nreturn Err(format_err!(\"Packet too short!\"));\n}\n@@ -289,7 +296,7 @@ impl ForwardingProtocolMessage for IdentificationMessage {\n/// takes a byte slice that may potentially contain a IdentificationMessage and\n/// deserializes it\nfn read_message(payload: &[u8]) -> Result<(usize, IdentificationMessage), Error> {\n- if payload.len() < 20 {\n+ if payload.len() < HEADER_LEN {\nreturn Err(format_err!(\"Packet too short!\"));\n}\n@@ -313,7 +320,7 @@ impl ForwardingProtocolMessage for IdentificationMessage {\nlet bytes_read = 20 + packet_len as usize;\n- match serde_json::from_slice(&payload[20..(20 + packet_len as usize)]) {\n+ match serde_json::from_slice(&payload[HEADER_LEN..bytes_read]) {\nOk(message) => Ok((bytes_read, message)),\nErr(serde_error) => Err(serde_error.into()),\n}\n@@ -353,7 +360,7 @@ impl ForwardingProtocolMessage for ErrorMessage {\n/// takes a byte slice that may potentially contain a ErrorMessage and\n/// deserializes it\nfn read_message(payload: &[u8]) -> Result<(usize, ErrorMessage), Error> {\n- if payload.len() < 20 {\n+ if payload.len() < HEADER_LEN {\nreturn Err(format_err!(\"Packet too short!\"));\n}\n@@ -375,9 +382,9 @@ impl ForwardingProtocolMessage for ErrorMessage {\nreturn Err(format_err!(\"Wrong packet type!\"));\n}\n- let bytes_read = 20 + packet_len as usize;\n+ let bytes_read = HEADER_LEN + packet_len as usize;\n- match serde_json::from_slice(&payload[20..(20 + packet_len as usize)]) {\n+ match serde_json::from_slice(&payload[HEADER_LEN..bytes_read]) {\nOk(message) => Ok((bytes_read, message)),\nErr(serde_error) => Err(serde_error.into()),\n}\n@@ -421,7 +428,7 @@ impl ForwardingProtocolMessage for ForwardMessage {\n/// takes a byte slice that may potentially contain a ForwardMessage and\n/// deserializes it\nfn read_message(payload: &[u8]) -> Result<(usize, ForwardMessage), Error> {\n- if payload.len() < 20 {\n+ if payload.len() < HEADER_LEN {\nreturn Err(format_err!(\"Packet too short!\"));\n}\n@@ -443,9 +450,9 @@ impl ForwardingProtocolMessage for ForwardMessage {\nreturn Err(format_err!(\"Wrong packet type!\"));\n}\n- let bytes_read = 20 + packet_len as usize;\n+ let bytes_read = HEADER_LEN + packet_len as usize;\n- match serde_json::from_slice(&payload[20..(20 + packet_len as usize)]) {\n+ match serde_json::from_slice(&payload[HEADER_LEN..bytes_read]) {\nOk(message) => Ok((bytes_read, message)),\nErr(serde_error) => Err(serde_error.into()),\n}\n@@ -485,7 +492,7 @@ impl ForwardingProtocolMessage for ForwardingCloseMessage {\n/// takes a byte slice that may potentially contain a ForwardMessage and\n/// deserializes it\nfn read_message(payload: &[u8]) -> Result<(usize, ForwardingCloseMessage), Error> {\n- if payload.len() < 20 {\n+ if payload.len() < HEADER_LEN {\nreturn Err(format_err!(\"Packet too short!\"));\n}\n@@ -507,9 +514,9 @@ impl ForwardingProtocolMessage for ForwardingCloseMessage {\nreturn Err(format_err!(\"Wrong packet type!\"));\n}\n- let bytes_read = 20 + packet_len as usize;\n+ let bytes_read = HEADER_LEN + packet_len as usize;\n- match serde_json::from_slice(&payload[20..(20 + packet_len as usize)]) {\n+ match serde_json::from_slice(&payload[HEADER_LEN..bytes_read]) {\nOk(message) => Ok((bytes_read, message)),\nErr(serde_error) => Err(serde_error.into()),\n}\n@@ -549,7 +556,7 @@ impl ForwardingProtocolMessage for KeepAliveMessage {\n/// takes a byte slice that may potentially contain a ForwardMessage and\n/// deserializes it\nfn read_message(payload: &[u8]) -> Result<(usize, KeepAliveMessage), Error> {\n- if payload.len() < 20 {\n+ if payload.len() < HEADER_LEN {\nreturn Err(format_err!(\"Packet too short!\"));\n}\n@@ -571,9 +578,9 @@ impl ForwardingProtocolMessage for KeepAliveMessage {\nreturn Err(format_err!(\"Wrong packet type!\"));\n}\n- let bytes_read = 20 + packet_len as usize;\n+ let bytes_read = HEADER_LEN + packet_len as usize;\n- match serde_json::from_slice(&payload[20..(20 + packet_len as usize)]) {\n+ match serde_json::from_slice(&payload[HEADER_LEN..bytes_read]) {\nOk(message) => Ok((bytes_read, message)),\nErr(serde_error) => Err(serde_error.into()),\n}\n@@ -656,19 +663,46 @@ mod tests {\n#[test]\nfn test_id_message() {\nlet message = IdentificationMessage::new(get_test_id());\n- let out = message.get_message();\n- let (size, parsed) = IdentificationMessage::read_message(&out).expect(\"Failed to parse!\");\n- assert_eq!(parsed, message);\n- assert_eq!(size, out.len());\n+ let message_bytes = message.get_message();\n+ let (number_of_bytes_parsed, parsed_message_contents) =\n+ IdentificationMessage::read_message(&message_bytes).expect(\"Failed to parse!\");\n+ assert_eq!(message, parsed_message_contents);\n+ assert_eq!(number_of_bytes_parsed, message_bytes.len());\n+ }\n+\n+ #[test]\n+ fn test_id_message_trailing_bytes() {\n+ let message = IdentificationMessage::new(get_test_id());\n+ let mut message_bytes = message.get_message();\n+ let actual_message_length = message_bytes.len();\n+ // add some random trailing bytes\n+ message_bytes.extend_from_slice(&get_random_test_vector());\n+ let (message_bytes_parsed, parsed_message_contents) =\n+ IdentificationMessage::read_message(&message_bytes).expect(\"Failed to parse!\");\n+ assert_eq!(parsed_message_contents, message);\n+ assert_eq!(message_bytes_parsed, actual_message_length);\n}\n#[test]\nfn test_forward_message() {\nlet message = get_forward_message();\n- let out = message.get_message();\n- let (size, parsed) = ForwardMessage::read_message(&out).expect(\"Failed to parse!\");\n- assert_eq!(parsed, message);\n- assert_eq!(size, out.len());\n+ let message_bytes = message.get_message();\n+ let (message_bytes_parsed, parsed_message_contents) =\n+ ForwardMessage::read_message(&message_bytes).expect(\"Failed to parse!\");\n+ assert_eq!(message, parsed_message_contents);\n+ assert_eq!(message_bytes_parsed, message_bytes.len());\n+ }\n+\n+ #[test]\n+ fn test_forward_message_trailing_bytes() {\n+ let message = get_forward_message();\n+ let mut message_bytes = message.get_message();\n+ let actual_message_length = message_bytes.len();\n+ message_bytes.extend_from_slice(&get_random_test_vector());\n+ let (message_bytes_parsed, parsed_message_contents) =\n+ ForwardMessage::read_message(&message_bytes).expect(\"Failed to parse!\");\n+ assert_eq!(parsed_message_contents, message);\n+ assert_eq!(message_bytes_parsed, actual_message_length);\n}\n#[test]\n@@ -680,6 +714,17 @@ mod tests {\nassert_eq!(size, out.len());\n}\n+ #[test]\n+ fn test_error_message_trailing_bytes() {\n+ let message = ErrorMessage::new(\"test\".to_string());\n+ let mut out = message.get_message();\n+ let actual_message_length = out.len();\n+ out.extend_from_slice(&get_random_test_vector());\n+ let (size, parsed) = ErrorMessage::read_message(&out).expect(\"Failed to parse!\");\n+ assert_eq!(parsed, message);\n+ assert_eq!(size, actual_message_length);\n+ }\n+\n#[test]\nfn test_connecton_close_message() {\nlet message = ConnectionClose::new(get_random_stream_id());\n@@ -689,6 +734,17 @@ mod tests {\nassert_eq!(size, out.len());\n}\n+ #[test]\n+ fn test_connecton_close_message_trailing_bytes() {\n+ let message = ConnectionClose::new(get_random_stream_id());\n+ let mut out = message.get_message();\n+ let actual_message_length = out.len();\n+ out.extend_from_slice(&get_random_test_vector());\n+ let (size, parsed) = ConnectionClose::read_message(&out).expect(\"Failed to parse!\");\n+ assert_eq!(parsed, message);\n+ assert_eq!(size, actual_message_length);\n+ }\n+\n#[test]\nfn test_connecton_message() {\nlet message = ConnectionMessage::new(get_random_stream_id(), get_random_test_vector());\n@@ -698,6 +754,17 @@ mod tests {\nassert_eq!(size, out.len());\n}\n+ #[test]\n+ fn test_connecton_message_trailing_bytes() {\n+ let message = ConnectionMessage::new(get_random_stream_id(), get_random_test_vector());\n+ let mut out = message.get_message();\n+ let actual_message_length = out.len();\n+ out.extend_from_slice(&get_random_test_vector());\n+ let (size, parsed) = ConnectionMessage::read_message(&out).expect(\"Failed to parse!\");\n+ assert_eq!(parsed, message);\n+ assert_eq!(size, actual_message_length);\n+ }\n+\n#[test]\nfn test_close_message() {\nlet message = ForwardingCloseMessage::new();\n@@ -707,6 +774,17 @@ mod tests {\nassert_eq!(size, out.len());\n}\n+ #[test]\n+ fn test_close_message_trailing_bytes() {\n+ let message = ForwardingCloseMessage::new();\n+ let mut out = message.get_message();\n+ let actual_message_length = out.len();\n+ out.extend_from_slice(&get_random_test_vector());\n+ let (size, parsed) = ForwardingCloseMessage::read_message(&out).expect(\"Failed to parse!\");\n+ assert_eq!(parsed, message);\n+ assert_eq!(size, actual_message_length);\n+ }\n+\n#[test]\nfn test_keepalive_message() {\nlet message = KeepAliveMessage::new();\n@@ -717,7 +795,18 @@ mod tests {\n}\n#[test]\n- fn test_multiple_connection_messages() {\n+ fn test_keepalive_message_trailing_bytes() {\n+ let message = KeepAliveMessage::new();\n+ let mut out = message.get_message();\n+ let actual_message_length = out.len();\n+ out.extend_from_slice(&get_random_test_vector());\n+ let (size, parsed) = KeepAliveMessage::read_message(&out).expect(\"Failed to parse!\");\n+ assert_eq!(parsed, message);\n+ assert_eq!(size, actual_message_length);\n+ }\n+\n+ #[test]\n+ fn test_multiple_message_types() {\nlet mut multi_message = Vec::new();\nlet message1 = ConnectionClose::new(get_random_stream_id());\nmulti_message.extend_from_slice(&message1.get_message());\n@@ -738,7 +827,7 @@ mod tests {\n}\n#[test]\n- fn test_multiple_message_types() {\n+ fn test_multiple_connection_types() {\nlet mut multi_message = Vec::new();\nlet message1 = ConnectionMessage::new(get_random_stream_id(), get_random_test_vector());\nmulti_message.extend_from_slice(&message1.get_message());\n"
}
] | Rust | Apache License 2.0 | althea-net/althea_rs | Add more tests and clean up forwarding protocol logic
I'm chasing an issue where we have a packet with an incorrect size
value. Trying to determine if that's happening here or at a different
level. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.