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
25.06.2021 10:16:19
14,400
c240cd275648a06781c288faad81d4a7db15519b
Remove travis ci We're not going to use this again since Travis is now woefully behind Github actions or Gitlab CI there's no platform I can forsee where Travis would once again be our CI of choice, making this file nothing but cruft.
[ { "change_type": "DELETE", "old_path": ".travis.yml", "new_path": null, "diff": "-language: rust\n-dist: xenial\n-services:\n- - postgresql\n-before_install:\n- - sudo add-apt-repository ppa:wireguard/wireguard -y\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 --version 0.1.9 --force\n-\n-env:\n- matrix:\n- - CMD=\"cross build --target x86_64-unknown-linux-gnu --verbose -p rita --bin rita && cross test --target x86_64-unknown-linux-gnu --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\"\n- - CMD=\"cross build --target mips-unknown-linux-gnu --verbose -p rita --bin rita && cross test --target mips-unknown-linux-gnu --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\"\n- - CMD=\"cross build --target mipsel-unknown-linux-gnu --verbose -p rita --bin rita && cross test --target mipsel-unknown-linux-gnu --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\"\n- - CMD=\"cross build --target mips64-unknown-linux-gnuabi64 --verbose -p rita --bin rita && cross test --target mips64-unknown-linux-gnuabi64 --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\"\n- - CMD=\"cross build --target mips64el-unknown-linux-gnuabi64 --verbose -p rita --bin rita && cross test --target mips64el-unknown-linux-gnuabi64 --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\"\n- - CMD=\"cross build --target aarch64-unknown-linux-gnu --verbose -p rita --bin rita && cross test --target aarch64-unknown-linux-gnu --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\"\n- - CMD=\"cross build --target armv7-unknown-linux-gnueabihf --verbose -p rita --bin rita && cross test --target armv7-unknown-linux-gnueabihf --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\"\n- # test Rita exit only on x86 since cross does not include postgres libs :(\n- - CMD=\"cargo build --all && RUST_TEST_THREADS=1 cargo test --verbose --all\"\n-\n-rust:\n- - stable\n- - beta\n- - nightly\n-\n-script:\n- - eval \"$CMD\"\n-\n-matrix:\n- allow_failures:\n- - rust: nightly\n- - rust: beta\n- fast_finish: true\n-\n- include:\n- - rust: stable\n- env:\n- before_install:\n- script:\n- - rustup component add rustfmt-preview\n- - cargo fmt --all -- --check\n- # to stop opt level 3 from sneaking in\n- - 'grep -q ''opt-level = \"z\"'' Cargo.toml'\n- - \"cargo install cargo-audit --force && cargo audit\"\n- - \"cargo install cargo-geiger --force && cargo geiger\"\n- - script: ./integration-tests/rita.sh\n- env: SPEEDTEST_THROUGHPUT=\"20\" SPEEDTEST_DURATION=\"15\" INITIAL_POLL_INTERVAL=5 BACKOFF_FACTOR=\"1.5\" VERBOSE=1 POSTGRES_USER=postgres POSTGRES_BIN=/usr/lib/postgresql/9.6/bin/postgres POSTGRES_DATABASE=/var/ramfs/postgresql/9.6/main POSTGRES_CONFIG=/etc/postgresql/9.6/main/postgresql.conf\n- - script: ./integration-tests/rita.sh\n- env: SPEEDTEST_THROUGHPUT=\"20\" SPEEDTEST_DURATION=\"15\" REVISION_B=release REMOTE_A=.. REMOTE_B=\"https://github.com/althea-mesh/althea_rs.git\" COMPAT_LAYOUT=\"inner_ring_old\" INITIAL_POLL_INTERVAL=5 BACKOFF_FACTOR=\"1.5\" VERBOSE=1 POSTGRES_USER=postgres POSTGRES_BIN=/usr/lib/postgresql/9.6/bin/postgres POSTGRES_DATABASE=/var/ramfs/postgresql/9.6/main POSTGRES_CONFIG=/etc/postgresql/9.6/main/postgresql.conf\n- - script: ./integration-tests/rita.sh\n- env: SPEEDTEST_THROUGHPUT=\"20\" SPEEDTEST_DURATION=\"15\" REVISION_B=master REMOTE_A=.. REMOTE_B=\"https://github.com/althea-mesh/althea_rs.git\" COMPAT_LAYOUT=\"inner_ring_old\" INITIAL_POLL_INTERVAL=5 BACKOFF_FACTOR=\"1.5\" VERBOSE=1 POSTGRES_USER=postgres POSTGRES_BIN=/usr/lib/postgresql/9.6/bin/postgres POSTGRES_DATABASE=/var/ramfs/postgresql/9.6/main POSTGRES_CONFIG=/etc/postgresql/9.6/main/postgresql.conf\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove travis ci We're not going to use this again since Travis is now woefully behind Github actions or Gitlab CI there's no platform I can forsee where Travis would once again be our CI of choice, making this file nothing but cruft.
20,244
29.06.2021 15:51:06
14,400
9e3833a6d0d31c91d55a6a45d6e423ff7cc4c870
Add cargo fmt check to test.sh This should be located here so that we can test for everything easily locally
[ { "change_type": "MODIFY", "old_path": "scripts/test.sh", "new_path": "scripts/test.sh", "diff": "@@ -6,6 +6,8 @@ NODES=${NODES:='None'}\nRUST_TEST_THREADS=1 cargo test --all\n# check for nits\ncargo clippy --all --all-targets --all-features -- -D warnings\n+# check for fmt errors\n+cargo fmt --all -- --check\n# test rita only on many architectures\nCROSS_TEST_ARGS=\"--verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add cargo fmt check to test.sh This should be located here so that we can test for everything easily locally
20,255
30.06.2021 11:32:31
25,200
eb7f963d7f252ab14a026bd941c70269f2abebbb
Migrated geoip.rs to use sync babel.
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_exit/database/geoip.rs", "new_path": "rita/src/rita_exit/database/geoip.rs", "diff": "use crate::rita_common::utils::ip_increment::is_unicast_link_local;\n+use crate::rita_exit::rita_loop::EXIT_LOOP_TIMEOUT;\nuse crate::KI;\nuse crate::SETTING;\n-use babel_monitor_legacy::open_babel_stream_legacy;\n-use babel_monitor_legacy::parse_routes_legacy;\n-use babel_monitor_legacy::start_connection_legacy;\n+use babel_monitor::open_babel_stream;\n+use babel_monitor::parse_routes;\n+use babel_monitor::start_connection;\nuse failure::Error;\n-use futures01::future;\n-use futures01::future::Future;\nuse ipnetwork::IpNetwork;\nuse settings::exit::RitaExitSettings;\nuse settings::RitaCommonSettings;\n@@ -21,24 +20,20 @@ lazy_static! {\n}\n/// gets the gateway ip for a given mesh IP\n-pub fn get_gateway_ip_single(mesh_ip: IpAddr) -> Box<dyn Future<Item = IpAddr, Error = Error>> {\n+pub fn get_gateway_ip_single(mesh_ip: IpAddr) -> Result<IpAddr, Error> {\nlet babel_port = SETTING.get_network().babel_port;\n- Box::new(\n- open_babel_stream_legacy(babel_port)\n- .from_err()\n- .and_then(move |stream| {\n- start_connection_legacy(stream).and_then(move |stream| {\n- parse_routes_legacy(stream).and_then(move |routes| {\n+ let mut stream = open_babel_stream(babel_port, EXIT_LOOP_TIMEOUT)?;\n+ let _start_conn = start_connection(&mut stream);\n+\n+ let routes = parse_routes(&mut stream)?;\n+\nlet mut route_to_des = None;\n- for route in routes.1.iter() {\n+ for route in routes.iter() {\n// Only ip6\nif let IpNetwork::V6(ref ip) = route.prefix {\n// Only host addresses and installed routes\n- if ip.prefix() == 128\n- && route.installed\n- && IpAddr::V6(ip.ip()) == mesh_ip\n- {\n+ if ip.prefix() == 128 && route.installed && IpAddr::V6(ip.ip()) == mesh_ip {\nroute_to_des = Some(route.clone());\n}\n}\n@@ -48,10 +43,6 @@ pub fn get_gateway_ip_single(mesh_ip: IpAddr) -> Box<dyn Future<Item = IpAddr, E\nSome(route) => Ok(KI.get_wg_remote_ip(&route.iface)?),\nNone => bail!(\"No route found for mesh ip: {:?}\", mesh_ip),\n}\n- })\n- })\n- }),\n- )\n}\n#[derive(Debug, Clone, Copy)]\n@@ -62,30 +53,25 @@ pub struct IpPair {\n/// gets the gateway ip for a given set of mesh IPs, inactive addresses will simply\n/// not appear in the result vec\n-pub fn get_gateway_ip_bulk(\n- mesh_ip_list: Vec<IpAddr>,\n-) -> Box<dyn Future<Item = Vec<IpPair>, Error = Error>> {\n+pub fn get_gateway_ip_bulk(mesh_ip_list: Vec<IpAddr>) -> Result<Vec<IpPair>, Error> {\nlet babel_port = SETTING.get_network().babel_port;\ntrace!(\"getting gateway ip bulk\");\n- Box::new(\n- open_babel_stream_legacy(babel_port)\n- .from_err()\n- .and_then(|stream| {\n- start_connection_legacy(stream).and_then(|stream| {\n- parse_routes_legacy(stream).and_then(|routes| {\n+ let mut stream = open_babel_stream(babel_port, EXIT_LOOP_TIMEOUT)?;\n+\n+ let _start_conn = start_connection(&mut stream);\n+\n+ let routes = parse_routes(&mut stream)?;\n+\ntrace!(\"done talking to babel for gateway ip bulk\");\nlet mut remote_ip_cache: HashMap<String, IpAddr> = HashMap::new();\nlet mut results = Vec::new();\nfor mesh_ip in mesh_ip_list {\n- for route in routes.1.iter() {\n+ for route in routes.iter() {\n// Only ip6\nif let IpNetwork::V6(ref ip) = route.prefix {\n// Only host addresses and installed routes\n- if ip.prefix() == 128\n- && route.installed\n- && IpAddr::V6(ip.ip()) == mesh_ip\n- {\n+ if ip.prefix() == 128 && route.installed && IpAddr::V6(ip.ip()) == mesh_ip {\n// check if we've already looked up this interface this round, since gateways\n// have many clients this will often be the case\nif let Some(remote_ip) = remote_ip_cache.get(&route.iface) {\n@@ -96,8 +82,7 @@ pub fn get_gateway_ip_bulk(\n} else {\nmatch KI.get_wg_remote_ip(&route.iface) {\nOk(remote_ip) => {\n- remote_ip_cache\n- .insert(route.iface.clone(), remote_ip);\n+ remote_ip_cache.insert(route.iface.clone(), remote_ip);\nresults.push(IpPair {\nmesh_ip,\ngateway_ip: remote_ip,\n@@ -112,12 +97,7 @@ pub fn get_gateway_ip_bulk(\n}\n}\n}\n-\nOk(results)\n- })\n- })\n- }),\n- )\n}\n#[derive(Deserialize, Debug)]\n@@ -130,13 +110,6 @@ struct CountryDetails {\niso_code: String,\n}\n-pub fn get_country_async(ip: IpAddr) -> impl Future<Item = String, Error = Error> {\n- match get_country(ip) {\n- Ok(res) => future::ok(res),\n- Err(e) => future::err(e),\n- }\n-}\n-\n/// get ISO country code from ip, consults a in memory cache\npub fn get_country(ip: IpAddr) -> Result<String, Error> {\ntrace!(\"get GeoIP country for {}\", ip.to_string());\n@@ -222,10 +195,10 @@ pub fn get_country(ip: IpAddr) -> Result<String, Error> {\n/// Returns true or false if an ip is confirmed to be inside or outside the region and error\n/// if an api error is encountered trying to figure that out.\n-pub fn verify_ip(request_ip: IpAddr) -> impl Future<Item = bool, Error = Error> {\n+pub fn verify_ip(request_ip: IpAddr) -> Result<bool, Error> {\nmatch verify_ip_sync(request_ip) {\n- Ok(item) => future::ok(item),\n- Err(e) => future::err(e),\n+ Ok(item) => Ok(item),\n+ Err(e) => Err(e),\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": "use crate::rita_common::debt_keeper::get_debts_list;\nuse crate::rita_common::debt_keeper::DebtAction;\n-use crate::rita_common::utils::wait_timeout::wait_timeout;\n-use crate::rita_common::utils::wait_timeout::WaitResult;\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;\nuse crate::rita_exit::database::database_tools::get_client;\nuse crate::rita_exit::database::database_tools::get_database_connection;\n+use crate::rita_exit::database::database_tools::get_database_connection_sync;\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::verify_client;\nuse crate::rita_exit::database::database_tools::verify_db_client;\nuse crate::rita_exit::database::email::handle_email_registration;\n-use crate::rita_exit::database::geoip::get_country_async;\n+use crate::rita_exit::database::geoip::get_country;\nuse crate::rita_exit::database::geoip::get_gateway_ip_bulk;\nuse crate::rita_exit::database::geoip::get_gateway_ip_single;\nuse crate::rita_exit::database::geoip::verify_ip;\n@@ -26,7 +25,6 @@ use crate::rita_exit::database::struct_tools::display_hashset;\nuse 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;\n-use crate::rita_exit::rita_loop::EXIT_LOOP_TIMEOUT;\nuse crate::EXIT_ALLOWED_COUNTRIES;\nuse crate::EXIT_DESCRIPTION;\nuse crate::EXIT_NETWORK_SETTINGS;\n@@ -107,14 +105,28 @@ pub fn secs_since_unix_epoch() -> i64 {\n/// ip and then sends out an email of phone message\npub fn signup_client(client: ExitClientIdentity) -> impl Future<Item = ExitState, Error = Error> {\ninfo!(\"got setup request {:?}\", client);\n- get_gateway_ip_single(client.global.mesh_ip).and_then(move |gateway_ip| {\n+ let gateway_ip = match get_gateway_ip_single(client.global.mesh_ip) {\n+ Ok(a) => a,\n+ Err(e) => {\n+ return Box::new(future::err(e)) as Box<dyn Future<Item = ExitState, Error = Error>>\n+ }\n+ };\n+\ninfo!(\"got gateway ip {:?}\", client);\n- verify_ip(gateway_ip).and_then(move |verify_status| {\n+ let verify_status = verify_ip(gateway_ip).unwrap();\ninfo!(\"verified the ip country {:?}\", client);\n- get_country_async(gateway_ip).and_then(move |user_country| {\n+ let user_country = get_country(gateway_ip).unwrap();\ninfo!(\"got the country {:?}\", client);\n- get_database_connection().and_then(move |conn| {\n- info!(\"Doing database work for {:?} in country {} with verify_status {}\", client, user_country, verify_status);\n+\n+ let conn = match get_database_connection_sync() {\n+ Ok(a) => a,\n+ Err(e) => return Box::new(future::err(e)),\n+ };\n+\n+ info!(\n+ \"Doing database work for {:?} in country {} with verify_status {}\",\n+ client, user_country, verify_status\n+ );\n// check if we have any users with conflicting details\nmatch client_conflict(&client, &conn) {\nOk(true) => {\n@@ -129,26 +141,23 @@ pub fn signup_client(client: ExitClientIdentity) -> impl Future<Item = ExitState\nOk(false) => {}\nErr(e) => return Box::new(future::err(e)),\n}\n-\n- let their_record =\n- match create_or_update_user_record(&conn, &client, user_country) {\n+ let their_record = match create_or_update_user_record(&conn, &client, user_country) {\nOk(record) => record,\nErr(e) => return Box::new(future::err(e)),\n};\n-\n// either update and grab an existing entry or create one\nmatch (verify_status, EXIT_VERIF_SETTINGS.clone()) {\n- (true, Some(ExitVerifSettings::Email(mailer))) => {\n- Box::new(handle_email_registration(\n+ (true, Some(ExitVerifSettings::Email(mailer))) => Box::new(handle_email_registration(\n&client,\n&their_record,\n&conn,\nmailer.email_cooldown as i64,\n- ))\n- }\n- (true, Some(ExitVerifSettings::Phone(phone))) => Box::new(\n- handle_sms_registration(client, their_record, phone.auth_api_key),\n- ),\n+ )),\n+ (true, Some(ExitVerifSettings::Phone(phone))) => Box::new(handle_sms_registration(\n+ client,\n+ their_record,\n+ phone.auth_api_key,\n+ )),\n(true, None) => {\nmatch verify_client(&client, true, &conn) {\nOk(_) => (),\n@@ -158,7 +167,6 @@ pub fn signup_client(client: ExitClientIdentity) -> impl Future<Item = ExitState\nOk(ip) => ip,\nErr(e) => return Box::new(future::err(format_err!(\"{:?}\", e))),\n};\n-\nBox::new(future::ok(ExitState::Registered {\nour_details: ExitClientDetails { client_internal_ip },\ngeneral_details: get_exit_info(),\n@@ -172,12 +180,7 @@ pub fn signup_client(client: ExitClientIdentity) -> impl Future<Item = ExitState\n),\n})),\n}\n- })\n- })\n- })\n- })\n}\n-\n/// Gets the status of a client and updates it in the database\npub fn client_status(client: ExitClientIdentity, conn: &PgConnection) -> Result<ExitState, Error> {\ntrace!(\"Checking if record exists for {:?}\", client.global.mesh_ip);\n@@ -251,11 +254,7 @@ pub fn validate_clients_region(\nErr(_e) => error!(\"Database entry with invalid mesh ip! {:?}\", item),\n}\n}\n- let list = match wait_timeout(get_gateway_ip_bulk(ip_vec), EXIT_LOOP_TIMEOUT) {\n- WaitResult::Err(e) => return Err(e),\n- WaitResult::Ok(val) => val,\n- WaitResult::TimedOut(_) => return Err(format_err!(\"Timed out!\")),\n- };\n+ let list = get_gateway_ip_bulk(ip_vec)?;\nfor item in list.iter() {\nlet res = verify_ip_sync(item.gateway_ip);\nmatch res {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Migrated geoip.rs to use sync babel.
20,244
08.07.2021 10:48:47
14,400
7bc75f404b661c887d126fe66fc6f92c457bfa95
Upgrade transitive deps, web30, actix This updates all transitive deps, as well as the async versions of web30 and actix. The primary diver of this update is to be post London hardfork compatible for sending transactions on both Ethereum and Xdai.
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -50,7 +50,7 @@ dependencies = [\n\"parking_lot 0.11.1\",\n\"pin-project-lite\",\n\"smallvec 1.6.1\",\n- \"tokio 1.6.1\",\n+ \"tokio 1.8.1\",\n\"tokio-util\",\n]\n@@ -66,15 +66,15 @@ dependencies = [\n\"futures-sink\",\n\"log\",\n\"pin-project-lite\",\n- \"tokio 1.6.1\",\n+ \"tokio 1.8.1\",\n\"tokio-util\",\n]\n[[package]]\nname = \"actix-http\"\n-version = \"3.0.0-beta.6\"\n+version = \"3.0.0-beta.8\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"59d51c2ba06062e698a5d212d860e9fb2afc931c285ede687aaae896c8150347\"\n+checksum = \"3cd16d6b846983ffabfd081e1a67abd7698094fcbe7b3d9bcf1acbc6f546a516\"\ndependencies = [\n\"actix-codec\",\n\"actix-rt\",\n@@ -84,7 +84,6 @@ dependencies = [\n\"ahash\",\n\"base64 0.13.0\",\n\"bitflags\",\n- \"brotli2\",\n\"bytes 1.0.1\",\n\"bytestring\",\n\"derive_more\",\n@@ -96,32 +95,32 @@ dependencies = [\n\"http 0.2.4\",\n\"httparse\",\n\"itoa\",\n- \"language-tags\",\n+ \"language-tags 0.3.2\",\n\"local-channel\",\n\"log\",\n\"mime\",\n\"once_cell\",\n- \"paste\",\n\"percent-encoding 2.1.0\",\n\"pin-project\",\n\"pin-project-lite\",\n- \"rand 0.8.3\",\n+ \"rand 0.8.4\",\n\"regex\",\n\"serde 1.0.126\",\n\"sha-1 0.9.6\",\n\"smallvec 1.6.1\",\n- \"time 0.2.26\",\n- \"tokio 1.6.1\",\n+ \"time 0.2.27\",\n+ \"tokio 1.8.1\",\n+ \"zstd\",\n]\n[[package]]\nname = \"actix-macros\"\n-version = \"0.2.0\"\n+version = \"0.2.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"dbcb2b608f0accc2f5bcf3dd872194ce13d94ee45b571487035864cf966b04ef\"\n+checksum = \"c2f86cd6857c135e6e9fe57b1619a88d1f94a7df34c00e11fe13e64fd3438837\"\ndependencies = [\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n]\n[[package]]\n@@ -172,7 +171,7 @@ checksum = \"bc7d7cd957c9ed92288a7c3c96af81fa5291f65247a76a34dac7b6af74e52ba0\"\ndependencies = [\n\"actix-macros\",\n\"futures-core\",\n- \"tokio 1.6.1\",\n+ \"tokio 1.8.1\",\n]\n[[package]]\n@@ -186,10 +185,10 @@ dependencies = [\n\"actix-utils\",\n\"futures-core\",\n\"log\",\n- \"mio 0.7.11\",\n+ \"mio 0.7.13\",\n\"num_cpus\",\n\"slab\",\n- \"tokio 1.6.1\",\n+ \"tokio 1.8.1\",\n]\n[[package]]\n@@ -218,7 +217,7 @@ dependencies = [\n\"http 0.2.4\",\n\"log\",\n\"openssl\",\n- \"tokio-openssl 0.6.1\",\n+ \"tokio-openssl 0.6.2\",\n\"tokio-util\",\n]\n@@ -252,7 +251,7 @@ dependencies = [\n\"h2 0.1.26\",\n\"http 0.1.21\",\n\"httparse\",\n- \"language-tags\",\n+ \"language-tags 0.2.2\",\n\"lazy_static\",\n\"lazycell\",\n\"log\",\n@@ -287,9 +286,9 @@ dependencies = [\n[[package]]\nname = \"actix-web\"\n-version = \"4.0.0-beta.6\"\n+version = \"4.0.0-beta.8\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ff12e933051557d700b0fcad20fe25b9ca38395cc87bbc5aeaddaef17b937a2f\"\n+checksum = \"c503f726f895e55dac39adeafd14b5ee00cc956796314e9227fc7ae2e176f443\"\ndependencies = [\n\"actix-codec\",\n\"actix-http\",\n@@ -303,16 +302,18 @@ dependencies = [\n\"actix-web-codegen\",\n\"ahash\",\n\"bytes 1.0.1\",\n+ \"cfg-if 1.0.0\",\n\"derive_more\",\n\"either\",\n\"encoding_rs\",\n\"futures-core\",\n\"futures-util\",\n\"itoa\",\n- \"language-tags\",\n+ \"language-tags 0.3.2\",\n\"log\",\n\"mime\",\n\"once_cell\",\n+ \"paste\",\n\"pin-project\",\n\"regex\",\n\"serde 1.0.126\",\n@@ -320,19 +321,19 @@ dependencies = [\n\"serde_urlencoded 0.7.0\",\n\"smallvec 1.6.1\",\n\"socket2 0.4.0\",\n- \"time 0.2.26\",\n+ \"time 0.2.27\",\n\"url 2.2.2\",\n]\n[[package]]\nname = \"actix-web-codegen\"\n-version = \"0.5.0-beta.2\"\n+version = \"0.5.0-beta.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7f138ac357a674c3b480ddb7bbd894b13c1b6e8927d728bc9ea5e17eee2f8fc9\"\n+checksum = \"0d048c6986743105c1e8e9729fbc8d5d1667f2f62393a58be8d85a7d9a5a6c8d\"\ndependencies = [\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n]\n[[package]]\n@@ -364,7 +365,7 @@ checksum = \"b95aceadaf327f18f0df5962fedc1bde2f870566a0b9f65c89508a3b1f79334c\"\ndependencies = [\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n]\n[[package]]\n@@ -375,7 +376,7 @@ checksum = \"6d44b8fee1ced9671ba043476deddef739dd0959bf77030b26b738cc591737a7\"\ndependencies = [\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n]\n[[package]]\n@@ -418,7 +419,7 @@ name = \"althea_kernel_interface\"\nversion = \"0.1.0\"\ndependencies = [\n\"althea_types\",\n- \"itertools 0.10.0\",\n+ \"itertools 0.10.1\",\n\"lazy_static\",\n\"log\",\n\"oping\",\n@@ -448,7 +449,7 @@ dependencies = [\n\"lettre\",\n\"num256\",\n\"phonenumber\",\n- \"rand 0.8.3\",\n+ \"rand 0.8.4\",\n\"serde 1.0.126\",\n\"serde_derive\",\n\"serde_json\",\n@@ -468,7 +469,7 @@ dependencies = [\n\"lazy_static\",\n\"log\",\n\"oping\",\n- \"rand 0.8.3\",\n+ \"rand 0.8.4\",\n\"serde 1.0.126\",\n\"serde_json\",\n\"sodiumoxide\",\n@@ -483,7 +484,7 @@ dependencies = [\n\"failure\",\n\"lazy_static\",\n\"log\",\n- \"rand 0.8.3\",\n+ \"rand 0.8.4\",\n\"serde 1.0.126\",\n\"serde_derive\",\n\"serde_json\",\n@@ -559,10 +560,10 @@ dependencies = [\n\"log\",\n\"num 0.4.0\",\n\"num256\",\n- \"rand 0.8.3\",\n+ \"rand 0.8.4\",\n\"serde 1.0.126\",\n\"serde_derive\",\n- \"web30 0.14.0\",\n+ \"web30 0.14.6\",\n]\n[[package]]\n@@ -579,9 +580,9 @@ checksum = \"cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a\"\n[[package]]\nname = \"awc\"\n-version = \"3.0.0-beta.5\"\n+version = \"3.0.0-beta.7\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d8bea03ceedb5bc5d1696f0d800dfcb81cf3d1991eed1c84ae00306eb74b2d70\"\n+checksum = \"364ef81705bf38403a3c3da4fab9eeec1e1503cd72dd6cd7c4259d2a6b08aa98\"\ndependencies = [\n\"actix-codec\",\n\"actix-http\",\n@@ -589,6 +590,7 @@ dependencies = [\n\"actix-service\",\n\"base64 0.13.0\",\n\"bytes 1.0.1\",\n+ \"cfg-if 1.0.0\",\n\"derive_more\",\n\"futures-core\",\n\"itoa\",\n@@ -597,7 +599,7 @@ dependencies = [\n\"openssl\",\n\"percent-encoding 2.1.0\",\n\"pin-project-lite\",\n- \"rand 0.8.3\",\n+ \"rand 0.8.4\",\n\"serde 1.0.126\",\n\"serde_json\",\n\"serde_urlencoded 0.7.0\",\n@@ -640,7 +642,7 @@ checksum = \"9fe17f59a06fe8b87a6fc8bf53bb70b3aba76d7685f432487a68cd5552853625\"\ndependencies = [\n\"getrandom\",\n\"instant\",\n- \"rand 0.8.3\",\n+ \"rand 0.8.4\",\n]\n[[package]]\n@@ -752,26 +754,6 @@ version = \"0.2.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae\"\n-[[package]]\n-name = \"brotli-sys\"\n-version = \"0.3.2\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd\"\n-dependencies = [\n- \"cc\",\n- \"libc\",\n-]\n-\n-[[package]]\n-name = \"brotli2\"\n-version = \"0.3.2\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e\"\n-dependencies = [\n- \"brotli-sys\",\n- \"libc\",\n-]\n-\n[[package]]\nname = \"bufstream\"\nversion = \"0.1.4\"\n@@ -832,6 +814,9 @@ name = \"cc\"\nversion = \"1.0.68\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787\"\n+dependencies = [\n+ \"jobserver\",\n+]\n[[package]]\nname = \"cfg-if\"\n@@ -860,9 +845,9 @@ dependencies = [\n[[package]]\nname = \"clarity\"\n-version = \"0.4.10\"\n+version = \"0.4.11\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f9a71f164b576fc638513be84beb1b2173a18ce1639d2ac9c9054e46f361e4e0\"\n+checksum = \"3c4d0255e48d61f1a33e9aab934613f3e44deb22b401c9199705ae54438f68cf\"\ndependencies = [\n\"lazy_static\",\n\"num-bigint 0.4.0\",\n@@ -897,7 +882,7 @@ dependencies = [\n\"ipgen\",\n\"lazy_static\",\n\"log\",\n- \"rand 0.8.3\",\n+ \"rand 0.8.4\",\n\"regex\",\n\"serde 1.0.126\",\n\"serde_derive\",\n@@ -919,9 +904,9 @@ dependencies = [\n[[package]]\nname = \"compressed_log\"\n-version = \"0.3.4\"\n+version = \"0.3.8\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"988a21770ae28427f5a507fe6c01d4f9f004e67a3b087603e439153589b39648\"\n+checksum = \"b282eec1026cb8d3210fce1c52d2348c63ec43a3015e3ed037cf5d1d807f61c3\"\ndependencies = [\n\"actix 0.11.1\",\n\"awc\",\n@@ -991,9 +976,9 @@ checksum = \"ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b\"\n[[package]]\nname = \"cpufeatures\"\n-version = \"0.1.4\"\n+version = \"0.1.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ed00c67cb5d0a7d64a44f6ad2668db7e7530311dd53ea79bcd4fb022c64911c8\"\n+checksum = \"66c99696f6c9dd7f35d486b9d04d7e6e202aa3e8c40d553f2fdf5e7e0c6a71ef\"\ndependencies = [\n\"libc\",\n]\n@@ -1106,21 +1091,22 @@ dependencies = [\n[[package]]\nname = \"derive_more\"\n-version = \"0.99.14\"\n+version = \"0.99.16\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5cc7b9cef1e351660e5443924e4f43ab25fbbed3e9a5f052df3677deb4d6b320\"\n+checksum = \"40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df\"\ndependencies = [\n\"convert_case\",\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"rustc_version 0.3.3\",\n+ \"syn 1.0.73\",\n]\n[[package]]\nname = \"diesel\"\n-version = \"1.4.6\"\n+version = \"1.4.7\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"047bfc4d5c3bd2ef6ca6f981941046113524b9a9f9a7cbdfdd7ff40f58e6f542\"\n+checksum = \"bba51ca66f57261fd17cadf8b73e4775cc307d0521d855de3f5de91a8f074e0e\"\ndependencies = [\n\"bitflags\",\n\"byteorder\",\n@@ -1137,7 +1123,7 @@ checksum = \"45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3\"\ndependencies = [\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n]\n[[package]]\n@@ -1194,6 +1180,15 @@ version = \"0.4.8\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0\"\n+[[package]]\n+name = \"ed25519\"\n+version = \"1.1.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"8d0860415b12243916284c67a9be413e044ee6668247b99ba26d94b2bc06c8f6\"\n+dependencies = [\n+ \"signature\",\n+]\n+\n[[package]]\nname = \"either\"\nversion = \"1.6.1\"\n@@ -1290,9 +1285,9 @@ dependencies = [\n[[package]]\nname = \"env_logger\"\n-version = \"0.8.3\"\n+version = \"0.8.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"17392a012ea30ef05a610aa97dfb49496e71c9f676b27879922ea5bdf60d9d3f\"\n+checksum = \"a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3\"\ndependencies = [\n\"atty\",\n\"humantime\",\n@@ -1342,7 +1337,7 @@ dependencies = [\n\"proc-macro-error\",\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n]\n[[package]]\n@@ -1363,7 +1358,7 @@ checksum = \"aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4\"\ndependencies = [\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n\"synstructure\",\n]\n@@ -1527,7 +1522,7 @@ dependencies = [\n\"proc-macro-hack\",\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n]\n[[package]]\n@@ -1669,16 +1664,16 @@ dependencies = [\n\"http 0.2.4\",\n\"indexmap\",\n\"slab\",\n- \"tokio 1.6.1\",\n+ \"tokio 1.8.1\",\n\"tokio-util\",\n\"tracing\",\n]\n[[package]]\nname = \"handlebars\"\n-version = \"4.0.0\"\n+version = \"4.1.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"28f0fe89affef47e2c9729030a8f6e79df34cb66b8a44ecf91dad43f31150559\"\n+checksum = \"72a0ffab8c36d0436114310c7e10b59b3307e650ddfabf6d006028e29a70c6e6\"\ndependencies = [\n\"log\",\n\"pest\",\n@@ -1690,15 +1685,15 @@ dependencies = [\n[[package]]\nname = \"hashbrown\"\n-version = \"0.9.1\"\n+version = \"0.11.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04\"\n+checksum = \"ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e\"\n[[package]]\nname = \"hermit-abi\"\n-version = \"0.1.18\"\n+version = \"0.1.19\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c\"\n+checksum = \"62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33\"\ndependencies = [\n\"libc\",\n]\n@@ -1711,9 +1706,9 @@ checksum = \"7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70\"\n[[package]]\nname = \"hex-literal\"\n-version = \"0.3.1\"\n+version = \"0.3.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5af1f635ef1bc545d78392b136bfe1c9809e029023c84a3638a864a10b8819c8\"\n+checksum = \"76505e26b6ca3bbdbbb360b68472abbb80998c5fa5dc43672eca34f28258e138\"\n[[package]]\nname = \"hostname\"\n@@ -1789,9 +1784,9 @@ checksum = \"9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4\"\n[[package]]\nname = \"hyper\"\n-version = \"0.14.8\"\n+version = \"0.14.10\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d3f71a7eea53a3f8257a7b4795373ff886397178cd634430ea94e12d7fe4fe34\"\n+checksum = \"7728a72c4c7d72665fde02204bcbd93b247721025b222ef78606f14513e0fd03\"\ndependencies = [\n\"bytes 1.0.1\",\n\"futures-channel\",\n@@ -1803,9 +1798,9 @@ dependencies = [\n\"httparse\",\n\"httpdate\",\n\"itoa\",\n- \"pin-project\",\n+ \"pin-project-lite\",\n\"socket2 0.4.0\",\n- \"tokio 1.6.1\",\n+ \"tokio 1.8.1\",\n\"tower-service 0.3.1\",\n\"tracing\",\n\"want\",\n@@ -1820,7 +1815,7 @@ dependencies = [\n\"bytes 1.0.1\",\n\"hyper\",\n\"native-tls\",\n- \"tokio 1.6.1\",\n+ \"tokio 1.8.1\",\n\"tokio-native-tls\",\n]\n@@ -1848,9 +1843,9 @@ dependencies = [\n[[package]]\nname = \"indexmap\"\n-version = \"1.6.2\"\n+version = \"1.7.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3\"\n+checksum = \"bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5\"\ndependencies = [\n\"autocfg 1.0.1\",\n\"hashbrown\",\n@@ -1899,9 +1894,9 @@ dependencies = [\n[[package]]\nname = \"ipnet\"\n-version = \"2.3.0\"\n+version = \"2.3.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135\"\n+checksum = \"68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9\"\n[[package]]\nname = \"ipnetwork\"\n@@ -1929,9 +1924,9 @@ dependencies = [\n[[package]]\nname = \"itertools\"\n-version = \"0.10.0\"\n+version = \"0.10.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319\"\n+checksum = \"69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf\"\ndependencies = [\n\"either\",\n]\n@@ -1963,6 +1958,15 @@ dependencies = [\n\"libc\",\n]\n+[[package]]\n+name = \"jobserver\"\n+version = \"0.1.22\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"972f5ae5d1cb9c6ae417789196c803205313edde988685da5e3aae0827b9e7fd\"\n+dependencies = [\n+ \"libc\",\n+]\n+\n[[package]]\nname = \"js-sys\"\nversion = \"0.3.51\"\n@@ -1994,6 +1998,12 @@ version = \"0.2.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a\"\n+[[package]]\n+name = \"language-tags\"\n+version = \"0.3.2\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388\"\n+\n[[package]]\nname = \"lazy_static\"\nversion = \"1.4.0\"\n@@ -2053,19 +2063,20 @@ dependencies = [\n[[package]]\nname = \"libc\"\n-version = \"0.2.95\"\n+version = \"0.2.98\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"789da6d93f1b866ffe175afc5322a4d76c038605a1c3319bb57b06967ca98a36\"\n+checksum = \"320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790\"\n[[package]]\nname = \"libsodium-sys\"\n-version = \"0.2.6\"\n+version = \"0.2.7\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a685b64f837b339074115f2e7f7b431ac73681d08d75b389db7498b8892b8a58\"\n+checksum = \"6b779387cd56adfbc02ea4a668e704f729be8d6a6abd2c27ca5ee537849a92fd\"\ndependencies = [\n\"cc\",\n\"libc\",\n\"pkg-config\",\n+ \"walkdir\",\n]\n[[package]]\n@@ -2230,9 +2241,9 @@ dependencies = [\n[[package]]\nname = \"mio\"\n-version = \"0.7.11\"\n+version = \"0.7.13\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"cf80d3e903b34e0bd7282b218398aec54e082c840d9baf8339e0080a0c542956\"\n+checksum = \"8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16\"\ndependencies = [\n\"libc\",\n\"log\",\n@@ -2285,7 +2296,7 @@ dependencies = [\n\"httparse\",\n\"lazy_static\",\n\"log\",\n- \"rand 0.8.3\",\n+ \"rand 0.8.4\",\n\"regex\",\n\"serde_json\",\n\"serde_urlencoded 0.7.0\",\n@@ -2434,7 +2445,7 @@ checksum = \"876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d\"\ndependencies = [\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n]\n[[package]]\n@@ -2526,18 +2537,18 @@ dependencies = [\n[[package]]\nname = \"object\"\n-version = \"0.25.2\"\n+version = \"0.25.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f8bc1d42047cf336f0f939c99e97183cf31551bf0f2865a2ec9c8d91fd4ffb5e\"\n+checksum = \"a38f2be3697a57b4060074ff41b44c16870d916ad7877c17696e063257482bc7\"\ndependencies = [\n\"memchr\",\n]\n[[package]]\nname = \"once_cell\"\n-version = \"1.7.2\"\n+version = \"1.8.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3\"\n+checksum = \"692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56\"\n[[package]]\nname = \"oncemutex\"\n@@ -2559,9 +2570,9 @@ checksum = \"624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5\"\n[[package]]\nname = \"openssl\"\n-version = \"0.10.34\"\n+version = \"0.10.35\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6d7830286ad6a3973c0f1d9b73738f69c76b739301d0229c4b96501695cbe4c8\"\n+checksum = \"549430950c79ae24e6d02e0b7404534ecf311d94cc9f861e9e4020187d13d885\"\ndependencies = [\n\"bitflags\",\n\"cfg-if 1.0.0\",\n@@ -2588,9 +2599,9 @@ dependencies = [\n[[package]]\nname = \"openssl-sys\"\n-version = \"0.9.63\"\n+version = \"0.9.65\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b6b0d6fb7d80f877617dfcb014e605e2b5ab2fb0afdf27935219bb6bd984cb98\"\n+checksum = \"7a7907e3bfa08bb85105209cdfcb6c63d109f8f6c1ed6ca318fff5c1853fbc1d\"\ndependencies = [\n\"autocfg 1.0.1\",\n\"cc\",\n@@ -2638,7 +2649,7 @@ checksum = \"f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252\"\ndependencies = [\n\"lock_api 0.3.4\",\n\"parking_lot_core 0.6.2\",\n- \"rustc_version\",\n+ \"rustc_version 0.2.3\",\n]\n[[package]]\n@@ -2660,7 +2671,7 @@ checksum = \"94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9\"\ndependencies = [\n\"libc\",\n\"rand 0.6.5\",\n- \"rustc_version\",\n+ \"rustc_version 0.2.3\",\n\"smallvec 0.6.14\",\n\"winapi 0.3.9\",\n]\n@@ -2675,7 +2686,7 @@ dependencies = [\n\"cloudabi\",\n\"libc\",\n\"redox_syscall 0.1.57\",\n- \"rustc_version\",\n+ \"rustc_version 0.2.3\",\n\"smallvec 0.6.14\",\n\"winapi 0.3.9\",\n]\n@@ -2689,7 +2700,7 @@ dependencies = [\n\"cfg-if 1.0.0\",\n\"instant\",\n\"libc\",\n- \"redox_syscall 0.2.8\",\n+ \"redox_syscall 0.2.9\",\n\"smallvec 1.6.1\",\n\"winapi 0.3.9\",\n]\n@@ -2741,7 +2752,7 @@ dependencies = [\n\"pest_meta\",\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n]\n[[package]]\n@@ -2792,14 +2803,14 @@ checksum = \"48c950132583b500556b1efd71d45b319029f2b71518d979fcc208e16b42426f\"\ndependencies = [\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n]\n[[package]]\nname = \"pin-project-lite\"\n-version = \"0.2.6\"\n+version = \"0.2.7\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905\"\n+checksum = \"8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443\"\n[[package]]\nname = \"pin-utils\"\n@@ -2837,7 +2848,7 @@ dependencies = [\n\"proc-macro-error-attr\",\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n\"version_check 0.9.3\",\n]\n@@ -2979,14 +2990,14 @@ dependencies = [\n[[package]]\nname = \"rand\"\n-version = \"0.8.3\"\n+version = \"0.8.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e\"\n+checksum = \"2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8\"\ndependencies = [\n\"libc\",\n- \"rand_chacha 0.3.0\",\n- \"rand_core 0.6.2\",\n- \"rand_hc 0.3.0\",\n+ \"rand_chacha 0.3.1\",\n+ \"rand_core 0.6.3\",\n+ \"rand_hc 0.3.1\",\n]\n[[package]]\n@@ -3001,12 +3012,12 @@ dependencies = [\n[[package]]\nname = \"rand_chacha\"\n-version = \"0.3.0\"\n+version = \"0.3.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d\"\n+checksum = \"e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88\"\ndependencies = [\n\"ppv-lite86\",\n- \"rand_core 0.6.2\",\n+ \"rand_core 0.6.3\",\n]\n[[package]]\n@@ -3026,9 +3037,9 @@ checksum = \"9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc\"\n[[package]]\nname = \"rand_core\"\n-version = \"0.6.2\"\n+version = \"0.6.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7\"\n+checksum = \"d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7\"\ndependencies = [\n\"getrandom\",\n]\n@@ -3044,11 +3055,11 @@ dependencies = [\n[[package]]\nname = \"rand_hc\"\n-version = \"0.3.0\"\n+version = \"0.3.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73\"\n+checksum = \"d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7\"\ndependencies = [\n- \"rand_core 0.6.2\",\n+ \"rand_core 0.6.3\",\n]\n[[package]]\n@@ -3121,9 +3132,9 @@ checksum = \"41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce\"\n[[package]]\nname = \"redox_syscall\"\n-version = \"0.2.8\"\n+version = \"0.2.9\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc\"\n+checksum = \"5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee\"\ndependencies = [\n\"bitflags\",\n]\n@@ -3168,9 +3179,9 @@ dependencies = [\n[[package]]\nname = \"reqwest\"\n-version = \"0.11.3\"\n+version = \"0.11.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"2296f2fac53979e8ccbc4a1136b25dcefd37be9ed7e4a1f6b05a6029c84ff124\"\n+checksum = \"246e9f61b9bb77df069a947682be06e31ac43ea37862e244a69f177694ea6d22\"\ndependencies = [\n\"base64 0.13.0\",\n\"bytes 1.0.1\",\n@@ -3192,7 +3203,7 @@ dependencies = [\n\"serde 1.0.126\",\n\"serde_json\",\n\"serde_urlencoded 0.7.0\",\n- \"tokio 1.6.1\",\n+ \"tokio 1.8.1\",\n\"tokio-native-tls\",\n\"url 2.2.2\",\n\"wasm-bindgen\",\n@@ -3218,7 +3229,7 @@ dependencies = [\n\"actix 0.11.1\",\n\"actix 0.7.11\",\n\"actix-web 0.7.19\",\n- \"actix-web 4.0.0-beta.6\",\n+ \"actix-web 4.0.0-beta.8\",\n\"actix-web-httpauth\",\n\"actix_derive 0.5.0\",\n\"althea_kernel_interface\",\n@@ -3260,7 +3271,7 @@ dependencies = [\n\"openssl-probe\",\n\"phonenumber\",\n\"r2d2\",\n- \"rand 0.8.3\",\n+ \"rand 0.8.4\",\n\"regex\",\n\"reqwest\",\n\"serde 1.0.126\",\n@@ -3273,7 +3284,7 @@ dependencies = [\n\"tokio-codec\",\n\"tokio-io\",\n\"trust-dns-resolver\",\n- \"web30 0.14.0\",\n+ \"web30 0.14.6\",\n\"web30 0.4.3\",\n]\n@@ -3285,9 +3296,9 @@ checksum = \"3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2\"\n[[package]]\nname = \"rustc-demangle\"\n-version = \"0.1.19\"\n+version = \"0.1.20\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"410f7acf3cb3a44527c5d9546bad4bf4e6c460915d5f9f2fc524498bfe8f70ce\"\n+checksum = \"dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49\"\n[[package]]\nname = \"rustc_version\"\n@@ -3295,7 +3306,16 @@ version = \"0.2.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a\"\ndependencies = [\n- \"semver\",\n+ \"semver 0.9.0\",\n+]\n+\n+[[package]]\n+name = \"rustc_version\"\n+version = \"0.3.3\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee\"\n+dependencies = [\n+ \"semver 0.11.0\",\n]\n[[package]]\n@@ -3310,6 +3330,15 @@ version = \"0.3.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072\"\n+[[package]]\n+name = \"same-file\"\n+version = \"1.0.6\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502\"\n+dependencies = [\n+ \"winapi-util\",\n+]\n+\n[[package]]\nname = \"schannel\"\nversion = \"0.1.19\"\n@@ -3343,27 +3372,27 @@ checksum = \"d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd\"\n[[package]]\nname = \"secp256k1\"\n-version = \"0.20.2\"\n+version = \"0.20.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ee5070fdc6f26ca5be6dcfc3d07c76fdb974a63a8b246b459854274145f5a258\"\n+checksum = \"97d03ceae636d0fed5bae6a7f4f664354c5f4fcedf6eef053fef17e49f837d0a\"\ndependencies = [\n\"secp256k1-sys\",\n]\n[[package]]\nname = \"secp256k1-sys\"\n-version = \"0.4.0\"\n+version = \"0.4.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"67e4b6455ee49f5901c8985b88f98fb0a0e1d90a6661f5a03f4888bd987dad29\"\n+checksum = \"827cb7cce42533829c792fc51b82fbf18b125b45a702ef2c8be77fce65463a7b\"\ndependencies = [\n\"cc\",\n]\n[[package]]\nname = \"security-framework\"\n-version = \"2.3.0\"\n+version = \"2.3.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b239a3d5db51252f6f48f42172c65317f37202f4a21021bf5f9d40a408f4592c\"\n+checksum = \"23a2ac85147a3a11d77ecf1bc7166ec0b92febfa4461c37944e180f319ece467\"\ndependencies = [\n\"bitflags\",\n\"core-foundation\",\n@@ -3388,7 +3417,16 @@ version = \"0.9.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403\"\ndependencies = [\n- \"semver-parser\",\n+ \"semver-parser 0.7.0\",\n+]\n+\n+[[package]]\n+name = \"semver\"\n+version = \"0.11.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6\"\n+dependencies = [\n+ \"semver-parser 0.10.2\",\n]\n[[package]]\n@@ -3397,6 +3435,15 @@ version = \"0.7.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3\"\n+[[package]]\n+name = \"semver-parser\"\n+version = \"0.10.2\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7\"\n+dependencies = [\n+ \"pest\",\n+]\n+\n[[package]]\nname = \"serde\"\nversion = \"0.8.23\"\n@@ -3453,7 +3500,7 @@ checksum = \"963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43\"\ndependencies = [\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n]\n[[package]]\n@@ -3565,6 +3612,12 @@ dependencies = [\n\"libc\",\n]\n+[[package]]\n+name = \"signature\"\n+version = \"1.3.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"c19772be3c4dd2ceaacf03cb41d5885f2a02c4d8804884918e3a258480803335\"\n+\n[[package]]\nname = \"slab\"\nversion = \"0.4.3\"\n@@ -3609,10 +3662,11 @@ dependencies = [\n[[package]]\nname = \"sodiumoxide\"\n-version = \"0.2.6\"\n+version = \"0.2.7\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7038b67c941e23501573cb7242ffb08709abe9b11eb74bceff875bbda024a6a8\"\n+checksum = \"e26be3acb6c2d9a7aac28482586a7856436af4cfe7100031d219de2d2ecb0028\"\ndependencies = [\n+ \"ed25519\",\n\"libc\",\n\"libsodium-sys\",\n\"serde 1.0.126\",\n@@ -3646,7 +3700,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5\"\ndependencies = [\n\"discard\",\n- \"rustc_version\",\n+ \"rustc_version 0.2.3\",\n\"stdweb-derive\",\n\"stdweb-internal-macros\",\n\"stdweb-internal-runtime\",\n@@ -3663,7 +3717,7 @@ dependencies = [\n\"quote 1.0.9\",\n\"serde 1.0.126\",\n\"serde_derive\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n]\n[[package]]\n@@ -3679,7 +3733,7 @@ dependencies = [\n\"serde_derive\",\n\"serde_json\",\n\"sha1\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n]\n[[package]]\n@@ -3722,9 +3776,9 @@ dependencies = [\n[[package]]\nname = \"syn\"\n-version = \"1.0.72\"\n+version = \"1.0.73\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82\"\n+checksum = \"f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7\"\ndependencies = [\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n@@ -3739,7 +3793,7 @@ checksum = \"b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701\"\ndependencies = [\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n\"unicode-xid 0.2.2\",\n]\n@@ -3751,8 +3805,8 @@ checksum = \"dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22\"\ndependencies = [\n\"cfg-if 1.0.0\",\n\"libc\",\n- \"rand 0.8.3\",\n- \"redox_syscall 0.2.8\",\n+ \"rand 0.8.4\",\n+ \"redox_syscall 0.2.9\",\n\"remove_dir_all\",\n\"winapi 0.3.9\",\n]\n@@ -3768,22 +3822,22 @@ dependencies = [\n[[package]]\nname = \"thiserror\"\n-version = \"1.0.25\"\n+version = \"1.0.26\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"fa6f76457f59514c7eeb4e59d891395fab0b2fd1d40723ae737d64153392e9c6\"\n+checksum = \"93119e4feac1cbe6c798c34d3a53ea0026b0b1de6a120deef895137c0529bfe2\"\ndependencies = [\n\"thiserror-impl\",\n]\n[[package]]\nname = \"thiserror-impl\"\n-version = \"1.0.25\"\n+version = \"1.0.26\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8a36768c0fbf1bb15eca10defa29526bda730a2376c2ab4393ccfa16fb1a318d\"\n+checksum = \"060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745\"\ndependencies = [\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n]\n[[package]]\n@@ -3798,9 +3852,9 @@ dependencies = [\n[[package]]\nname = \"time\"\n-version = \"0.2.26\"\n+version = \"0.2.27\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"08a8cbfbf47955132d0202d1662f49b2423ae35862aee471f3ba4b133358f372\"\n+checksum = \"4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242\"\ndependencies = [\n\"const_fn\",\n\"libc\",\n@@ -3823,15 +3877,15 @@ dependencies = [\n[[package]]\nname = \"time-macros-impl\"\n-version = \"0.1.1\"\n+version = \"0.1.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa\"\n+checksum = \"fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f\"\ndependencies = [\n\"proc-macro-hack\",\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n\"standback\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n]\n[[package]]\n@@ -3875,15 +3929,15 @@ dependencies = [\n[[package]]\nname = \"tokio\"\n-version = \"1.6.1\"\n+version = \"1.8.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0a38d31d7831c6ed7aad00aa4c12d9375fd225a6dd77da1d25b707346319a975\"\n+checksum = \"98c8b05dc14c75ea83d63dd391100353789f5f24b8b3866542a5e85c8be8e985\"\ndependencies = [\n\"autocfg 1.0.1\",\n\"bytes 1.0.1\",\n\"libc\",\n\"memchr\",\n- \"mio 0.7.11\",\n+ \"mio 0.7.13\",\n\"num_cpus\",\n\"once_cell\",\n\"parking_lot 0.11.1\",\n@@ -3948,13 +4002,13 @@ dependencies = [\n[[package]]\nname = \"tokio-macros\"\n-version = \"1.2.0\"\n+version = \"1.3.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c49e3df43841dafb86046472506755d8501c5615673955f6aa17181125d13c37\"\n+checksum = \"54473be61f4ebe4efd09cec9bd5d16fa51d70ea0192213d754d2d500457db110\"\ndependencies = [\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n]\n[[package]]\n@@ -3964,7 +4018,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b\"\ndependencies = [\n\"native-tls\",\n- \"tokio 1.6.1\",\n+ \"tokio 1.8.1\",\n]\n[[package]]\n@@ -3980,14 +4034,14 @@ dependencies = [\n[[package]]\nname = \"tokio-openssl\"\n-version = \"0.6.1\"\n+version = \"0.6.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ac1bec5c0a4aa71e3459802c7a12e8912c2091ce2151004f9ce95cc5d1c6124e\"\n+checksum = \"f24cddc8445a4dc8359cdd9e91c19d544fc95f672e32afe8945852b9381a09fe\"\ndependencies = [\n\"futures 0.3.15\",\n\"openssl\",\n- \"pin-project\",\n- \"tokio 1.6.1\",\n+ \"openssl-sys\",\n+ \"tokio 1.8.1\",\n]\n[[package]]\n@@ -4123,7 +4177,7 @@ dependencies = [\n\"futures-sink\",\n\"log\",\n\"pin-project-lite\",\n- \"tokio 1.6.1\",\n+ \"tokio 1.8.1\",\n]\n[[package]]\n@@ -4333,7 +4387,7 @@ dependencies = [\n\"nom 4.2.3\",\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n]\n[[package]]\n@@ -4348,9 +4402,9 @@ dependencies = [\n[[package]]\nname = \"vcpkg\"\n-version = \"0.2.13\"\n+version = \"0.2.15\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"025ce40a007e1907e58d5bc1a594def78e5573bb0b1160bc389634e8f12e4faa\"\n+checksum = \"accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426\"\n[[package]]\nname = \"version_check\"\n@@ -4364,6 +4418,17 @@ version = \"0.9.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe\"\n+[[package]]\n+name = \"walkdir\"\n+version = \"2.3.2\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56\"\n+dependencies = [\n+ \"same-file\",\n+ \"winapi 0.3.9\",\n+ \"winapi-util\",\n+]\n+\n[[package]]\nname = \"want\"\nversion = \"0.3.0\"\n@@ -4403,7 +4468,7 @@ dependencies = [\n\"log\",\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n\"wasm-bindgen-shared\",\n]\n@@ -4437,7 +4502,7 @@ checksum = \"be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97\"\ndependencies = [\n\"proc-macro2 1.0.27\",\n\"quote 1.0.9\",\n- \"syn 1.0.72\",\n+ \"syn 1.0.73\",\n\"wasm-bindgen-backend\",\n\"wasm-bindgen-shared\",\n]\n@@ -4481,21 +4546,21 @@ dependencies = [\n[[package]]\nname = \"web30\"\n-version = \"0.14.0\"\n+version = \"0.14.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d771de6834b84f5fde0e5a7fe0f0d60a220654f4bd5c2f62b1a6708a63493842\"\n+checksum = \"cea94095bcdfd7f4bc36a86f2e8333e455ac0977acc426b39adda1419e1e4107\"\ndependencies = [\n- \"actix 0.11.1\",\n\"awc\",\n\"clarity\",\n\"futures 0.3.15\",\n+ \"lazy_static\",\n\"log\",\n\"num 0.4.0\",\n\"num256\",\n\"serde 1.0.126\",\n\"serde_derive\",\n\"serde_json\",\n- \"tokio 1.6.1\",\n+ \"tokio 1.8.1\",\n]\n[[package]]\n@@ -4592,3 +4657,32 @@ checksum = \"56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85\"\ndependencies = [\n\"linked-hash-map\",\n]\n+\n+[[package]]\n+name = \"zstd\"\n+version = \"0.7.0+zstd.1.4.9\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"9428752481d8372e15b1bf779ea518a179ad6c771cca2d2c60e4fbff3cc2cd52\"\n+dependencies = [\n+ \"zstd-safe\",\n+]\n+\n+[[package]]\n+name = \"zstd-safe\"\n+version = \"3.1.0+zstd.1.4.9\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"5aa1926623ad7fe406e090555387daf73db555b948134b4d73eac5eb08fb666d\"\n+dependencies = [\n+ \"libc\",\n+ \"zstd-sys\",\n+]\n+\n+[[package]]\n+name = \"zstd-sys\"\n+version = \"1.5.0+zstd.1.4.9\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"4e6c094340240369025fc6b731b054ee2a834328fa584310ac96aa4baebdc465\"\n+dependencies = [\n+ \"cc\",\n+ \"libc\",\n+]\n" }, { "change_type": "MODIFY", "old_path": "rita/Cargo.toml", "new_path": "rita/Cargo.toml", "diff": "@@ -30,9 +30,9 @@ web30 = {git = \"https://github.com/althea-net/web30\", rev = \"a600b8b8ebf2c49bade\n# duplicate async dependencies, we are currently carrying both futures 0.1 and modern async/await dependencies\n# these will be kept here for quite some time until the switch is completed.\n-async-web30 = {package=\"web30\", version = \"0.14\"}\n+async-web30 = {package=\"web30\", version = \"0.14.6\"}\nactix-async = {package=\"actix\", version = \"0.11\"}\n-actix-web-async = {package=\"actix-web\", version = \"4.0.0-beta.6\", default_features = false, features= [\"openssl\"] }\n+actix-web-async = {package=\"actix-web\", version = \"4.0.0-beta.8\", default_features = false, features= [\"openssl\"] }\nactix = \"0.7\"\nactix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\n@@ -72,7 +72,7 @@ r2d2 = \"0.8\"\nsha3 = \"0.9\"\nhex-literal = \"0.3\"\nsodiumoxide = \"0.2\"\n-compressed_log = \"0.3.4\"\n+compressed_log = \"0.3\"\nflate2 = { version = \"1.0\", features = [\"rust_backend\"], default-features = false }\nreqwest = { version = \"0.11\", features = [\"blocking\", \"json\"] }\njemallocator = {version = \"0.3\", optional = true}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Upgrade transitive deps, web30, actix This updates all transitive deps, as well as the async versions of web30 and actix. The primary diver of this update is to be post London hardfork compatible for sending transactions on both Ethereum and Xdai.
20,255
14.07.2021 15:22:07
25,200
87375d13b4c7f8906b43abbfb5a6b16a5b294d1f
Migrated PeerListener to synchronous code
[ { "change_type": "MODIFY", "old_path": "rita/src/rita_client/dashboard/interfaces.rs", "new_path": "rita/src/rita_client/dashboard/interfaces.rs", "diff": "//! A generalized interface for modifying networking interface assignments using UCI\n-use crate::rita_common::peer_listener::PeerListener;\n-use crate::rita_common::peer_listener::UnListen;\n+use crate::rita_common::peer_listener::unlisten_interface;\nuse crate::ARGS;\nuse crate::KI;\nuse crate::SETTING;\n-use actix::SystemService;\nuse actix_web::Path;\nuse actix_web::{HttpRequest, HttpResponse, Json};\nuse failure::Error;\n@@ -228,7 +226,7 @@ pub fn ethernet_transform_mode(\n// listening then we can remove the section, we also need to remove it\n// from the config\nInterfaceMode::Mesh => {\n- PeerListener::from_registry().do_send(UnListen(ifname.to_string()));\n+ unlisten_interface(ifname.to_string());\nSETTING.get_network_mut().peer_interfaces.remove(ifname);\nlet ret = KI.del_uci_var(&filtered_ifname);\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/peer_listener/mod.rs", "new_path": "rita/src/rita_common/peer_listener/mod.rs", "diff": "mod message;\nuse self::message::PeerMessage;\n-use crate::rita_common::rita_loop::fast_loop::Tick;\nuse crate::KI;\nuse crate::SETTING;\n-use ::actix::{Actor, Context};\n-use ::actix::{Handler, Message, Supervised, SystemService};\nuse failure::Error;\nuse settings::RitaCommonSettings;\nuse std::collections::HashMap;\nuse std::net::{IpAddr, Ipv6Addr, SocketAddr, SocketAddrV6, UdpSocket};\n+use std::sync::Arc;\n+use std::sync::RwLock;\n+\n+lazy_static! {\n+ static ref PEER_LISTENER: Arc<RwLock<PeerListener>> =\n+ Arc::new(RwLock::new(PeerListener::default()));\n+}\n#[derive(Debug)]\npub struct PeerListener {\n@@ -43,10 +47,6 @@ impl Peer {\n}\n}\n-impl Actor for PeerListener {\n- type Context = Context<Self>;\n-}\n-\nimpl Default for PeerListener {\nfn default() -> PeerListener {\nPeerListener::new().unwrap()\n@@ -62,17 +62,15 @@ impl PeerListener {\n}\n}\n-impl Supervised for PeerListener {}\n-\n-impl PeerListener {\n- fn listen_to_available_ifaces(&mut self) {\n+fn listen_to_available_ifaces(peer_listener: &mut PeerListener) {\nlet interfaces = SETTING.get_network().peer_interfaces.clone();\nlet iface_list = interfaces;\nfor iface in iface_list.iter() {\n- if !self.interfaces.contains_key(iface) {\n+ if !peer_listener.interfaces.contains_key(iface) {\nmatch ListenInterface::new(iface) {\nOk(new_listen_interface) => {\n- self.interfaces\n+ peer_listener\n+ .interfaces\n.insert(new_listen_interface.ifname.clone(), new_listen_interface);\n}\nErr(_e) => {}\n@@ -80,82 +78,25 @@ impl PeerListener {\n}\n}\n}\n-}\n-\n-impl SystemService for PeerListener {\n- // Binds to all ready interfaces\n- fn service_started(&mut self, _ctx: &mut Context<Self>) {\n- info!(\"PeerListener starting\");\n- self.listen_to_available_ifaces();\n- }\n-}\n-impl Handler<Tick> for PeerListener {\n- type Result = Result<(), Error>;\n- fn handle(&mut self, _: Tick, _ctx: &mut Context<Self>) -> Self::Result {\n+pub fn tick() {\ntrace!(\"Starting PeerListener tick!\");\n- send_im_here(&mut self.interfaces);\n-\n- self.peers = receive_im_here(&mut self.interfaces);\n-\n- self.listen_to_available_ifaces();\n-\n- Ok(())\n- }\n-}\n-\n-// message containing interface name as a string\n-pub struct Listen(pub String);\n-impl Message for Listen {\n- type Result = ();\n-}\n-\n-/// Adds a given interface to the list of interfaces on which peers can be found\n-/// and contacted\n-impl Handler<Listen> for PeerListener {\n- type Result = ();\n- fn handle(&mut self, listen: Listen, _: &mut Context<Self>) -> Self::Result {\n- trace!(\"Peerlistener listen on {:?}\", listen.0);\n- let new_iface_name = listen.0;\n+ let mut writer = PEER_LISTENER.write().unwrap();\n+ send_im_here(&mut writer.interfaces);\n- if self.interfaces.contains_key(&new_iface_name) {\n- error!(\"Someone attempted a double listen!\");\n- return;\n- }\n-\n- let new_iface = ListenInterface::new(&new_iface_name);\n- match new_iface {\n- Ok(n) => {\n- SETTING\n- .get_network_mut()\n- .peer_interfaces\n- .insert(new_iface_name.clone());\n- self.interfaces.insert(new_iface_name, n);\n- }\n- Err(e) => {\n- error!(\"Peer listener failed to listen on {:?}\", e);\n- }\n- }\n- }\n-}\n+ (*writer).peers = receive_im_here(&mut writer.interfaces);\n-// message containing interface name as a string\n-pub struct UnListen(pub String);\n-impl Message for UnListen {\n- type Result = ();\n+ listen_to_available_ifaces(&mut writer);\n}\n-/// Removes a given interface to the list of interfaces on which peers can be found\n-/// and contacted\n-impl Handler<UnListen> for PeerListener {\n- type Result = ();\n-\n- fn handle(&mut self, un_listen: UnListen, _: &mut Context<Self>) -> Self::Result {\n- trace!(\"Peerlistener unlisten on {:?}\", un_listen.0);\n- let ifname_to_delete = un_listen.0;\n- if self.interfaces.contains_key(&ifname_to_delete) {\n- self.interfaces.remove(&ifname_to_delete);\n+#[allow(dead_code)]\n+pub fn unlisten_interface(interface: String) {\n+ trace!(\"Peerlistener unlisten on {:?}\", interface);\n+ let ifname_to_delete = interface;\n+ let mut writer = PEER_LISTENER.write().unwrap();\n+ if writer.interfaces.contains_key(&ifname_to_delete) {\n+ writer.interfaces.remove(&ifname_to_delete);\nSETTING\n.get_network_mut()\n.peer_interfaces\n@@ -164,20 +105,9 @@ impl Handler<UnListen> for PeerListener {\nerror!(\"Tried to unlisten interface that's not present!\")\n}\n}\n-}\n-#[derive(Debug)]\n-pub struct GetPeers();\n-impl Message for GetPeers {\n- type Result = Result<HashMap<IpAddr, Peer>, Error>;\n-}\n-\n-impl Handler<GetPeers> for PeerListener {\n- type Result = Result<HashMap<IpAddr, Peer>, Error>;\n-\n- fn handle(&mut self, _: GetPeers, _: &mut Context<Self>) -> Self::Result {\n- Ok(self.peers.clone())\n- }\n+pub fn get_peers() -> HashMap<IpAddr, Peer> {\n+ PEER_LISTENER.read().unwrap().peers.clone()\n}\n#[derive(Debug)]\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": "@@ -3,8 +3,8 @@ use crate::rita_common::debt_keeper::send_debt_update;\nuse crate::rita_common::network_monitor::NetworkInfo as NetworkMonitorTick;\nuse crate::rita_common::network_monitor::NetworkMonitor;\nuse crate::rita_common::payment_validator::validate;\n-use crate::rita_common::peer_listener::GetPeers;\n-use crate::rita_common::peer_listener::PeerListener;\n+use crate::rita_common::peer_listener::get_peers;\n+use crate::rita_common::peer_listener::tick;\nuse crate::rita_common::rita_loop::set_gateway;\nuse crate::rita_common::traffic_watcher::{TrafficWatcher, Watch};\nuse crate::rita_common::tunnel_manager::gc::TriggerGc;\n@@ -198,43 +198,26 @@ impl Handler<Tick> for RitaFastLoop {\nlet start = Instant::now();\ntrace!(\"Starting PeerListener tick\");\n- Arbiter::spawn(\n- PeerListener::from_registry()\n- .send(Tick {})\n- .timeout(FAST_LOOP_TIMEOUT)\n- .then(move |res| {\n+\n+ tick();\n+\ninfo!(\n- \"PeerListener tick completed in {}s {}ms, with result {:?}\",\n+ \"PeerListener tick completed in {}s {}ms\",\nstart.elapsed().as_secs(),\nstart.elapsed().subsec_millis(),\n- res\n- );\n- res\n- })\n- .then(|_| Ok(())),\n);\nlet start = Instant::now();\ntrace!(\"Getting Peers from PeerListener to pass to TunnelManager\");\n- Arbiter::spawn(\n- PeerListener::from_registry()\n- .send(GetPeers {})\n- .timeout(FAST_LOOP_TIMEOUT)\n- .and_then(move |peers| {\n- // GetPeers never fails so unwrap is safe\n- let peers = peers.unwrap();\n+\n+ let peers = get_peers();\ninfo!(\n\"PeerListener get {} peers completed in {}s {}ms\",\npeers.len(),\nstart.elapsed().as_secs(),\nstart.elapsed().subsec_millis(),\n);\n- TunnelManager::from_registry()\n- .send(PeersToContact::new(peers))\n- .timeout(FAST_LOOP_TIMEOUT)\n- })\n- .then(|_| Ok(())),\n- );\n+ TunnelManager::from_registry().do_send(PeersToContact::new(peers));\nOk(())\n}\n" }, { "change_type": "MODIFY", "old_path": "rita/src/rita_common/rita_loop/mod.rs", "new_path": "rita/src/rita_common/rita_loop/mod.rs", "diff": "@@ -78,7 +78,6 @@ pub fn check_rita_common_actors() {\nassert!(crate::rita_common::tunnel_manager::TunnelManager::from_registry().connected());\nassert!(crate::rita_common::hello_handler::HelloHandler::from_registry().connected());\nassert!(crate::rita_common::traffic_watcher::TrafficWatcher::from_registry().connected());\n- assert!(crate::rita_common::peer_listener::PeerListener::from_registry().connected());\nassert!(crate::rita_common::rita_loop::fast_loop::RitaFastLoop::from_registry().connected());\ncrate::rita_common::rita_loop::slow_loop::start_rita_slow_loop();\ncrate::rita_common::rita_loop::fast_loop::start_rita_fast_loop();\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Migrated PeerListener to synchronous code
20,244
22.07.2021 08:18:18
14,400
0c64c9a76a04cba6514f2b7ca5d959f117492bc9
Update builds with crate references This scripts reffer to the 'rita' crate directly since that crate no longer exists these builds will fail until updated with 'rita_bin' which this patch does.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -49,7 +49,7 @@ lint_clippy:\ncross_arch_mips:\nstage: cross-arch\nvariables:\n- CROSS_TEST_ARGS: \"--verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\"\n+ CROSS_TEST_ARGS: \"--verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\"\nscript:\n- \"cargo install cross\"\n- \"cross test --target mips-unknown-linux-gnu $CROSS_TEST_ARGS\"\n@@ -57,7 +57,7 @@ cross_arch_mips:\ncross_arch_mips_64:\nstage: cross-arch\nvariables:\n- CROSS_TEST_ARGS: \"--verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\"\n+ CROSS_TEST_ARGS: \"--verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\"\nscript:\n- \"cargo install cross\"\n- \"cross test --target mips64-unknown-linux-gnuabi64 $CROSS_TEST_ARGS\"\n@@ -65,7 +65,7 @@ cross_arch_mips_64:\ncross_arch_arm64:\nstage: cross-arch\nvariables:\n- CROSS_TEST_ARGS: \"--verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\"\n+ CROSS_TEST_ARGS: \"--verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\"\nscript:\n- \"cargo install cross\"\n- \"cross test --target aarch64-unknown-linux-gnu $CROSS_TEST_ARGS\"\n" }, { "change_type": "MODIFY", "old_path": "scripts/openwrt_build_ipq40xx.sh", "new_path": "scripts/openwrt_build_ipq40xx.sh", "diff": "@@ -24,4 +24,4 @@ export OPENSSL_STATIC=1\nrustup target add armv7-unknown-linux-musleabihf\n-cargo build --target armv7-unknown-linux-musleabihf ${PROFILE} ${FEATURES} -p rita --bin rita\n+cargo build --target armv7-unknown-linux-musleabihf ${PROFILE} ${FEATURES} -p rita_bin --bin rita\n" }, { "change_type": "MODIFY", "old_path": "scripts/openwrt_build_mips.sh", "new_path": "scripts/openwrt_build_mips.sh", "diff": "@@ -22,4 +22,4 @@ export OPENSSL_STATIC=1\nrustup target add mips-unknown-linux-musl\n-cargo build --target mips-unknown-linux-musl ${PROFILE} ${FEATURES} -p rita --bin rita\n+cargo build --target mips-unknown-linux-musl ${PROFILE} ${FEATURES} -p rita_bin --bin rita\n" }, { "change_type": "MODIFY", "old_path": "scripts/openwrt_build_mipsel.sh", "new_path": "scripts/openwrt_build_mipsel.sh", "diff": "@@ -22,4 +22,4 @@ export OPENSSL_STATIC=1\nrustup target add mipsel-unknown-linux-musl\n-cargo build --target mipsel-unknown-linux-musl ${PROFILE} ${FEATURES} -p rita --bin rita\n+cargo build --target mipsel-unknown-linux-musl ${PROFILE} ${FEATURES} -p rita_bin --bin rita\n" }, { "change_type": "MODIFY", "old_path": "scripts/openwrt_build_mvebu.sh", "new_path": "scripts/openwrt_build_mvebu.sh", "diff": "@@ -22,4 +22,4 @@ export OPENSSL_STATIC=1\nrustup target add armv7-unknown-linux-musleabihf\n-cargo build --target armv7-unknown-linux-musleabihf ${PROFILE} ${FEATURES} -p rita --bin rita\n+cargo build --target armv7-unknown-linux-musleabihf ${PROFILE} ${FEATURES} -p rita_bin --bin rita\n" }, { "change_type": "MODIFY", "old_path": "scripts/openwrt_build_octeon.sh", "new_path": "scripts/openwrt_build_octeon.sh", "diff": "@@ -22,4 +22,4 @@ export OPENSSL_STATIC=1\nrustup target add mips64-unknown-linux-gnuabi64\n-cargo build --target mips64-unknown-linux-gnuabi64 ${PROFILE} ${FEATURES} -p rita --bin rita\n+cargo build --target mips64-unknown-linux-gnuabi64 ${PROFILE} ${FEATURES} -p rita_bin --bin rita\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Update builds with crate references This scripts reffer to the 'rita' crate directly since that crate no longer exists these builds will fail until updated with 'rita_bin' which this patch does.
20,244
29.07.2021 08:38:58
14,400
de07f1a5627d89ed8b700bb17e4f4640463ed062
Remove Rita tower This has been moved into the private repo and is no longer needed here
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -3229,7 +3229,6 @@ dependencies = [\n\"rita_client\",\n\"rita_common\",\n\"rita_exit\",\n- \"rita_tower\",\n\"serde 1.0.126\",\n\"serde_derive\",\n\"serde_json\",\n@@ -3350,18 +3349,6 @@ dependencies = [\n\"sodiumoxide\",\n]\n-[[package]]\n-name = \"rita_tower\"\n-version = \"0.18.0\"\n-dependencies = [\n- \"althea_types\",\n- \"lazy_static\",\n- \"log\",\n- \"serde 1.0.126\",\n- \"serde_derive\",\n- \"serde_json\",\n-]\n-\n[[package]]\nname = \"rust-ini\"\nversion = \"0.13.0\"\n" }, { "change_type": "MODIFY", "old_path": "Cargo.toml", "new_path": "Cargo.toml", "diff": "@@ -15,7 +15,7 @@ jemalloc = [\"rita_bin/jemalloc\"]\nrita_bin = { path = \"./rita_bin\" }\n[workspace]\n-members = [\"althea_kernel_interface\", \"settings\", \"clu\", \"exit_db\", \"antenna_forwarding_client\", \"antenna_forwarding_protocol\", \"auto_bridge\", \"babel_monitor_legacy\",\"rita_common\",\"rita_exit\",\"rita_tower\",\"rita_client\"]\n+members = [\"althea_kernel_interface\", \"settings\", \"clu\", \"exit_db\", \"antenna_forwarding_client\", \"antenna_forwarding_protocol\", \"auto_bridge\", \"babel_monitor_legacy\",\"rita_common\",\"rita_exit\",\"rita_client\"]\n[profile.release]\nopt-level = \"z\"\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "@@ -13,10 +13,6 @@ path = \"src/exit.rs\"\nname = \"rita\"\npath = \"src/client.rs\"\n-[[bin]]\n-name = \"rita_tower\"\n-path = \"src/tower.rs\"\n-\n[dependencies]\nalthea_kernel_interface = { path = \"../althea_kernel_interface\" }\nantenna_forwarding_client = {path = \"../antenna_forwarding_client\"}\n@@ -60,7 +56,6 @@ r2d2 = \"0.8\"\nrita_common = { path = \"../rita_common\"}\nrita_client = { path = \"../rita_client\"}\nrita_exit = { path = \"../rita_exit\"}\n-rita_tower = { path = \"../rita_tower\"}\nflate2 = { version = \"1.0\", features = [\"rust_backend\"], default-features = false }\nreqwest = { version = \"0.11\", features = [\"blocking\", \"json\"] }\n" }, { "change_type": "DELETE", "old_path": "rita_bin/src/tower.rs", "new_path": null, "diff": "-use althea_types::WgKey;\n-pub(crate) use antenna_forwarding_client::start_antenna_forwarding_proxy;\n-use compressed_log::builder::LoggerBuilder;\n-use compressed_log::compression::Compression;\n-#[cfg(feature = \"jemalloc\")]\n-use jemallocator::Jemalloc;\n-#[cfg(feature = \"jemalloc\")]\n-#[global_allocator]\n-static GLOBAL: Jemalloc = Jemalloc;\n-\n-#[macro_use]\n-extern crate failure;\n-#[macro_use]\n-extern crate lazy_static;\n-#[macro_use]\n-extern crate log;\n-#[macro_use]\n-extern crate serde_derive;\n-#[cfg(test)]\n-extern crate arrayvec;\n-\n-use docopt::Docopt;\n-use log::{LevelFilter, Record};\n-use settings::client::RitaClientSettings;\n-\n-use settings::FileWrite;\n-use std::env;\n-\n-use failure::Error;\n-\n-use rita_common::dashboard::own_info::READABLE_VERSION;\n-use rita_common::rita_loop::check_rita_common_actors;\n-use rita_common::rita_loop::start_core_rita_endpoints;\n-use rita_common::utils::env_vars_contains;\n-\n-#[derive(Debug, Deserialize, Default)]\n-pub struct Args {\n- flag_config: String,\n- flag_platform: String,\n- flag_future: bool,\n-}\n-\n-lazy_static! {\n- pub static ref HEARTBEAT_SERVER_KEY: WgKey = \"hizclQFo/ArWY+/9+AJ0LBY2dTiQK4smy5icM7GA5ng=\"\n- .parse()\n- .unwrap();\n-}\n-\n-lazy_static! {\n- static ref USAGE: String = format!(\n- \"Usage: rita --config=<settings> --platform=<platform> [--future]\n-Options:\n- -c, --config=<settings> Name of config file\n- --future Enable B side of A/B releases\n-About:\n- Version {} - {}\n- git hash {}\",\n- READABLE_VERSION,\n- env!(\"CARGO_PKG_VERSION\"),\n- env!(\"GIT_HASH\")\n- );\n-}\n-\n-use althea_kernel_interface::KernelInterface;\n-use althea_kernel_interface::LinuxCommandRunner;\n-\n-lazy_static! {\n- pub static ref KI: Box<dyn KernelInterface> = Box::new(LinuxCommandRunner {});\n-}\n-\n-lazy_static! {\n- pub static ref ARGS: Args = Docopt::new((*USAGE).as_str())\n- .and_then(|d| d.deserialize())\n- .unwrap_or_else(|e| e.exit());\n-}\n-\n-lazy_static! {\n- pub static ref SETTING: RitaClientSettings = {\n- let settings_file = &ARGS.flag_config;\n- let platform = &ARGS.flag_platform;\n-\n- let mut s = RitaClientSettings::new_watched(settings_file).unwrap();\n-\n- s.set_future(ARGS.flag_future);\n-\n- let s = clu::init(platform, s);\n-\n- s.write(settings_file).unwrap();\n- s\n- };\n-}\n-\n-fn main() {\n- // On Linux static builds we need to probe ssl certs path to be able to\n- // do TLS stuff.\n- openssl_probe::init_ssl_cert_env_vars();\n-\n- let should_remote_log = SETTING.log.enabled || SETTING.operator.operator_address.is_some();\n- // if remote logging is disabled, or the NO_REMOTE_LOG env var is set we should use the\n- // local logger and log to std-out. Note we don't care what is actually set in NO_REMOTE_LOG\n- // just that it is set\n- if !should_remote_log || env_vars_contains(\"NO_REMOTE_LOG\") {\n- env_logger::init();\n- } else {\n- let res = enable_remote_logging();\n- println!(\"logging status {:?}\", res);\n- }\n-\n- let _args: Args = Docopt::new((*USAGE).as_str())\n- .and_then(|d| d.deserialize())\n- .unwrap_or_else(|e| e.exit());\n-\n- info!(\n- \"crate ver {}, git hash {}\",\n- env!(\"CARGO_PKG_VERSION\"),\n- env!(\"GIT_HASH\")\n- );\n-\n- check_rita_common_actors();\n- start_core_rita_endpoints(4);\n- start_antenna_forwarder();\n-}\n-/// starts the antenna forwarder, this is a logically independent set of code\n-/// that does not care about anything else Rita is doing, it only deals with the\n-/// actual physical interfaces and attempting to find antennas to forward on them.\n-fn start_antenna_forwarder() {\n- #[cfg(not(feature = \"operator_debug\"))]\n- let url = \"operator.althea.net:33334\";\n- #[cfg(feature = \"operator_debug\")]\n- let url = \"192.168.10.2:33334\";\n-\n- let network = SETTING.get_network();\n- let our_id = SETTING.get_identity().unwrap();\n- let mut interfaces = network.peer_interfaces.clone();\n- interfaces.insert(\"br-pbs\".to_string());\n- start_antenna_forwarding_proxy(\n- url.to_string(),\n- our_id,\n- *HEARTBEAT_SERVER_KEY,\n- network.wg_public_key.unwrap(),\n- network.wg_private_key.unwrap(),\n- interfaces,\n- );\n-}\n-/// enables remote logging if the user has configured it\n-pub fn enable_remote_logging() -> Result<(), Error> {\n- trace!(\"About to enable remote logging\");\n- let log = &SETTING.log;\n- let key = SETTING\n- .get_network()\n- .wg_public_key\n- .expect(\"Tried to init remote logging without WgKey!\");\n- let logging_url = &log.dest_url;\n- let level: LevelFilter = match log.level.parse() {\n- Ok(level) => level,\n- Err(_) => LevelFilter::Error,\n- };\n-\n- let logger = LoggerBuilder::default()\n- .set_level(\n- level\n- .to_level()\n- .ok_or_else(|| format_err!(\"Unable to convert level filter to a level\"))?,\n- )\n- .set_compression_level(Compression::Fast)\n- .set_sink_url(logging_url)\n- .set_threshold(1000)\n- .set_format(Box::new(move |record: &Record| {\n- format!(\n- \"{} {} rita: {}\\n\",\n- key,\n- env!(\"CARGO_PKG_VERSION\"),\n- record.args()\n- )\n- }))\n- .build();\n- if let Err(e) = logger {\n- bail!(format_err!(\"{}\", e))\n- }\n- let logger = logger.unwrap();\n-\n- if let Err(e) = log::set_boxed_logger(Box::new(logger)) {\n- bail!(format_err!(\"{}\", e))\n- }\n- log::set_max_level(level);\n-\n- println!(\n- \"Remote compressed logging enabled with target {}\",\n- logging_url\n- );\n- Ok(())\n-}\n" }, { "change_type": "DELETE", "old_path": "rita_tower/Cargo.toml", "new_path": null, "diff": "-[package]\n-name = \"rita_tower\"\n-version = \"0.18.0\"\n-edition = \"2018\"\n-license = \"Apache-2.0\"\n-\n-[dependencies]\n-althea_types = { path = \"../althea_types\"}\n-lazy_static = \"1.4\"\n-serde_derive = \"1.0\"\n-serde = \"1.0\"\n-serde_json = \"1.0\"\n-log = { version = \"0.4\", features = [\"release_max_level_info\"] }\n" }, { "change_type": "DELETE", "old_path": "rita_tower/src/errors.rs", "new_path": null, "diff": "-use std::{env, fmt};\n-use std::{\n- error::Error,\n- time::{Instant, SystemTimeError},\n-};\n-use std::{io::ErrorKind, num::ParseIntError};\n-use std::{\n- num::ParseFloatError,\n- process::{Command, Output},\n-};\n-use std::{\n- str::Utf8Error,\n- sync::{Arc, Mutex},\n-};\n-\n-use std::str;\n-\n-use althea_types::error::AltheaTypesError;\n-\n-use std::fmt::Result as FormatResult;\n-use std::io::Error as IoError;\n-use std::net::AddrParseError;\n-use std::string::FromUtf8Error;\n-\n-type CommandFunction = Box<dyn FnMut(String, Vec<String>) -> Result<Output, TowerError> + Send>;\n-\n-#[derive(Clone, Debug)]\n-pub enum TowerError {\n- RuntimeError(String),\n- FailedToGetEnbsError,\n- FailedToGetConnectedUesError,\n- FailedToGetAttachedUesError,\n- FailedToGetUptime,\n-}\n-\n-impl fmt::Display for TowerError {\n- fn fmt(&self, f: &mut fmt::Formatter) -> FormatResult {\n- match self {\n- TowerError::RuntimeError(val) => write!(f, \"Runtime Error: {}\", val),\n-\n- TowerError::FailedToGetEnbsError => write!(f, \"Unable to handle or obtain enbs file\"),\n- TowerError::FailedToGetConnectedUesError => {\n- write!(f, \"Unable to handle or obtain connected ues file\")\n- }\n- TowerError::FailedToGetAttachedUesError => {\n- write!(f, \"Unable to handle or obtain attached ues file\")\n- }\n- TowerError::FailedToGetUptime => {\n- write!(f, \"Unable to parse string for uptime\")\n- }\n- }\n- }\n-}\n-\n-impl Error for TowerError {}\n-\n-impl From<FromUtf8Error> for TowerError {\n- fn from(e: FromUtf8Error) -> Self {\n- TowerError::RuntimeError(format!(\"{}\", e))\n- }\n-}\n-\n-impl From<IoError> for TowerError {\n- fn from(e: IoError) -> Self {\n- TowerError::RuntimeError(format!(\"{}\", e))\n- }\n-}\n-\n-impl From<AddrParseError> for TowerError {\n- fn from(e: AddrParseError) -> Self {\n- TowerError::RuntimeError(format!(\"{}\", e))\n- }\n-}\n-\n-impl From<ParseIntError> for TowerError {\n- fn from(e: ParseIntError) -> Self {\n- TowerError::RuntimeError(format!(\"{}\", e))\n- }\n-}\n-\n-impl From<ParseFloatError> for TowerError {\n- fn from(e: ParseFloatError) -> Self {\n- TowerError::RuntimeError(format!(\"{}\", e))\n- }\n-}\n-\n-impl From<AltheaTypesError> for TowerError {\n- fn from(e: AltheaTypesError) -> Self {\n- TowerError::RuntimeError(format!(\"{}\", e))\n- }\n-}\n-\n-impl From<Utf8Error> for TowerError {\n- fn from(e: Utf8Error) -> Self {\n- TowerError::RuntimeError(format!(\"{}\", e))\n- }\n-}\n-\n-impl From<SystemTimeError> for TowerError {\n- fn from(e: SystemTimeError) -> Self {\n- TowerError::RuntimeError(format!(\"{}\", e))\n- }\n-}\n-\n-#[cfg(test)]\n-lazy_static! {\n- pub static ref KI: Box<dyn Tower> = Box::new(TestCommandRunner {\n- run_command: Arc::new(Mutex::new(Box::new(|_program, _args| {\n- panic!(\"kernel interface used before initialized\");\n- })))\n- });\n-}\n-\n-#[cfg(not(test))]\n-lazy_static! {\n- pub static ref KI: Box<dyn Tower> = Box::new(LinuxCommandRunner {});\n-}\n-\n-pub trait CommandRunner {\n- fn run_command(&self, program: &str, args: &[&str]) -> Result<Output, TowerError>;\n- fn set_mock(&self, mock: CommandFunction);\n-}\n-\n-// a quick throwaway function to print arguments arrays so that they can be copy/pasted from logs\n-fn print_str_array(input: &[&str]) -> String {\n- let mut output = String::new();\n- for item in input {\n- output = output + \" \" + item;\n- }\n- output\n-}\n-\n-pub struct LinuxCommandRunner;\n-\n-impl CommandRunner for LinuxCommandRunner {\n- fn run_command(&self, program: &str, args: &[&str]) -> Result<Output, TowerError> {\n- let start = Instant::now();\n- let output = match Command::new(program).args(args).output() {\n- Ok(o) => o,\n- Err(e) => {\n- if e.kind() == ErrorKind::NotFound {\n- error!(\"The {:?} binary was not found. Please install a package that provides it. PATH={:?}\", program, env::var(\"PATH\"));\n- }\n- return Err(e.into());\n- }\n- };\n-\n- trace!(\n- \"Command {} {} returned: {:?}\",\n- program,\n- print_str_array(args),\n- output\n- );\n- if !output.status.success() {\n- trace!(\n- \"Command {} {} returned: an error {:?}\",\n- program,\n- print_str_array(args),\n- output\n- );\n- }\n- trace!(\n- \"command completed in {}s {}ms\",\n- start.elapsed().as_secs(),\n- start.elapsed().subsec_millis()\n- );\n-\n- if start.elapsed().as_secs() > 5 {\n- error!(\n- \"Command {} {} took more than five seconds to complete!\",\n- program,\n- print_str_array(args)\n- );\n- } else if start.elapsed().as_secs() > 1 {\n- warn!(\n- \"Command {} {} took more than one second to complete!\",\n- program,\n- print_str_array(args)\n- );\n- }\n-\n- Ok(output)\n- }\n-\n- fn set_mock(\n- &self,\n- _mock: Box<dyn FnMut(String, Vec<String>) -> Result<Output, TowerError> + Send>,\n- ) {\n- unimplemented!()\n- }\n-}\n-\n-pub struct TestCommandRunner {\n- pub run_command: Arc<Mutex<CommandFunction>>,\n-}\n-\n-impl CommandRunner for TestCommandRunner {\n- fn run_command(&self, program: &str, args: &[&str]) -> Result<Output, TowerError> {\n- let mut args_owned = Vec::new();\n- for a in args {\n- args_owned.push((*a).to_string())\n- }\n-\n- (&mut *self.run_command.lock().unwrap())(program.to_string(), args_owned)\n- }\n-\n- fn set_mock(&self, mock: CommandFunction) {\n- *self.run_command.lock().unwrap() = mock\n- }\n-}\n-\n-pub trait Tower: CommandRunner + Sync + Send {}\n-\n-impl Tower for LinuxCommandRunner {}\n-impl Tower for TestCommandRunner {}\n" }, { "change_type": "DELETE", "old_path": "rita_tower/src/lib.rs", "new_path": null, "diff": "-#[macro_use]\n-extern crate lazy_static;\n-\n-#[macro_use]\n-extern crate serde_derive;\n-\n-#[macro_use]\n-extern crate log;\n-\n-pub mod errors;\n-pub mod structs;\n-// pub mod tower_info;\n" }, { "change_type": "DELETE", "old_path": "rita_tower/src/structs.rs", "new_path": null, "diff": "-use std::time::Duration;\n-\n-#[derive(Debug, Clone, Serialize, Deserialize)]\n-pub enum RoleSpecificCheckin {\n- RitaTower,\n-}\n-#[derive(Debug, Clone, Serialize, Deserialize)]\n-pub struct RitaTowerInfo {\n- pub connected_enbs: f32,\n- pub connected_ues: f32,\n- pub attached_ues: f32,\n- #[serde(default)]\n- pub mme_start_time: Duration,\n- #[serde(default)]\n- pub sgwc_start_time: Duration,\n- #[serde(default)]\n- pub sgwu_start_time: Duration,\n- #[serde(default)]\n- pub smf_start_time: Duration,\n- #[serde(default)]\n- pub upf_start_time: Duration,\n-}\n" }, { "change_type": "DELETE", "old_path": "rita_tower/src/tower_info.rs", "new_path": null, "diff": "-// use crate::errors::TowerError as Error;\n-// use crate::structs::RitaTowerInfo;\n-\n-// use std::fs::File;\n-// use std::io::BufRead;\n-// use std::io::BufReader;\n-// use std::time::Duration;\n-// use std::u64;\n-\n-// fn get_rita_tower_info() -> Result<RitaTowerInfo, Error> {\n-// let connected_enbs = parse_connected_enbs()?;\n-// let connected_ues = parse_connected_ues()?;\n-// let attached_ues = parse_attached_ues()?;\n-// let mme_start_time = get_mme_start_time()?;\n-// let sgwc_start_time = get_sgwc_start_time()?;\n-// let sgwu_start_time = get_sgwu_start_time()?;\n-// let smf_start_time = get_smf_start_time()?;\n-// let upf_start_time = get_upf_start_time()?;\n-\n-// Ok(RitaTowerInfo {\n-// connected_enbs,\n-// connected_ues,\n-// attached_ues,\n-// mme_start_time,\n-// sgwc_start_time,\n-// sgwu_start_time,\n-// smf_start_time,\n-// upf_start_time,\n-// })\n-// }\n-\n-// fn parse_connected_enbs() -> Result<f32, Error> {\n-// let connected_enbs_error = Err(Error::FailedToGetEnbsError);\n-\n-// let lines = get_lines(\"/tmp/open5gs/connected_enbs\")?;\n-// let line = match lines.get(0) {\n-// Some(line) => line,\n-// None => return connected_enbs_error,\n-// };\n-\n-// let mut iter = line.split_whitespace();\n-// let connected_enbs: f32 = match iter.next() {\n-// Some(val) => val.parse()?,\n-// None => return connected_enbs_error,\n-// };\n-\n-// Ok(connected_enbs)\n-// }\n-// fn parse_connected_ues() -> Result<f32, Error> {\n-// let connected_ues_error = Err(Error::FailedToGetConnectedUesError);\n-\n-// let lines = get_lines(\"/tmp/open5gs/connected_ues\")?;\n-// let line = match lines.get(0) {\n-// Some(line) => line,\n-// None => return connected_ues_error,\n-// };\n-\n-// let mut iter = line.split_whitespace();\n-// let connected_ues: f32 = match iter.next() {\n-// Some(val) => val.parse()?,\n-// None => return connected_ues_error,\n-// };\n-\n-// Ok(connected_ues)\n-// }\n-// fn parse_attached_ues() -> Result<f32, Error> {\n-// let attached_ues_error = Err(Error::FailedToGetAttachedUesError);\n-\n-// let lines = get_lines(\"/tmp/open5gs/attached_ues\")?;\n-// let line = match lines.get(0) {\n-// Some(line) => line,\n-// None => return attached_ues_error,\n-// };\n-\n-// let mut iter = line.split_whitespace();\n-// let attached_ues: f32 = match iter.next() {\n-// Some(val) => val.parse()?,\n-// None => return attached_ues_error,\n-// };\n-\n-// Ok(attached_ues)\n-// }\n-\n-// fn parse_uptime(lines: Vec<String>) -> Result<Duration, Error> {\n-// let uptime_error = Err(Error::FailedToGetUptime);\n-\n-// let line = match lines.get(1) {\n-// Some(line) => line,\n-// None => return uptime_error,\n-// };\n-\n-// let mut iter = line.split_whitespace();\n-\n-// let uptime: u64 = match iter.next() {\n-// Some(val) => val.parse()?,\n-// None => return uptime_error,\n-// };\n-\n-// Ok(Duration::new(uptime, 0))\n-// }\n-\n-// fn get_mme_start_time() -> Result<Duration, Error> {\n-// let lines = get_lines(\"/tmp/open5gs/mme_start_time\")?;\n-\n-// let mme_start_time = parse_uptime(lines)?;\n-\n-// Ok(mme_start_time)\n-// }\n-// fn get_sgwc_start_time() -> Result<Duration, Error> {\n-// let lines = get_lines(\"/tmp/open5gs/sgwc_start_time\")?;\n-\n-// let sgwc_start_time = parse_uptime(lines)?;\n-\n-// Ok(sgwc_start_time)\n-// }\n-// fn get_sgwu_start_time() -> Result<Duration, Error> {\n-// let lines = get_lines(\"/tmp/open5gs/sgwu_start_time\")?;\n-\n-// let sgwu_start_time = parse_uptime(lines)?;\n-\n-// Ok(sgwu_start_time)\n-// }\n-// fn get_smf_start_time() -> Result<Duration, Error> {\n-// let lines = get_lines(\"/tmp/open5gs/smf_start_time\")?;\n-\n-// let smf_start_time = parse_uptime(lines)?;\n-\n-// Ok(smf_start_time)\n-// }\n-// fn get_upf_start_time() -> Result<Duration, Error> {\n-// let lines = get_lines(\"/tmp/open5gs/upf_start_time\")?;\n-\n-// let upf_start_time = parse_uptime(lines)?;\n-\n-// Ok(upf_start_time)\n-// }\n-\n-// pub fn get_lines(filename: &str) -> Result<Vec<String>, Error> {\n-// let f = File::open(filename)?;\n-// let file = BufReader::new(&f);\n-// let mut out_lines = Vec::new();\n-// for line in file.lines() {\n-// match line {\n-// Ok(val) => out_lines.push(val),\n-// Err(_) => break,\n-// }\n-// }\n-\n-// Ok(out_lines)\n-// }\n-// // Test for rita_tower\n-// #[cfg(test)]\n-// mod test {\n-// use crate::tower_info::{\n-// get_mme_start_time, get_sgwc_start_time, get_sgwu_start_time, get_smf_start_time,\n-// get_upf_start_time, parse_attached_ues, parse_connected_enbs, parse_connected_ues,\n-// };\n-\n-// //use super::get_rita_tower_info;\n-// // #[test]\n-// // fn test_get_rita_tower_info() {\n-// // let res = get_rita_tower_info();\n-// // println!(\"{:?}\", res)\n-// // }\n-// #[test]\n-// fn test_parse_connected_enbs() {\n-// let res = parse_connected_enbs();\n-// println!(\"{:?}\", res)\n-// }\n-// #[test]\n-// fn test_connected_ues() {\n-// let res = parse_connected_ues();\n-// println!(\"{:?}\", res)\n-// }\n-// #[test]\n-// fn test_attached_ues() {\n-// let res = parse_attached_ues();\n-// println!(\"{:?}\", res)\n-// }\n-\n-// #[test]\n-// fn test_all_uptime() {\n-// test_mme_start_time();\n-// test_sgwc_start_time();\n-// test_sgwu_start_time();\n-// test_smf_start_time();\n-// test_upf_start_time();\n-// }\n-// fn test_mme_start_time() {\n-// let res = get_mme_start_time().unwrap();\n-// println!(\"{:?}\", res.as_secs());\n-// }\n-// fn test_sgwc_start_time() {\n-// let res = get_sgwc_start_time().unwrap();\n-// println!(\"{:?}\", res.as_secs());\n-// }\n-// fn test_sgwu_start_time() {\n-// let res = get_sgwu_start_time().unwrap();\n-// println!(\"{:?}\", res.as_secs());\n-// }\n-// fn test_smf_start_time() {\n-// let res = get_smf_start_time().unwrap();\n-// println!(\"{:?}\", res.as_secs());\n-// }\n-// fn test_upf_start_time() {\n-// let res = get_upf_start_time().unwrap();\n-// println!(\"{:?}\", res.as_secs());\n-// }\n-// }\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove Rita tower This has been moved into the private repo and is no longer needed here
20,244
29.07.2021 08:42:49
14,400
86860fb19d1b9fa3c7881a4e8541a4874164aaa1
Cleanup imports the Cargo.toml files had a lot of newlines left in them from dependencies being deleted during the refactor.
[ { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "@@ -18,25 +18,16 @@ althea_kernel_interface = { path = \"../althea_kernel_interface\" }\nantenna_forwarding_client = {path = \"../antenna_forwarding_client\"}\nalthea_types = { path = \"../althea_types\", features = [\"actix\"]}\nclu = { path = \"../clu\" }\n-\n-\nactix-web-httpauth = {git = \"https://github.com/althea-net/actix-web-httpauth\"}\n-\nactix-async = {package=\"actix\", version = \"0.11\"}\nactix-web-async = {package=\"actix-web\", version = \"4.0.0-beta.6\", default_features = false, features= [\"openssl\"] }\n-\nactix = \"0.7\"\nactix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\nactix_derive = \"0.5\"\n-\ndocopt = \"1.1\"\n-\ncompressed_log = \"0.3.4\"\n-\nsettings = { path = \"../settings\" }\n-\ndiesel = { version = \"1.4\", features = [\"postgres\", \"r2d2\"] }\n-\nlog = { version = \"0.4\", features = [\"release_max_level_info\"] }\nserde = \"1.0\"\nserde_derive = \"1.0\"\n@@ -45,18 +36,13 @@ arrayvec = {version= \"0.7\", features = [\"serde\"]}\nhex-literal = \"0.3\"\nopenssl-probe = \"0.1\"\nenv_logger = \"0.8\"\n-\nlazy_static = \"1.4\"\nfailure = \"0.1\"\n-\nphonenumber = \"0.3\"\nr2d2 = \"0.8\"\n-\n-\nrita_common = { path = \"../rita_common\"}\nrita_client = { path = \"../rita_client\"}\nrita_exit = { path = \"../rita_exit\"}\n-\nflate2 = { version = \"1.0\", features = [\"rust_backend\"], default-features = false }\nreqwest = { version = \"0.11\", features = [\"blocking\", \"json\"] }\njemallocator = {version = \"0.3\", optional = true}\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "@@ -34,10 +34,8 @@ tokio-codec = \"0.1\"\nsodiumoxide = \"0.2\"\nclu = { path = \"../clu\" }\nweb30 = {git = \"https://github.com/althea-net/web30\", rev = \"a600b8b8ebf2c49badee6b65ac90a56bbdad4ab9\"}\n-\nactix = \"0.7\"\nactix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\n-\nclarity = \"0.4\"\n[lib]\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "@@ -33,15 +33,10 @@ futures01 = { package = \"futures\", version = \"0.1\"}\ntokio = \"0.1\"\nbincode = \"1.3\"\nserde_cbor = \"0.11\"\n-\nlazy_static = \"1.4\"\n-\nalthea_kernel_interface = { path = \"../althea_kernel_interface\" }\n-\nactix-web-httpauth = {git = \"https://github.com/althea-net/actix-web-httpauth\"}\nactix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\n-\nasync-web30 = {package=\"web30\", version = \"0.14\"}\n-\nalthea_types = { path = \"../althea_types\" }\nbabel_monitor_legacy = {path = \"../babel_monitor_legacy\"}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/Cargo.toml", "new_path": "rita_exit/Cargo.toml", "diff": "@@ -4,8 +4,6 @@ version = \"0.18.0\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n-[lib]\n-\n[dependencies]\ncompressed_log = \"0.3.4\"\n@@ -33,11 +31,8 @@ arrayvec = {version= \"0.7\", features = [\"serde\"]}\nlog = { version = \"0.4\", features = [\"release_max_level_info\"] }\nreqwest = { version = \"0.11\", features = [\"blocking\", \"json\"] }\nexit_db = { path = \"../exit_db\" }\n-\nbabel_monitor_legacy = {path = \"../babel_monitor_legacy\"}\n-\nactix-web-httpauth = {git = \"https://github.com/althea-net/actix-web-httpauth\"}\nactix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\n-\ndiesel = { version = \"1.4\", features = [\"postgres\", \"r2d2\"] }\nfutures01 = { package = \"futures\", version = \"0.1\"}\n\\ No newline at end of file\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Cleanup imports the Cargo.toml files had a lot of newlines left in them from dependencies being deleted during the refactor.
20,247
02.08.2021 12:02:12
25,200
774acd60081d30c3414612937a650a43eefff875
Use "ip neigh" instead of "ip neighbor"
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/get_neighbors.rs", "new_path": "althea_kernel_interface/src/get_neighbors.rs", "diff": "@@ -9,7 +9,7 @@ impl dyn KernelInterface {\n/// Returns a vector of neighbors reachable over layer 2, giving IP address of each.\n/// Implemented with `ip neighbor` on Linux.\npub fn get_neighbors(&self) -> Result<Vec<(IpAddr, String)>, Error> {\n- let output = self.run_command(\"ip\", &[\"neighbor\"])?;\n+ let output = self.run_command(\"ip\", &[\"neigh\"])?;\ntrace!(\"Got {:?} from `ip neighbor`\", output);\nlet mut vec = Vec::new();\n@@ -46,7 +46,7 @@ fn test_get_neighbors_linux() {\nKI.set_mock(Box::new(move |program, args| {\nassert_eq!(program, \"ip\");\n- assert_eq!(args, &[\"neighbor\"]);\n+ assert_eq!(args, &[\"neigh\"]);\nOk(Output {\nstdout: b\"10.0.2.2 dev eth0 lladdr 00:00:00:aa:00:03 STALE\n" }, { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/link_local_tools.rs", "new_path": "althea_kernel_interface/src/link_local_tools.rs", "diff": "@@ -150,7 +150,7 @@ fn test_get_device_name_linux() {\nKI.set_mock(Box::new(move |program, args| {\nassert_eq!(program, \"ip\");\n- assert_eq!(args, &[\"neighbor\"]);\n+ assert_eq!(args, &[\"neigh\"]);\nOk(Output {\nstdout: b\"10.0.2.2 dev eth0 lladdr 00:00:00:aa:00:03 STALE\n@@ -216,7 +216,7 @@ fn test_get_link_local_reply_ip_linux() {\nmatch counter {\n1 => {\nassert_eq!(program, \"ip\");\n- assert_eq!(args, &[\"neighbor\"]);\n+ assert_eq!(args, &[\"neigh\"]);\nOk(Output {\nstdout: b\"\n" }, { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/open_tunnel.rs", "new_path": "althea_kernel_interface/src/open_tunnel.rs", "diff": "@@ -201,7 +201,7 @@ fn test_open_tunnel_linux() {\n1 => {\n//get interfaces\nassert_eq!(program, \"ip\");\n- assert_eq!(args, &[\"neighbor\"]);\n+ assert_eq!(args, &[\"neigh\"]);\nOk(Output {\nstdout: b\"10.0.2.2 dev eth0 lladdr 00:00:00:aa:00:03 STALE\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Use "ip neigh" instead of "ip neighbor"
20,247
02.08.2021 17:34:40
25,200
f07d472c7569a12074949c92acac8b82d7255e80
Add aarch64 build script
[ { "change_type": "ADD", "old_path": null, "new_path": "scripts/openwrt_build_aarch64.sh", "diff": "+#!/bin/bash\n+set -eux\n+DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\n+\n+# Parse command line arguments\n+source $DIR/build_common.sh\n+\n+if [[ ! -d $DIR/staging_dir ]]; then\n+ pushd $DIR\n+ wget -N https://updates.altheamesh.com/staging.tar.xz -O staging.tar.xz > /dev/null; tar -xf staging.tar.xz\n+fi\n+\n+export TOOLCHAIN=toolchain-aarch64_generic_gcc-8.4.0_musl\n+export TARGET_CC=$DIR/staging_dir/$TOOLCHAIN/bin/aarch64-openwrt-linux-gcc\n+export TARGET_LD=$DIR/staging_dir/$TOOLCHAIN/bin/aarch64-openwrt-linux-ld\n+export TARGET_AR=$DIR/staging_dir/$TOOLCHAIN/bin/aarch64-openwrt-linux-ar\n+export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=$TARGET_CC\n+export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_AR=$TARGET_AR\n+export SQLITE3_LIB_DIR=$DIR/staging_dir/target-aarch64_generic_musl/usr/lib/\n+export AARCH64_UNKNOWN_LINUX_MUSL_OPENSSL_DIR=$DIR/staging_dir/target-aarch64_generic_musl/usr/\n+export OPENSSL_STATIC=1\n+\n+rustup target add aarch64-unknown-linux-musl\n+\n+cargo build --target aarch64-unknown-linux-musl ${PROFILE} ${FEATURES} -p rita_bin --bin rita\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add aarch64 build script
20,247
06.08.2021 10:10:47
25,200
ecf0e641997f47867af92785d7377f92b4963fd9
Fix port toggle settings save temp_copy was the one being saved, but it was created before the changes were applied to rita_client as rita_client.network = network
[ { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/interfaces.rs", "new_path": "rita_client/src/dashboard/interfaces.rs", "diff": "@@ -335,22 +335,22 @@ pub fn ethernet_transform_mode(\n}\n}\nlet mut rita_client = settings::get_rita_client();\n- let temp_copy = rita_client.clone();\nif error_occured {\nlet res = KI.uci_revert(\"network\");\nrita_client.network = old_network_settings;\nsettings::set_rita_client(rita_client);\nbail!(\"Error running UCI commands! Revert attempted: {:?}\", res);\n}\n- rita_client.network = network;\n- settings::set_rita_client(rita_client);\nKI.uci_commit(\"network\")?;\nKI.openwrt_reset_network()?;\n- temp_copy.write(&settings::get_flag_config())?;\n+ rita_client.network = network;\n+ settings::set_rita_client(rita_client);\n- if let Err(_e) = temp_copy.write(&settings::get_flag_config()) {\n+ // try and save the config and fail if we can't\n+ let rita_client = settings::get_rita_client();\n+ if let Err(_e) = rita_client.write(&settings::get_flag_config()) {\nreturn Err(_e);\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix port toggle settings save temp_copy was the one being saved, but it was created before the changes were applied to rita_client as rita_client.network = network
20,243
10.08.2021 17:57:51
14,400
78b61202fd5af0bc71d8a62d3a88f711938f6461
Modified the default value for the node list
[ { "change_type": "MODIFY", "old_path": "settings/src/payment.rs", "new_path": "settings/src/payment.rs", "diff": "@@ -227,7 +227,7 @@ impl Default for PaymentSettings {\nnonce: 0u64.into(),\ngas_price: 0u64.into(), // 10 gwei\nnet_version: None,\n- node_list: Vec::new(),\n+ node_list: default_node_list(),\nsystem_chain: default_system_chain(),\nwithdraw_chain: default_system_chain(),\ndebts_file: default_debts_file(),\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Modified the default value for the node list
20,243
10.08.2021 20:14:06
14,400
c5187f90bdf4ff7e4c08165af2001c0bdfe6420d
Modified traffic watcher to not unwrap Similar to wireguard, ipset was not installed and this masked the bug.
[ { "change_type": "MODIFY", "old_path": "rita_common/src/traffic_watcher/mod.rs", "new_path": "rita_common/src/traffic_watcher/mod.rs", "diff": "@@ -31,10 +31,14 @@ impl Supervised for TrafficWatcher {}\nimpl SystemService for TrafficWatcher {\nfn service_started(&mut self, _ctx: &mut Context<Self>) {\n- KI.init_counter(&FilterTarget::Input).unwrap();\n- KI.init_counter(&FilterTarget::Output).unwrap();\n- KI.init_counter(&FilterTarget::ForwardInput).unwrap();\n- KI.init_counter(&FilterTarget::ForwardOutput).unwrap();\n+ KI.init_counter(&FilterTarget::Input)\n+ .expect(\"Is ipset installed?\");\n+ KI.init_counter(&FilterTarget::Output)\n+ .expect(\"Is ipset installed?\");\n+ KI.init_counter(&FilterTarget::ForwardInput)\n+ .expect(\"Is ipset installed?\");\n+ KI.init_counter(&FilterTarget::ForwardOutput)\n+ .expect(\"Is ipset installed?\");\ninfo!(\"Traffic Watcher started\");\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Modified traffic watcher to not unwrap Similar to wireguard, ipset was not installed and this masked the bug.
20,244
15.08.2021 12:50:30
14,400
cf6edbb2db7a6b5e3f0351f97a65e77935e9994c
Reduce size of rita_bin definitions This lifts a lot of extra library functions out of rita_bin and into rita_common, client, or exit where they can be imported by downstream libraries. What this will do is allow us to produce an internal version of Rita more easily.
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -480,41 +480,6 @@ dependencies = [\n\"sodiumoxide\",\n]\n-[[package]]\n-name = \"antenna_forwarding_client\"\n-version = \"0.1.0\"\n-dependencies = [\n- \"althea_kernel_interface\",\n- \"althea_types\",\n- \"antenna_forwarding_protocol\",\n- \"env_logger\",\n- \"failure\",\n- \"get_if_addrs\",\n- \"lazy_static\",\n- \"log\",\n- \"oping\",\n- \"rand 0.8.4\",\n- \"serde 1.0.126\",\n- \"serde_json\",\n- \"sodiumoxide\",\n-]\n-\n-[[package]]\n-name = \"antenna_forwarding_protocol\"\n-version = \"0.1.0\"\n-dependencies = [\n- \"althea_types\",\n- \"clarity\",\n- \"failure\",\n- \"lazy_static\",\n- \"log\",\n- \"rand 0.8.4\",\n- \"serde 1.0.126\",\n- \"serde_derive\",\n- \"serde_json\",\n- \"sodiumoxide\",\n-]\n-\n[[package]]\nname = \"arrayvec\"\nversion = \"0.5.2\"\n@@ -819,12 +784,6 @@ dependencies = [\n\"bytes 1.0.1\",\n]\n-[[package]]\n-name = \"c_linked_list\"\n-version = \"1.1.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b\"\n-\n[[package]]\nname = \"cc\"\nversion = \"1.0.69\"\n@@ -1568,12 +1527,6 @@ dependencies = [\n\"slab\",\n]\n-[[package]]\n-name = \"gcc\"\n-version = \"0.3.55\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2\"\n-\n[[package]]\nname = \"generic-array\"\nversion = \"0.12.4\"\n@@ -1593,28 +1546,6 @@ dependencies = [\n\"version_check 0.9.3\",\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.2.3\"\n@@ -3210,14 +3141,12 @@ dependencies = [\n\"actix_derive 0.5.0\",\n\"althea_kernel_interface\",\n\"althea_types\",\n- \"antenna_forwarding_client\",\n\"arrayvec 0.7.1\",\n\"clu\",\n\"compressed_log\",\n\"diesel\",\n\"docopt\",\n\"env_logger\",\n- \"failure\",\n\"flate2\",\n\"hex-literal\",\n\"jemallocator\",\n@@ -3227,13 +3156,11 @@ dependencies = [\n\"openssl-probe\",\n\"phonenumber\",\n\"r2d2\",\n- \"regex\",\n\"reqwest\",\n\"rita_client\",\n\"rita_common\",\n\"rita_exit\",\n\"serde 1.0.126\",\n- \"serde_derive\",\n\"serde_json\",\n\"settings\",\n]\n@@ -3285,7 +3212,6 @@ dependencies = [\n\"actix-web-httpauth\",\n\"althea_kernel_interface\",\n\"althea_types\",\n- \"antenna_forwarding_client\",\n\"arrayvec 0.7.1\",\n\"auto-bridge\",\n\"babel_monitor\",\n@@ -3306,6 +3232,7 @@ dependencies = [\n\"num-traits 0.2.14\",\n\"num256\",\n\"rand 0.8.4\",\n+ \"regex\",\n\"serde 1.0.126\",\n\"serde_cbor\",\n\"serde_derive\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "@@ -15,7 +15,6 @@ path = \"src/client.rs\"\n[dependencies]\nalthea_kernel_interface = { path = \"../althea_kernel_interface\" }\n-antenna_forwarding_client = {path = \"../antenna_forwarding_client\"}\nalthea_types = { path = \"../althea_types\", features = [\"actix\"]}\nclu = { path = \"../clu\" }\nactix-web-httpauth = {git = \"https://github.com/althea-net/actix-web-httpauth\"}\n@@ -30,14 +29,12 @@ settings = { path = \"../settings\" }\ndiesel = { version = \"1.4\", features = [\"postgres\", \"r2d2\"] }\nlog = { version = \"0.4\", features = [\"release_max_level_info\"] }\nserde = \"1.0\"\n-serde_derive = \"1.0\"\nserde_json = \"1.0\"\narrayvec = {version= \"0.7\", features = [\"serde\"]}\nhex-literal = \"0.3\"\nopenssl-probe = \"0.1\"\nenv_logger = \"0.8\"\nlazy_static = \"1.4\"\n-failure = \"0.1\"\nphonenumber = \"0.3\"\nr2d2 = \"0.8\"\nrita_common = { path = \"../rita_common\"}\n@@ -53,11 +50,6 @@ jemallocator = {version = \"0.3\", optional = true}\n# 3mb to the build so it's tagged into the server feature and it's own feature\nopenssl = {version = \"0.10\", features = [\"vendored\"], optional = true}\n-[dependencies.regex]\n-version = \"1.4\"\n-default-features = false\n-features = [\"std\"]\n-\n[features]\njemalloc = [\"jemallocator\"]\nbundle_openssl = [\"openssl\"]\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/src/client.rs", "new_path": "rita_bin/src/client.rs", "diff": "#![allow(clippy::pedantic)]\n#![forbid(unsafe_code)]\n-use antenna_forwarding_client::start_antenna_forwarding_proxy;\n#[cfg(feature = \"jemalloc\")]\nuse jemallocator::Jemalloc;\n#[cfg(feature = \"jemalloc\")]\n#[global_allocator]\nstatic GLOBAL: Jemalloc = Jemalloc;\n-#[macro_use]\n-extern crate failure;\n#[macro_use]\nextern crate lazy_static;\n#[macro_use]\nextern crate log;\n-#[macro_use]\n-extern crate serde_derive;\n-extern crate arrayvec;\n-use actix_web::http::Method;\n-use actix_web::{http, server, App};\n+use althea_kernel_interface::KernelInterface;\n+use althea_kernel_interface::LinuxCommandRunner;\nuse docopt::Docopt;\n+use rita_client::dashboard::start_client_dashboard;\n+use rita_client::get_client_usage;\nuse rita_client::logging::enable_remote_logging;\n-use rita_client::rita_loop::metrics_permitted;\n-use settings::client::RitaClientSettings;\n-use std::env;\n-use std::time::{Duration, Instant};\n-\n-use settings::FileWrite;\n-\nuse rita_client::rita_loop::check_rita_client_actors;\nuse rita_client::rita_loop::start_rita_client_endpoints;\n-use rita_common::dashboard::own_info::READABLE_VERSION;\n+use rita_client::wait_for_settings;\n+use rita_client::Args;\nuse rita_common::rita_loop::check_rita_common_actors;\nuse rita_common::rita_loop::start_core_rita_endpoints;\nuse rita_common::utils::env_vars_contains;\n-\n-use althea_kernel_interface::KernelInterface;\n-use althea_kernel_interface::LinuxCommandRunner;\n-use rita_client::dashboard::auth::*;\n-use rita_client::dashboard::backup_created::*;\n-use rita_client::dashboard::bandwidth_limit::*;\n-use rita_client::dashboard::contact_info::*;\n-use rita_client::dashboard::eth_private_key::*;\n-use rita_client::dashboard::exits::*;\n-use rita_client::dashboard::installation_details::*;\n-use rita_client::dashboard::interfaces::*;\n-use rita_client::dashboard::localization::*;\n-use rita_client::dashboard::logging::*;\n-use rita_client::dashboard::mesh_ip::*;\n-use rita_client::dashboard::neighbors::*;\n-use rita_client::dashboard::notifications::*;\n-use rita_client::dashboard::operator::*;\n-use rita_client::dashboard::prices::*;\n-use rita_client::dashboard::release_feed::*;\n-use rita_client::dashboard::remote_access::*;\n-use rita_client::dashboard::router::*;\n-use rita_client::dashboard::system_chain::*;\n-use rita_client::dashboard::usage::*;\n-use rita_client::dashboard::wifi::*;\n-use rita_client::heartbeat::HEARTBEAT_SERVER_KEY;\n-use rita_common::dashboard::babel::*;\n-use rita_common::dashboard::debts::*;\n-use rita_common::dashboard::development::*;\n-use rita_common::dashboard::nickname::*;\n-use rita_common::dashboard::own_info::*;\n-use rita_common::dashboard::settings::*;\n-use rita_common::dashboard::token_bridge::*;\n-use rita_common::dashboard::usage::*;\n-use rita_common::dashboard::wallet::*;\n-use rita_common::dashboard::wg_key::*;\n-use rita_common::network_endpoints::*;\n-mod middleware;\n-\n-#[derive(Debug, Deserialize, Default)]\n-pub struct Args {\n- flag_config: String,\n- flag_platform: String,\n- flag_future: bool,\n-}\n-\n-// TODO we should remove --platform as it's not used, but that requires\n-// changing how rita is invoked everywhere, because that's difficult\n-// with in the field routers this is waiting on another more pressing\n-// upgrade to the init file for Rita on the routers\n-lazy_static! {\n- static ref USAGE: String = format!(\n- \"Usage: rita --config=<settings> --platform=<platform> [--future]\n-Options:\n- -c, --config=<settings> Name of config file\n- -p, --platform=<platform> Platform (linux or OpenWrt)\n- --future Enable B side of A/B releases\n-About:\n- Version {} - {}\n- git hash {}\",\n- READABLE_VERSION,\n- env!(\"CARGO_PKG_VERSION\"),\n- env!(\"GIT_HASH\")\n- );\n-}\n+use settings::client::RitaClientSettings;\n+use settings::FileWrite;\n+use std::env;\nlazy_static! {\npub static ref KI: Box<dyn KernelInterface> = Box::new(LinuxCommandRunner {});\n}\n-/// Some devices (n600/n750) will provide junk file reads during disk init\n-/// post flashing, this adds in retry for the settings file read for up to\n-/// two minutes\n-fn wait_for_settings(settings_file: &str) -> RitaClientSettings {\n- let start = Instant::now();\n- let timeout = Duration::from_secs(120);\n- let mut res = RitaClientSettings::new(settings_file);\n- while (Instant::now() - start) < timeout {\n- if let Ok(val) = res {\n- return val;\n- }\n- res = RitaClientSettings::new(settings_file);\n- }\n- match res {\n- Ok(val) => val,\n- Err(e) => panic!(\"Settings parse failure {:?}\", e),\n- }\n-}\n-\nfn main() {\n- let args: Args = Docopt::new((*USAGE).as_str())\n+ let args: Args = Docopt::new(get_client_usage(\n+ env!(\"CARGO_PKG_VERSION\"),\n+ env!(\"GIT_HASH\"),\n+ ))\n.and_then(|d| d.deserialize())\n.unwrap_or_else(|e| e.exit());\n@@ -203,199 +116,7 @@ fn main() {\nstart_core_rita_endpoints(4);\nstart_rita_client_endpoints(1);\nstart_client_dashboard(settings.network.rita_dashboard_port);\n- start_antenna_forwarder(settings);\nsystem.run();\ninfo!(\"Started Rita Client!\");\n}\n-\n-/// starts the antenna forwarder, this is a logically independent set of code\n-/// that does not care about anything else Rita is doing, it only deals with the\n-/// actual physical interfaces and attempting to find antennas to forward on them.\n-fn start_antenna_forwarder(settings: RitaClientSettings) {\n- if metrics_permitted() {\n- #[cfg(not(feature = \"operator_debug\"))]\n- let url = \"operator.althea.net:33334\";\n- #[cfg(feature = \"operator_debug\")]\n- let url = \"192.168.10.2:33334\";\n-\n- let our_id = settings.get_identity().unwrap();\n- let network = settings.network;\n- let mut interfaces = network.peer_interfaces.clone();\n- interfaces.insert(\"br-pbs\".to_string());\n- start_antenna_forwarding_proxy(\n- url.to_string(),\n- our_id,\n- *HEARTBEAT_SERVER_KEY,\n- network.wg_public_key.unwrap(),\n- network.wg_private_key.unwrap(),\n- interfaces,\n- );\n- }\n-}\n-\n-fn start_client_dashboard(rita_dashboard_password: u16) {\n- // dashboard\n- server::new(|| {\n- App::new()\n- .middleware(middleware::Headers)\n- .middleware(middleware::Auth)\n- .route(\"/backup_created\", Method::GET, get_backup_created)\n- .route(\"/backup_created/{status}\", Method::POST, set_backup_created)\n- .route(\"/dao_list\", Method::GET, get_dao_list)\n- .route(\"/dao_list/add/{address}\", Method::POST, add_to_dao_list)\n- .route(\n- \"/dao_list/remove/{address}\",\n- Method::POST,\n- remove_from_dao_list,\n- )\n- .route(\"/dao_fee\", Method::GET, get_dao_fee)\n- .route(\"/dao_fee/{fee}\", Method::POST, set_dao_fee)\n- .route(\"/operator\", Method::GET, get_operator)\n- .route(\"/operator/{address}\", Method::POST, change_operator)\n- .route(\"/operator/remove\", Method::POST, remove_operator)\n- .route(\"/operator_fee\", Method::GET, get_operator_fee)\n- .route(\"/operator_debt\", Method::GET, get_operator_debt)\n- .route(\"/debts\", Method::GET, get_debts)\n- .route(\"/debts/reset\", Method::POST, reset_debt)\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- .route(\"/exits/{name}/reset\", Method::POST, reset_exit)\n- .route(\"/exits/{name}/select\", Method::POST, select_exit)\n- .route(\"/local_fee\", Method::GET, get_local_fee)\n- .route(\"/local_fee/{fee}\", Method::POST, set_local_fee)\n- .route(\"/metric_factor\", Method::GET, get_metric_factor)\n- .route(\"/metric_factor/{factor}\", Method::POST, set_metric_factor)\n- .route(\n- \"/exits/{name}/verify/{code}\",\n- Method::POST,\n- verify_on_exit_with_code,\n- )\n- .route(\"/info\", Method::GET, get_own_info)\n- .route(\"/interfaces\", Method::GET, get_interfaces_endpoint)\n- .route(\"/interfaces\", Method::POST, set_interfaces_endpoint)\n- .route(\"/interfaces/mesh\", Method::GET, wlan_mesh_get)\n- .route(\"/interfaces/lightclient\", Method::GET, wlan_lightclient_get)\n- .route(\"/interfaces/mesh/{enabled}\", Method::POST, wlan_mesh_set)\n- .route(\n- \"/interfaces/lightclient/{enabled}\",\n- Method::POST,\n- wlan_lightclient_set,\n- )\n- .route(\"/eth_private_key\", Method::GET, get_eth_private_key)\n- .route(\"/mesh_ip\", Method::GET, get_mesh_ip)\n- .route(\"/neighbors\", Method::GET, get_neighbor_info)\n- .route(\"/routes\", Method::GET, get_routes)\n- .route(\"/remote_logging/enabled\", Method::GET, get_remote_logging)\n- .route(\n- \"/remote_logging/enabled/{enabled}\",\n- Method::POST,\n- remote_logging,\n- )\n- .route(\n- \"/remote_logging/level\",\n- Method::GET,\n- get_remote_logging_level,\n- )\n- .route(\n- \"/remote_logging/level/{level}\",\n- Method::POST,\n- remote_logging_level,\n- )\n- .route(\"/settings\", Method::GET, get_settings)\n- .route(\"/settings\", Method::POST, set_settings)\n- .route(\"/version\", Method::GET, version)\n- .route(\"/wg_public_key\", Method::GET, get_wg_public_key)\n- .route(\"/wifi_settings\", Method::POST, set_wifi_multi)\n- .route(\n- \"/wifi_settings/get_channels/{radio}\",\n- Method::GET,\n- get_allowed_wifi_channels,\n- )\n- .route(\"/wifi_settings\", Method::GET, get_wifi_config)\n- .route(\"/withdraw/{address}/{amount}\", Method::POST, withdraw)\n- .route(\"/withdraw_all/{address}\", Method::POST, withdraw_all)\n- .route(\n- \"/auto_price/enabled/{status}\",\n- Method::POST,\n- set_auto_pricing,\n- )\n- .route(\"/auto_price/enabled\", Method::GET, auto_pricing_status)\n- .route(\"/prices\", Method::GET, get_prices)\n- .route(\n- \"/blockchain/set/{chain_id}\",\n- Method::POST,\n- set_system_blockchain_endpoint,\n- )\n- .route(\"/blockchain/get\", Method::GET, get_system_blockchain)\n- .route(\"/nickname/get\", Method::GET, get_nickname)\n- .route(\"/nickname/set\", Method::POST, set_nickname)\n- .route(\n- \"/low_balance_notification\",\n- Method::GET,\n- get_low_balance_notification,\n- )\n- .route(\n- \"/low_balance_notification/{status}\",\n- Method::POST,\n- set_low_balance_notification,\n- )\n- .route(\"/usage/relay\", Method::GET, get_relay_usage)\n- .route(\"/usage/client\", Method::GET, get_client_usage)\n- .route(\"/usage/payments\", Method::GET, get_payments)\n- .route(\"/token_bridge/status\", Method::GET, get_bridge_status)\n- .route(\"/router/reboot\", Method::POST, reboot_router)\n- .route(\"/router/update\", Method::POST, update_router)\n- .route(\"/router/password\", Method::POST, set_pass)\n- .route(\"/release_feed/get\", Method::GET, get_release_feed_http)\n- .route(\n- \"/release_feed/set/{feed}\",\n- Method::POST,\n- set_release_feed_http,\n- )\n- .route(\"/remote_access\", Method::GET, get_remote_access_status)\n- .route(\n- \"/remote_access/{status}\",\n- Method::POST,\n- set_remote_access_status,\n- )\n- .route(\"/wipe\", Method::POST, wipe)\n- .route(\"/crash_actors\", Method::POST, crash_actors)\n- .route(\"/localization\", Method::GET, get_localization)\n- .route(\"/wyre_reservation\", Method::POST, get_wyre_reservation)\n- .route(\n- \"/installation_details\",\n- Method::POST,\n- set_installation_details,\n- )\n- .route(\n- \"/installation_details\",\n- Method::GET,\n- get_installation_details,\n- )\n- .route(\"/billing_details\", Method::GET, get_billing_details)\n- .route(\"/billing_details\", Method::POST, set_billing_details)\n- .route(\"/bandwidth_limit\", Method::GET, get_bandwidth_limit)\n- .route(\n- \"/bandwidth_limit/{limit}\",\n- Method::POST,\n- set_bandwidth_limit,\n- )\n- .route(\n- \"/operator_setup/{enabled}\",\n- Method::POST,\n- set_display_operator_setup,\n- )\n- .route(\"/operator_setup\", Method::GET, display_operator_setup)\n- .route(\"/phone\", Method::GET, get_phone_number)\n- .route(\"/phone\", Method::POST, set_phone_number)\n- .route(\"/email\", Method::GET, get_email)\n- .route(\"/email\", Method::POST, set_email)\n- })\n- .workers(1)\n- .bind(format!(\"[::0]:{}\", rita_dashboard_password))\n- .unwrap()\n- .shutdown_timeout(0)\n- .start();\n-}\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/src/exit.rs", "new_path": "rita_bin/src/exit.rs", "diff": "@@ -19,23 +19,10 @@ use jemallocator::Jemalloc;\n#[global_allocator]\nstatic GLOBAL: Jemalloc = Jemalloc;\n-#[macro_use]\n-extern crate failure;\n-#[macro_use]\n-extern crate lazy_static;\n#[macro_use]\nextern crate log;\n-#[macro_use]\n-extern crate serde_derive;\n-extern crate phonenumber;\n-use actix_web::http::Method;\n-use actix_web::{http, server, App};\nuse docopt::Docopt;\n-\n-use settings::exit::RitaExitSettingsStruct;\n-\n-use rita_common::dashboard::own_info::READABLE_VERSION;\nuse rita_common::rita_loop::check_rita_common_actors;\nuse rita_common::rita_loop::start_core_rita_endpoints;\nuse rita_common::utils::env_vars_contains;\n@@ -44,41 +31,9 @@ use rita_exit::logging::enable_remote_logging;\nuse rita_exit::rita_loop::check_rita_exit_actors;\nuse rita_exit::rita_loop::start_rita_exit_endpoints;\nuse rita_exit::rita_loop::start_rita_exit_loop;\n-\n-use rita_common::dashboard::babel::*;\n-use rita_common::dashboard::debts::*;\n-use rita_common::dashboard::development::*;\n-use rita_common::dashboard::nickname::*;\n-use rita_common::dashboard::own_info::*;\n-use rita_common::dashboard::settings::*;\n-use rita_common::dashboard::token_bridge::*;\n-use rita_common::dashboard::usage::*;\n-use rita_common::dashboard::wallet::*;\n-use rita_common::dashboard::wg_key::*;\n-use rita_common::network_endpoints::*;\n-use rita_exit::network_endpoints::*;\n-pub mod middleware;\n-\n-#[derive(Debug, Deserialize, Default)]\n-pub struct Args {\n- flag_config: String,\n- flag_future: bool,\n-}\n-\n-lazy_static! {\n- static ref USAGE: String = format!(\n- \"Usage: rita_exit --config=<settings>\n-Options:\n- -c, --config=<settings> Name of config file\n- --future Enable B side of A/B releases\n-About:\n- Version {} - {}\n- git hash {}\",\n- READABLE_VERSION,\n- env!(\"CARGO_PKG_VERSION\"),\n- env!(\"GIT_HASH\")\n- );\n-}\n+use rita_exit::start_rita_exit_dashboard;\n+use rita_exit::{get_exit_usage, Args};\n+use settings::exit::RitaExitSettingsStruct;\n/// used to crash the exit on first startup if config does not make sense\n/// as is usually desirable for cloud infrastruture\n@@ -92,7 +47,7 @@ fn sanity_check_config() {\n}\nfn main() {\n- let args: Args = Docopt::new((*USAGE).as_str())\n+ let args: Args = Docopt::new(get_exit_usage(env!(\"CARGO_PKG_VERSION\"), env!(\"GIT_HASH\")))\n.and_then(|d| d.deserialize())\n.unwrap_or_else(|e| e.exit());\n@@ -155,39 +110,3 @@ fn main() {\nsystem.run();\n}\n-\n-fn start_rita_exit_dashboard() {\n- // Dashboard\n- server::new(|| {\n- App::new()\n- .middleware(middleware::Headers)\n- .route(\"/info\", Method::GET, get_own_info)\n- .route(\"/local_fee\", Method::GET, get_local_fee)\n- .route(\"/local_fee/{fee}\", Method::POST, set_local_fee)\n- .route(\"/metric_factor\", Method::GET, get_metric_factor)\n- .route(\"/metric_factor/{factor}\", Method::POST, set_metric_factor)\n- .route(\"/settings\", Method::GET, get_settings)\n- .route(\"/settings\", Method::POST, set_settings)\n- .route(\"/version\", Method::GET, version)\n- .route(\"/wg_public_key\", Method::GET, get_wg_public_key)\n- .route(\"/wipe\", Method::POST, wipe)\n- .route(\"/database\", Method::DELETE, nuke_db)\n- .route(\"/debts\", Method::GET, get_debts)\n- .route(\"/debts/reset\", Method::POST, reset_debt)\n- .route(\"/withdraw/{address}/{amount}\", Method::POST, withdraw)\n- .route(\"/withdraw_all/{address}\", Method::POST, withdraw_all)\n- .route(\"/nickname/get/\", Method::GET, get_nickname)\n- .route(\"/nickname/set/\", Method::POST, set_nickname)\n- .route(\"/crash_actors\", Method::POST, crash_actors)\n- .route(\"/usage/payments\", Method::GET, get_payments)\n- .route(\"/token_bridge/status\", Method::GET, get_bridge_status)\n- })\n- .bind(format!(\n- \"[::0]:{}\",\n- settings::get_rita_exit().network.rita_dashboard_port\n- ))\n- .unwrap()\n- .workers(1)\n- .shutdown_timeout(0)\n- .start();\n-}\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/mod.rs", "new_path": "rita_client/src/dashboard/mod.rs", "diff": "@@ -25,3 +25,205 @@ pub mod router;\npub mod system_chain;\npub mod usage;\npub mod wifi;\n+\n+use crate::dashboard::auth::*;\n+use crate::dashboard::backup_created::*;\n+use crate::dashboard::bandwidth_limit::*;\n+use crate::dashboard::contact_info::*;\n+use crate::dashboard::eth_private_key::*;\n+use crate::dashboard::exits::*;\n+use crate::dashboard::installation_details::*;\n+use crate::dashboard::interfaces::*;\n+use crate::dashboard::localization::*;\n+use crate::dashboard::logging::*;\n+use crate::dashboard::mesh_ip::*;\n+use crate::dashboard::neighbors::*;\n+use crate::dashboard::notifications::*;\n+use crate::dashboard::operator::*;\n+use crate::dashboard::prices::*;\n+use crate::dashboard::release_feed::*;\n+use crate::dashboard::remote_access::*;\n+use crate::dashboard::router::*;\n+use crate::dashboard::system_chain::*;\n+use crate::dashboard::usage::*;\n+use crate::dashboard::wifi::*;\n+use actix_web::http::Method;\n+use actix_web::{server, App};\n+use rita_common::dashboard::babel::*;\n+use rita_common::dashboard::debts::*;\n+use rita_common::dashboard::development::*;\n+use rita_common::dashboard::nickname::*;\n+use rita_common::dashboard::own_info::*;\n+use rita_common::dashboard::settings::*;\n+use rita_common::dashboard::token_bridge::*;\n+use rita_common::dashboard::usage::*;\n+use rita_common::dashboard::wallet::*;\n+use rita_common::dashboard::wg_key::*;\n+use rita_common::middleware;\n+use rita_common::network_endpoints::*;\n+\n+pub fn start_client_dashboard(rita_dashboard_password: u16) {\n+ // dashboard\n+ server::new(|| {\n+ App::new()\n+ .middleware(middleware::Headers)\n+ .middleware(middleware::Auth)\n+ .route(\"/backup_created\", Method::GET, get_backup_created)\n+ .route(\"/backup_created/{status}\", Method::POST, set_backup_created)\n+ .route(\"/dao_list\", Method::GET, get_dao_list)\n+ .route(\"/dao_list/add/{address}\", Method::POST, add_to_dao_list)\n+ .route(\n+ \"/dao_list/remove/{address}\",\n+ Method::POST,\n+ remove_from_dao_list,\n+ )\n+ .route(\"/dao_fee\", Method::GET, get_dao_fee)\n+ .route(\"/dao_fee/{fee}\", Method::POST, set_dao_fee)\n+ .route(\"/operator\", Method::GET, get_operator)\n+ .route(\"/operator/{address}\", Method::POST, change_operator)\n+ .route(\"/operator/remove\", Method::POST, remove_operator)\n+ .route(\"/operator_fee\", Method::GET, get_operator_fee)\n+ .route(\"/operator_debt\", Method::GET, get_operator_debt)\n+ .route(\"/debts\", Method::GET, get_debts)\n+ .route(\"/debts/reset\", Method::POST, reset_debt)\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+ .route(\"/exits/{name}/reset\", Method::POST, reset_exit)\n+ .route(\"/exits/{name}/select\", Method::POST, select_exit)\n+ .route(\"/local_fee\", Method::GET, get_local_fee)\n+ .route(\"/local_fee/{fee}\", Method::POST, set_local_fee)\n+ .route(\"/metric_factor\", Method::GET, get_metric_factor)\n+ .route(\"/metric_factor/{factor}\", Method::POST, set_metric_factor)\n+ .route(\n+ \"/exits/{name}/verify/{code}\",\n+ Method::POST,\n+ verify_on_exit_with_code,\n+ )\n+ .route(\"/info\", Method::GET, get_own_info)\n+ .route(\"/interfaces\", Method::GET, get_interfaces_endpoint)\n+ .route(\"/interfaces\", Method::POST, set_interfaces_endpoint)\n+ .route(\"/interfaces/mesh\", Method::GET, wlan_mesh_get)\n+ .route(\"/interfaces/lightclient\", Method::GET, wlan_lightclient_get)\n+ .route(\"/interfaces/mesh/{enabled}\", Method::POST, wlan_mesh_set)\n+ .route(\n+ \"/interfaces/lightclient/{enabled}\",\n+ Method::POST,\n+ wlan_lightclient_set,\n+ )\n+ .route(\"/eth_private_key\", Method::GET, get_eth_private_key)\n+ .route(\"/mesh_ip\", Method::GET, get_mesh_ip)\n+ .route(\"/neighbors\", Method::GET, get_neighbor_info)\n+ .route(\"/routes\", Method::GET, get_routes)\n+ .route(\"/remote_logging/enabled\", Method::GET, get_remote_logging)\n+ .route(\n+ \"/remote_logging/enabled/{enabled}\",\n+ Method::POST,\n+ remote_logging,\n+ )\n+ .route(\n+ \"/remote_logging/level\",\n+ Method::GET,\n+ get_remote_logging_level,\n+ )\n+ .route(\n+ \"/remote_logging/level/{level}\",\n+ Method::POST,\n+ remote_logging_level,\n+ )\n+ .route(\"/settings\", Method::GET, get_settings)\n+ .route(\"/settings\", Method::POST, set_settings)\n+ .route(\"/version\", Method::GET, version)\n+ .route(\"/wg_public_key\", Method::GET, get_wg_public_key)\n+ .route(\"/wifi_settings\", Method::POST, set_wifi_multi)\n+ .route(\n+ \"/wifi_settings/get_channels/{radio}\",\n+ Method::GET,\n+ get_allowed_wifi_channels,\n+ )\n+ .route(\"/wifi_settings\", Method::GET, get_wifi_config)\n+ .route(\"/withdraw/{address}/{amount}\", Method::POST, withdraw)\n+ .route(\"/withdraw_all/{address}\", Method::POST, withdraw_all)\n+ .route(\n+ \"/auto_price/enabled/{status}\",\n+ Method::POST,\n+ set_auto_pricing,\n+ )\n+ .route(\"/auto_price/enabled\", Method::GET, auto_pricing_status)\n+ .route(\"/prices\", Method::GET, get_prices)\n+ .route(\n+ \"/blockchain/set/{chain_id}\",\n+ Method::POST,\n+ set_system_blockchain_endpoint,\n+ )\n+ .route(\"/blockchain/get\", Method::GET, get_system_blockchain)\n+ .route(\"/nickname/get\", Method::GET, get_nickname)\n+ .route(\"/nickname/set\", Method::POST, set_nickname)\n+ .route(\n+ \"/low_balance_notification\",\n+ Method::GET,\n+ get_low_balance_notification,\n+ )\n+ .route(\n+ \"/low_balance_notification/{status}\",\n+ Method::POST,\n+ set_low_balance_notification,\n+ )\n+ .route(\"/usage/relay\", Method::GET, get_relay_usage)\n+ .route(\"/usage/client\", Method::GET, get_client_usage)\n+ .route(\"/usage/payments\", Method::GET, get_payments)\n+ .route(\"/token_bridge/status\", Method::GET, get_bridge_status)\n+ .route(\"/router/reboot\", Method::POST, reboot_router)\n+ .route(\"/router/update\", Method::POST, update_router)\n+ .route(\"/router/password\", Method::POST, set_pass)\n+ .route(\"/release_feed/get\", Method::GET, get_release_feed_http)\n+ .route(\n+ \"/release_feed/set/{feed}\",\n+ Method::POST,\n+ set_release_feed_http,\n+ )\n+ .route(\"/remote_access\", Method::GET, get_remote_access_status)\n+ .route(\n+ \"/remote_access/{status}\",\n+ Method::POST,\n+ set_remote_access_status,\n+ )\n+ .route(\"/wipe\", Method::POST, wipe)\n+ .route(\"/crash_actors\", Method::POST, crash_actors)\n+ .route(\"/localization\", Method::GET, get_localization)\n+ .route(\"/wyre_reservation\", Method::POST, get_wyre_reservation)\n+ .route(\n+ \"/installation_details\",\n+ Method::POST,\n+ set_installation_details,\n+ )\n+ .route(\n+ \"/installation_details\",\n+ Method::GET,\n+ get_installation_details,\n+ )\n+ .route(\"/billing_details\", Method::GET, get_billing_details)\n+ .route(\"/billing_details\", Method::POST, set_billing_details)\n+ .route(\"/bandwidth_limit\", Method::GET, get_bandwidth_limit)\n+ .route(\n+ \"/bandwidth_limit/{limit}\",\n+ Method::POST,\n+ set_bandwidth_limit,\n+ )\n+ .route(\n+ \"/operator_setup/{enabled}\",\n+ Method::POST,\n+ set_display_operator_setup,\n+ )\n+ .route(\"/operator_setup\", Method::GET, display_operator_setup)\n+ .route(\"/phone\", Method::GET, get_phone_number)\n+ .route(\"/phone\", Method::POST, set_phone_number)\n+ .route(\"/email\", Method::GET, get_email)\n+ .route(\"/email\", Method::POST, set_email)\n+ })\n+ .workers(1)\n+ .bind(format!(\"[::0]:{}\", rita_dashboard_password))\n+ .unwrap()\n+ .shutdown_timeout(0)\n+ .start();\n+}\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/lib.rs", "new_path": "rita_client/src/lib.rs", "diff": "@@ -19,6 +19,8 @@ pub mod operator_update;\npub mod rita_loop;\npub mod traffic_watcher;\n+use rita_common::READABLE_VERSION;\n+\npub use crate::dashboard::auth::*;\npub use crate::dashboard::backup_created::*;\npub use crate::dashboard::bandwidth_limit::*;\n@@ -41,3 +43,49 @@ pub use crate::dashboard::router::*;\npub use crate::dashboard::system_chain::*;\npub use crate::dashboard::usage;\npub use crate::dashboard::wifi::*;\n+use settings::client::RitaClientSettings;\n+use std::time::{Duration, Instant};\n+\n+#[derive(Debug, Deserialize, Default)]\n+pub struct Args {\n+ pub flag_config: String,\n+ pub flag_platform: String,\n+ pub flag_future: bool,\n+}\n+\n+// TODO we should remove --platform as it's not used, but that requires\n+// changing how rita is invoked everywhere, because that's difficult\n+// with in the field routers this is waiting on another more pressing\n+// upgrade to the init file for Rita on the routers\n+pub fn get_client_usage(version: &str, git_hash: &str) -> String {\n+ format!(\n+ \"Usage: rita --config=<settings> --platform=<platform> [--future]\n+Options:\n+ -c, --config=<settings> Name of config file\n+ -p, --platform=<platform> Platform (linux or OpenWrt)\n+ --future Enable B side of A/B releases\n+About:\n+ Version {} - {}\n+ git hash {}\",\n+ READABLE_VERSION, version, git_hash\n+ )\n+}\n+\n+/// Some devices (n600/n750) will provide junk file reads during disk init\n+/// post flashing, this adds in retry for the settings file read for up to\n+/// two minutes\n+pub fn wait_for_settings(settings_file: &str) -> RitaClientSettings {\n+ let start = Instant::now();\n+ let timeout = Duration::from_secs(120);\n+ let mut res = RitaClientSettings::new(settings_file);\n+ while (Instant::now() - start) < timeout {\n+ if let Ok(val) = res {\n+ return val;\n+ }\n+ res = RitaClientSettings::new(settings_file);\n+ }\n+ match res {\n+ Ok(val) => val,\n+ Err(e) => panic!(\"Settings parse failure {:?}\", e),\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "@@ -17,7 +17,6 @@ byteorder = { version = \"1.4\", features = [\"i128\"] }\narrayvec = {version= \"0.7\", features = [\"serde\"]}\nbabel_monitor = { path = \"../babel_monitor\" }\nflate2 = { version = \"1.0\", features = [\"rust_backend\"], default-features = false }\n-antenna_forwarding_client = {path = \"../antenna_forwarding_client\"}\nactix-async = {package=\"actix\", version = \"0.11\"}\nauto-bridge = {path = \"../auto_bridge\"}\nserde_json = \"1.0\"\n@@ -40,3 +39,8 @@ actix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\nasync-web30 = {package=\"web30\", version = \"0.14\"}\nalthea_types = { path = \"../althea_types\" }\nbabel_monitor_legacy = {path = \"../babel_monitor_legacy\"}\n+\n+[dependencies.regex]\n+version = \"1.4\"\n+default-features = false\n+features = [\"std\"]\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/lib.rs", "new_path": "rita_common/src/lib.rs", "diff": "@@ -23,6 +23,7 @@ pub mod blockchain_oracle;\npub mod dashboard;\npub mod debt_keeper;\npub mod hello_handler;\n+pub mod middleware;\npub mod network_endpoints;\npub mod network_monitor;\npub mod payment_controller;\n" }, { "change_type": "RENAME", "old_path": "rita_bin/src/middleware.rs", "new_path": "rita_common/src/middleware.rs", "diff": "//! This is the Actix-web middleware that attaches the content headers we need for\n//! the client dashboard\n-use crate::http::{header, HttpTryFrom, Method, StatusCode};\n+use actix_web::http::{header, HttpTryFrom, Method, StatusCode};\nuse actix_web::middleware::{Middleware, Response, Started};\nuse actix_web::{FromRequest, HttpRequest, HttpResponse, Result};\nuse actix_web_httpauth::extractors::basic::{BasicAuth, Config};\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/lib.rs", "new_path": "rita_exit/src/lib.rs", "diff": "@@ -10,9 +10,46 @@ extern crate failure;\n#[macro_use]\nextern crate serde_derive;\n+pub mod database;\n+pub mod logging;\n+pub mod network_endpoints;\n+pub mod rita_loop;\n+pub mod traffic_watcher;\n+\n+pub use crate::database::database_tools::*;\n+pub use crate::database::database_tools::*;\n+pub use crate::database::db_client::*;\n+pub use crate::database::email::*;\n+pub use crate::database::geoip::*;\n+pub use crate::database::sms::*;\n+pub use crate::logging::*;\n+use crate::network_endpoints::nuke_db;\n+use actix_web::http::Method;\n+use actix_web::{server, App};\nuse althea_types::SystemChain;\n+use althea_types::WgKey;\n+use diesel::r2d2::ConnectionManager;\n+use diesel::r2d2::Pool;\n+use diesel::PgConnection;\n+use rita_common::dashboard::babel::*;\n+use rita_common::dashboard::debts::*;\n+use rita_common::dashboard::development::*;\n+use rita_common::dashboard::nickname::*;\n+use rita_common::dashboard::own_info::READABLE_VERSION;\n+use rita_common::dashboard::own_info::*;\n+use rita_common::dashboard::settings::*;\n+use rita_common::dashboard::token_bridge::*;\n+use rita_common::dashboard::usage::*;\n+use rita_common::dashboard::wallet::*;\n+use rita_common::dashboard::wg_key::*;\n+use rita_common::middleware;\n+use rita_common::network_endpoints::version;\nuse settings::exit::ExitNetworkSettings;\nuse settings::exit::ExitVerifSettings;\n+use std::collections::HashSet;\n+use std::sync::Arc;\n+use std::sync::RwLock;\n+use std::time::Instant;\n// These are a set of vars that are never updated during runtime. This means we can have\n// read only versions of them available here to prevent lock contention on large exits.\n@@ -72,27 +109,57 @@ lazy_static! {\n))\n};\n}\n+#[derive(Debug, Deserialize, Default)]\n+pub struct Args {\n+ pub flag_config: String,\n+ pub flag_future: bool,\n+}\n-pub mod database;\n-pub mod logging;\n-pub mod network_endpoints;\n-pub mod rita_loop;\n-pub mod traffic_watcher;\n-\n-use std::collections::HashSet;\n-use std::sync::Arc;\n-use std::sync::RwLock;\n-use std::time::Instant;\n-\n-use althea_types::WgKey;\n-use diesel::r2d2::ConnectionManager;\n-use diesel::r2d2::Pool;\n-use diesel::PgConnection;\n+pub fn get_exit_usage(version: &str, git_hash: &str) -> String {\n+ format!(\n+ \"Usage: rita_exit --config=<settings>\n+Options:\n+ -c, --config=<settings> Name of config file\n+ --future Enable B side of A/B releases\n+About:\n+ Version {} - {}\n+ git hash {}\",\n+ READABLE_VERSION, version, git_hash\n+ )\n+}\n-pub use crate::database::database_tools::*;\n-pub use crate::database::database_tools::*;\n-pub use crate::database::db_client::*;\n-pub use crate::database::email::*;\n-pub use crate::database::geoip::*;\n-pub use crate::database::sms::*;\n-pub use crate::logging::*;\n+pub fn start_rita_exit_dashboard() {\n+ // Dashboard\n+ server::new(|| {\n+ App::new()\n+ .middleware(middleware::Headers)\n+ .route(\"/info\", Method::GET, get_own_info)\n+ .route(\"/local_fee\", Method::GET, get_local_fee)\n+ .route(\"/local_fee/{fee}\", Method::POST, set_local_fee)\n+ .route(\"/metric_factor\", Method::GET, get_metric_factor)\n+ .route(\"/metric_factor/{factor}\", Method::POST, set_metric_factor)\n+ .route(\"/settings\", Method::GET, get_settings)\n+ .route(\"/settings\", Method::POST, set_settings)\n+ .route(\"/version\", Method::GET, version)\n+ .route(\"/wg_public_key\", Method::GET, get_wg_public_key)\n+ .route(\"/wipe\", Method::POST, wipe)\n+ .route(\"/database\", Method::DELETE, nuke_db)\n+ .route(\"/debts\", Method::GET, get_debts)\n+ .route(\"/debts/reset\", Method::POST, reset_debt)\n+ .route(\"/withdraw/{address}/{amount}\", Method::POST, withdraw)\n+ .route(\"/withdraw_all/{address}\", Method::POST, withdraw_all)\n+ .route(\"/nickname/get/\", Method::GET, get_nickname)\n+ .route(\"/nickname/set/\", Method::POST, set_nickname)\n+ .route(\"/crash_actors\", Method::POST, crash_actors)\n+ .route(\"/usage/payments\", Method::GET, get_payments)\n+ .route(\"/token_bridge/status\", Method::GET, get_bridge_status)\n+ })\n+ .bind(format!(\n+ \"[::0]:{}\",\n+ settings::get_rita_exit().network.rita_dashboard_port\n+ ))\n+ .unwrap()\n+ .workers(1)\n+ .shutdown_timeout(0)\n+ .start();\n+}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Reduce size of rita_bin definitions This lifts a lot of extra library functions out of rita_bin and into rita_common, client, or exit where they can be imported by downstream libraries. What this will do is allow us to produce an internal version of Rita more easily.
20,244
15.08.2021 15:09:44
14,400
bccaeb821b393af3f4b0cb0790fc3d5a0bf9f1ea
Bump for Beta 18 RC1
[ { "change_type": "MODIFY", "old_path": "rita_common/src/dashboard/own_info.rs", "new_path": "rita_common/src/dashboard/own_info.rs", "diff": "@@ -5,7 +5,7 @@ use clarity::Address;\nuse failure::Error;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 18 RC0\";\n+pub static READABLE_VERSION: &str = \"Beta 18 RC1\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 18 RC1
20,247
18.08.2021 21:25:07
25,200
7bdbe6523dd188908812115a3f0f31ef45ef31b2
Bump rita-common to 0.18.1
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -3204,7 +3204,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.18.0\"\n+version = \"0.18.1\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "[package]\nname = \"rita_common\"\n-version = \"0.18.0\"\n+version = \"0.18.1\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump rita-common to 0.18.1
20,255
20.08.2021 13:12:35
25,200
fc9a211a6271893a7dc8a8f504a82603449718a8
Added tests to check the deposit flow in xdai_bridge Changed 'rescue_dai' to be the main transfer flow from dai to the xdai chain. Removes redundant deposit code that previously would not be executed because of the time taken for eth to be converted to dai.
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -544,7 +544,7 @@ dependencies = [\n\"serde 1.0.126\",\n\"serde_derive\",\n\"tokio 1.8.2\",\n- \"web30 0.15.0\",\n+ \"web30 0.15.1\",\n]\n[[package]]\n@@ -3239,7 +3239,7 @@ dependencies = [\n\"serde_json\",\n\"settings\",\n\"tokio 0.1.22\",\n- \"web30 0.15.0\",\n+ \"web30 0.15.1\",\n\"web30 0.4.3\",\n]\n@@ -4547,9 +4547,9 @@ dependencies = [\n[[package]]\nname = \"web30\"\n-version = \"0.15.0\"\n+version = \"0.15.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e7a9fb83f885149c4a79b8c379bb1d27b8417bce231388c8b79ba8b76b1fd9f7\"\n+checksum = \"c6650f5f21e5e7a5960f1aedf75c9795af99b41a5a90daa258a7c710b5604d55\"\ndependencies = [\n\"awc\",\n\"clarity\",\n" }, { "change_type": "MODIFY", "old_path": "auto_bridge/src/lib.rs", "new_path": "auto_bridge/src/lib.rs", "diff": "@@ -19,9 +19,8 @@ pub use error::TokenBridgeError;\n/// These hardcoded values are obtained\n// by looking at the values on Etherscan and observing gas values in practice, along with slight padding\n// to ensure correct operation. These hardcoded gas values are only being used to estimate the reserve amount\n-pub static UNISWAP_GAS_LIMIT: u128 = 80_000;\n+pub static UNISWAP_GAS_LIMIT: u128 = 150_000;\npub static ERC20_GAS_LIMIT: u128 = 40_000;\n-pub static ETH_TRANSACTION_GAS_LIMIT: u128 = 21_000;\npub static XDAI_FUNDS_UNLOCK_GAS: u128 = 180_000;\nfn default_helper_on_xdai_address() -> Address {\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/token_bridge/mod.rs", "new_path": "rita_common/src/token_bridge/mod.rs", "diff": "@@ -123,10 +123,9 @@ impl Default for TokenBridgeState {\n}\n}\n-/// If some part of the depositing chain is disrupted due to a failure we may end up\n-/// with a stranded dai balance, this function detects that balance and 'rescues' stranded\n-/// dai\n-async fn rescue_dai(\n+/// Transfers dai present in eth address from previous xdai_bridge iterations to the xdai chain.\n+/// This also assists in rescuing any stranded dai balance because of failures in depositing flow.\n+async fn transfer_dai(\nbridge: TokenBridgeCore,\nour_address: Address,\nminimum_stranded_dai_transfer: Uint256,\n@@ -242,17 +241,17 @@ async fn xdai_bridge() {\n}\n}\n- //rescue any stranded dai\n- let res = rescue_dai(\n+ // transfer dai exchanged from eth during previous iterations\n+ let res = transfer_dai(\nbridge.clone(),\nbridge.own_address,\nminimum_stranded_dai_transfer,\n)\n.await;\nif res.is_err() {\n- warn!(\"Failed to rescue dai with {:?}\", res);\n+ warn!(\"Failed to transfer dai with {:?}\", res);\n}\n- trace!(\"rescued dai\");\n+ trace!(\"Transfered dai\");\n// run the conveyor belt eth -> xdai\nif our_eth_balance >= minimum_to_exchange {\n@@ -265,20 +264,13 @@ async fn xdai_bridge() {\n});\ninfo!(\"Converting to Dai\");\n- let dai_bought = match bridge.eth_to_dai_swap(swap_amount, UNISWAP_TIMEOUT).await {\n+ let _dai_bought = match bridge.eth_to_dai_swap(swap_amount, UNISWAP_TIMEOUT).await {\nOk(val) => val,\nErr(e) => {\nwarn!(\"Failed to swap dai with {:?}\", e);\nreturn;\n}\n};\n- detailed_state_change(DetailedBridgeState::DaiToXdai {\n- amount: dai_bought.clone(),\n- });\n- // And over the bridge into xDai\n- let _res = bridge\n- .dai_to_xdai_bridge(dai_bought, ETH_TRANSFER_TIMEOUT)\n- .await;\n} else {\ndetailed_state_change(DetailedBridgeState::NoOp {\neth_balance: our_eth_balance,\n@@ -745,4 +737,110 @@ mod tests {\n}\n})\n}\n+\n+ /// Tests the deposit flow of funds from eth to dai on xdai chain. First converts eth to dai, reserving an amount\n+ /// to pay for withdrawal. Then transfer this amount over to the xdai chain.\n+ #[test]\n+ #[ignore]\n+ fn test_deposit_flow() {\n+ let pk = PrivateKey::from_str(&format!(\n+ \"983aa7cb3e22b5aa8425facb9703a{}e04bd829e675b{}e5df\",\n+ \"632c1e54099\", \"51b0281\"\n+ ))\n+ .unwrap();\n+\n+ let bridge = TokenBridge::new(\n+ default_bridge_addresses(),\n+ pk.to_public_key().unwrap(),\n+ pk,\n+ \"https://eth.altheamesh.com\".into(),\n+ \"https://dai.altheamesh.com\".into(),\n+ TIMEOUT,\n+ );\n+\n+ let runner = actix_async::System::new();\n+ runner.block_on(async move {\n+ let eth_gas_price = match bridge.eth_web3.eth_gas_price().await {\n+ Ok(val) => val,\n+ Err(e) => {\n+ panic!(\"Failed to get eth gas price with {}\", e);\n+ }\n+ };\n+\n+ let reserve_amount = get_reserve_amount(eth_gas_price.clone());\n+ println!(\"reserve amount is {}\", reserve_amount);\n+ let minimum_to_exchange = reserve_amount.clone()\n+ + (eth_gas_price.clone() * (UNISWAP_GAS_LIMIT + ERC20_GAS_LIMIT).into());\n+ println!(\"Mnimum to exchnage is {}\", minimum_to_exchange);\n+\n+ let our_eth_balance = match bridge.eth_web3.eth_get_balance(bridge.own_address).await {\n+ Ok(val) => val,\n+ Err(e) => {\n+ panic!(\"Failed to get eth balance {}\", e);\n+ }\n+ };\n+ println!(\"Our eth balance is {}\", our_eth_balance);\n+\n+ // run the conveyor belt eth -> xdai\n+ if our_eth_balance >= minimum_to_exchange {\n+ // Leave a reserve in the account to use for gas in the future\n+ let swap_amount = our_eth_balance - reserve_amount;\n+\n+ let dai_bought = match bridge.eth_to_dai_swap(swap_amount, UNISWAP_TIMEOUT).await {\n+ Ok(val) => val,\n+ Err(e) => {\n+ panic!(\"Failed to swap dai with {:?}\", e);\n+ }\n+ };\n+ println!(\"received dai: {}\", dai_bought);\n+\n+ // And over the bridge into xDai\n+ let _res = bridge\n+ .dai_to_xdai_bridge(dai_bought, ETH_TRANSFER_TIMEOUT)\n+ .await;\n+ } else {\n+ println!(\"ETH BALANCE IS NOT GREATER THAN MIN\");\n+ }\n+ })\n+ }\n+\n+ /// Tests that funds in dai are being transfered over to the xdai blockchain as long as dai funds are greater than\n+ /// minimum amount to exchange (cost of a withdrawal + cost of swap to dai + cost of transfer)\n+ #[test]\n+ #[ignore]\n+ fn test_transfer_dai() {\n+ let pk = PrivateKey::from_str(&format!(\n+ \"983aa7cb3e22b5aa8425facb9703a{}e04bd829e675b{}e5df\",\n+ \"632c1e54099\", \"51b0281\"\n+ ))\n+ .unwrap();\n+\n+ let bridge = TokenBridge::new(\n+ default_bridge_addresses(),\n+ pk.to_public_key().unwrap(),\n+ pk,\n+ \"https://eth.altheamesh.com\".into(),\n+ \"https://dai.altheamesh.com\".into(),\n+ TIMEOUT,\n+ );\n+\n+ let runner = actix_async::System::new();\n+ runner.block_on(async move {\n+ let eth_gas_price = match bridge.eth_web3.eth_gas_price().await {\n+ Ok(val) => val,\n+ Err(e) => {\n+ panic!(\"Failed to get eth gas price with {}\", e);\n+ }\n+ };\n+ let reserve_amount = get_reserve_amount(eth_gas_price.clone());\n+\n+ let minimum_to_exchange = reserve_amount.clone()\n+ + (eth_gas_price.clone() * (UNISWAP_GAS_LIMIT + ERC20_GAS_LIMIT).into());\n+\n+ let res = transfer_dai(bridge.clone(), bridge.own_address, minimum_to_exchange).await;\n+ if res.is_err() {\n+ panic!(\"Failed to rescue dai with {:?}\", res);\n+ }\n+ })\n+ }\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Added tests to check the deposit flow in xdai_bridge Changed 'rescue_dai' to be the main transfer flow from dai to the xdai chain. Removes redundant deposit code that previously would not be executed because of the time taken for eth to be converted to dai.
20,255
23.08.2021 15:03:46
25,200
5c3a86701455f7330b8ebca8c595f1e7bfe2d74d
Only swap tokens during lower 20% gas prices We monitor gas prices in a 24 hour window, and execute desposit swap only when eth gas price is in lower 20% of prices. This greatly reduces gas fees during the deposit process, since the daily min is often 6x lower than daily max.
[ { "change_type": "MODIFY", "old_path": "rita_common/src/token_bridge/mod.rs", "new_path": "rita_common/src/token_bridge/mod.rs", "diff": "@@ -37,6 +37,9 @@ use num_traits::identities::Zero;\nuse rand::{thread_rng, Rng};\nuse settings::payment::PaymentSettings;\n+use std::cmp::Ordering;\n+use std::collections::VecDeque;\n+use std::iter::FromIterator;\nuse std::sync::Arc;\nuse std::sync::RwLock;\nuse std::time::Duration;\n@@ -45,6 +48,9 @@ lazy_static! {\nstatic ref BRIDGE: Arc<RwLock<TokenBridgeState>> =\nArc::new(RwLock::new(TokenBridgeState::default()));\nstatic ref AMOUNTS: Arc<RwLock<LastAmounts>> = Arc::new(RwLock::new(LastAmounts::default()));\n+ /// This variable pushes gas prices every minute over the last 24 hours. New entries are pushed to the front\n+ /// and older entries are popped from the back. The number of entries here is limited by the constant GAS_PRICE_ENTRIES\n+ static ref GAS_PRICES: Arc<RwLock<VecDeque<Uint256>>> = Arc::new(RwLock::new(VecDeque::with_capacity(GAS_PRICE_ENTRIES)));\n}\npub const ETH_TRANSFER_TIMEOUT: Duration = Duration::from_secs(600);\n@@ -53,6 +59,9 @@ const UNISWAP_TIMEOUT: Duration = ETH_TRANSFER_TIMEOUT;\nconst WEI_PER_ETH: u128 = 1_000_000_000_000_000_000_u128;\nconst SIGNATURES_TIMEOUT: Duration = ETH_TRANSFER_TIMEOUT;\nconst BLOCKS: u64 = 40_032;\n+/// This is the number of minutes in a day. We use this since we run the xdai_bridge every minute, therefore\n+/// entering an entry every minute\n+const GAS_PRICE_ENTRIES: usize = 1440;\npub fn eth_to_wei(eth: u64) -> Uint256 {\nlet wei = eth as u128 * WEI_PER_ETH;\n@@ -188,6 +197,19 @@ async fn xdai_bridge() {\n}\n};\n+ // Add gas price entry to lazy static\n+ let writer = &mut *GAS_PRICES.write().unwrap();\n+ update_gas_price_store(eth_gas_price.clone(), writer);\n+\n+ // Get max acceptable gas price (within 20%)\n+ let max_gas_price = match get_acceptable_gas_price(eth_gas_price.clone(), writer) {\n+ Ok(a) => a,\n+ Err(_) => {\n+ error!(\"Not enough entries in gas price datastore, or error in datastore entry logic\");\n+ return;\n+ }\n+ };\n+\n// the amount of Eth to retain in WEI. This is the cost of our transfer from the\n// xdai chain to the destination address.\nlet reserve_amount = get_reserve_amount(eth_gas_price.clone());\n@@ -241,6 +263,12 @@ async fn xdai_bridge() {\n}\n}\n+ //run these deposit steps only if gas price is low\n+ if max_gas_price < eth_gas_price {\n+ warn!(\"Gas prices too high this iteration\");\n+ return;\n+ }\n+\n// transfer dai exchanged from eth during previous iterations\nlet res = transfer_dai(\nbridge.clone(),\n@@ -279,6 +307,49 @@ async fn xdai_bridge() {\n}\n}\n+/// This helper function adds a gas price entry to the GAS_PRICES data store.\n+fn update_gas_price_store(gp: Uint256, datastore: &mut VecDeque<Uint256>) {\n+ match datastore.len().cmp(&GAS_PRICE_ENTRIES) {\n+ Ordering::Less => datastore.push_front(gp),\n+ Ordering::Equal => {\n+ //vec is full, remove oldest entry\n+ datastore.pop_back();\n+ datastore.push_front(gp);\n+ }\n+ Ordering::Greater => {\n+ panic!(\"Vec size greater than max size, error in GAS_PRICES vecDeque logic\")\n+ }\n+ }\n+}\n+\n+/// Look thorugh all the gas prices in the last 24 hours and determine the highest\n+/// acceptabe price to pay (bottom 20% of gas prices in last 24 hours)\n+fn get_acceptable_gas_price(\n+ eth_gas_price: Uint256,\n+ datastore: &VecDeque<Uint256>,\n+) -> Result<Uint256, Error> {\n+ // if there are no entries, return current gas price as acceptable\n+ // We should not reach this condition since we alway call update_gas_price_store\n+ // before calling this function\n+ if datastore.is_empty() {\n+ return Ok(eth_gas_price);\n+ }\n+\n+ let vector = datastore.clone();\n+ let mut vector: Vec<Uint256> = Vec::from_iter(vector);\n+ vector.sort();\n+\n+ //find gas price in lowest 20%\n+ let lowest_20: usize = (0.2_f32 * vector.len() as f32).ceil() as usize;\n+ let value = match vector.get(lowest_20 - 1) {\n+ Some(a) => a.clone(),\n+ None => {\n+ bail!(\"There is no entry at index {}, should not reach this condition, error with GAS_PRICES vecDeque logic\", lowest_20 - 1);\n+ }\n+ };\n+ Ok(value)\n+}\n+\n/// This function is called inside the bridge loop. It retrieves the 'n' most recent blocks\n/// (where 'n' is the const 'BLOCKS' that is currently set to 40,032, which represents 1 week of blocks on xdai chain) that\n/// have withdraw events related to our address. It then simulates these events and submits\n@@ -388,7 +459,7 @@ pub struct Withdraw {\n}\n/// Since our withdraw function is async and cannot be called from the previous sync context\n-/// we use this function to setup information about the withdrawal in the sync context. We setup\n+/// we use this function to setup information about the withdrawal in the sync cUint256::from_bytes_be(&[12_u8])ontext. We setup\n/// a bool and Withdraw struct inside a lazy static variable that we can read from later when\n/// we initiate the withdrawal from an async context.\npub fn setup_withdraw(msg: Withdraw) -> Result<(), Error> {\n@@ -843,4 +914,100 @@ mod tests {\n}\n})\n}\n+\n+ /// This test the function update_gas_price_store to check if the lazy static would be updated\n+ /// correctly, both for when the queue size is less that max capacity and for when it is at max\n+ /// capacity\n+ #[test]\n+ fn test_update_gas_price_store() {\n+ let mut vec: VecDeque<Uint256> = VecDeque::with_capacity(GAS_PRICE_ENTRIES);\n+ assert_eq!(vec.len(), 0);\n+\n+ update_gas_price_store(12_u32.into(), &mut vec);\n+\n+ assert_eq!(vec.len(), 1);\n+ assert_eq!(\n+ vec.get(0).unwrap().clone(),\n+ Uint256::from_bytes_be(&[12_u8])\n+ );\n+\n+ let append_vec = vec![Uint256::from_bytes_be(&[12_u8]); 1439];\n+\n+ vec.append(&mut VecDeque::from(append_vec));\n+\n+ assert_eq!(vec.len(), GAS_PRICE_ENTRIES);\n+\n+ update_gas_price_store(11_u32.into(), &mut vec);\n+\n+ // Vec size should not exceed GAS_PRICE_ENTRIES and eariliest elemtn should match what we just added.\n+ assert_eq!(vec.len(), GAS_PRICE_ENTRIES);\n+ assert_eq!(\n+ vec.get(0).unwrap().clone(),\n+ Uint256::from_bytes_be(&[11_u8])\n+ );\n+ }\n+\n+ /// Test the function get_acceptable_gas_price, which contains logic for getting the max threshold\n+ /// for the bottom 20% of prices in datastore. Tests various scenarios such as empty queue and odd\n+ /// number of elements in datastore\n+ #[test]\n+ fn test_get_acceptable_gas_price() {\n+ let mut vec: VecDeque<Uint256> = VecDeque::with_capacity(GAS_PRICE_ENTRIES);\n+ let eth_gas_price = Uint256::from_bytes_be(&[12_u8]);\n+\n+ // when datastore is empty, return current gas price\n+ let res = get_acceptable_gas_price(eth_gas_price.clone(), &vec).unwrap();\n+ assert_eq!(eth_gas_price, res);\n+\n+ // when datastore has one element, return it\n+ vec.push_front(12_u32.into());\n+ let res = get_acceptable_gas_price(eth_gas_price.clone(), &vec).unwrap();\n+ assert_eq!(res, eth_gas_price);\n+ vec.pop_front();\n+\n+ // when datastore has multiple elements, calculate bottom 20% and return threshold value\n+ let append_vec: Vec<Uint256> = vec![\n+ 1_u32.into(),\n+ 2_u32.into(),\n+ 3_u32.into(),\n+ 4_u32.into(),\n+ 5_u32.into(),\n+ 6_u32.into(),\n+ 7_u32.into(),\n+ 8_u32.into(),\n+ 9_u32.into(),\n+ 10_u32.into(),\n+ ];\n+ assert_eq!(vec.len(), 0);\n+ vec.append(&mut VecDeque::from(append_vec));\n+ assert_eq!(vec.len(), 10);\n+ let res = get_acceptable_gas_price(eth_gas_price.clone(), &vec).unwrap();\n+ assert_eq!(res, Uint256::from_bytes_be(&[2_u8]));\n+\n+ //test for random order in datastore\n+ vec.clear();\n+ assert_eq!(vec.len(), 0);\n+ let append_vec: Vec<Uint256> = vec![\n+ 10_u32.into(),\n+ 5_u32.into(),\n+ 3_u32.into(),\n+ 7_u32.into(),\n+ 8_u32.into(),\n+ 6_u32.into(),\n+ 2_u32.into(),\n+ 1_u32.into(),\n+ 9_u32.into(),\n+ 4_u32.into(),\n+ ];\n+ vec.append(&mut VecDeque::from(append_vec));\n+ assert_eq!(vec.len(), 10);\n+ let res = get_acceptable_gas_price(eth_gas_price.clone(), &vec).unwrap();\n+ assert_eq!(res, Uint256::from_bytes_be(&[2_u8]));\n+\n+ //test for odd nubmer of elements in datastore\n+ vec.push_front(0_u32.into());\n+ assert_eq!(vec.len(), 11);\n+ let res = get_acceptable_gas_price(eth_gas_price, &vec).unwrap();\n+ assert_eq!(res, Uint256::from_bytes_be(&[2_u8]));\n+ }\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Only swap tokens during lower 20% gas prices We monitor gas prices in a 24 hour window, and execute desposit swap only when eth gas price is in lower 20% of prices. This greatly reduces gas fees during the deposit process, since the daily min is often 6x lower than daily max.
20,247
19.08.2021 13:40:08
25,200
5defbc382be3a37319920fd6b8b993712f45c594
Bump Rita versions to 0.18.1
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -3131,7 +3131,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.18.0\"\n+version = \"0.18.1\"\ndependencies = [\n\"actix 0.11.1\",\n\"actix 0.7.11\",\n@@ -3167,7 +3167,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.18.0\"\n+version = \"0.18.1\"\ndependencies = [\n\"actix 0.7.11\",\n\"actix-web 0.7.19\",\n@@ -3245,7 +3245,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.18.0\"\n+version = \"0.18.1\"\ndependencies = [\n\"actix 0.7.11\",\n\"actix-web 0.7.19\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.18.0\"\n+version = \"0.18.1\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\nbuild = \"build.rs\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "[package]\nname = \"rita_client\"\n-version = \"0.18.0\"\n+version = \"0.18.1\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/Cargo.toml", "new_path": "rita_exit/Cargo.toml", "diff": "[package]\nname = \"rita_exit\"\n-version = \"0.18.0\"\n+version = \"0.18.1\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump Rita versions to 0.18.1
20,244
30.09.2020 06:37:15
14,400
c7b35e75c8aa3e91b7b2e490289ce71e0f7fcba2
Migrate to github actions Travis has long been an abandoned product and it's only gotten worse lets try this out.
[ { "change_type": "ADD", "old_path": null, "new_path": ".github/workflows/backwards-compatibility.yml", "diff": "+name: Backwards compatibility test\n+\n+on:\n+ push:\n+ branches: [master]\n+ pull_request:\n+ branches: [master]\n+\n+jobs:\n+ build:\n+ runs-on: ubuntu-latest\n+\n+ steps:\n+ - uses: actions/checkout@v2\n+ - name: Install Wireguard\n+ run: sudo apt-get update && sudo apt install -y wireguard linux-source linux-headers-$(uname -r) build-essential && sudo modprobe wireguard\n+ - name: Run integration test\n+ run: bash scripts/test-ci.sh\n" }, { "change_type": "ADD", "old_path": null, "new_path": ".github/workflows/integration-test.yml", "diff": "+name: All up test\n+\n+on:\n+ push:\n+ branches: [master]\n+ pull_request:\n+ branches: [master]\n+\n+jobs:\n+ build:\n+ runs-on: ubuntu-latest\n+\n+ steps:\n+ - uses: actions/checkout@v2\n+ - name: Install Wireguard\n+ run: sudo apt-get update && sudo apt install -y wireguard linux-source linux-headers-$(uname -r) build-essential && sudo modprobe wireguard\n+ - name: Run integration test\n+ run: bash scripts/test-ci-backcompat.sh\n" }, { "change_type": "ADD", "old_path": null, "new_path": ".github/workflows/rust.yml", "diff": "+name: Rust\n+\n+on:\n+ push:\n+ branches: [master]\n+ pull_request:\n+ branches: [master]\n+\n+env:\n+ CARGO_TERM_COLOR: always\n+\n+jobs:\n+ build:\n+ runs-on: ubuntu-latest\n+\n+ steps:\n+ - uses: actions/checkout@v2\n+ - name: Install cross\n+ run: cargo install cross\n+ - name: Test Rita and Rita Exit x86\n+ run: cargo build --all && RUST_TEST_THREADS=1 cargo test --verbose --all\n+ - name: Cross test x86_64\n+ run: cross test --target x86_64-unknown-linux-musl --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\n+ - name: Cross test mips\n+ run: cross test --target mips-unknown-linux-musl --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\n+ - name: Cross test mipsel\n+ run: cross test --target mipsel-unknown-linux-musl --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\n+ - name: Cross test mips64\n+ run: cross test --target mips64-unknown-linux-gnuabi64 --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\n+ - name: Cross test mips64el\n+ run: cross test --target mips64el-unknown-linux-gnuabi64 --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\n+ - name: Cross test aarch64\n+ run: cross test --target aarch64-unknown-linux-musl --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\n+ - name: Cross test armv7\n+ run: cross test --target armv7-unknown-linux-musleabihf --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/container/Dockerfile", "new_path": "integration-tests/container/Dockerfile", "diff": "@@ -9,6 +9,10 @@ ENV POSTGRES_BIN=/usr/lib/postgresql/13/bin/postgres\nENV INITDB_BIN=/usr/lib/postgresql/13/bin/initdb\nRUN PATH=$PATH:$HOME/.cargo/bin cargo install diesel_cli --force\nARG NODES\n+ENV SPEEDTEST_THROUGHPUT=$SPEEDTEST_THROUGHPUT\n+ENV SPEEDTEST_DURATION=$SPEEDTEST_DURATION\n+ENV VERBOSE=$VERBOSE\n+RUN PATH=$PATH:$HOME/.cargo/bin cargo install diesel_cli --force\nENV 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" }, { "change_type": "ADD", "old_path": null, "new_path": "scripts/test-ci-backcompat.sh", "diff": "+#!/bin/bash\n+set -eux\n+NODES=${NODES:='None'}\n+\n+RUST_TEST_THREADS=1 cargo test --all\n+\n+if ! modprobe wireguard ; then\n+ echo \"The container can't load modules into the host kernel\"\n+ echo \"Please install WireGuard https://www.wireguard.com/ and load the kernel module using 'sudo modprobe wireguard'\"\n+ exit 1\n+fi\n+\n+DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\n+DOCKERFOLDER=$DIR/../integration-tests/container/\n+REPOFOLDER=$DIR/..\n+git archive --format=tar.gz -o $DOCKERFOLDER/rita.tar.gz --prefix=althea_rs/ HEAD\n+pushd $DOCKERFOLDER\n+time docker build -t rita-test --build-arg NODES=$NODES --build-arg SPEEDTEST_THROUGHPUT=\"20\" --build-arg SPEEDTEST_DURATION=\"15\" --build-arg REVISION_B=master --build-arg REMOTE_A=.. --build-arg REMOTE_B=\"https://github.com/althea-mesh/althea_rs.git\" --build-arg COMPAT_LAYOUT=\"inner_ring_old\" --build-arg INITIAL_POLL_INTERVAL=5 --build-arg BACKOFF_FACTOR=\"1.5\" --build-arg VERBOSE=1 .\n+time docker run --privileged -t rita-test\n+rm rita.tar.gz\n+popd\n" }, { "change_type": "ADD", "old_path": null, "new_path": "scripts/test-ci.sh", "diff": "+#!/bin/bash\n+set -eux\n+NODES=${NODES:='None'}\n+\n+RUST_TEST_THREADS=1 cargo test --all\n+\n+if ! modprobe wireguard ; then\n+ echo \"The container can't load modules into the host kernel\"\n+ echo \"Please install WireGuard https://www.wireguard.com/ and load the kernel module using 'sudo modprobe wireguard'\"\n+ exit 1\n+fi\n+\n+DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\n+DOCKERFOLDER=$DIR/../integration-tests/container/\n+REPOFOLDER=$DIR/..\n+git archive --format=tar.gz -o $DOCKERFOLDER/rita.tar.gz --prefix=althea_rs/ HEAD\n+pushd $DOCKERFOLDER\n+time docker build -t rita-test --build-arg NODES=$NODES --build-arg SPEEDTEST_THROUGHPUT=\"20\" --build-arg SPEEDTEST_DURATION=\"15\" --build-arg INITIAL_POLL_INTERVAL=5 --build-arg BACKOFF_FACTOR=\"1.5\" --build-arg VERBOSE=1 .\n+time docker run --privileged -t rita-test\n+rm rita.tar.gz\n+popd\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Migrate to github actions Travis has long been an abandoned product and it's only gotten worse lets try this out.
20,255
26.08.2021 11:46:58
25,200
093e1abc7bf22dc2cd3ebfd738e993e1bb8ac846
Migrated Exit Manager and QueryExitDebts to async await. Removed the futures based http client in these handlers and replaced them with the async http client 'awc'
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -108,6 +108,7 @@ dependencies = [\n\"ahash\",\n\"base64 0.13.0\",\n\"bitflags\",\n+ \"brotli2\",\n\"bytes 1.0.1\",\n\"bytestring\",\n\"derive_more\",\n@@ -267,7 +268,7 @@ dependencies = [\n\"bitflags\",\n\"byteorder\",\n\"bytes 0.4.12\",\n- \"cookie\",\n+ \"cookie 0.11.4\",\n\"encoding\",\n\"failure\",\n\"futures 0.1.31\",\n@@ -607,6 +608,7 @@ dependencies = [\n\"base64 0.13.0\",\n\"bytes 1.0.1\",\n\"cfg-if 1.0.0\",\n+ \"cookie 0.15.1\",\n\"derive_more\",\n\"futures-core\",\n\"itoa\",\n@@ -770,6 +772,26 @@ version = \"0.2.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae\"\n+[[package]]\n+name = \"brotli-sys\"\n+version = \"0.3.2\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd\"\n+dependencies = [\n+ \"cc\",\n+ \"libc\",\n+]\n+\n+[[package]]\n+name = \"brotli2\"\n+version = \"0.3.2\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e\"\n+dependencies = [\n+ \"brotli-sys\",\n+ \"libc\",\n+]\n+\n[[package]]\nname = \"bufstream\"\nversion = \"0.1.4\"\n@@ -963,6 +985,17 @@ dependencies = [\n\"time 0.1.43\",\n]\n+[[package]]\n+name = \"cookie\"\n+version = \"0.15.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"d5f1c7727e460397e56abc4bddc1d49e07a1ad78fc98eb2e1c8f032a58a2f80d\"\n+dependencies = [\n+ \"percent-encoding 2.1.0\",\n+ \"time 0.2.27\",\n+ \"version_check 0.9.3\",\n+]\n+\n[[package]]\nname = \"core-foundation\"\nversion = \"0.9.1\"\n@@ -3238,11 +3271,13 @@ dependencies = [\nname = \"rita_client\"\nversion = \"0.18.1\"\ndependencies = [\n+ \"actix 0.12.0\",\n\"actix 0.7.11\",\n\"actix-web 0.7.19\",\n\"althea_kernel_interface\",\n\"althea_types\",\n\"arrayvec 0.7.1\",\n+ \"awc\",\n\"babel_monitor\",\n\"babel_monitor_legacy\",\n\"clarity\",\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "@@ -35,6 +35,8 @@ sodiumoxide = \"0.2\"\nclu = { path = \"../clu\" }\nweb30 = {git = \"https://github.com/althea-net/web30\", rev = \"a600b8b8ebf2c49badee6b65ac90a56bbdad4ab9\"}\nactix = \"0.7\"\n+awc = \"3.0.0-beta.7\"\n+actix-async = {package=\"actix\", version = \"0.12\"}\nactix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\nclarity = \"0.4\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/prices.rs", "new_path": "rita_client/src/dashboard/prices.rs", "diff": "use crate::traffic_watcher::GetExitDestPrice;\n-use crate::traffic_watcher::TrafficWatcher;\n+use crate::traffic_watcher::TrafficWatcherActor;\nuse actix::SystemService;\nuse actix_web::Path;\n@@ -47,7 +47,7 @@ pub fn get_prices(_req: HttpRequest) -> Box<dyn Future<Item = Json<Prices>, Erro\ndebug!(\"/prices GET hit\");\nlet payment = settings::get_rita_client().payment;\n- let f = TrafficWatcher::from_registry().send(GetExitDestPrice);\n+ let f = TrafficWatcherActor::from_registry().send(GetExitDestPrice);\nlet b = f.from_err().and_then(move |exit_dest_price| {\nlet exit_dest_price = exit_dest_price.unwrap();\nlet simulated_tx_fee = payment.simulated_transaction_fee;\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/exit_manager/mod.rs", "new_path": "rita_client/src/exit_manager/mod.rs", "diff": "//!\n//! Signup is complete and the user may use the connection\n-use crate::rita_loop::Tick;\nuse crate::rita_loop::CLIENT_LOOP_TIMEOUT;\n-use crate::traffic_watcher::{QueryExitDebts, TrafficWatcher};\n-use actix::registry::SystemService;\n-use actix::{Actor, Arbiter, Context, Handler, ResponseFuture, Supervised};\n+use crate::traffic_watcher::{query_exit_debts, QueryExitDebts};\nuse actix_web::client::Connection;\n+\nuse actix_web::{client, HttpMessage, Result};\nuse althea_kernel_interface::{\nexit_client_tunnel::ClientExitTunnelConfig, DefaultRoute, KernelInterfaceError,\n@@ -31,12 +29,9 @@ use althea_types::ExitDetails;\nuse althea_types::WgKey;\nuse althea_types::{EncryptedExitClientIdentity, EncryptedExitState};\nuse althea_types::{ExitClientIdentity, ExitRegistrationDetails, ExitState, ExitVerifMode};\n-use babel_monitor_legacy::open_babel_stream_legacy;\n-use babel_monitor_legacy::parse_routes_legacy;\n-use babel_monitor_legacy::start_connection_legacy;\n+use babel_monitor::{open_babel_stream, parse_routes};\nuse failure::Error;\nuse futures01::future;\n-use futures01::future::join_all;\nuse futures01::Future;\nuse rita_common::blockchain_oracle::low_balance;\nuse rita_common::KI;\n@@ -45,9 +40,15 @@ use sodiumoxide::crypto::box_;\nuse sodiumoxide::crypto::box_::curve25519xsalsa20poly1305::Nonce;\nuse sodiumoxide::crypto::box_::curve25519xsalsa20poly1305::PublicKey;\nuse std::net::SocketAddr;\n+use std::sync::Arc;\n+use std::sync::RwLock;\nuse std::time::Duration;\nuse tokio::net::TcpStream as TokioTcpStream;\n-use tokio::util::FutureExt;\n+\n+lazy_static! {\n+ pub static ref EXIT_MANAGER: Arc<RwLock<ExitManager>> =\n+ Arc::new(RwLock::new(ExitManager::default()));\n+}\nfn linux_setup_exit_tunnel(\ncurrent_exit: &ExitServer,\n@@ -97,20 +98,19 @@ fn remove_nat() {\n}\n}\n-pub fn get_exit_info(to: &SocketAddr) -> impl Future<Item = ExitState, Error = Error> {\n+pub async fn get_exit_info(to: &SocketAddr) -> Result<ExitState, Error> {\nlet endpoint = format!(\"http://[{}]:{}/exit_info\", to.ip(), to.port());\n- let stream = TokioTcpStream::connect(to);\n+ let client = awc::Client::default();\n+ let mut response = match client.get(&endpoint).send().await {\n+ Ok(a) => a,\n+ Err(e) => {\n+ bail!(\"Error with get request for exit info: {}\", e);\n+ }\n+ };\n+ let response_json = response.json().await?;\n- stream.from_err().and_then(move |stream| {\n- client::get(&endpoint)\n- .with_connection(Connection::from_stream(stream))\n- .finish()\n- .unwrap()\n- .send()\n- .from_err()\n- .and_then(|response| response.json().from_err().and_then(Ok))\n- })\n+ Ok(response_json)\n}\nfn encrypt_exit_client_id(\n@@ -200,60 +200,51 @@ fn send_exit_setup_request(\n})\n}\n-fn send_exit_status_request(\n+async fn send_exit_status_request(\nexit_pubkey: WgKey,\nto: &SocketAddr,\nident: ExitClientIdentity,\n-) -> impl Future<Item = ExitState, Error = Error> {\n+) -> Result<ExitState, Error> {\nlet endpoint = format!(\"http://[{}]:{}/secure_status\", to.ip(), to.port());\nlet ident = encrypt_exit_client_id(&exit_pubkey.into(), ident);\n- let stream = TokioTcpStream::connect(to);\n-\n- stream.from_err().and_then(move |stream| {\n- client::post(&endpoint)\n+ let client = awc::Client::default();\n+ let response = client\n+ .post(&endpoint)\n.timeout(CLIENT_LOOP_TIMEOUT)\n- .with_connection(Connection::from_stream(stream))\n- .json(ident)\n- .unwrap()\n- .send()\n- .from_err()\n- .and_then(move |response| {\n- response\n- .json()\n- .from_err()\n- .and_then(move |value: EncryptedExitState| {\n+ .send_json(&ident)\n+ .await;\n+\n+ let mut response = match response {\n+ Ok(a) => a,\n+ Err(e) => bail!(\"Error with post request for exit status: {}\", e),\n+ };\n+\n+ let value = response.json().await?;\n+\ndecrypt_exit_state(value, exit_pubkey.into())\n- })\n- })\n- })\n}\n-fn exit_general_details_request(exit: String) -> impl Future<Item = (), Error = Error> {\n+async fn exit_general_details_request(exit: String) -> Result<(), Error> {\nlet current_exit = match settings::get_rita_client().exit_client.exits.get(&exit) {\nSome(current_exit) => current_exit.clone(),\nNone => {\n- return Box::new(future::err(format_err!(\"No valid exit for {}\", exit)))\n- as Box<dyn Future<Item = (), Error = Error>>;\n+ return Err(format_err!(\"No valid exit for {}\", exit));\n}\n};\nlet endpoint = SocketAddr::new(current_exit.id.mesh_ip, current_exit.registration_port);\ntrace!(\"sending exit general details request to {}\", exit);\n- let r = get_exit_info(&endpoint).and_then(move |exit_details| {\n+ let exit_details = get_exit_info(&endpoint).await?;\nlet mut rita_client = settings::get_rita_client();\nlet current_exit = match rita_client.exit_client.exits.get_mut(&exit) {\nSome(exit) => exit,\nNone => bail!(\"Could not find exit {}\", exit),\n};\ncurrent_exit.info = exit_details;\n-\nsettings::set_rita_client(rita_client);\nOk(())\n- });\n-\n- Box::new(r)\n}\npub fn exit_setup_request(\n@@ -340,17 +331,16 @@ pub fn exit_setup_request(\n)\n}\n-fn exit_status_request(exit: String) -> impl Future<Item = (), Error = Error> {\n+async fn exit_status_request(exit: String) -> Result<(), Error> {\nlet current_exit = match settings::get_rita_client().exit_client.exits.get(&exit) {\nSome(current_exit) => current_exit.clone(),\nNone => {\n- return Box::new(future::err(format_err!(\"No valid exit for {}\", exit)))\n- as Box<dyn Future<Item = (), Error = Error>>;\n+ return Err(format_err!(\"No valid exit for {}\", exit));\n}\n};\nlet reg_details = match settings::get_rita_client().exit_client.contact_info {\nSome(val) => val.into(),\n- None => return Box::new(future::err(format_err!(\"No valid details\"))),\n+ None => return Err(format_err!(\"No valid details\")),\n};\nlet exit_server = current_exit.id.mesh_ip;\n@@ -359,9 +349,7 @@ fn exit_status_request(exit: String) -> impl Future<Item = (), Error = Error> {\nglobal: match settings::get_rita_client().get_identity() {\nSome(id) => id,\nNone => {\n- return Box::new(future::err(format_err!(\n- \"Identity has no mesh IP ready yet\"\n- )));\n+ return Err(format_err!(\"Identity has no mesh IP ready yet\"));\n}\n},\nwg_port: settings::get_rita_client().exit_client.wg_listen_port,\n@@ -376,44 +364,24 @@ fn exit_status_request(exit: String) -> impl Future<Item = (), Error = Error> {\nendpoint\n);\n- let r =\n- send_exit_status_request(exit_pubkey, &endpoint, ident).and_then(move |exit_response| {\n+ let exit_response = send_exit_status_request(exit_pubkey, &endpoint, ident).await?;\nlet mut rita_client = settings::get_rita_client();\n-\nlet current_exit = match rita_client.exit_client.exits.get_mut(&exit) {\nSome(exit_struct) => exit_struct,\nNone => bail!(\"Could not find exit {:?}\", exit),\n};\n-\ncurrent_exit.info = exit_response.clone();\nsettings::set_rita_client(rita_client);\n-\ntrace!(\"Got exit status response {:?}\", exit_response);\n-\nOk(())\n- });\n-\n- Box::new(r)\n}\n/// An actor which pays the exit\n#[derive(Default)]\npub struct ExitManager {\n// used to determine if we've changed exits\n- last_exit: Option<ExitServer>,\n- nat_setup: bool,\n-}\n-\n-impl Actor for ExitManager {\n- type Context = Context<Self>;\n-}\n-\n-impl Supervised for ExitManager {}\n-impl SystemService for ExitManager {\n- fn service_started(&mut self, _ctx: &mut Context<Self>) {\n- info!(\"Exit Manager started\");\n- self.last_exit = None;\n- }\n+ pub last_exit: Option<ExitServer>,\n+ pub nat_setup: bool,\n}\nfn correct_default_route(input: Option<DefaultRoute>) -> bool {\n@@ -423,15 +391,11 @@ fn correct_default_route(input: Option<DefaultRoute>) -> bool {\n}\n}\n-impl Handler<Tick> for ExitManager {\n- type Result = ResponseFuture<(), Error>;\n-\n- fn handle(&mut self, _: Tick, _ctx: &mut Context<Self>) -> Self::Result {\n+pub async fn exit_manager_tick() {\n// scopes our access to SETTING and prevent\n// holding a readlock while exit tunnel setup requires a write lock\n// roughly the same as a drop(); inline\n- let client_can_use_free_tier =\n- { settings::get_rita_client().payment.client_can_use_free_tier };\n+ let client_can_use_free_tier = { settings::get_rita_client().payment.client_can_use_free_tier };\nlet exit_server = {\nsettings::get_rita_client()\n.exit_client\n@@ -440,38 +404,41 @@ impl Handler<Tick> for ExitManager {\n};\n// code that connects to the current exit server\n- trace!(\"About to setup exit tunnel!\");\n+ info!(\"About to setup exit tunnel!\");\nif let Some(exit) = exit_server {\ntrace!(\"We have selected an exit!\");\nif let Some(general_details) = exit.info.general_details() {\ntrace!(\"We have details for the selected exit!\");\nlet signed_up_for_exit = exit.info.our_details().is_some();\n+\n+ let mut writer = &mut *EXIT_MANAGER.write().unwrap();\n+\nlet exit_has_changed =\n- !(self.last_exit.is_some() && self.last_exit.clone().unwrap() == exit);\n+ !(writer.last_exit.is_some() && writer.last_exit.clone().unwrap() == exit);\nlet correct_default_route = correct_default_route(KI.get_default_route());\nmatch (signed_up_for_exit, exit_has_changed, correct_default_route) {\n(true, true, _) => {\n- info!(\"Exit change, setting up exit tunnel\");\n+ trace!(\"Exit change, setting up exit tunnel\");\nlinux_setup_exit_tunnel(\n&exit,\n&general_details.clone(),\nexit.info.our_details().unwrap(),\n)\n.expect(\"failure setting up exit tunnel\");\n- self.nat_setup = true;\n- self.last_exit = Some(exit.clone());\n+ writer.nat_setup = true;\n+ writer.last_exit = Some(exit.clone());\n}\n(true, false, false) => {\n- info!(\"DHCP overwrite setup exit tunnel again\");\n+ trace!(\"DHCP overwrite setup exit tunnel again\");\nlinux_setup_exit_tunnel(\n&exit,\n&general_details.clone(),\nexit.info.our_details().unwrap(),\n)\n.expect(\"failure setting up exit tunnel\");\n- self.nat_setup = true;\n+ writer.nat_setup = true;\n}\n_ => {}\n}\n@@ -480,7 +447,7 @@ impl Handler<Tick> for ExitManager {\n// this prevents the free tier from being confusing (partially working)\n// when deployments are not interested in having a sufficiently fast one\nlet low_balance = low_balance();\n- let nat_setup = self.nat_setup;\n+ let nat_setup = writer.nat_setup;\ntrace!(\n\"client can use free tier {} low balance {}\",\nclient_can_use_free_tier,\n@@ -492,21 +459,21 @@ impl Handler<Tick> for ExitManager {\n(true, false, true) => {\ntrace!(\"removing exit tunnel!\");\nremove_nat();\n- self.nat_setup = false;\n+ writer.nat_setup = false;\n}\n// restore when our balance is not low and our nat is not setup\n// regardless of the free tier value\n(false, _, false) => {\ntrace!(\"restoring exit tunnel!\");\nrestore_nat();\n- self.nat_setup = true;\n+ writer.nat_setup = true;\n}\n// restore if the nat is not setup and the free tier is enabled\n// this only happens when settings change under the hood\n(true, true, false) => {\ntrace!(\"restoring exit tunnel!\");\nrestore_nat();\n- self.nat_setup = true;\n+ writer.nat_setup = true;\n}\n_ => {}\n}\n@@ -518,33 +485,31 @@ impl Handler<Tick> for ExitManager {\nlet exit_port = exit.registration_port;\nlet exit_id = exit.id;\nlet babel_port = settings::get_rita_client().network.babel_port;\n- trace!(\"We are signed up for the selected exit!\");\n+ info!(\"We are signed up for the selected exit!\");\n- Arbiter::spawn(\n- open_babel_stream_legacy(babel_port)\n- .from_err()\n- .and_then(move |stream| {\n- start_connection_legacy(stream).and_then(move |stream| {\n- parse_routes_legacy(stream).and_then(move |routes| {\n- TrafficWatcher::from_registry().do_send(QueryExitDebts {\n+ let mut stream = match open_babel_stream(babel_port, CLIENT_LOOP_TIMEOUT) {\n+ Ok(a) => a,\n+ Err(_) => {\n+ error!(\"open babel stream error in exit manager tick\");\n+ return;\n+ }\n+ };\n+ let routes = match parse_routes(&mut stream) {\n+ Ok(a) => a,\n+ Err(_) => {\n+ error!(\"Parse routes error in exit manager tick\");\n+ return;\n+ }\n+ };\n+\n+ query_exit_debts(QueryExitDebts {\nexit_id,\nexit_price,\n- routes: routes.1,\n+ routes,\nexit_internal_addr,\nexit_port,\n- });\n- Ok(())\n- })\n- })\n})\n- .timeout(CLIENT_LOOP_TIMEOUT)\n- .then(|ret| {\n- if let Err(e) = ret {\n- error!(\"Failed to watch client traffic with {:?}\", e)\n- }\n- Ok(())\n- }),\n- );\n+ .await;\n}\n}\n}\n@@ -552,15 +517,12 @@ impl Handler<Tick> for ExitManager {\n// code that manages requesting details to exits\nlet servers = { settings::get_rita_client().exit_client.exits };\n- let mut futs: Vec<Box<dyn Future<Item = (), Error = Error>>> = Vec::new();\n-\nfor (k, s) in servers {\nmatch s.info {\nExitState::Denied { .. } | ExitState::Disabled | ExitState::GotInfo { .. } => {}\n+\nExitState::New { .. } => {\n- futs.push(Box::new(exit_general_details_request(k.clone()).then(\n- move |res| {\n- match res {\n+ match exit_general_details_request(k.clone()).await {\nOk(_) => {\ntrace!(\"exit details request to {} was successful\", k);\n}\n@@ -568,13 +530,10 @@ impl Handler<Tick> for ExitManager {\ntrace!(\"exit details request to {} failed with {:?}\", k, e);\n}\n};\n- Ok(())\n- },\n- )));\n}\n+\nExitState::Registered { .. } => {\n- futs.push(Box::new(exit_status_request(k.clone()).then(move |res| {\n- match res {\n+ match exit_status_request(k.clone()).await {\nOk(_) => {\ntrace!(\"exit status request to {} was successful\", k);\n}\n@@ -582,15 +541,11 @@ impl Handler<Tick> for ExitManager {\ntrace!(\"exit status request to {} failed with {:?}\", k, e);\n}\n};\n- Ok(())\n- })));\n}\n+\nstate => {\ntrace!(\"Waiting on exit state {:?} for {}\", state, k);\n}\n}\n}\n-\n- Box::new(join_all(futs).and_then(|_| Ok(()))) as ResponseFuture<(), Error>\n- }\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/light_client_manager/mod.rs", "new_path": "rita_client/src/light_client_manager/mod.rs", "diff": "//! far as I can tell due to the restrictive nature of how and when Android allows ipv6 routing.\nuse crate::traffic_watcher::GetExitDestPrice;\n-use crate::traffic_watcher::TrafficWatcher;\n+use crate::traffic_watcher::TrafficWatcherActor;\nuse rita_common::debt_keeper::traffic_update;\nuse rita_common::debt_keeper::Traffic;\nuse rita_common::peer_listener::Peer;\n@@ -75,7 +75,7 @@ pub fn light_client_hello_response(\n) -> Box<dyn Future<Item = HttpResponse, Error = Error>> {\nlet their_id = *req.0;\nlet a = LightClientManager::from_registry().send(GetAddress(their_id));\n- let b = TrafficWatcher::from_registry().send(GetExitDestPrice);\n+ let b = TrafficWatcherActor::from_registry().send(GetExitDestPrice);\nBox::new(\na.join(b)\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/rita_loop/mod.rs", "new_path": "rita_client/src/rita_loop/mod.rs", "diff": "//! This loop manages exit signup based on the settings configuration state and deploys an exit vpn\n//! tunnel if the signup was successful on the selected exit.\n-use crate::exit_manager::ExitManager;\n+use crate::exit_manager::exit_manager_tick;\nuse crate::heartbeat::send_udp_heartbeat;\nuse crate::light_client_manager::light_client_hello_response;\nuse crate::light_client_manager::LightClientManager;\n@@ -13,22 +13,26 @@ use crate::operator_fee_manager::OperatorFeeManager;\nuse crate::operator_fee_manager::Tick as OperatorTick;\nuse crate::operator_update::{OperatorUpdate, Update};\nuse crate::traffic_watcher::GetExitDestPrice;\n-use crate::traffic_watcher::TrafficWatcher;\n+use crate::traffic_watcher::TrafficWatcherActor;\nuse rita_common::tunnel_manager::GetNeighbors;\nuse rita_common::tunnel_manager::GetTunnels;\nuse rita_common::tunnel_manager::TunnelManager;\nuse actix::{\nActor, ActorContext, Addr, Arbiter, AsyncContext, Context, Handler, Message, Supervised,\n- SystemService,\n+ System, SystemService,\n};\nuse actix_web::http::Method;\nuse actix_web::{server, App};\n+\n+use actix_async::System as AsyncSystem;\n+use std::thread;\n+use std::time::{Duration, Instant};\n+\nuse althea_types::ExitState;\nuse failure::Error;\nuse futures01::future::Future;\nuse std::sync::atomic::{AtomicBool, Ordering};\n-use std::time::{Duration, Instant};\nlazy_static! {\n/// see the comment on check_for_gateway_client_billing_corner_case()\n@@ -116,11 +120,9 @@ impl Handler<Tick> for RitaLoop {\nlet start = Instant::now();\ntrace!(\"Client Tick!\");\n- ExitManager::from_registry().do_send(Tick {});\n-\nArbiter::spawn(check_for_gateway_client_billing_corner_case());\n- let dest_price = TrafficWatcher::from_registry().send(GetExitDestPrice);\n+ let dest_price = TrafficWatcherActor::from_registry().send(GetExitDestPrice);\nlet tunnels = TunnelManager::from_registry().send(GetTunnels);\nArbiter::spawn(dest_price.join(tunnels).then(move |res| {\n// unwrap top level actix error, ok to crash if this fails\n@@ -155,9 +157,51 @@ impl Handler<Tick> for RitaLoop {\n}\n}\n+/// Rita loop thread spawning function, there are currently two rita loops, one that\n+/// runs as a thread with async/await support and one that runs as a actor using old futures\n+/// slowly things will be migrated into this new sync loop as we move to async/await\n+pub fn start_rita_loop() {\n+ let mut last_restart = Instant::now();\n+ // this is a reference to the non-async actix system since this can bring down the whole process\n+ let system = System::current();\n+\n+ // outer thread is a watchdog inner thread is the runner\n+ thread::spawn(move || {\n+ // this will always be an error, so it's really just a loop statement\n+ // with some fancy destructuring\n+\n+ while let Err(e) = {\n+ thread::spawn(move || loop {\n+ let start = Instant::now();\n+ trace!(\"Client tick!\");\n+\n+ let runner = AsyncSystem::new();\n+ runner.block_on(async move {\n+ exit_manager_tick().await;\n+ });\n+\n+ // sleep until it has been CLIENT_LOOP_SPEED seconds from start, whenever that may be\n+ // if it has been more than CLIENT_LOOP_SPEED seconds from start, go right ahead\n+ let client_loop_speed = Duration::from_secs(CLIENT_LOOP_SPEED);\n+ if start.elapsed() < client_loop_speed {\n+ thread::sleep(client_loop_speed - start.elapsed());\n+ }\n+ })\n+ .join()\n+ } {\n+ error!(\"Rita client loop thread paniced! Respawning {:?}\", e);\n+ if Instant::now() - last_restart < Duration::from_secs(60) {\n+ error!(\"Restarting too quickly, leaving it to auto rescue!\");\n+ system.stop_with_code(121)\n+ }\n+ last_restart = Instant::now();\n+ }\n+ });\n+}\n+\npub fn check_rita_client_actors() {\nassert!(crate::rita_loop::RitaLoop::from_registry().connected());\n- assert!(crate::exit_manager::ExitManager::from_registry().connected());\n+ crate::rita_loop::start_rita_loop();\n}\n/// There is a complicated corner case where the gateway is a client and a relay to\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/traffic_watcher/mod.rs", "new_path": "rita_client/src/traffic_watcher/mod.rs", "diff": "@@ -27,25 +27,26 @@ use rita_common::debt_keeper::{\ntraffic_replace, traffic_update, wgkey_insensitive_traffic_update, Traffic,\n};\n-use actix::{Actor, Arbiter, Context, Handler, Message, Supervised, SystemService};\n-use actix_web::client;\n-use actix_web::client::Connection;\n-use actix_web::HttpMessage;\n+use actix::{Actor, Context, Handler, Message, Supervised, SystemService};\nuse althea_types::Identity;\nuse babel_monitor::Route as RouteLegacy;\nuse failure::Error;\n-use futures01::future::ok as future_ok;\n-use futures01::future::Future;\nuse num256::Int256;\nuse num_traits::identities::Zero;\nuse rita_common::usage_tracker::update_usage_data;\nuse rita_common::usage_tracker::UpdateUsage;\nuse rita_common::usage_tracker::UsageType;\nuse rita_common::KI;\n-use std::net::{IpAddr, SocketAddr};\n+use std::net::IpAddr;\n+use std::sync::Arc;\n+use std::sync::RwLock;\nuse std::time::Duration;\nuse std::time::Instant;\n-use tokio::net::TcpStream as TokioTcpStream;\n+\n+lazy_static! {\n+ pub static ref TRAFFIC_WATCHER: Arc<RwLock<TrafficWatcher>> =\n+ Arc::new(RwLock::new(TrafficWatcher::default()));\n+}\npub struct TrafficWatcher {\n// last read download\n@@ -56,18 +57,21 @@ pub struct TrafficWatcher {\nlast_exit_dest_price: u128,\n}\n-impl Actor for TrafficWatcher {\n+/// Dummy Traffic Watcher struct for Actor, used to ensure we dont accidently read out of the\n+/// original TrafficWatcher struct.\n+pub struct TrafficWatcherActor {}\n+\n+impl Actor for TrafficWatcherActor {\ntype Context = Context<Self>;\n}\n-impl Supervised for TrafficWatcher {}\n-impl SystemService for TrafficWatcher {\n- fn service_started(&mut self, _ctx: &mut Context<Self>) {\n- info!(\"Client traffic watcher started\");\n- self.last_read_input = 0;\n- self.last_read_output = 0;\n- self.last_exit_dest_price = 0;\n+impl Supervised for TrafficWatcherActor {}\n+impl SystemService for TrafficWatcherActor {}\n+impl Default for TrafficWatcherActor {\n+ fn default() -> TrafficWatcherActor {\n+ TrafficWatcherActor {}\n}\n}\n+\nimpl Default for TrafficWatcher {\nfn default() -> TrafficWatcher {\nTrafficWatcher {\n@@ -104,20 +108,18 @@ impl Message for QueryExitDebts {\ntype Result = Result<(), Error>;\n}\n-impl Handler<QueryExitDebts> for TrafficWatcher {\n- type Result = Result<(), Error>;\n-\n- fn handle(&mut self, msg: QueryExitDebts, _: &mut Context<Self>) -> Self::Result {\n+pub async fn query_exit_debts(msg: QueryExitDebts) {\ntrace!(\"About to query the exit for client debts\");\n+ let writer = &mut *TRAFFIC_WATCHER.write().unwrap();\n+\n// we could exit the function if this fails, but doing so would remove the chance\n// that we can get debts from the exit and continue anyways\nlet local_debt =\n- match local_traffic_calculation(self, &msg.exit_id, msg.exit_price, msg.routes) {\n+ match local_traffic_calculation(writer, &msg.exit_id, msg.exit_price, msg.routes) {\nOk(val) => Some(Int256::from(val)),\nErr(_e) => None,\n};\n-\nlet gateway_exit_client = is_gateway_client();\nlet start = Instant::now();\nlet exit_addr = msg.exit_internal_addr;\n@@ -130,21 +132,28 @@ impl Handler<QueryExitDebts> for TrafficWatcher {\nlet request = format!(\"http://{}:{}/client_debt\", exit_addr, exit_port);\n// it's an ipaddr appended to a u16, there's no real way for this to fail\n// unless of course it's an ipv6 address and you don't do the []\n- let socket: SocketAddr = format!(\"{}:{}\", exit_addr, exit_port).parse().unwrap();\n-\n- let stream_future = TokioTcpStream::connect(&socket);\n- let s = stream_future.then(move |active_stream| match active_stream {\n- Ok(stream) => Box::new(\n- client::post(request.clone())\n- .with_connection(Connection::from_stream(stream))\n- .json(our_id)\n- .unwrap()\n- .send()\n+ let client = awc::Client::default();\n+ let response = client\n+ .post(request.clone())\n.timeout(Duration::from_secs(5))\n- .then(move |response| match response {\n- Ok(response) => Box::new(response.json().then(move |debt_value| {\n- match debt_value {\n+ .send_json(&our_id)\n+ .await;\n+ let mut response = match response {\n+ Ok(a) => a,\n+ Err(e) => {\n+ error!(\"Exit debts request to {} failed with {:?}\", request, e);\n+ if let Some(val) = local_debt {\n+ traffic_update(vec![Traffic {\n+ from: exit_id,\n+ amount: val,\n+ }])\n+ }\n+ return;\n+ }\n+ };\n+ let response = response.json().await;\n+ match response {\nOk(debt) => {\ninfo!(\n\"Successfully got debt from the exit {:?} Rita Client TrafficWatcher completed in {}s {}ms\",\n@@ -155,83 +164,35 @@ impl Handler<QueryExitDebts> for TrafficWatcher {\nlet we_are_not_a_gateway = !gateway_exit_client;\nlet we_owe_exit = debt >= Int256::zero();\nmatch (we_are_not_a_gateway, we_owe_exit) {\n- (true, true) => {\n- traffic_replace(\n- Traffic {\n+ (true, true) => traffic_replace(Traffic {\nfrom: exit_id,\namount: debt,\n- }\n- )\n- },\n+ }),\n// the exit should never tell us it owes us, that doesn't make sense outside of the gateway\n// client corner case\n- (true, false) => warn!(\"We're probably a gateway but haven't detected it yet\"),\n+ (true, false) => {\n+ warn!(\"We're probably a gateway but haven't detected it yet\")\n+ }\n(false, _) => {\ninfo!(\"We are a gateway!, Acting accordingly\");\nif let Some(val) = local_debt {\n- wgkey_insensitive_traffic_update(\n- Traffic {\n+ wgkey_insensitive_traffic_update(Traffic {\nfrom: exit_id,\namount: val,\n+ })\n}\n-\n- )\n}\n- },\n}\n}\nErr(e) => {\nerror!(\"Failed deserializing exit debts update with {:?}\", e);\nif let Some(val) = local_debt {\n- traffic_update(\n- vec![Traffic {\n+ traffic_update(vec![Traffic {\nfrom: exit_id,\namount: val,\n- }]\n-\n- )\n- }\n+ }])\n}\n}\n- Ok(()) as Result<(), ()>\n- })),\n- Err(e) => {\n- error!(\"Exit debts request to {} failed with {:?}\", request, e);\n- if let Some(val) = local_debt {\n- traffic_update(\n- vec![Traffic {\n- from: exit_id,\n- amount: val,\n- }]\n-\n- )\n- }\n- Box::new(future_ok(())) as Box<dyn Future<Item = (), Error = ()>>\n- }\n- }),\n- ),\n-\n- Err(e) => {\n- error!(\n- \"Failed to open stream to exit for debts update! with {:?}\",\n- e\n- );\n- if let Some(val) = local_debt {\n- traffic_update(\n- vec![Traffic {\n- from: exit_id,\n- amount: val,\n- }]\n-\n- )\n-\n-\n- }\n- Box::new(future_ok(())) as Box<dyn Future<Item = (), Error = ()>>\n- }\n- });\n- Arbiter::spawn(s);\n- Ok(())\n}\n}\n@@ -368,10 +329,10 @@ impl Message for GetExitDestPrice {\ntype Result = Result<u128, Error>;\n}\n-impl Handler<GetExitDestPrice> for TrafficWatcher {\n+impl Handler<GetExitDestPrice> for TrafficWatcherActor {\ntype Result = Result<u128, Error>;\nfn handle(&mut self, _msg: GetExitDestPrice, _: &mut Context<Self>) -> Self::Result {\n- Ok(self.last_exit_dest_price)\n+ Ok(TRAFFIC_WATCHER.read().unwrap().last_exit_dest_price)\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Migrated Exit Manager and QueryExitDebts to async await. Removed the futures based http client in these handlers and replaced them with the async http client 'awc'
20,244
03.09.2021 10:23:21
14,400
4571054283fa9167b0e924dccb2a9ca1aefde307
Expand Github Actions This expands github actions, creating a single workflow that builds, tests, lints, and runs the integration tests, all with dependency filters to avoid wated cpu time.
[ { "change_type": "DELETE", "old_path": ".github/workflows/backwards-compatibility.yml", "new_path": null, "diff": "-name: Backwards compatibility test\n-\n-on:\n- push:\n- branches: [master]\n- pull_request:\n- branches: [master]\n-\n-jobs:\n- build:\n- runs-on: ubuntu-latest\n-\n- steps:\n- - uses: actions/checkout@v2\n- - name: Install Wireguard\n- run: sudo apt-get update && sudo apt install -y wireguard linux-source linux-headers-$(uname -r) build-essential && sudo modprobe wireguard\n- - name: Run integration test\n- run: bash scripts/test-ci.sh\n" }, { "change_type": "DELETE", "old_path": ".github/workflows/integration-test.yml", "new_path": null, "diff": "-name: All up test\n-\n-on:\n- push:\n- branches: [master]\n- pull_request:\n- branches: [master]\n-\n-jobs:\n- build:\n- runs-on: ubuntu-latest\n-\n- steps:\n- - uses: actions/checkout@v2\n- - name: Install Wireguard\n- run: sudo apt-get update && sudo apt install -y wireguard linux-source linux-headers-$(uname -r) build-essential && sudo modprobe wireguard\n- - name: Run integration test\n- run: bash scripts/test-ci-backcompat.sh\n" }, { "change_type": "MODIFY", "old_path": ".github/workflows/rust.yml", "new_path": ".github/workflows/rust.yml", "diff": "-name: Rust\n+name: Rust tests\non:\npush:\n@@ -10,26 +10,90 @@ env:\nCARGO_TERM_COLOR: always\njobs:\n- build:\n+ check:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ - name: Check Rita and Rita Exit x86\n+ run: cargo check --all\n+ test:\n+ needs: check\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ - name: Run Rita and Rita Exit tests\n+ run: RUST_TEST_THREADS=1 cargo test --verbose --all\n+ rustfmt:\n+ needs: check\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ - name: Check code formatting\n+ run: rustup component add rustfmt && cargo fmt --all -- --check\n+ clippy:\n+ needs: check\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ - name: Check for Clippy lints\n+ run: rustup component add clippy && cargo clippy --all --all-targets --all-features -- -D warnings\n+ cross-mips:\n+ needs: test\nruns-on: ubuntu-latest\n-\nsteps:\n- uses: actions/checkout@v2\n- - name: Install cross\n- run: cargo install cross\n- - name: Test Rita and Rita Exit x86\n- run: cargo build --all && RUST_TEST_THREADS=1 cargo test --verbose --all\n- - name: Cross test x86_64\n- run: cross test --target x86_64-unknown-linux-musl --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\n- name: Cross test mips\n- run: cross test --target mips-unknown-linux-musl --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\n+ run: cargo install cross && cross test --target mips-unknown-linux-musl --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\n+ cross-mipsel:\n+ needs: test\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n- name: Cross test mipsel\n- run: cross test --target mipsel-unknown-linux-musl --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\n+ run: cargo install cross && cross test --target mipsel-unknown-linux-musl --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\n+ cross-mips64:\n+ needs: test\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n- name: Cross test mips64\n- run: cross test --target mips64-unknown-linux-gnuabi64 --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\n+ run: cargo install cross && cross test --target mips64-unknown-linux-gnuabi64 --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\n+ cross-mips64el:\n+ needs: test\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n- name: Cross test mips64el\n- run: cross test --target mips64el-unknown-linux-gnuabi64 --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\n+ run: cargo install cross && cross test --target mips64el-unknown-linux-gnuabi64 --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\n+ cross-aarch64:\n+ needs: test\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n- name: Cross test aarch64\n- run: cross test --target aarch64-unknown-linux-musl --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\n+ run: cargo install cross && cross test --target aarch64-unknown-linux-musl --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\n+ cross-armv7:\n+ needs: test\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n- name: Cross test armv7\n- run: cross test --target armv7-unknown-linux-musleabihf --verbose -p rita --bin rita --features bundle_openssl -- --test-threads=1\n+ run: cargo install cross && cross test --target armv7-unknown-linux-musleabihf --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\n+ integration-test-with-backcompat:\n+ needs: test\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ - name: Install Wireguard\n+ run: sudo apt-get update && sudo apt install -y wireguard linux-source linux-headers-$(uname -r) build-essential && sudo modprobe wireguard\n+ - name: Run integration test\n+ run: bash scripts/test-ci-backcompat.sh\n+ integration-test:\n+ needs: test\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ - name: Install Wireguard\n+ run: sudo apt-get update && sudo apt install -y wireguard linux-source linux-headers-$(uname -r) build-essential && sudo modprobe wireguard\n+ - name: Run integration test\n+ run: bash scripts/test-ci.sh\n" }, { "change_type": "MODIFY", "old_path": "scripts/test-ci-backcompat.sh", "new_path": "scripts/test-ci-backcompat.sh", "diff": "set -eux\nNODES=${NODES:='None'}\n-RUST_TEST_THREADS=1 cargo test --all\nif ! modprobe wireguard ; then\necho \"The container can't load modules into the host kernel\"\n@@ -15,7 +14,7 @@ DOCKERFOLDER=$DIR/../integration-tests/container/\nREPOFOLDER=$DIR/..\ngit archive --format=tar.gz -o $DOCKERFOLDER/rita.tar.gz --prefix=althea_rs/ HEAD\npushd $DOCKERFOLDER\n-time docker build -t rita-test --build-arg NODES=$NODES --build-arg SPEEDTEST_THROUGHPUT=\"20\" --build-arg SPEEDTEST_DURATION=\"15\" --build-arg REVISION_B=master --build-arg REMOTE_A=.. --build-arg REMOTE_B=\"https://github.com/althea-mesh/althea_rs.git\" --build-arg COMPAT_LAYOUT=\"inner_ring_old\" --build-arg INITIAL_POLL_INTERVAL=5 --build-arg BACKOFF_FACTOR=\"1.5\" --build-arg VERBOSE=1 .\n+time docker build -t rita-test --build-arg NODES=$NODES --build-arg SPEEDTEST_THROUGHPUT=\"20\" --build-arg SPEEDTEST_DURATION=\"15\" --build-arg REVISION_B=master --build-arg REMOTE_A=.. --build-arg REMOTE_B=\"https://github.com/althea-net/althea_rs.git\" --build-arg COMPAT_LAYOUT=\"inner_ring_old\" --build-arg INITIAL_POLL_INTERVAL=5 --build-arg BACKOFF_FACTOR=\"1.5\" --build-arg VERBOSE=1 .\ntime docker run --privileged -t rita-test\nrm rita.tar.gz\npopd\n" }, { "change_type": "MODIFY", "old_path": "scripts/test-ci.sh", "new_path": "scripts/test-ci.sh", "diff": "set -eux\nNODES=${NODES:='None'}\n-RUST_TEST_THREADS=1 cargo test --all\n-\nif ! modprobe wireguard ; then\necho \"The container can't load modules into the host kernel\"\necho \"Please install WireGuard https://www.wireguard.com/ and load the kernel module using 'sudo modprobe wireguard'\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Expand Github Actions This expands github actions, creating a single workflow that builds, tests, lints, and runs the integration tests, all with dependency filters to avoid wated cpu time.
20,244
03.09.2021 16:40:34
14,400
e5754535a47e55fa2f4c74ead3d4b0c1a4029e3c
Use HashSet for check_withdrawals This is a minor change that makes the function somewhat less ergonomic to use but eliminates all need to handle cases around duplicate addresses possibly returning dulicate values
[ { "change_type": "MODIFY", "old_path": "auto_bridge/src/lib.rs", "new_path": "auto_bridge/src/lib.rs", "diff": "@@ -7,6 +7,7 @@ use clarity::abi::{encode_call, Token};\nuse clarity::utils::bytes_to_hex_str;\nuse clarity::{Address, PrivateKey};\nuse num256::Uint256;\n+use std::collections::HashSet;\nuse std::time::Duration;\nuse web30::amm::{DAI_CONTRACT_ADDRESS as DAI_CONTRACT_ON_ETH, WETH_CONTRACT_ADDRESS};\nuse web30::client::Web3;\n@@ -497,7 +498,7 @@ pub async fn check_withdrawals(\nblocks_to_check: u64,\ncontract: Address,\nxdai_web3: Web3,\n- search_addresses: Vec<Address>,\n+ search_addresses: HashSet<Address>,\n) -> Result<Vec<WithdrawEvent>, Web3Error> {\n/// Total number of blocks on the xdai blockchain we retrieve at once. If the blocks to check is greater than this we loop.\nconst MAX_ITER: u64 = 10_000;\n@@ -797,12 +798,14 @@ mod tests {\nlet blocks_to_check = 10000;\nrunner.block_on(async move {\n+ let mut h = HashSet::new();\n+ h.insert(token_bridge.own_address);\n// res is empty since we use a dummy address\nlet res = check_withdrawals(\nblocks_to_check,\ntoken_bridge.xdai_bridge_on_xdai,\ntoken_bridge.xdai_web3,\n- vec![token_bridge.own_address],\n+ h,\n)\n.await\n.unwrap();\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/token_bridge/mod.rs", "new_path": "rita_common/src/token_bridge/mod.rs", "diff": "@@ -38,6 +38,7 @@ use rand::{thread_rng, Rng};\nuse settings::payment::PaymentSettings;\nuse std::cmp::Ordering;\n+use std::collections::HashSet;\nuse std::collections::VecDeque;\nuse std::iter::FromIterator;\nuse std::sync::Arc;\n@@ -359,14 +360,10 @@ async fn simulated_withdrawal_on_eth(\nwei_per_dollar: Uint256,\n) -> Result<(), TokenBridgeError> {\nlet client = bridge.xdai_web3.clone();\n+ let mut h = HashSet::new();\n+ h.insert(bridge.own_address);\n- let events = check_withdrawals(\n- BLOCKS,\n- bridge.xdai_bridge_on_xdai,\n- client,\n- vec![bridge.own_address],\n- )\n- .await?;\n+ let events = check_withdrawals(BLOCKS, bridge.xdai_bridge_on_xdai, client, h).await?;\nfor event in events.iter() {\nlet txid = event.txid.clone();\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Use HashSet for check_withdrawals This is a minor change that makes the function somewhat less ergonomic to use but eliminates all need to handle cases around duplicate addresses possibly returning dulicate values
20,243
13.09.2021 09:07:43
25,200
ad8441510f92323c6973b6a9b5c44541cd515892
Modified cargo.toml to include dev dependencies feature This modification will pass down the feature dev in order to be able to better debug down the road.
[ { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "@@ -37,9 +37,9 @@ env_logger = \"0.8\"\nlazy_static = \"1.4\"\nphonenumber = \"0.3\"\nr2d2 = \"0.8\"\n-rita_common = { path = \"../rita_common\"}\n-rita_client = { path = \"../rita_client\"}\n-rita_exit = { path = \"../rita_exit\"}\n+rita_common = { path = \"../rita_common\", default-features = false }\n+rita_client = { path = \"../rita_client\", default-features = false }\n+rita_exit = { path = \"../rita_exit\", default-features = false }\nflate2 = { version = \"1.0\", features = [\"rust_backend\"], default-features = false }\nreqwest = { version = \"0.11\", features = [\"blocking\", \"json\"] }\njemallocator = {version = \"0.3\", optional = true}\n@@ -59,4 +59,4 @@ server = [\"jemalloc\", \"openssl\"]\ndash_debug = []\n# changes operator urls\noperator_debug = []\n-development = [\"dash_debug\", \"operator_debug\"]\n+development = [\"rita_client/dash_debug\",\"rita_common/dash_debug\",\"rita_exit/dash_debug\",\"rita_client/operator_debug\",\"rita_common/operator_debug\",\"rita_exit/operator_debug\"]\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "@@ -43,3 +43,9 @@ clarity = \"0.4\"\n[lib]\nname = \"rita_client\"\npath = \"src/lib.rs\"\n+\n+[features]\n+# disables cors for dash debugging\n+dash_debug = []\n+# changes operator urls\n+operator_debug = []\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "@@ -44,3 +44,8 @@ babel_monitor_legacy = {path = \"../babel_monitor_legacy\"}\nversion = \"1.4\"\ndefault-features = false\nfeatures = [\"std\"]\n+[features]\n+# disables cors for dash debugging\n+dash_debug = []\n+# changes operator urls\n+operator_debug = []\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/Cargo.toml", "new_path": "rita_exit/Cargo.toml", "diff": "@@ -36,3 +36,8 @@ actix-web-httpauth = {git = \"https://github.com/althea-net/actix-web-httpauth\"}\nactix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\ndiesel = { version = \"1.4\", features = [\"postgres\", \"r2d2\"] }\nfutures01 = { package = \"futures\", version = \"0.1\"}\n+[features]\n+# disables cors for dash debugging\n+dash_debug = []\n+# changes operator urls\n+operator_debug = []\n\\ No newline at end of file\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Modified cargo.toml to include dev dependencies feature This modification will pass down the feature dev in order to be able to better debug down the road.
20,244
20.09.2021 08:08:13
14,400
176abe1ed200d852897bd78a279d73eb315a75f7
Reduce exit logging to 1k lines As previously discovered with Rita client we are unable to accept the gzip payload when we attempt to send 100k lines at a time. When this fix was applied to Rita client it was neglected on Rita exit, this patch corrects that oversight.
[ { "change_type": "MODIFY", "old_path": "rita_exit/src/logging.rs", "new_path": "rita_exit/src/logging.rs", "diff": "@@ -24,7 +24,7 @@ pub fn enable_remote_logging() -> Result<(), Error> {\n)\n.set_compression_level(Compression::Fast)\n.set_sink_url(logging_url)\n- .set_threshold(100_000)\n+ .set_threshold(1_000)\n.set_format(Box::new(move |record: &Record| {\nformat!(\n\"{} {} rita_exit: {}\\n\",\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Reduce exit logging to 1k lines As previously discovered with Rita client we are unable to accept the gzip payload when we attempt to send 100k lines at a time. When this fix was applied to Rita client it was neglected on Rita exit, this patch corrects that oversight.
20,244
21.09.2021 15:24:31
14,400
695b47568a7065da9af1f5874e1c509426448422
Update compressed log This patch updates compressed log to use Actix 0.12
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -931,11 +931,11 @@ dependencies = [\n[[package]]\nname = \"compressed_log\"\n-version = \"0.3.8\"\n+version = \"0.3.9\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b282eec1026cb8d3210fce1c52d2348c63ec43a3015e3ed037cf5d1d807f61c3\"\n+checksum = \"b9ad903597ea665b1e9d9dd59477f9f8b7cc4c83ab661d486a1a2bc2d6526d7b\"\ndependencies = [\n- \"actix 0.11.1\",\n+ \"actix 0.12.0\",\n\"awc\",\n\"backoff\",\n\"chrono\",\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "@@ -6,7 +6,7 @@ license = \"Apache-2.0\"\n[dependencies]\n-compressed_log = \"0.3.4\"\n+compressed_log = \"0.3.9\"\nnum-traits=\"0.2\"\nnum256 = \"0.3\"\nserde = \"1.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/Cargo.toml", "new_path": "rita_exit/Cargo.toml", "diff": "@@ -6,7 +6,7 @@ license = \"Apache-2.0\"\n[dependencies]\n-compressed_log = \"0.3.4\"\n+compressed_log = \"0.3.9\"\nsodiumoxide = \"0.2\"\nnum256 = \"0.3\"\nrita_common = { path = \"../rita_common\" }\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Update compressed log This patch updates compressed log to use Actix 0.12
20,255
21.09.2021 12:46:57
25,200
d4521a2d7b0c4ab5dbf6d65a8985f585740b502b
Removed babel dump info logs this caused logging errors with compressed log sink, which didn't want to accept such long lines. This is a general issue that needs fixing with the logging system.
[ { "change_type": "MODIFY", "old_path": "babel_monitor/src/lib.rs", "new_path": "babel_monitor/src/lib.rs", "diff": "@@ -162,7 +162,7 @@ fn read_babel(\nprevious_contents: String,\ndepth: usize,\n) -> Result<String, Error> {\n- info!(\n+ trace!(\n\"starting read babel with {} and {}\",\nprevious_contents, depth\n);\n@@ -191,7 +191,7 @@ fn read_babel(\n}\nlet output = output.unwrap();\nlet output = output.trim_matches(char::from(0));\n- info!(\n+ trace!(\n\"Babel monitor got {} bytes with the message {}\",\nbytes, output\n);\n@@ -494,7 +494,7 @@ pub fn parse_routes(stream: &mut TcpStream) -> Result<Vec<Route>, Error> {\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- info!(\"Got from babel dump: {}\", babel_out);\n+ trace!(\"Got from babel dump: {}\", babel_out);\nfor entry in babel_out.split('\\n') {\nif entry.contains(\"add route\") {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Removed babel dump info logs this caused logging errors with compressed log sink, which didn't want to accept such long lines. This is a general issue that needs fixing with the logging system.
20,255
29.09.2021 11:55:10
25,200
8de0055ff0e61d1e25518acf01d86466c0980e00
Upgraded matplotlib from 3.0.3 to 3.4.3 Upgraded networkx from 2.3 to 2.5 Changed python syntax from 'is' to '==' in CI tests
[ { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/rita.py", "new_path": "integration-tests/integration-test-script/rita.py", "diff": "@@ -137,7 +137,7 @@ def setup_arbitrary_node_config(nodes):\nfor graph_node, rita_node in zip(ws.nodes, world.nodes):\nprint(\"Associating {} with {}\".format(graph_node, rita_node))\nneighbors = get_neighbors(graph_node, ws.edges)\n- if len(neighbors) is 0:\n+ if len(neighbors) == 0:\nprint(\"Disconnected node!\")\nexit(1)\n@@ -199,7 +199,7 @@ def next_hop_and_cost(graph, start, finish, world):\ncontinue\nprint(world.nodes)\ncost += world.nodes[node].local_fee\n- if len(path) is 1:\n+ if len(path) == 1:\nreturn (path[0], 0)\nif len(path) >= 2:\nprint(path)\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/utils.py", "new_path": "integration-tests/integration-test-script/utils.py", "diff": "@@ -321,14 +321,14 @@ def ip_to_num(ip):\ndef num_to_ip(num):\n- if num is 0:\n+ if num == 0:\nreturn \"fd00::aabb\"\nelse:\nreturn \"fd00::{}\".format(num)\ndef num_to_linklocal_ip(num):\n- if num is 0:\n+ if num == 0:\nreturn \"fe80::\"\nelse:\nreturn \"fe80::{}\".format(num)\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/world.py", "new_path": "integration-tests/integration-test-script/world.py", "diff": "@@ -353,9 +353,9 @@ class World:\noutput = status.stdout.read().decode(\"utf-8\")\n# not zero is a hack to deal with the fact that the 7 node format is\n# one indexed and the arbitrary node one is zero indexed\n- if output is \"\" and n is not 0:\n+ if output == \"\" and n != 0:\nbreak\n- elif output is \"\" and n is 0:\n+ elif output == \"\" and n == 0:\nn += 1\ncontinue\nstatus = json.loads(output)\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/requirements.txt", "new_path": "integration-tests/requirements.txt", "diff": "termcolor==1.1.0\ntoml==0.9.4\n-networkx==2.3\n-matplotlib==3.0.3\n+networkx==2.5\n+matplotlib==3.4.3\njoblib==0.14.0\n\\ No newline at end of file\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Upgraded matplotlib from 3.0.3 to 3.4.3 Upgraded networkx from 2.3 to 2.5 Changed python syntax from 'is' to '==' in CI tests
20,255
29.09.2021 20:38:37
25,200
9218f66d512289fccaafd1075423f81a5e1e7927
Updated Config reading from old RitaClientSettings struct to fill out details in the new struct This new RitaClientSetting struct was added to allow for exits to have a subnet and have different ips within this subnet. This allows for the exit switcher code to make informed decisions about switching exits and failing over
[ { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/rita.py", "new_path": "integration-tests/integration-test-script/rita.py", "diff": "@@ -89,14 +89,19 @@ EXIT_SETTINGS = {\n\"exits\": {\n\"exit_a\": {\n\"subnet\": \"fd00::5/128\",\n+ \"id\": {\n+ \"mesh_ip\": \"fd00::5\",\n+ \"eth_address\": \"0xbe398dc24de37c73cec974d688018e58f94d6e0a\",\n+ \"wg_public_key\": \"fd00::5\",\n+ },\n\"subnet_len\": 128,\n\"selected_exit\": {\n\"selected_id\": \"fd00::5\"\n},\n- \"registration_port\": 4875,\n- \"state\": \"New\",\n\"eth_address\": \"0xbe398dc24de37c73cec974d688018e58f94d6e0a\",\n\"wg_public_key\": \"fd00::5\",\n+ \"registration_port\": 4875,\n+ \"state\": \"New\",\n}\n},\n\"current_exit\": \"exit_a\",\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/world.py", "new_path": "integration-tests/integration-test-script/world.py", "diff": "@@ -148,10 +148,13 @@ class World:\nEXIT_SETTINGS[\"exits\"][\"exit_a\"][\"wg_public_key\"] = get_rita_settings(\nself.exit_id)[\"exit_network\"][\"wg_public_key\"]\n+ EXIT_SETTINGS[\"exits\"][\"exit_a\"][\"id\"][\"wg_public_key\"] = get_rita_settings(\n+ self.exit_id)[\"exit_network\"][\"wg_public_key\"]\nEXIT_SETTINGS[\"exits\"][\"exit_a\"][\"payment\"] = {}\nEXIT_SETTINGS[\"exits\"][\"exit_a\"][\"payment\"][\"eth_address\"] = get_rita_settings(\nself.exit_id)[\"payment\"][\"eth_address\"]\n+\nprint(\"starting rita\")\nlog = \"TRACE\"\n# reduce logging in large configurations to keep disk pressure\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/src/client.rs", "new_path": "rita_bin/src/client.rs", "diff": "@@ -35,7 +35,7 @@ use rita_client::Args;\nuse rita_common::rita_loop::check_rita_common_actors;\nuse rita_common::rita_loop::start_core_rita_endpoints;\nuse rita_common::utils::env_vars_contains;\n-use settings::client::{OldRitaClientSettings, RitaClientSettings};\n+use settings::client::RitaClientSettings;\nuse settings::FileWrite;\nuse std::env;\n@@ -44,8 +44,6 @@ lazy_static! {\n}\nfn main() {\n- info!(\"Started this main function\");\n-\nlet args: Args = Docopt::new(get_client_usage(\nenv!(\"CARGO_PKG_VERSION\"),\nenv!(\"GIT_HASH\"),\n@@ -61,7 +59,7 @@ fn main() {\nlet settings: RitaClientSettings = {\nlet platform = &args.flag_platform;\n- OldRitaClientSettings::new_watched(&settings_file).unwrap();\n+ RitaClientSettings::new_watched(&settings_file).unwrap();\nlet mut s = settings::get_rita_client();\nsettings::set_flag_config(settings_file.to_string());\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/exit_manager/exit_switcher.rs", "new_path": "rita_client/src/exit_manager/exit_switcher.rs", "diff": "@@ -490,8 +490,6 @@ pub fn get_babel_routes(babel_port: u16) -> Result<Vec<Route>, Error> {\n#[cfg(test)]\nmod tests {\n- use settings::SUBNET;\n-\nuse super::*;\nuse std::net::{IpAddr, Ipv4Addr};\n@@ -820,22 +818,33 @@ mod tests {\n#[test]\nfn test_config_update() {\n- use settings::client::OldRitaClientSettings;\n- use settings::update_config;\n+ use settings::client::RitaClientSettings;\nlet path = \"./src/exit_manager/config_in_use.toml\".to_string();\n- let old_settings = OldRitaClientSettings::new(&path).unwrap();\n- let subnet = SUBNET;\n- let new_settings = update_config(old_settings.clone(), subnet).unwrap();\n-\n- assert_eq!(old_settings.payment, new_settings.payment);\n- assert_eq!(old_settings.log, new_settings.log);\n- assert_eq!(old_settings.operator, new_settings.operator);\n- assert_eq!(old_settings.localization, new_settings.localization);\n- assert_eq!(old_settings.network, new_settings.network);\n- assert_eq!(old_settings.future, new_settings.future);\n-\n- println!(\"Old Settings: {:?}\", old_settings.exit_client.exits);\n- println!(\"\\n\\n\\n\\nNew Settings: {:?}\", new_settings.exit_client);\n+ let settings = RitaClientSettings::new(&path).unwrap();\n+\n+ assert_eq!(\n+ settings.exit_client.current_exit,\n+ settings.old_exit_client.current_exit\n+ );\n+ assert_eq!(\n+ settings.exit_client.wg_listen_port,\n+ settings.old_exit_client.wg_listen_port\n+ );\n+ assert_eq!(\n+ settings.exit_client.contact_info,\n+ settings.old_exit_client.contact_info\n+ );\n+ assert_eq!(\n+ settings.exit_client.lan_nics,\n+ settings.old_exit_client.lan_nics\n+ );\n+ assert_eq!(\n+ settings.exit_client.low_balance_notification,\n+ settings.old_exit_client.low_balance_notification\n+ );\n+\n+ println!(\"Old Settings: {:?}\", settings.old_exit_client.exits);\n+ println!(\"\\n\\n\\n\\nNew Settings: {:?}\", settings.exit_client.exits);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/lib.rs", "new_path": "rita_client/src/lib.rs", "diff": "@@ -20,9 +20,6 @@ pub mod rita_loop;\npub mod traffic_watcher;\nuse rita_common::READABLE_VERSION;\n-use settings::client::OldRitaClientSettings;\n-use settings::update_config;\n-use settings::SUBNET;\npub use crate::dashboard::auth::*;\npub use crate::dashboard::backup_created::*;\n@@ -80,25 +77,15 @@ About:\npub fn wait_for_settings(settings_file: &str) -> RitaClientSettings {\nlet start = Instant::now();\nlet timeout = Duration::from_secs(120);\n- let mut res = OldRitaClientSettings::new(settings_file);\n+ let mut res = RitaClientSettings::new(settings_file);\nwhile (Instant::now() - start) < timeout {\nif let Ok(val) = res {\n- match update_config(val, SUBNET) {\n- Ok(a) => {\n- return a;\n+ return val;\n}\n- Err(e) => {\n- panic!(\"Settings parse failure {:?}\", e);\n- }\n- }\n- }\n- res = OldRitaClientSettings::new(settings_file);\n+ res = RitaClientSettings::new(settings_file);\n}\nmatch res {\n- Ok(val) => match update_config(val, SUBNET) {\n- Ok(a) => a,\n- Err(e) => panic!(\"Settings parse failure {:?}\", e),\n- },\n+ Ok(val) => val,\nErr(e) => panic!(\"Settings parse failure {:?}\", e),\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "settings/src/client.rs", "new_path": "settings/src/client.rs", "diff": "@@ -200,15 +200,14 @@ impl RitaClientSettings {\nlet mut s = Config::new();\nassert!(Path::new(file_name).exists());\ns.merge(config::File::with_name(file_name).required(false))?;\n- let settings: Self = s.try_into()?;\n-\n+ let settings: Self = update_config(s.try_into()?, SUBNET)?;\nOk(settings)\n}\npub fn new_watched(file_name: &str) -> Result<Self, Error> {\nlet mut s = Config::new();\ns.merge(config::File::with_name(file_name).required(false))?;\n- let settings: Self = s.try_into()?;\n+ let settings: Self = update_config(s.try_into()?, SUBNET)?;\nset_rita_client(settings.clone());\n@@ -226,33 +225,6 @@ impl RitaClientSettings {\n}\n}\n-impl OldRitaClientSettings {\n- pub fn new(file_name: &str) -> Result<Self, Error> {\n- let mut s = Config::new();\n- assert!(Path::new(file_name).exists());\n- s.merge(config::File::with_name(file_name).required(false))?;\n- let settings: Self = s.try_into()?;\n-\n- Ok(settings)\n- }\n-\n- pub fn new_watched(file_name: &str) -> Result<Self, Error> {\n- let mut s = Config::new();\n- s.merge(config::File::with_name(file_name).required(false))?;\n- let settings: Self = s.try_into()?;\n-\n- let subnet = SUBNET;\n- let new_settings = update_config(settings.clone(), subnet);\n- let new_settings = new_settings?;\n-\n- set_rita_client(new_settings.clone());\n-\n- spawn_watch_thread_client(new_settings, file_name);\n-\n- Ok(settings)\n- }\n-}\n-\n/// This is the main struct for rita\n#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq, Default)]\npub struct RitaClientSettings {\n@@ -264,36 +236,25 @@ pub struct RitaClientSettings {\n#[serde(default)]\npub localization: LocalizationSettings,\npub network: NetworkSettings,\n+ #[serde(rename = \"exit_client\")]\n+ pub old_exit_client: OldExitClientSettings,\n+ #[serde(rename = \"new_exit_client\", default)]\npub exit_client: ExitClientSettings,\n#[serde(skip)]\npub future: bool,\n}\n-/// This is the main struct for rita\n-#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq, Default)]\n-pub struct OldRitaClientSettings {\n- pub payment: PaymentSettings,\n- #[serde(default)]\n- pub log: LoggingSettings,\n- #[serde(default)]\n- pub operator: OperatorSettings,\n- #[serde(default)]\n- pub localization: LocalizationSettings,\n- pub network: NetworkSettings,\n- pub exit_client: OldExitClientSettings,\n- #[serde(skip)]\n- pub future: bool,\n-}\n-\nimpl RitaClientSettings {\npub fn merge(&mut self, changed_settings: serde_json::Value) -> Result<(), Error> {\nlet mut settings_value = serde_json::to_value(self.clone())?;\n+ info!(\"Merge is being called, maybe error here\");\n+\njson_merge(&mut settings_value, &changed_settings);\nmatch serde_json::from_value(settings_value) {\nOk(new_settings) => {\n- *self = new_settings;\n+ *self = update_config(new_settings, SUBNET)?;\nOk(())\n}\nErr(e) => Err(e.into()),\n" }, { "change_type": "MODIFY", "old_path": "settings/src/lib.rs", "new_path": "settings/src/lib.rs", "diff": "@@ -17,7 +17,7 @@ extern crate serde_derive;\nextern crate log;\nextern crate arrayvec;\n-use crate::client::{ExitClientSettings, ExitServer, OldRitaClientSettings, SelectedExit};\n+use crate::client::{ExitClientSettings, ExitServer, SelectedExit};\nuse althea_types::Identity;\nuse failure::Error;\nuse ipnetwork::IpNetwork;\n@@ -297,7 +297,7 @@ where\n///Takes a file config and updates the config to use the new ExitServer struct\npub fn update_config(\n- old_settings: OldRitaClientSettings,\n+ old_settings: RitaClientSettings,\nsubnet: u8,\n) -> Result<RitaClientSettings, Error> {\nlet mut new_settings = RitaClientSettings {\n@@ -306,20 +306,13 @@ pub fn update_config(\noperator: old_settings.operator,\nlocalization: old_settings.localization,\nnetwork: old_settings.network,\n- exit_client: ExitClientSettings {\n- exits: HashMap::new(),\n- current_exit: old_settings.exit_client.current_exit,\n- wg_listen_port: old_settings.exit_client.wg_listen_port,\n- contact_info: old_settings.exit_client.contact_info,\n- lan_nics: old_settings.exit_client.lan_nics,\n- low_balance_notification: old_settings.exit_client.low_balance_notification,\n- },\n+ old_exit_client: old_settings.old_exit_client.clone(),\n+ exit_client: ExitClientSettings::default(),\nfuture: old_settings.future,\n};\n- // Set hashset with new exit info\nlet mut new_exits: HashMap<String, ExitServer> = HashMap::new();\n- for (k, v) in old_settings.exit_client.exits {\n+ for (k, v) in old_settings.old_exit_client.clone().exits {\nlet s_len = if v.subnet_len.is_some() {\nv.subnet_len.unwrap()\n} else {\n@@ -341,6 +334,15 @@ pub fn update_config(\nnew_exits.insert(k, new_exit);\n}\n+ let old_exit_client = old_settings.old_exit_client;\n+ new_settings.exit_client = ExitClientSettings {\n+ exits: HashMap::new(),\n+ current_exit: old_exit_client.clone().current_exit,\n+ wg_listen_port: old_exit_client.wg_listen_port,\n+ contact_info: old_exit_client.clone().contact_info,\n+ lan_nics: old_exit_client.clone().lan_nics,\n+ low_balance_notification: old_exit_client.low_balance_notification,\n+ };\nnew_settings.exit_client.exits = new_exits.clone();\nOk(new_settings)\n@@ -348,9 +350,8 @@ pub fn update_config(\n#[cfg(test)]\nmod tests {\n- use crate::client::{OldRitaClientSettings, RitaClientSettings};\n+ use crate::client::RitaClientSettings;\nuse crate::exit::RitaExitSettingsStruct;\n- use crate::update_config;\n#[test]\nfn test_settings_test() {\n@@ -359,11 +360,8 @@ mod tests {\n#[test]\nfn test_settings_example() {\n- let settings = update_config(\n- OldRitaClientSettings::new(\"old_example.toml\").unwrap(),\n- 120_u8,\n- );\n- println!(\"{:?}\", settings.unwrap().exit_client);\n+ let settings = RitaClientSettings::new(\"old_example.toml\").unwrap();\n+ assert!(!settings.exit_client.exits.is_empty())\n}\n#[test]\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Updated Config reading from old RitaClientSettings struct to fill out details in the new struct This new RitaClientSetting struct was added to allow for exits to have a subnet and have different ips within this subnet. This allows for the exit switcher code to make informed decisions about switching exits and failing over
20,255
30.09.2021 13:17:09
25,200
056314e6af34c2880057946a3f3c98a6392c6d37
Added average tracking metric for exit switcher Instead of comparing metrics to instantaneous babel metrics, which may not be robust, using a long term average to compare metrics. This allows us to be sure of when to switch tracking exits, insteads of switching due to network bursts.
[ { "change_type": "MODIFY", "old_path": ".gitignore", "new_path": ".gitignore", "diff": "@@ -15,6 +15,7 @@ test.db-journal\n*.orig\n/scripts/staging_dir/\n+/scripts/staging/\nintegration-tests/private-key*\nintegration-tests/deps*\nintegration-tests/rita-settings*\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/exit_manager/exit_switcher.rs", "new_path": "rita_client/src/exit_manager/exit_switcher.rs", "diff": "@@ -5,6 +5,7 @@ use ipnetwork::IpNetwork;\nuse rita_common::FAST_LOOP_SPEED;\nuse settings::client::SelectedExit;\nuse settings::client::{ExitServer, ExitSwitchingCode};\n+use std::collections::HashMap;\nuse std::net::IpAddr;\nuse std::sync::Arc;\nuse std::sync::RwLock;\n@@ -18,40 +19,116 @@ lazy_static! {\n/// To switch, this vector needs to be full of values from a single exit.\npub static ref METRIC_VALUES: Arc<RwLock<Vec<u16>>> =\nArc::new(RwLock::new(Vec::with_capacity(METRIC_ENTRIES)));\n+\n+ pub static ref EXIT_TRACKER: Arc<RwLock<HashMap<IpAddr, ExitTracker>>> = Arc::new(RwLock::new(HashMap::new()));\n+}\n+\n+/// This struct contains information about each exit in the cluster. It stores a running total of metric values. This is used to\n+/// calculate the average metric, and this value wont overflow since we track metric values for no more than 15 mins.\n+/// Since babel advertises several routes to a given exit, we need to find the route with the best metric and add it to this total. Last_added_metric\n+/// helps with this by keeping track of what we previosly added to running_total, so that if we come across a better metric to the exit, we\n+/// subtract this from the total and add the new better value.\n+#[derive(Default, Debug)]\n+pub struct ExitTracker {\n+ last_added_metric: u16,\n+ running_total: u64,\n+ ticker_len: u16,\n+}\n+\n+impl ExitTracker {\n+ fn new(last_added_metric: u16, running_total: u64, ticker_len: u16) -> ExitTracker {\n+ ExitTracker {\n+ last_added_metric,\n+ running_total,\n+ ticker_len,\n+ }\n+ }\n}\n/// Simple struct that keep tracks of the following metrics during every tick:\n///\n/// 1.) boolean of whether our current exit went down or hasnt been assigned yet,\n///\n-/// 2.) Babel metric of our current exit\n+/// 2.) Option<IpAddr> of current exit\n///\n-/// 3.) Metric of exit we are tracking in METRIC_VALUES lazy static\n+/// 3.) Babel metric of our current exit\n///\n-/// 4.) Option<IpAddr> of the best exit during this tick\n+/// 4.) Option<IpAddr> of tracking exit\n///\n-/// 5.) Metric of the best exit during this tick\n-\n+/// 5.) Metric of exit we are tracking in lazy static\n+///\n+/// 6.) Option<IpAddr> of the best exit during this tick\n+///\n+/// 7.) Metric of the best exit during this tick\n+#[derive(Debug, Clone, Copy)]\nstruct ExitMetrics {\nis_exit_down: bool,\n+ cur_exit: Option<IpAddr>,\n+ cur_exit_babel_met: u16,\n+ tracking_exit: Option<IpAddr>,\n+ tracking_met: u16,\n+ best_exit: Option<IpAddr>,\n+ best_exit_met: u16,\n+}\n+\n+impl ExitMetrics {\n+ fn new(\n+ is_exit_down: bool,\n+ cur_exit: Option<IpAddr>,\ncur_exit_babel_met: u16,\n+ tracking_exit: Option<IpAddr>,\ntracking_met: u16,\nbest_exit: Option<IpAddr>,\nbest_exit_met: u16,\n+ ) -> ExitMetrics {\n+ ExitMetrics {\n+ is_exit_down,\n+ cur_exit,\n+ cur_exit_babel_met,\n+ tracking_exit,\n+ tracking_met,\n+ best_exit,\n+ best_exit_met,\n+ }\n+ }\n}\n-impl From<ExitMetrics> for (bool, u16, u16, Option<IpAddr>, u16) {\n- fn from(e: ExitMetrics) -> (bool, u16, u16, Option<IpAddr>, u16) {\n+impl From<ExitMetrics>\n+ for (\n+ bool,\n+ Option<IpAddr>,\n+ u16,\n+ Option<IpAddr>,\n+ u16,\n+ Option<IpAddr>,\n+ u16,\n+ )\n+{\n+ fn from(\n+ e: ExitMetrics,\n+ ) -> (\n+ bool,\n+ Option<IpAddr>,\n+ u16,\n+ Option<IpAddr>,\n+ u16,\n+ Option<IpAddr>,\n+ u16,\n+ ) {\nlet ExitMetrics {\nis_exit_down,\n+ cur_exit,\ncur_exit_babel_met,\n+ tracking_exit,\ntracking_met,\nbest_exit,\nbest_exit_met,\n} = e;\n(\nis_exit_down,\n+ cur_exit,\ncur_exit_babel_met,\n+ tracking_exit,\ntracking_met,\nbest_exit,\nbest_exit_met,\n@@ -106,27 +183,18 @@ pub fn set_best_exit(\nbail!(\"No routes are found\")\n}\n- //Metric that we advertise (ignores the degradation of metric value due to current traffic, unlike the babel Route metric, which smoothens the value)\n- let current_metric: u16 = rita_client_exit_ser_ref\n+ // Metric that we advertise which is differnt from babel's advertised metric. Babel_metric - SomeConstant that measures how much our connection degrades the route\n+ // (ignores the degradation of metric value due to current traffic, unlike the babel Route metric, which smoothens the value)\n+ let current_adjusted_metric: u16 = rita_client_exit_ser_ref\n.selected_exit\n.selected_id_metric\n.unwrap_or(u16::MAX);\n-\n- //Metric of the best exit metric this tick\n- let best_metric: u16;\n-\n- //Ip of the best exit metric this tick\n- let best_exit: Option<IpAddr>;\n-\n- // Ip of exit we are currently tracking in lazy static\n+ // Ip of exit we are currently tracking in lazy static, if present\nlet tracking_exit = rita_client_exit_ser_ref.selected_exit.tracking_exit;\n-\n// Retrieve current exit ip, if connected\nlet current_exit_ip: Option<IpAddr> = rita_client_exit_ser_ref.selected_exit.selected_id;\n- // Set the best exit so far to be the one we are currently connected to, if any\n- best_exit = current_exit_ip;\n- best_metric = current_metric;\n+ let exit_map = &mut *EXIT_TRACKER.write().unwrap();\n// Parse all babel routes and find useful metrics\nlet exit_metrics = get_exit_metrics(\n@@ -134,38 +202,41 @@ pub fn set_best_exit(\nexits,\ncurrent_exit_ip,\ntracking_exit,\n- best_exit,\n- best_metric,\n+ current_exit_ip,\n+ current_adjusted_metric,\n+ exit_map,\n+ );\n+\n+ info!(\n+ \"Exit_Switcher: This tick, we have these metrics: {:?}\",\n+ exit_metrics\n);\n// update lazy static metric and retrieve exit code\nlet metric_vec = &mut *METRIC_VALUES.write().unwrap();\n- let exit_code = update_metric_value(\n- exit_metrics.best_exit,\n- exit_metrics.best_exit_met,\n- current_exit_ip,\n- exit_metrics.cur_exit_babel_met,\n- tracking_exit,\n- exit_metrics.tracking_met,\n- metric_vec,\n- );\n+ let exit_code = update_metric_value(exit_metrics, metric_vec, exit_map);\ninfo!(\n- \"Exit_Switcher: We have following metrics, Down?: {}, exitCode: {:?}, vector len : {:?}, selected_metric: {:?}, current_exit_babel_met: {:?}\",\n- exit_metrics.is_exit_down,\n+ \"Exit_Switcher: exitCode: {:?}, vector len : {:?}, selected_metric: {:?}, current_exit_babel_met: {:?}, degradation: {:?}\",\nexit_code,\nmetric_vec.len(),\n- current_metric,\n- exit_metrics.cur_exit_babel_met\n+ current_adjusted_metric,\n+ exit_metrics.cur_exit_babel_met,\n+ rita_client_exit_ser_ref.selected_exit.selected_id_degradation\n+ );\n+\n+ info!(\n+ \"Exit_Switcher: Our ExitTracker hashmap looks like: {:?}\",\n+ exit_map\n);\n// if exit is down or is not set yet, just return the best exit and reset the lazy static\nif exit_metrics.is_exit_down {\n- match best_exit {\n+ match exit_metrics.best_exit {\nSome(a) => {\ninfo!(\n\"Exit_Switcher: setup all initial exit informaion with selected_id_metric = {}\",\n- best_metric\n+ exit_metrics.best_exit_met\n);\nrita_client_exit_ser_ref.selected_exit = SelectedExit {\nselected_id: exit_metrics.best_exit,\n@@ -174,12 +245,29 @@ pub fn set_best_exit(\ntracking_exit: exit_metrics.best_exit,\n};\nmetric_vec.clear();\n+ reset_exit_tracking(exit_map);\nOk(a)\n}\nNone => bail!(\"Error with finding best exit logic, no exit found\"),\n}\n} else {\n//logic to determine wheter we should switch or not.\n+ set_exit_state(\n+ rita_client_exit_ser_ref,\n+ exit_code,\n+ exit_metrics,\n+ metric_vec,\n+ )\n+ }\n+}\n+\n+/// This function looks at the corresponding exit code and makes a decision based on what state we are currently in\n+fn set_exit_state(\n+ rita_client_exit_ser_ref: &mut ExitServer,\n+ exit_code: ExitSwitchingCode,\n+ exit_metrics: ExitMetrics,\n+ metric_vec: &mut Vec<u16>,\n+) -> Result<IpAddr, Error> {\nmatch exit_code {\n// we get this code when the exit is not setup, meaning it should not reach this else statement in the first place.\nExitSwitchingCode::InitialExitSetup => panic!(\"Should not reach this statement\"),\n@@ -195,7 +283,9 @@ pub fn set_best_exit(\n.selected_id_metric\n.expect(\"No selected Ip metric where there should be one\"),\n);\n- Ok(current_exit_ip.expect(\"Ip value expected, none present\"))\n+ Ok(exit_metrics\n+ .cur_exit\n+ .expect(\"Ip value expected, none present\"))\n}\nExitSwitchingCode::ContinueCurrent => {\n// set a degradation values if none, else update the current exit advertised values\n@@ -231,7 +321,9 @@ pub fn set_best_exit(\nrita_client_exit_ser_ref.selected_exit.selected_id_metric = res;\n}\n}\n- Ok(current_exit_ip.expect(\"Ip value expected, none present\"))\n+ Ok(exit_metrics\n+ .cur_exit\n+ .expect(\"Ip value expected, none present\"))\n}\nExitSwitchingCode::SwitchExit => {\n// We swtich to the new exit\n@@ -241,16 +333,19 @@ pub fn set_best_exit(\nselected_id_degradation: None,\ntracking_exit: exit_metrics.best_exit,\n};\n- Ok(best_exit.expect(\"Ip value expected, none present\"))\n- }\n- ExitSwitchingCode::ContinueTracking => {\n- Ok(current_exit_ip.expect(\"Ip value expected, none present\"))\n+ Ok(exit_metrics\n+ .best_exit\n+ .expect(\"Ip value expected, none present\"))\n}\n+ ExitSwitchingCode::ContinueTracking => Ok(exit_metrics\n+ .cur_exit\n+ .expect(\"Ip value expected, none present\")),\nExitSwitchingCode::ResetTracking => {\n// selected id is still the same, we dont change exit, just change what we track\nrita_client_exit_ser_ref.selected_exit.tracking_exit = exit_metrics.best_exit;\n- Ok(current_exit_ip.expect(\"Ip value expected, none present\"))\n- }\n+ Ok(exit_metrics\n+ .cur_exit\n+ .expect(\"Ip value expected, none present\"))\n}\n}\n}\n@@ -268,24 +363,31 @@ pub fn set_best_exit(\n///\n/// 1.) boolean of whether our current exit went down or hasnt been assigned yet,\n///\n-/// 2.) Babel metric of our current exit\n+/// 2.) Option<IpAddr> of current exit\n+///\n+/// 3.) Babel metric of our current exit\n+///\n+/// 4.) Option<IpAddr> of tracking exit\n///\n-/// 3.) Metric of exit we are tracking in lazy static\n+/// 5.) Metric of exit we are tracking in lazy static\n///\n-/// 4.) Option<IpAddr> of the best exit during this tick\n+/// 6.) Option<IpAddr> of the best exit during this tick\n///\n-/// 5.) Metric of the best exit during this tick\n+/// 7.) Metric of the best exit during this tick\nfn get_exit_metrics(\nroutes: Vec<Route>,\nexits: IpNetwork,\ncurrent_exit_ip: Option<IpAddr>,\ntracking_exit: Option<IpAddr>,\n- _initial_best_exit: Option<IpAddr>,\n+ initial_best_exit: Option<IpAddr>,\ninitial_best_metric: u16,\n+ exit_map: &mut HashMap<IpAddr, ExitTracker>,\n) -> ExitMetrics {\nlet mut best_exit = None;\nlet mut best_metric = u16::MAX;\n+ //By default we say our exit is down. If we find a route to it that is not u16::MAX, we can change this\nlet mut current_exit_down = true;\n+\nlet mut current_exit_metric = u16::MAX;\nlet mut tracking_metric = u16::MAX;\n@@ -301,21 +403,32 @@ fn get_exit_metrics(\n// 3.) Exit's route metric has gone to inf\nif let Some(exit_ip) = current_exit_ip {\nif exit_ip == ip && route.metric != u16::MAX {\n- // Current exit metric is not inf and we have a path to exit, so current exit is up\n+ // Current exit metric is not inf and we have a path to exit, so current exit is up. The time intial_best_metric is\n+ // u16::MAX is on rita startup, meaning we have not setup the initial exit yet\nif initial_best_metric != u16::MAX {\ncurrent_exit_down = false;\n- current_exit_metric = route.metric;\n+ current_exit_metric = if current_exit_metric > route.metric {\n+ route.metric\n+ } else {\n+ current_exit_metric\n+ };\n}\n}\n}\nif let Some(tracking_ip) = tracking_exit {\nif tracking_ip == ip && route.metric != u16::MAX {\n- // We are currently tracking an exit, we set its metric\n- tracking_metric = route.metric;\n+ // We are currently tracking an exit, we set its metric. Since babel advertises several routes to an exit, we choose best one\n+ tracking_metric = if tracking_metric > route.metric {\n+ route.metric\n+ } else {\n+ tracking_metric\n+ };\n}\n}\ninfo!(\"Metric for the IP: {} is {}\", ip, route.metric);\n+ // Set details for additional exits in the server\n+ observe_cluster_metrics(exit_map, ip, route.metric);\n// Every loop iteration, update the best exit\nif route.metric < best_metric {\n@@ -325,15 +438,58 @@ fn get_exit_metrics(\n}\n}\n+ //If current exit is still up, we reset best exit with current exit, using our advertised metric values given that our current exit better\n+ if !current_exit_down && initial_best_metric < best_metric {\n+ best_metric = initial_best_metric;\n+ best_exit = initial_best_exit;\n+ }\n+\n+ //We are done adding metrics values to running averages for all exits this tick, so we do cleanup\n+ set_last_added_to_zero(exit_map);\n+\nExitMetrics {\nis_exit_down: current_exit_down,\n+ cur_exit: current_exit_ip,\ncur_exit_babel_met: current_exit_metric,\n+ tracking_exit,\ntracking_met: tracking_metric,\nbest_exit,\nbest_exit_met: best_metric,\n}\n}\n+/// This function is called to update the running averages of babel metrics for every exit in the cluster. These average can then\n+/// be reliabably used to decide which exit to track/switch to. Since babel advertises several routes to exits, we choose the best metric\n+/// to add to this running average\n+/// TODO: Add metric tracking to network stat tracker and just query that information here\n+fn observe_cluster_metrics(exit_map: &mut HashMap<IpAddr, ExitTracker>, ip: IpAddr, met: u16) {\n+ let met_64 = met as u64;\n+ if let std::collections::hash_map::Entry::Vacant(e) = exit_map.entry(ip) {\n+ e.insert(ExitTracker::new(met, met_64, 1));\n+ } else {\n+ let exit = exit_map\n+ .get_mut(&ip)\n+ .expect(\"There needs to be an ExitTracker struct for given ip\");\n+ if exit.last_added_metric == 0 {\n+ exit.running_total += met_64;\n+ exit.last_added_metric = met;\n+ exit.ticker_len += 1;\n+ } else if met < exit.last_added_metric {\n+ exit.running_total -= exit.last_added_metric as u64;\n+ exit.running_total += met_64;\n+ exit.last_added_metric = met;\n+ }\n+ }\n+}\n+\n+/// After going through a tick of babel metrics for every exits, we may have a residual value for last_added_metric. We set this to 0, so that\n+/// during the next tick, We dont subtract the previous tick's addition to the running average.\n+fn set_last_added_to_zero(exit_map: &mut HashMap<IpAddr, ExitTracker>) {\n+ for (_, v) in exit_map.iter_mut() {\n+ v.last_added_metric = 0;\n+ }\n+}\n+\n/// Helper function that checks if the provided ip address is within the subnet specified by the provided IpNetwork\nfn check_ip_in_subnet(ip: IpAddr, exits: IpNetwork) -> bool {\n//check that both are either V4 or V6\n@@ -369,15 +525,17 @@ fn check_ip_in_subnet(ip: IpAddr, exits: IpNetwork) -> bool {\n///\n/// ResetTracking: tracking and best are diffrent. We reset timer/vector and start tracking new best\nfn update_metric_value(\n- best_exit: Option<IpAddr>,\n- best_metric: u16,\n- current_exit: Option<IpAddr>,\n- current_metric: u16,\n- tracking_exit: Option<IpAddr>,\n- tracking_metric: u16,\n+ exit_metrics: ExitMetrics,\nmetric_vec: &mut Vec<u16>,\n+ exit_map: &mut HashMap<IpAddr, ExitTracker>,\n) -> ExitSwitchingCode {\nlet is_full = metric_vec.len() == metric_vec.capacity();\n+ let current_exit = exit_metrics.cur_exit;\n+ let current_metric = exit_metrics.cur_exit_babel_met;\n+ let best_exit = exit_metrics.best_exit;\n+ let best_metric = exit_metrics.best_exit_met;\n+ let tracking_exit = exit_metrics.tracking_exit;\n+ let tracking_metric = exit_metrics.tracking_met;\nif current_exit.is_none() {\n//setting up exit for first time, vec should be empty\n@@ -402,6 +560,7 @@ fn update_metric_value(\n// All three exits are the same\nif is_full {\nmetric_vec.clear();\n+ reset_exit_tracking(exit_map);\nmetric_vec.push(best_metric);\nExitSwitchingCode::ContinueCurrentReset\n} else {\n@@ -412,6 +571,7 @@ fn update_metric_value(\n//our current exit is different from the best exit\nif is_full {\nmetric_vec.clear();\n+ reset_exit_tracking(exit_map);\nmetric_vec.push(best_metric);\nExitSwitchingCode::SwitchExit\n} else {\n@@ -421,44 +581,73 @@ fn update_metric_value(\n}\n} else {\n// best exit is different from tracking, so we change tracking to be best if we see that the best metric >>> tracking metric\n- if worth_switching_tracking_exit(metric_vec, best_metric) {\n+ if worth_switching_tracking_exit(metric_vec, best_exit.unwrap(), exit_map) {\nmetric_vec.clear();\n+ reset_exit_tracking(exit_map);\nmetric_vec.push(best_metric);\nExitSwitchingCode::ResetTracking\n} else {\n// Since we want to continue with current tracking exit, we just make recursive call to best exit == tracking exit\nupdate_metric_value(\n- Some(tracking_exit),\n- tracking_metric,\n+ ExitMetrics::new(\n+ exit_metrics.is_exit_down,\ncurrent_exit,\ncurrent_metric,\nSome(tracking_exit),\ntracking_metric,\n+ Some(tracking_exit),\n+ tracking_metric,\n+ ),\nmetric_vec,\n+ exit_map,\n)\n}\n}\n}\n+fn reset_exit_tracking(exit_map: &mut HashMap<IpAddr, ExitTracker>) {\n+ for (_, v) in exit_map.iter_mut() {\n+ v.last_added_metric = 0;\n+ v.running_total = 0;\n+ v.ticker_len = 0;\n+ }\n+}\n+\n/// It is worth tracking a new better exit only if its values is more than 10% better than our current tracking exit values, else there is no point\n/// throwing away all our progress for our current tracking exit. This helps solve the following edge case:\n///\n/// We are connected to exit A, exit B and C are consistently better than A, but they flucuate between being the best exit every tick. Instead of\n/// reseting our tracking exit every tick, we continue with one exit, either B or C, unless one exit becomes significantly better than the other. This way\n/// we dont get stuck at exit A when there are better exits available.\n-fn worth_switching_tracking_exit(metric_vec: &mut Vec<u16>, best_metric: u16) -> bool {\n+fn worth_switching_tracking_exit(\n+ metric_vec: &mut Vec<u16>,\n+ best_ip: IpAddr,\n+ exit_map: &mut HashMap<IpAddr, ExitTracker>,\n+) -> bool {\n+ if metric_vec.is_empty() {\n+ return false;\n+ }\nlet avg_tracking_metric = calculate_average(metric_vec.clone());\n- if avg_tracking_metric < best_metric {\n+\n+ let exit_tracker = exit_map\n+ .get(&best_ip)\n+ .expect(\"There should be an ExitTracker entry here\");\n+ if exit_tracker.ticker_len == 0 {\n+ return false;\n+ }\n+ let avg_best_metric = (exit_tracker.running_total / exit_tracker.ticker_len as u64) as u16;\n+\n+ if avg_tracking_metric < avg_best_metric || avg_best_metric == 0 {\nfalse\n} else {\n- (((avg_tracking_metric - best_metric) as f64) / (avg_tracking_metric as f64)) > 0.1\n+ (((avg_tracking_metric - avg_best_metric) as f64) / (avg_tracking_metric as f64)) > 0.1\n}\n}\n/// Given a vector of u16, calculates the average. Panics if given a vector with no entries\nfn calculate_average(vals: Vec<u16>) -> u16 {\nif vals.is_empty() {\n- panic!(\"received list of values with no elements\")\n+ panic!(\"received list of values with no elements\");\n}\nlet mut sum: u64 = 0;\nfor entry in vals.iter() {\n@@ -508,23 +697,37 @@ mod tests {\n#[test]\nfn test_worth_switching_tracking() {\nlet mut vec: Vec<u16> = vec![100];\n+ let mut exit_map: HashMap<IpAddr, ExitTracker> = HashMap::new();\n+ let ip = IpAddr::V4(Ipv4Addr::new(1, 1, 1, 1));\n+\n+ exit_map.insert(ip, ExitTracker::new(110, 110, 1));\n+ assert!(!worth_switching_tracking_exit(&mut vec, ip, &mut exit_map));\n+\n+ exit_map.insert(ip, ExitTracker::new(111, 111, 1));\n+ assert!(!worth_switching_tracking_exit(&mut vec, ip, &mut exit_map));\n- assert!(!worth_switching_tracking_exit(&mut vec, 110));\n- assert!(!worth_switching_tracking_exit(&mut vec, 111));\n+ exit_map.insert(ip, ExitTracker::new(90, 90, 1));\n+ assert!(!worth_switching_tracking_exit(&mut vec, ip, &mut exit_map));\n- assert!(!worth_switching_tracking_exit(&mut vec, 90));\n- assert!(worth_switching_tracking_exit(&mut vec, 89));\n+ exit_map.insert(ip, ExitTracker::new(89, 89, 1));\n+ assert!(worth_switching_tracking_exit(&mut vec, ip, &mut exit_map));\n//avg is 13.6 -> to u16 -> 13\nlet mut vec = vec![10, 10, 12, 16, 20];\n- assert!(!worth_switching_tracking_exit(&mut vec, 12));\n- assert!(worth_switching_tracking_exit(&mut vec, 11));\n+ exit_map.insert(ip, ExitTracker::new(12, 12 * 5, 5));\n+ assert!(!worth_switching_tracking_exit(&mut vec, ip, &mut exit_map));\n+\n+ exit_map.insert(ip, ExitTracker::new(11, 11 * 5, 5));\n+ assert!(worth_switching_tracking_exit(&mut vec, ip, &mut exit_map));\n}\n#[test]\nfn test_update_metric_values() {\nlet mut vec: Vec<u16> = Vec::with_capacity(10);\n+ let mut exit_map: HashMap<IpAddr, ExitTracker> = HashMap::new();\n+ let ip = IpAddr::V4(Ipv4Addr::new(1, 1, 1, 1));\n+ exit_map.insert(ip, ExitTracker::new(110, 110, 1));\n// we use ipv6 addrs, but this should also work with ipv4\n@@ -536,13 +739,17 @@ mod tests {\nassert_eq!(\nExitSwitchingCode::InitialExitSetup,\nupdate_metric_value(\n- best_exit,\n- 400,\n+ ExitMetrics::new(\n+ true,\ncurrent_exit,\nu16::MAX,\ntracking_exit,\nu16::MAX,\n- &mut vec\n+ best_exit,\n+ 400\n+ ),\n+ &mut vec,\n+ &mut exit_map\n)\n);\nassert_eq!(vec.len(), 0);\n@@ -554,13 +761,9 @@ mod tests {\nassert_eq!(\nExitSwitchingCode::ContinueCurrent,\nupdate_metric_value(\n- best_exit,\n- 450,\n- current_exit,\n- 450,\n- tracking_exit,\n- 450,\n- &mut vec\n+ ExitMetrics::new(false, current_exit, 450, tracking_exit, 450, best_exit, 450),\n+ &mut vec,\n+ &mut exit_map\n)\n);\nassert_eq!(vec.len(), 1);\n@@ -574,13 +777,9 @@ mod tests {\nassert_eq!(\nExitSwitchingCode::ContinueCurrentReset,\nupdate_metric_value(\n- best_exit,\n- 415,\n- current_exit,\n- 415,\n- tracking_exit,\n- 415,\n- &mut vec\n+ ExitMetrics::new(false, current_exit, 415, tracking_exit, 415, best_exit, 415),\n+ &mut vec,\n+ &mut exit_map\n)\n);\nassert_eq!(vec.capacity(), 10);\n@@ -592,16 +791,22 @@ mod tests {\ncurrent_exit = Some(IpAddr::V4(Ipv4Addr::new(1, 120, 120, 120)));\ntracking_exit = current_exit;\n+ exit_map.insert(best_exit.unwrap(), ExitTracker::new(0, 91030, 1));\n+\nassert_eq!(\nExitSwitchingCode::ContinueCurrent,\nupdate_metric_value(\n- best_exit,\n- 413,\n+ ExitMetrics::new(\n+ false,\ncurrent_exit,\n5000,\ntracking_exit,\n5000,\n- &mut vec\n+ best_exit,\n+ 413\n+ ),\n+ &mut vec,\n+ &mut exit_map\n)\n);\nassert_eq!(vec.len(), 2);\n@@ -613,13 +818,9 @@ mod tests {\nassert_eq!(\nExitSwitchingCode::ContinueTracking,\nupdate_metric_value(\n- best_exit,\n- 410,\n- current_exit,\n- 500,\n- tracking_exit,\n- 410,\n- &mut vec\n+ ExitMetrics::new(false, current_exit, 500, tracking_exit, 410, best_exit, 410),\n+ &mut vec,\n+ &mut exit_map\n)\n);\nassert_eq!(vec.len(), 3);\n@@ -633,13 +834,9 @@ mod tests {\nassert_eq!(\nExitSwitchingCode::SwitchExit,\nupdate_metric_value(\n- best_exit,\n- 410,\n- current_exit,\n- 500,\n- tracking_exit,\n- 410,\n- &mut vec\n+ ExitMetrics::new(false, current_exit, 500, tracking_exit, 410, best_exit, 410),\n+ &mut vec,\n+ &mut exit_map\n)\n);\nassert_eq!(vec.len(), 1);\n@@ -656,13 +853,9 @@ mod tests {\nassert_eq!(\nExitSwitchingCode::SwitchExit,\nupdate_metric_value(\n- best_exit,\n- 440,\n- current_exit,\n- 500,\n- tracking_exit,\n- 450,\n- &mut vec\n+ ExitMetrics::new(false, current_exit, 500, tracking_exit, 450, best_exit, 440),\n+ &mut vec,\n+ &mut exit_map\n)\n);\nassert_eq!(vec.len(), 1);\n@@ -673,17 +866,14 @@ mod tests {\nappend = vec![410, 410, 400, 400, 430, 430, 410, 410, 430, 400];\nvec.append(&mut append);\nassert_eq!(vec.len(), 10);\n+ exit_map.insert(best_exit.unwrap(), ExitTracker::new(0, 10, 1));\nassert_eq!(\nExitSwitchingCode::ResetTracking,\nupdate_metric_value(\n- best_exit,\n- 200,\n- current_exit,\n- 500,\n- tracking_exit,\n- 450,\n- &mut vec\n+ ExitMetrics::new(false, current_exit, 500, tracking_exit, 450, best_exit, 200),\n+ &mut vec,\n+ &mut exit_map\n)\n);\nassert_eq!(vec.len(), 1);\n@@ -769,10 +959,19 @@ mod tests {\n};\nlet routes = vec![exit1, exit2, exit3, not_exit];\n+ let mut exit_map: HashMap<IpAddr, ExitTracker> = HashMap::new();\n// Nothing is setup yet\n- let (exit_down, c_e_met, t_e_m, b_exit, b_e_m) =\n- get_exit_metrics(routes.clone(), subnet, None, None, None, u16::MAX).into();\n+ let (exit_down, _, c_e_met, _, t_e_m, b_exit, b_e_m) = get_exit_metrics(\n+ routes.clone(),\n+ subnet,\n+ None,\n+ None,\n+ None,\n+ u16::MAX,\n+ &mut exit_map,\n+ )\n+ .into();\nassert!(exit_down);\nassert_eq!(c_e_met, u16::MAX);\nassert_eq!(t_e_m, u16::MAX);\n@@ -780,8 +979,16 @@ mod tests {\nassert_eq!(b_e_m, 200);\n// Only current exit is setup, not tracking yet\n- let (exit_down, c_e_met, t_e_m, b_exit, b_e_m) =\n- get_exit_metrics(routes.clone(), subnet, Some(ip1), None, Some(ip1), 400).into();\n+ let (exit_down, _, c_e_met, _, t_e_m, b_exit, b_e_m) = get_exit_metrics(\n+ routes.clone(),\n+ subnet,\n+ Some(ip1),\n+ None,\n+ Some(ip1),\n+ 400,\n+ &mut exit_map,\n+ )\n+ .into();\nassert!(!exit_down);\nassert_eq!(c_e_met, 400);\nassert_eq!(t_e_m, u16::MAX);\n@@ -789,8 +996,16 @@ mod tests {\nassert_eq!(b_e_m, 200);\n// current and tracking at setup and different from each other and best exit\n- let (exit_down, c_e_met, t_e_m, b_exit, b_e_m) =\n- get_exit_metrics(routes.clone(), subnet, Some(ip1), Some(ip2), Some(ip1), 500).into();\n+ let (exit_down, _, c_e_met, _, t_e_m, b_exit, b_e_m) = get_exit_metrics(\n+ routes.clone(),\n+ subnet,\n+ Some(ip1),\n+ Some(ip2),\n+ Some(ip1),\n+ 500,\n+ &mut exit_map,\n+ )\n+ .into();\nassert!(!exit_down);\nassert_eq!(c_e_met, 400);\nassert_eq!(t_e_m, 500);\n@@ -798,8 +1013,16 @@ mod tests {\nassert_eq!(b_e_m, 200);\n// Current and tracking are same but different from best exit\n- let (exit_down, c_e_met, t_e_m, b_exit, b_e_m) =\n- get_exit_metrics(routes.clone(), subnet, Some(ip2), Some(ip2), Some(ip2), 500).into();\n+ let (exit_down, _, c_e_met, _, t_e_m, b_exit, b_e_m) = get_exit_metrics(\n+ routes.clone(),\n+ subnet,\n+ Some(ip2),\n+ Some(ip2),\n+ Some(ip2),\n+ 500,\n+ &mut exit_map,\n+ )\n+ .into();\nassert!(!exit_down);\nassert_eq!(c_e_met, 500);\nassert_eq!(t_e_m, 500);\n@@ -807,8 +1030,16 @@ mod tests {\nassert_eq!(b_e_m, 200);\n// All three exits are the same\n- let (exit_down, c_e_met, t_e_m, b_exit, b_e_m) =\n- get_exit_metrics(routes, subnet, Some(ip3), Some(ip3), Some(ip3), 200).into();\n+ let (exit_down, _, c_e_met, _, t_e_m, b_exit, b_e_m) = get_exit_metrics(\n+ routes,\n+ subnet,\n+ Some(ip3),\n+ Some(ip3),\n+ Some(ip3),\n+ 200,\n+ &mut exit_map,\n+ )\n+ .into();\nassert!(!exit_down);\nassert_eq!(c_e_met, 200);\nassert_eq!(t_e_m, 200);\n" }, { "change_type": "DELETE", "old_path": "scripts/staging/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/initial/bin/mips-openwrt-linux-musl-gcc", "new_path": "scripts/staging/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/initial/bin/mips-openwrt-linux-musl-gcc", "diff": "" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Added average tracking metric for exit switcher Instead of comparing metrics to instantaneous babel metrics, which may not be robust, using a long term average to compare metrics. This allows us to be sure of when to switch tracking exits, insteads of switching due to network bursts.
20,244
05.10.2021 08:21:06
14,400
44cfd98ada5dad55065089f9967557135d6d5329
Add github actions caching This patch adds basic Docker layer caching and Rust build caching. This should dramatically reduce build times and hopefully not introduce too many cache errors.
[ { "change_type": "MODIFY", "old_path": ".github/workflows/rust.yml", "new_path": ".github/workflows/rust.yml", "diff": "@@ -14,6 +14,7 @@ jobs:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v2\n+ - uses: Swatinem/rust-cache@v1\n- name: Check Rita and Rita Exit x86\nrun: cargo check --all\ntest:\n@@ -21,6 +22,7 @@ jobs:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v2\n+ - uses: Swatinem/rust-cache@v1\n- name: Run Rita and Rita Exit tests\nrun: RUST_TEST_THREADS=1 cargo test --verbose --all\nrustfmt:\n@@ -35,6 +37,7 @@ jobs:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v2\n+ - uses: Swatinem/rust-cache@v1\n- name: Check for Clippy lints\nrun: rustup component add clippy && cargo clippy --all --all-targets --all-features -- -D warnings\ncross-mips:\n@@ -42,6 +45,7 @@ jobs:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v2\n+ - uses: Swatinem/rust-cache@v1\n- name: Cross test mips\nrun: cargo install cross && cross test --target mips-unknown-linux-musl --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\ncross-mipsel:\n@@ -49,6 +53,7 @@ jobs:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v2\n+ - uses: Swatinem/rust-cache@v1\n- name: Cross test mipsel\nrun: cargo install cross && cross test --target mipsel-unknown-linux-musl --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\ncross-mips64:\n@@ -56,6 +61,7 @@ jobs:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v2\n+ - uses: Swatinem/rust-cache@v1\n- name: Cross test mips64\nrun: cargo install cross && cross test --target mips64-unknown-linux-gnuabi64 --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\ncross-mips64el:\n@@ -63,6 +69,7 @@ jobs:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v2\n+ - uses: Swatinem/rust-cache@v1\n- name: Cross test mips64el\nrun: cargo install cross && cross test --target mips64el-unknown-linux-gnuabi64 --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\ncross-aarch64:\n@@ -70,6 +77,7 @@ jobs:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v2\n+ - uses: Swatinem/rust-cache@v1\n- name: Cross test aarch64\nrun: cargo install cross && cross test --target aarch64-unknown-linux-musl --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\ncross-armv7:\n@@ -77,6 +85,7 @@ jobs:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v2\n+ - uses: Swatinem/rust-cache@v1\n- name: Cross test armv7\nrun: cargo install cross && cross test --target armv7-unknown-linux-musleabihf --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\nintegration-test-with-backcompat:\n@@ -84,6 +93,7 @@ jobs:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v2\n+ - uses: satackey/action-docker-layer-caching@v0.0.11\n- name: Install Wireguard\nrun: sudo apt-get update && sudo apt install -y wireguard linux-source linux-headers-$(uname -r) build-essential && sudo modprobe wireguard\n- name: Run integration test\n@@ -93,6 +103,7 @@ jobs:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v2\n+ - uses: satackey/action-docker-layer-caching@v0.0.11\n- name: Install Wireguard\nrun: sudo apt-get update && sudo apt install -y wireguard linux-source linux-headers-$(uname -r) build-essential && sudo modprobe wireguard\n- name: Run integration test\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add github actions caching This patch adds basic Docker layer caching and Rust build caching. This should dramatically reduce build times and hopefully not introduce too many cache errors.
20,244
05.10.2021 09:03:12
14,400
c390de33b00d1eae60426c0ccb3eaecb44a87afb
Upgrade Postgres version in tests The postgres docker pin updated and broke our tests, easy fix.
[ { "change_type": "MODIFY", "old_path": "integration-tests/container/Dockerfile", "new_path": "integration-tests/container/Dockerfile", "diff": "@@ -5,8 +5,8 @@ RUN apt-get update && apt-get install -y sudo iputils-ping iproute2 jq vim netca\nRUN apt-get install -y -t unstable iperf3\nRUN curl https://sh.rustup.rs -sSf | sh -s -- -y\nENV POSTGRES_USER=postgres\n-ENV POSTGRES_BIN=/usr/lib/postgresql/13/bin/postgres\n-ENV INITDB_BIN=/usr/lib/postgresql/13/bin/initdb\n+ENV POSTGRES_BIN=/usr/lib/postgresql/14/bin/postgres\n+ENV INITDB_BIN=/usr/lib/postgresql/14/bin/initdb\nRUN PATH=$PATH:$HOME/.cargo/bin cargo install diesel_cli --force\nARG NODES\nENV SPEEDTEST_THROUGHPUT=$SPEEDTEST_THROUGHPUT\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Upgrade Postgres version in tests The postgres docker pin updated and broke our tests, easy fix.
20,244
05.10.2021 09:29:57
14,400
74abde35a2573f7b0b3eb85d9f7bb03157a2bdf8
Remove double install of diesel cli in tests Not really sure how this snuck in here, but it's obviously not useful, especially since it's below the vars and won't be cached.
[ { "change_type": "MODIFY", "old_path": "integration-tests/container/Dockerfile", "new_path": "integration-tests/container/Dockerfile", "diff": "@@ -12,7 +12,6 @@ ARG NODES\nENV SPEEDTEST_THROUGHPUT=$SPEEDTEST_THROUGHPUT\nENV SPEEDTEST_DURATION=$SPEEDTEST_DURATION\nENV VERBOSE=$VERBOSE\n-RUN PATH=$PATH:$HOME/.cargo/bin cargo install diesel_cli --force\nENV 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" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove double install of diesel cli in tests Not really sure how this snuck in here, but it's obviously not useful, especially since it's below the vars and won't be cached.
20,255
07.10.2021 11:29:57
25,200
68e299df18b840098db41bb925f0f97a9631f2e9
Exit Switcher does not panic when routing table is empty
[ { "change_type": "MODIFY", "old_path": "rita_client/src/exit_manager/exit_switcher.rs", "new_path": "rita_client/src/exit_manager/exit_switcher.rs", "diff": "@@ -207,6 +207,12 @@ pub fn set_best_exit(\nexit_map,\n);\n+ // When best exit is not set, we are still in initial setup, and no routes are present in the routing table.\n+ // We simply end the tick and continue the next tick when we have an exit.\n+ if exit_metrics.best_exit.is_none() {\n+ bail!(\"No exit routes found, likely because routing table is empty\");\n+ }\n+\ninfo!(\n\"Exit_Switcher: This tick, we have these metrics: {:?}\",\nexit_metrics\n@@ -545,8 +551,9 @@ fn update_metric_value(\nreturn ExitSwitchingCode::InitialExitSetup;\n}\n+ // if best exit is none, routing table is empty, and thus we still are initial setup\nif best_exit.is_none() {\n- panic!(\"No exit found while trying to update metric values\");\n+ panic!(\"Best exit should not be set to none. If it is it should not be reaching this statement\");\n}\nlet tracking_exit = match tracking_exit {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Exit Switcher does not panic when routing table is empty
20,247
18.10.2021 23:10:51
25,200
8756e04244b5c6bf98c2e2d7dfe1b0c5911b46ff
Restrict 5ghz wifi channels for tplink a6v3 and cudy wr2100
[ { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/wifi.rs", "new_path": "rita_client/src/dashboard/wifi.rs", "diff": "@@ -25,6 +25,8 @@ pub const ALLOWED_FIVE_40: [u16; 12] = [36, 44, 52, 60, 100, 108, 116, 124, 132,\npub const ALLOWED_FIVE_80: [u16; 6] = [36, 52, 100, 116, 132, 149];\n/// list of nonoverlapping 80mhz channels for the GLB1300/EA6350v3\npub const ALLOWED_FIVE_80_IPQ40XX: [u16; 2] = [36, 149];\n+/// list of nonoverlapping 80mhz channels for the TPLink-a6v3/wr-2100\n+pub const ALLOWED_FIVE_80_TPLINK_A6V3: [u16; 2] = [36];\n/// list of nonoverlapping 160mhz channels generally legal in NA, SA, EU, AU\npub const ALLOWED_FIVE_160: [u16; 2] = [36, 100];\n@@ -280,9 +282,10 @@ fn validate_channel(\nformat!(\"{:?}\", ALLOWED_FIVE_160),\n))\n// model specific restrictions below this point\n- } else if model.is_some()\n- && (model.clone().unwrap().contains(\"gl-b1300\")\n- || model.unwrap().contains(\"linksys_ea6350v3\"))\n+ } else if model.is_some() {\n+ let mdl = model.clone().unwrap();\n+ if (mdl.contains(\"gl-b1300\")\n+ || mdl.contains(\"linksys_ea6350v3\"))\n&& new_is_five\n&& channel_width_is_80\n&& !ALLOWED_FIVE_80_IPQ40XX.contains(&new_val)\n@@ -291,6 +294,21 @@ fn validate_channel(\n\"80\".to_string(),\nformat!(\"{:?}\", ALLOWED_FIVE_80_IPQ40XX),\n))\n+ }\n+ else if (mdl.contains(\"tplink_archer-a6-v3\")\n+ || mdl.contains(\"cudy_wr2100\"))\n+ && new_is_five\n+ && channel_width_is_80\n+ && !ALLOWED_FIVE_80_TPLINK_A6V3.contains(&new_val)\n+ {\n+ Err(ValidationError::BadChannel(\n+ \"80\".to_string(),\n+ format!(\"{:?}\", ALLOWED_FIVE_80_TPLINK_A6V3),\n+ ))\n+ }\n+ else {\n+ Ok(())\n+ }\n} else {\nOk(())\n}\n@@ -317,6 +335,12 @@ pub fn get_allowed_wifi_channels(radio: Path<String>) -> Result<HttpResponse, Er\n&& five_channel_width.contains(\"80\")\n{\nOk(HttpResponse::Ok().json(ALLOWED_FIVE_80_IPQ40XX))\n+ } else if model.is_some()\n+ && (model.clone().unwrap().contains(\"tplink_archer-a6-v3\")\n+ || model.unwrap().contains(\"cudy_wr2100\"))\n+ && five_channel_width.contains(\"80\")\n+ {\n+ Ok(HttpResponse::Ok().json(ALLOWED_FIVE_80_TPLINK_A6V3))\n// model specific values end here\n} else if five_channel_width.contains(\"20\") {\nOk(HttpResponse::Ok().json(ALLOWED_FIVE_20))\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Restrict 5ghz wifi channels for tplink a6v3 and cudy wr2100
20,247
19.10.2021 09:55:46
25,200
84a2a1e0a2a4277b7b69999f02080e9077ead735
Beta 18 RC 3
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -3241,7 +3241,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.18.2\"\n+version = \"0.18.3\"\ndependencies = [\n\"actix 0.11.1\",\n\"actix 0.7.11\",\n@@ -3277,7 +3277,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.18.2\"\n+version = \"0.18.3\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3317,7 +3317,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.18.2\"\n+version = \"0.18.3\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3358,7 +3358,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.18.2\"\n+version = \"0.18.3\"\ndependencies = [\n\"actix 0.7.11\",\n\"actix-web 0.7.19\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.18.2\"\n+version = \"0.18.3\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\nbuild = \"build.rs\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "[package]\nname = \"rita_client\"\n-version = \"0.18.2\"\n+version = \"0.18.3\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/wifi.rs", "new_path": "rita_client/src/dashboard/wifi.rs", "diff": "@@ -26,7 +26,7 @@ pub const ALLOWED_FIVE_80: [u16; 6] = [36, 52, 100, 116, 132, 149];\n/// list of nonoverlapping 80mhz channels for the GLB1300/EA6350v3\npub const ALLOWED_FIVE_80_IPQ40XX: [u16; 2] = [36, 149];\n/// list of nonoverlapping 80mhz channels for the TPLink-a6v3/wr-2100\n-pub const ALLOWED_FIVE_80_TPLINK_A6V3: [u16; 2] = [36];\n+pub const ALLOWED_FIVE_80_TPLINK_A6V3: [u16; 1] = [36];\n/// list of nonoverlapping 160mhz channels generally legal in NA, SA, EU, AU\npub const ALLOWED_FIVE_160: [u16; 2] = [36, 100];\n@@ -331,13 +331,13 @@ pub fn get_allowed_wifi_channels(radio: Path<String>) -> Result<HttpResponse, Er\n// model specific values start here\n} else if model.is_some()\n&& (model.clone().unwrap().contains(\"gl-b1300\")\n- || model.unwrap().contains(\"linksys_ea6350v3\"))\n+ || model.clone().unwrap().contains(\"linksys_ea6350v3\"))\n&& five_channel_width.contains(\"80\")\n{\nOk(HttpResponse::Ok().json(ALLOWED_FIVE_80_IPQ40XX))\n} else if model.is_some()\n&& (model.clone().unwrap().contains(\"tplink_archer-a6-v3\")\n- || model.unwrap().contains(\"cudy_wr2100\"))\n+ || model.clone().unwrap().contains(\"cudy_wr2100\"))\n&& five_channel_width.contains(\"80\")\n{\nOk(HttpResponse::Ok().json(ALLOWED_FIVE_80_TPLINK_A6V3))\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "[package]\nname = \"rita_common\"\n-version = \"0.18.2\"\n+version = \"0.18.3\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/dashboard/own_info.rs", "new_path": "rita_common/src/dashboard/own_info.rs", "diff": "@@ -5,7 +5,7 @@ use clarity::Address;\nuse failure::Error;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 18 RC2\";\n+pub static READABLE_VERSION: &str = \"Beta 18 RC3\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/Cargo.toml", "new_path": "rita_exit/Cargo.toml", "diff": "[package]\nname = \"rita_exit\"\n-version = \"0.18.2\"\n+version = \"0.18.3\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Beta 18 RC 3
20,255
11.10.2021 11:39:57
25,200
4ea84eaea40ade7c7bf0b4b8ccf70f2e904fad6e
Updated config update for us_west Now router when upgraded to beta 18 automatically load in the changed ip and subnet 116 for us west, allowing them to use the new exit switcher code. Removed redundant struct OldExitClientSettings, and moved serde logic into ExitClientSettings
[ { "change_type": "MODIFY", "old_path": "rita_client/src/exit_manager/config_in_use.toml", "new_path": "rita_client/src/exit_manager/config_in_use.toml", "diff": "[exit_client]\n-current_exit = \"test\"\n+current_exit = \"us_west\"\nlan_nics = [\"lan\"]\nlow_balance_notification = true\nwg_listen_port = 59999\n@@ -12,6 +12,98 @@ value = 5304703796\nzeros = 0\n[exit_client.exits.africa]\ndescription = \"Althea Africa exit\"\n+message = \"Got info successfully\"\n+registration_port = 4875\n+state = \"GotInfo\"\n+\n+[exit_client.exits.africa.general_details]\n+description = \"Althea Africa exit\"\n+exit_currency = \"Xdai\"\n+exit_price = 10000000\n+netmask = 16\n+server_internal_ip = \"172.168.0.254\"\n+verif_mode = \"Phone\"\n+wg_exit_port = 59999\n+\n+[exit_client.exits.africa.id]\n+eth_address = \"0xEba3aF4E87663b3Bb57FC89976502b960e3906ff\"\n+mesh_ip = \"fd00::1337:e7f\"\n+wg_public_key = \"V0tgdQ2Ljx5xyw4UMQ6a7ZztQmyvqrUp/4jrFcCeG1w=\"\n+\n+[exit_client.exits.apac]\n+description = \"In Singapore\"\n+registration_port = 4875\n+state = \"New\"\n+\n+[exit_client.exits.apac.id]\n+eth_address = \"0xE4AD1F9aA23957D294D869B70fC8F28774dF896E\"\n+mesh_ip = \"fd00::1337:e4f\"\n+wg_public_key = \"1kKSpzdhI4kfqeMqch9I1bXqOUXeKN7EQBecVzW60ys=\"\n+\n+[exit_client.exits.ca]\n+description = \"Canada Althea Exit\"\n+registration_port = 4875\n+state = \"New\"\n+\n+[exit_client.exits.ca.id]\n+eth_address = \"0x90b82ED41dCD867Df7d2aedAB62280E82FCd64F3\"\n+mesh_ip = \"fd00::1337:3e9f\"\n+wg_public_key = \"D0z23bOTn5RQgM87nuxx6zgmFMMAKBHXSOXopHtZhTc=\"\n+\n+[exit_client.exits.south_america_eth]\n+description = \"Nodo de salida de America del Sur\"\n+registration_port = 4875\n+state = \"New\"\n+\n+[exit_client.exits.south_america_eth.id]\n+eth_address = \"0x81B6c9F8cfD8f135743A9D39b3b0386024eA4Cc8\"\n+mesh_ip = \"fd00::1337:e8f\"\n+wg_public_key = \"AlsMwUkJmiA+EQ45p+n+RAtXq1rCA51k58HRwlzoETs=\"\n+\n+[exit_client.exits.test]\n+description = \"The Althea testing exit cluster. Unstable!\"\n+message = \"Got info successfully\"\n+registration_port = 4875\n+state = \"GotInfo\"\n+\n+[exit_client.exits.test.general_details]\n+description = \"Test cluster: A!\"\n+exit_currency = \"Rinkeby\"\n+exit_price = 714000\n+netmask = 16\n+server_internal_ip = \"172.168.0.254\"\n+verif_mode = \"Phone\"\n+wg_exit_port = 59999\n+\n+[exit_client.exits.test.id]\n+eth_address = \"0x5AeE3Dff733F56cFe7E5390B9cC3A46a90cA1CfA\"\n+mesh_ip = \"fd00::1337:1e0f\"\n+wg_public_key = \"zgAlhyOQy8crB0ewrsWt3ES9SvFguwx5mq9i2KiknmA=\"\n+\n+[exit_client.exits.us_west]\n+description = \"The Althea Production US exit\"\n+message = \"Registration OK\"\n+registration_port = 4875\n+state = \"Registered\"\n+\n+[exit_client.exits.us_west.general_details]\n+description = \"Althea San Francisco Exit Equinix\"\n+exit_currency = \"Xdai\"\n+exit_price = 10000000\n+netmask = 16\n+server_internal_ip = \"172.168.0.254\"\n+verif_mode = \"Phone\"\n+wg_exit_port = 59999\n+\n+[exit_client.exits.us_west.id]\n+eth_address = \"0x72d9E579f691D62aA7e0703840db6dd2fa9fAE21\"\n+mesh_ip = \"fd00::1337:e2f\"\n+wg_public_key = \"jkIodvXKgij/rAEQXFEPJpls6ooxXJEC5XlWA1uUPUg=\"\n+\n+[exit_client.exits.us_west.our_details]\n+client_internal_ip = \"172.168.2.146\"\n+[exit_client.new_exits.africa]\n+description = \"Althea Africa exit\"\neth_address = \"0xEba3aF4E87663b3Bb57FC89976502b960e3906ff\"\nmessage = \"Got info successfully\"\nregistration_port = 4875\n@@ -20,7 +112,7 @@ subnet = \"fd00::1337:e7f/128\"\nsubnet_len = 128\nwg_public_key = \"V0tgdQ2Ljx5xyw4UMQ6a7ZztQmyvqrUp/4jrFcCeG1w=\"\n-[exit_client.exits.africa.general_details]\n+[exit_client.new_exits.africa.general_details]\ndescription = \"Althea Africa exit\"\nexit_currency = \"Xdai\"\nexit_price = 10000000\n@@ -29,15 +121,15 @@ server_internal_ip = \"172.168.0.254\"\nverif_mode = \"Phone\"\nwg_exit_port = 59999\n-[exit_client.exits.africa.id]\n+[exit_client.new_exits.africa.id]\neth_address = \"0xEba3aF4E87663b3Bb57FC89976502b960e3906ff\"\nmesh_ip = \"fd00::1337:e7f\"\nwg_public_key = \"V0tgdQ2Ljx5xyw4UMQ6a7ZztQmyvqrUp/4jrFcCeG1w=\"\n-[exit_client.exits.africa.selected_exit]\n+[exit_client.new_exits.africa.selected_exit]\nselected_id = \"fd00::1337:e7f\"\n-[exit_client.exits.apac]\n+[exit_client.new_exits.apac]\ndescription = \"In Singapore\"\neth_address = \"0xE4AD1F9aA23957D294D869B70fC8F28774dF896E\"\nregistration_port = 4875\n@@ -46,15 +138,15 @@ subnet = \"fd00::1337:e4f/128\"\nsubnet_len = 128\nwg_public_key = \"1kKSpzdhI4kfqeMqch9I1bXqOUXeKN7EQBecVzW60ys=\"\n-[exit_client.exits.apac.id]\n+[exit_client.new_exits.apac.id]\neth_address = \"0xE4AD1F9aA23957D294D869B70fC8F28774dF896E\"\nmesh_ip = \"fd00::1337:e4f\"\nwg_public_key = \"1kKSpzdhI4kfqeMqch9I1bXqOUXeKN7EQBecVzW60ys=\"\n-[exit_client.exits.apac.selected_exit]\n+[exit_client.new_exits.apac.selected_exit]\nselected_id = \"fd00::1337:e4f\"\n-[exit_client.exits.ca]\n+[exit_client.new_exits.ca]\ndescription = \"Canada Althea Exit\"\neth_address = \"0x90b82ED41dCD867Df7d2aedAB62280E82FCd64F3\"\nregistration_port = 4875\n@@ -63,15 +155,15 @@ subnet = \"fd00::1337:3e9f/128\"\nsubnet_len = 128\nwg_public_key = \"D0z23bOTn5RQgM87nuxx6zgmFMMAKBHXSOXopHtZhTc=\"\n-[exit_client.exits.ca.id]\n+[exit_client.new_exits.ca.id]\neth_address = \"0x90b82ED41dCD867Df7d2aedAB62280E82FCd64F3\"\nmesh_ip = \"fd00::1337:3e9f\"\nwg_public_key = \"D0z23bOTn5RQgM87nuxx6zgmFMMAKBHXSOXopHtZhTc=\"\n-[exit_client.exits.ca.selected_exit]\n+[exit_client.new_exits.ca.selected_exit]\nselected_id = \"fd00::1337:3e9f\"\n-[exit_client.exits.south_america_eth]\n+[exit_client.new_exits.south_america_eth]\ndescription = \"Nodo de salida de America del Sur\"\neth_address = \"0x81B6c9F8cfD8f135743A9D39b3b0386024eA4Cc8\"\nregistration_port = 4875\n@@ -80,25 +172,25 @@ subnet = \"fd00::1337:e8f/128\"\nsubnet_len = 128\nwg_public_key = \"AlsMwUkJmiA+EQ45p+n+RAtXq1rCA51k58HRwlzoETs=\"\n-[exit_client.exits.south_america_eth.id]\n+[exit_client.new_exits.south_america_eth.id]\neth_address = \"0x81B6c9F8cfD8f135743A9D39b3b0386024eA4Cc8\"\nmesh_ip = \"fd00::1337:e8f\"\nwg_public_key = \"AlsMwUkJmiA+EQ45p+n+RAtXq1rCA51k58HRwlzoETs=\"\n-[exit_client.exits.south_america_eth.selected_exit]\n+[exit_client.new_exits.south_america_eth.selected_exit]\nselected_id = \"fd00::1337:e8f\"\n-[exit_client.exits.test]\n+[exit_client.new_exits.test]\ndescription = \"The Althea testing exit cluster. Unstable!\"\neth_address = \"0x5AeE3Dff733F56cFe7E5390B9cC3A46a90cA1CfA\"\nmessage = \"Got info successfully\"\nregistration_port = 4875\nstate = \"GotInfo\"\n-subnet = \"fd00::1337:1e0f/120\"\n-subnet_len = 120\n+subnet = \"fd00::1337:1e0f/128\"\n+subnet_len = 128\nwg_public_key = \"zgAlhyOQy8crB0ewrsWt3ES9SvFguwx5mq9i2KiknmA=\"\n-[exit_client.exits.test.general_details]\n+[exit_client.new_exits.test.general_details]\ndescription = \"Test cluster: A!\"\nexit_currency = \"Rinkeby\"\nexit_price = 714000\n@@ -107,25 +199,25 @@ server_internal_ip = \"172.168.0.254\"\nverif_mode = \"Phone\"\nwg_exit_port = 59999\n-[exit_client.exits.test.id]\n+[exit_client.new_exits.test.id]\neth_address = \"0x5AeE3Dff733F56cFe7E5390B9cC3A46a90cA1CfA\"\nmesh_ip = \"fd00::1337:1e0f\"\nwg_public_key = \"zgAlhyOQy8crB0ewrsWt3ES9SvFguwx5mq9i2KiknmA=\"\n-[exit_client.exits.test.selected_exit]\n+[exit_client.new_exits.test.selected_exit]\nselected_id = \"fd00::1337:1e0f\"\n-[exit_client.exits.us_west]\n+[exit_client.new_exits.us_west]\ndescription = \"The Althea Production US exit\"\neth_address = \"0x72d9E579f691D62aA7e0703840db6dd2fa9fAE21\"\nmessage = \"Registration OK\"\nregistration_port = 4875\nstate = \"Registered\"\n-subnet = \"fd00::1337:e2f/128\"\n-subnet_len = 128\n+subnet = \"fd00::1000:e2f/116\"\n+subnet_len = 116\nwg_public_key = \"jkIodvXKgij/rAEQXFEPJpls6ooxXJEC5XlWA1uUPUg=\"\n-[exit_client.exits.us_west.general_details]\n+[exit_client.new_exits.us_west.general_details]\ndescription = \"Althea San Francisco Exit Equinix\"\nexit_currency = \"Xdai\"\nexit_price = 10000000\n@@ -134,16 +226,16 @@ server_internal_ip = \"172.168.0.254\"\nverif_mode = \"Phone\"\nwg_exit_port = 59999\n-[exit_client.exits.us_west.id]\n+[exit_client.new_exits.us_west.id]\neth_address = \"0x72d9E579f691D62aA7e0703840db6dd2fa9fAE21\"\nmesh_ip = \"fd00::1337:e2f\"\nwg_public_key = \"jkIodvXKgij/rAEQXFEPJpls6ooxXJEC5XlWA1uUPUg=\"\n-[exit_client.exits.us_west.our_details]\n+[exit_client.new_exits.us_west.our_details]\nclient_internal_ip = \"172.168.2.146\"\n-[exit_client.exits.us_west.selected_exit]\n-selected_id = \"fd00::1337:e2f\"\n+[exit_client.new_exits.us_west.selected_exit]\n+selected_id = \"fd00::1000:e2f\"\n[localization]\ndisplay_currency_symbol = true\n@@ -173,7 +265,7 @@ manual_peers = [\"africa.althea.net\", \"ca.althea.net\", \"sa-eth.althea.org\", \"apac\nmesh_ip = \"fd22:99f8:27fb:133:151c:21f5:c6d:2684\"\nmetric_factor = 1900\nnickname = \"dev er-x\"\n-peer_interfaces = [\"eth2\", \"mesh\", \"eth3\", \"eth4\"]\n+peer_interfaces = [\"eth2\", \"mesh\", \"eth4\", \"eth3\"]\nrita_contact_port = 4874\nrita_dashboard_port = 4877\nrita_hello_port = 4876\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/exit_manager/exit_switcher.rs", "new_path": "rita_client/src/exit_manager/exit_switcher.rs", "diff": "@@ -1054,6 +1054,7 @@ mod tests {\nassert_eq!(b_e_m, 200);\n}\n+ #[ignore]\n#[test]\nfn test_config_update() {\nuse settings::client::RitaClientSettings;\n@@ -1061,28 +1062,7 @@ mod tests {\nlet path = \"./src/exit_manager/config_in_use.toml\".to_string();\nlet settings = RitaClientSettings::new(&path).unwrap();\n- assert_eq!(\n- settings.exit_client.current_exit,\n- settings.old_exit_client.current_exit\n- );\n- assert_eq!(\n- settings.exit_client.wg_listen_port,\n- settings.old_exit_client.wg_listen_port\n- );\n- assert_eq!(\n- settings.exit_client.contact_info,\n- settings.old_exit_client.contact_info\n- );\n- assert_eq!(\n- settings.exit_client.lan_nics,\n- settings.old_exit_client.lan_nics\n- );\n- assert_eq!(\n- settings.exit_client.low_balance_notification,\n- settings.old_exit_client.low_balance_notification\n- );\n-\n- println!(\"Old Settings: {:?}\", settings.old_exit_client.exits);\n- println!(\"\\n\\n\\n\\nNew Settings: {:?}\", settings.exit_client.exits);\n+ trace!(\"Old Settings: {:#?}\", settings.exit_client.old_exits);\n+ trace!(\"\\n\\n\\n\\nNew Settings: {:#?}\", settings.exit_client.exits);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/exit_manager/old_config1.toml", "new_path": "rita_client/src/exit_manager/old_config1.toml", "diff": "@@ -85,6 +85,7 @@ description = \"The Althea Production US exit\"\nmessage = \"Registration OK\"\nregistration_port = 4875\nstate = \"Registered\"\n+subnet = \"fd00::1337:e2f\"\n[exit_client.exits.us_west.general_details]\ndescription = \"Althea San Francisco Exit Equinix\"\n" }, { "change_type": "MODIFY", "old_path": "settings/src/client.rs", "new_path": "settings/src/client.rs", "diff": "@@ -123,8 +123,10 @@ fn default_balance_notification() -> bool {\n/// to a exit and to setup the exit tunnel\n#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]\npub struct ExitClientSettings {\n+ #[serde(rename = \"exits\", default)]\n+ pub old_exits: HashMap<String, OldExitServer>,\n/// This stores a mapping between an identifier (any string) to exits\n- #[serde(default)]\n+ #[serde(rename = \"new_exits\", default)]\npub exits: HashMap<String, ExitServer>,\n/// This stores the current exit identifier\npub current_exit: Option<String>,\n@@ -142,43 +144,10 @@ pub struct ExitClientSettings {\npub low_balance_notification: bool,\n}\n-#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]\n-pub struct OldExitClientSettings {\n- /// This stores a mapping between an identifier (any string) to exits\n- #[serde(default)]\n- pub exits: HashMap<String, OldExitServer>,\n- /// This stores the current exit identifier\n- pub current_exit: Option<String>,\n- /// This is the port which the exit wireguard tunnel will listen on\n- /// NOTE: must be under `wg_start_port` in `NetworkSettings`\n- pub wg_listen_port: u16,\n- /// ContactStorage is a TOML serialized representation of ContactType, use the .into()\n- /// traits to get ContactType for actual operations. This struct represents a full range\n- /// of possibilities for contact info.\n- pub contact_info: Option<ContactStorage>,\n- /// This controls which interfaces will be proxied over the exit tunnel\n- pub lan_nics: HashSet<String>,\n- /// Specifies if the user would like to receive low balance messages from the exit\n- #[serde(default = \"default_balance_notification\")]\n- pub low_balance_notification: bool,\n-}\n-\nimpl Default for ExitClientSettings {\nfn default() -> Self {\nExitClientSettings {\n- exits: HashMap::new(),\n- current_exit: None,\n- wg_listen_port: 59999,\n- contact_info: None,\n- lan_nics: HashSet::new(),\n- low_balance_notification: true,\n- }\n- }\n-}\n-\n-impl Default for OldExitClientSettings {\n- fn default() -> Self {\n- OldExitClientSettings {\n+ old_exits: HashMap::new(),\nexits: HashMap::new(),\ncurrent_exit: None,\nwg_listen_port: 59999,\n@@ -236,9 +205,6 @@ pub struct RitaClientSettings {\n#[serde(default)]\npub localization: LocalizationSettings,\npub network: NetworkSettings,\n- #[serde(rename = \"exit_client\")]\n- pub old_exit_client: OldExitClientSettings,\n- #[serde(rename = \"new_exit_client\", default)]\npub exit_client: ExitClientSettings,\n#[serde(skip)]\npub future: bool,\n" }, { "change_type": "MODIFY", "old_path": "settings/src/lib.rs", "new_path": "settings/src/lib.rs", "diff": "@@ -28,6 +28,7 @@ use serde_json::Value;\nuse std::collections::HashMap;\nuse std::fs::File;\nuse std::io::Write;\n+use std::net::{IpAddr, Ipv6Addr};\nuse std::sync::{Arc, RwLock};\nuse std::thread;\nuse std::time::Duration;\n@@ -45,6 +46,8 @@ use crate::client::RitaClientSettings;\nuse crate::exit::RitaExitSettingsStruct;\npub const SUBNET: u8 = 128;\n+pub const US_WEST_IP: IpAddr = IpAddr::V6(Ipv6Addr::new(0xfd00, 0, 0, 0, 0, 0, 0x1000, 0x0e2f));\n+pub const US_WEST_SUBNET: u8 = 116;\nlazy_static! {\nstatic ref EXIT_SETTING: Arc<RwLock<Option<RitaExitSettingsStruct>>> =\n@@ -306,13 +309,12 @@ pub fn update_config(\noperator: old_settings.operator,\nlocalization: old_settings.localization,\nnetwork: old_settings.network,\n- old_exit_client: old_settings.old_exit_client.clone(),\nexit_client: ExitClientSettings::default(),\nfuture: old_settings.future,\n};\nlet mut new_exits: HashMap<String, ExitServer> = HashMap::new();\n- for (k, v) in old_settings.old_exit_client.clone().exits {\n+ for (k, v) in old_settings.exit_client.clone().old_exits {\nlet s_len = if v.subnet_len.is_some() {\nv.subnet_len.unwrap()\n} else {\n@@ -330,24 +332,43 @@ pub fn update_config(\ninfo: v.info,\n};\n+ // we set the selected exit (starting exit) to be the one provided in config. This is required for registration\nnew_exit.selected_exit.selected_id = Some(v.id.mesh_ip);\n+\n+ // Special case for us_west.\n+ if v.id.mesh_ip == IpAddr::V6(\"fd00::1337:e2f\".parse().unwrap()) {\n+ new_exit = set_us_west(new_exit);\n+ }\n+\nnew_exits.insert(k, new_exit);\n}\n- let old_exit_client = old_settings.old_exit_client;\n+ let exit_client = old_settings.exit_client;\nnew_settings.exit_client = ExitClientSettings {\n+ old_exits: exit_client.clone().old_exits,\nexits: HashMap::new(),\n- current_exit: old_exit_client.clone().current_exit,\n- wg_listen_port: old_exit_client.wg_listen_port,\n- contact_info: old_exit_client.clone().contact_info,\n- lan_nics: old_exit_client.clone().lan_nics,\n- low_balance_notification: old_exit_client.low_balance_notification,\n+ current_exit: exit_client.clone().current_exit,\n+ wg_listen_port: exit_client.wg_listen_port,\n+ contact_info: exit_client.clone().contact_info,\n+ lan_nics: exit_client.clone().lan_nics,\n+ low_balance_notification: exit_client.low_balance_notification,\n};\nnew_settings.exit_client.exits = new_exits.clone();\nOk(new_settings)\n}\n+/// This function updates RitaClient struct with hardcoded values for us_west. To update this, we change the ip and add a subnet 116. When\n+/// router update to this version of rita, this automatically sets us west as a subnet to take advantage of the exit switching code\n+fn set_us_west(exit: ExitServer) -> ExitServer {\n+ let mut new_exit = exit;\n+ new_exit.subnet = IpNetwork::new(US_WEST_IP, US_WEST_SUBNET).unwrap();\n+ new_exit.id.unwrap().mesh_ip = US_WEST_IP;\n+ new_exit.subnet_len = US_WEST_SUBNET;\n+ new_exit.selected_exit.selected_id = Some(US_WEST_IP);\n+ new_exit\n+}\n+\n#[cfg(test)]\nmod tests {\nuse crate::client::RitaClientSettings;\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Updated config update for us_west Now router when upgraded to beta 18 automatically load in the changed ip and subnet 116 for us west, allowing them to use the new exit switcher code. Removed redundant struct OldExitClientSettings, and moved serde logic into ExitClientSettings
20,255
11.10.2021 14:53:40
25,200
cb7bd307beb41bd8455e7726c88cfc91b7b6236b
Updated RitaClientSettings update function to clear old settings after migrating This prevents issues like reading from the old config while we already migrated to new config
[ { "change_type": "MODIFY", "old_path": "rita_client/src/exit_manager/exit_switcher.rs", "new_path": "rita_client/src/exit_manager/exit_switcher.rs", "diff": "@@ -1062,7 +1062,7 @@ mod tests {\nlet path = \"./src/exit_manager/config_in_use.toml\".to_string();\nlet settings = RitaClientSettings::new(&path).unwrap();\n- trace!(\"Old Settings: {:#?}\", settings.exit_client.old_exits);\n- trace!(\"\\n\\n\\n\\nNew Settings: {:#?}\", settings.exit_client.exits);\n+ println!(\"Old Settings: {:#?}\", settings.exit_client.old_exits);\n+ println!(\"\\n\\n\\n\\nNew Settings: {:#?}\", settings.exit_client.exits);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "settings/src/lib.rs", "new_path": "settings/src/lib.rs", "diff": "@@ -309,10 +309,15 @@ pub fn update_config(\noperator: old_settings.operator,\nlocalization: old_settings.localization,\nnetwork: old_settings.network,\n- exit_client: ExitClientSettings::default(),\n+ exit_client: old_settings.exit_client.clone(),\nfuture: old_settings.future,\n};\n+ // we have already updated to reading the new settings\n+ if old_settings.exit_client.old_exits.is_empty() {\n+ return Ok(new_settings);\n+ }\n+\nlet mut new_exits: HashMap<String, ExitServer> = HashMap::new();\nfor (k, v) in old_settings.exit_client.clone().old_exits {\nlet s_len = if v.subnet_len.is_some() {\n@@ -346,7 +351,7 @@ pub fn update_config(\nlet exit_client = old_settings.exit_client;\nnew_settings.exit_client = ExitClientSettings {\nold_exits: exit_client.clone().old_exits,\n- exits: HashMap::new(),\n+ exits: exit_client.clone().exits,\ncurrent_exit: exit_client.clone().current_exit,\nwg_listen_port: exit_client.wg_listen_port,\ncontact_info: exit_client.clone().contact_info,\n@@ -354,7 +359,8 @@ pub fn update_config(\nlow_balance_notification: exit_client.low_balance_notification,\n};\nnew_settings.exit_client.exits = new_exits.clone();\n-\n+ //remove old info after migrating over\n+ new_settings.exit_client.old_exits = HashMap::new();\nOk(new_settings)\n}\n@@ -363,7 +369,8 @@ pub fn update_config(\nfn set_us_west(exit: ExitServer) -> ExitServer {\nlet mut new_exit = exit;\nnew_exit.subnet = IpNetwork::new(US_WEST_IP, US_WEST_SUBNET).unwrap();\n- new_exit.id.unwrap().mesh_ip = US_WEST_IP;\n+ let mut id = new_exit.id.as_mut().unwrap();\n+ id.mesh_ip = US_WEST_IP;\nnew_exit.subnet_len = US_WEST_SUBNET;\nnew_exit.selected_exit.selected_id = Some(US_WEST_IP);\nnew_exit\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Updated RitaClientSettings update function to clear old settings after migrating This prevents issues like reading from the old config while we already migrated to new config
20,255
22.10.2021 09:34:45
25,200
541cbb4ef62232baefd5d6ed07ed1a90f4a6b56c
Added option to add flags to remote sysupgrade Currently sysupgrade command only takes a url to a download and perform a plain sysupgrade. Sometimes we may need to add flags to this command to perserve files other than the default ones in /etc/
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/upgrade.rs", "new_path": "althea_kernel_interface/src/upgrade.rs", "diff": "use super::KernelInterface;\nuse crate::KernelInterfaceError as Error;\n-use althea_types::{OpkgCommand, OpkgCommandType};\n+use althea_types::{OpkgCommand, OpkgCommandType, SysupgradeCommand};\nuse std::process::Output;\nimpl dyn KernelInterface {\n- pub fn perform_sysupgrade(&self, path: &str) -> Result<Output, Error> {\n- self.run_command(\"/sbin/sysupgrade\", &[path])\n+ pub fn perform_sysupgrade(&self, command: SysupgradeCommand) -> Result<Output, Error> {\n+ //If empty url, return error\n+ if command.url.is_empty() {\n+ return Err(Error::RuntimeError(\n+ \"Empty url given to sysupgrade\".to_string(),\n+ ));\n+ }\n+\n+ // append path to end of flags\n+ let mut args = if command.flags.is_some() {\n+ command.flags.unwrap()\n+ } else {\n+ Vec::new()\n+ };\n+ args.push(command.url);\n+ let args_ref: Vec<&str> = args.iter().map(std::ops::Deref::deref).collect();\n+ self.run_command(\"/sbin/sysupgrade\", &args_ref)\n}\n/// This function checks if the function provided is update or install. In case of install, for each of the packages\n" }, { "change_type": "MODIFY", "old_path": "althea_types/src/interop.rs", "new_path": "althea_types/src/interop.rs", "diff": "@@ -334,10 +334,17 @@ pub struct PaymentTx {\n/// This can either be a sysupgrade with a url to a firmware image, or an opkg update with a url to a opkg feed\n#[derive(Serialize, Deserialize, Hash, Clone, Debug, Eq, PartialEq)]\npub enum UpdateType {\n- Sysupgrade(String),\n+ Sysupgrade(SysupgradeCommand),\nOpkg(OpkgCommandList),\n}\n+#[derive(Serialize, Deserialize, Hash, Clone, Debug, Eq, PartialEq)]\n+///This struct contains info required for a sysupgrade command\n+pub struct SysupgradeCommand {\n+ pub url: String,\n+ pub flags: Option<Vec<String>>,\n+}\n+\n#[derive(Serialize, Deserialize, Hash, Clone, Debug, Eq, PartialEq)]\n/// This struct contains the feed and a vector of opkg commands to run on an update\npub struct OpkgCommandList {\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/router.rs", "new_path": "rita_client/src/dashboard/router.rs", "diff": "@@ -47,7 +47,11 @@ pub fn set_router_update_instruction(instruction: Option<UpdateType>) {\n#[test]\nfn test_set_router_update_instruction() {\n- let test = UpdateType::Sysupgrade(\"dummyurl.com\".to_string());\n+ use althea_types::SysupgradeCommand;\n+ let test = UpdateType::Sysupgrade(SysupgradeCommand {\n+ url: \"dummyurl.com\".to_string(),\n+ flags: None,\n+ });\nset_router_update_instruction(Some(test.clone()));\nlet str = &*UPDATE_INSTRUCTION.read().unwrap();\nassert_eq!(Some(test), *str);\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/operator_update/mod.rs", "new_path": "rita_client/src/operator_update/mod.rs", "diff": "@@ -267,8 +267,7 @@ fn checkin() {\nSome(OperatorAction::Update { instruction }) => {\nlet _res = update_rita(instruction);\n}\n- #[allow(unused_variables)]\n- Some(OperatorAction::ChangeReleaseFeedAndUpdate { feed }) => {}\n+ Some(OperatorAction::ChangeReleaseFeedAndUpdate { feed: _ }) => {}\nNone => {}\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/operator_update/updater.rs", "new_path": "rita_client/src/operator_update/updater.rs", "diff": "@@ -8,7 +8,7 @@ use std::process::Output;\npub fn update_rita(instruction: UpdateType) -> Result<Output, KernelInterfaceError> {\nif KI.is_openwrt() {\nmatch instruction {\n- UpdateType::Sysupgrade(path) => KI.perform_sysupgrade(&path),\n+ UpdateType::Sysupgrade(command) => KI.perform_sysupgrade(command),\nUpdateType::Opkg(commands) => {\n//update the feed\nhandle_release_feed_update(Some(commands.feed));\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Added option to add flags to remote sysupgrade Currently sysupgrade command only takes a url to a download and perform a plain sysupgrade. Sometimes we may need to add flags to this command to perserve files other than the default ones in /etc/
20,247
26.10.2021 15:12:32
25,200
49e8e4886a9f40bda8b45afe88cd3862c2fc5c82
Rita support for disabling radios
[ { "change_type": "MODIFY", "old_path": "docs/api/router-dashboard.md", "new_path": "docs/api/router-dashboard.md", "diff": "@@ -516,7 +516,7 @@ application/json\" -d '\\{\"url\": \"https://somewhere.safe\"\\}'\n- Sample Call:\n`curl -XPOST 127.0.0.1:<rita_dashboard_port>/settings -H 'Content-Type: application/json' -i -d '{\"exit_client\": {\"current_exit\": \"SELECTEDEXIT\"}}'`\n-}\n+\n---\n@@ -534,12 +534,12 @@ they need to be tagged WifiChannel, WifiPass, and WifiSSID as shown below\n- Contents:\n```\n-{}\n+null\n```\n- Error Response: `500 Server Error`\n- Sample Call:\n- `curl -XPOST 127.0.0.1:<rita_dashboard_port>/settings -H 'Content-Type: application/json' -i -d '[{\"WifiChannel\": {\"radio\":\"radio0\", \"ssid\": \"this is a freeform ssid\"}}, {\"WifiChannel\":{\"radio\":\"radio1\", \"channel\": 34}}]'`\n+ `curl -XPOST 127.0.0.1:4877/wifi_settings -H 'Content-Type: application/json' -i -d '[{\"WifiChannel\":{\"radio\":\"radio1\",\"channel\":11}},{\"WifiSsid\":{\"radio\":\"radio1\",\"ssid\":\"this is a freeform ssid\"}},{\"WifiPass\":{\"radio\":\"radio1\",\"pass\":\"ChangeMe\"}},{\"WifiDisabled\":{\"radio\":\"radio1\",\"disabled\":\"0\"}}]'`\n---\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/wifi.rs", "new_path": "rita_client/src/dashboard/wifi.rs", "diff": "//! These endpoints are used to modify mundane wireless settings\n-use rita_common::dashboard::nickname::maybe_set_nickname;\n-use rita_common::KI;\n-\nuse ::actix_web::http::StatusCode;\nuse ::actix_web::Path;\nuse ::actix_web::{HttpRequest, HttpResponse, Json};\nuse failure::Error;\n+use rita_common::dashboard::nickname::maybe_set_nickname;\n+use rita_common::KI;\nuse serde_json::Value;\nuse std::collections::HashMap;\n@@ -60,31 +59,6 @@ pub struct WifiDevice {\npub radio_type: String,\n}\n-#[derive(Serialize, Deserialize, Default, Clone, Debug)]\n-pub struct WifiSsid {\n- pub radio: String,\n- pub ssid: String,\n-}\n-\n-#[derive(Serialize, Deserialize, Default, Clone, Debug)]\n-pub struct WifiPass {\n- pub radio: String,\n- pub pass: String,\n-}\n-\n-#[derive(Serialize, Deserialize, Default, Clone, Debug)]\n-pub struct WifiChannel {\n- pub radio: String,\n- pub channel: u16,\n-}\n-\n-#[derive(Serialize, Deserialize, Clone, Debug)]\n-pub enum WifiToken {\n- WifiChannel(WifiChannel),\n- WifiSsid(WifiSsid),\n- WifiPass(WifiPass),\n-}\n-\n/// A string of characters which we don't let users use because of corrupted UCI configs\nstatic FORBIDDEN_CHARS: &str = \"'/\\\"\\\\\";\n@@ -106,17 +80,24 @@ pub enum ValidationError {\nWrongRadio,\n#[fail(display = \"Value too short ({} required)\", _0)]\nTooShort(usize),\n+ #[fail(display = \"Invalid Choice\")]\n+ InvalidChoice,\n}\n-fn set_ssid(wifi_ssid: &WifiSsid) -> Result<HttpResponse, Error> {\n- let mut ret: HashMap<String, String> = HashMap::new();\n+#[derive(Serialize, Deserialize, Default, Clone, Debug)]\n+pub struct WifiSsid {\n+ pub radio: String,\n+ pub ssid: String,\n+}\n+fn set_ssid(wifi_ssid: &WifiSsid) -> Result<(), Error> {\nif let Err(e) = validate_config_value(&wifi_ssid.ssid) {\ninfo!(\"Setting of invalid SSID was requested: {}\", e);\n- ret.insert(\"error\".to_owned(), format!(\"{}\", e));\n- return Ok(HttpResponse::new(StatusCode::BAD_REQUEST)\n- .into_builder()\n- .json(ret));\n+ return Err(e.into());\n+ // ret.insert(\"error\".to_owned(), format!(\"{}\", e));\n+ // return Ok(HttpResponse::new(StatusCode::BAD_REQUEST)\n+ // .into_builder()\n+ // .json(ret));\n}\n// think radio0, radio1\n@@ -126,18 +107,21 @@ fn set_ssid(wifi_ssid: &WifiSsid) -> Result<HttpResponse, Error> {\nKI.set_uci_var(&format!(\"wireless.{}.ssid\", section_name), &ssid)?;\nKI.uci_commit(\"wireless\")?;\n- KI.openwrt_reset_wireless()?;\n// We edited disk contents, force global sync\nKI.fs_sync()?;\n+\n// set the nickname with the first SSID change may fail\n// if the ssid is too long but don't block on that\nlet _ = maybe_set_nickname(wifi_ssid.ssid.clone());\n- // we have invalidated the old nat rules, update them\n- KI.create_client_nat_rules()?;\n+ Ok(())\n+}\n- Ok(HttpResponse::Ok().json(ret))\n+#[derive(Serialize, Deserialize, Default, Clone, Debug)]\n+pub struct WifiPass {\n+ pub radio: String,\n+ pub pass: String,\n}\n/// Resets the wifi password to the stock value for all radios\n@@ -150,29 +134,28 @@ pub fn reset_wifi_pass() -> Result<(), Error> {\n};\nset_pass(&pass)?;\n}\n+\n+ KI.uci_commit(\"wireless\")?;\n+ KI.openwrt_reset_wireless()?;\n+\n+ // We edited disk contents, force global sync\n+ KI.fs_sync()?;\n+\n+ // we have invalidated the old nat rules, update them\n+ KI.create_client_nat_rules()?;\n+\nOk(())\n}\n-fn set_pass(wifi_pass: &WifiPass) -> Result<HttpResponse, Error> {\n- let mut ret = HashMap::new();\n-\n+fn set_pass(wifi_pass: &WifiPass) -> Result<(), Error> {\nlet wifi_pass_len = wifi_pass.pass.len();\nif wifi_pass_len < MINIMUM_PASS_CHARS {\n- ret.insert(\n- \"error\".to_owned(),\n- format!(\"{}\", ValidationError::TooShort(MINIMUM_PASS_CHARS)),\n- );\n- return Ok(HttpResponse::new(StatusCode::BAD_REQUEST)\n- .into_builder()\n- .json(ret));\n+ return Err(ValidationError::TooShort(MINIMUM_PASS_CHARS).into());\n}\nif let Err(e) = validate_config_value(&wifi_pass.pass) {\ninfo!(\"Setting of invalid SSID was requested: {}\", e);\n- ret.insert(\"error\".to_owned(), format!(\"{}\", e));\n- return Ok(HttpResponse::new(StatusCode::BAD_REQUEST)\n- .into_builder()\n- .json(ret));\n+ return Err(e.into());\n}\n// think radio0, radio1\n@@ -181,19 +164,16 @@ fn set_pass(wifi_pass: &WifiPass) -> Result<HttpResponse, Error> {\nlet section_name = format!(\"default_{}\", iface_name);\nKI.set_uci_var(&format!(\"wireless.{}.key\", section_name), &pass)?;\n- KI.uci_commit(\"wireless\")?;\n- KI.openwrt_reset_wireless()?;\n-\n- // We edited disk contents, force global sync\n- KI.fs_sync()?;\n-\n- // we have invalidated the old nat rules, update them\n- KI.create_client_nat_rules()?;\n+ Ok(())\n+}\n- Ok(HttpResponse::Ok().json(()))\n+#[derive(Serialize, Deserialize, Default, Clone, Debug)]\n+pub struct WifiChannel {\n+ pub radio: String,\n+ pub channel: u16,\n}\n-fn set_channel(wifi_channel: &WifiChannel) -> Result<HttpResponse, Error> {\n+fn set_channel(wifi_channel: &WifiChannel) -> Result<(), Error> {\nlet current_channel: u16 = KI\n.get_uci_var(&format!(\"wireless.{}.channel\", wifi_channel.radio))?\n.parse()?;\n@@ -201,24 +181,66 @@ fn set_channel(wifi_channel: &WifiChannel) -> Result<HttpResponse, Error> {\nif let Err(e) = validate_channel(current_channel, wifi_channel.channel, &channel_width) {\ninfo!(\"Setting of invalid SSID was requested: {}\", e);\n- return Ok(HttpResponse::new(StatusCode::BAD_REQUEST)\n- .into_builder()\n- .json(\"Invalid SSID!\"));\n+ return Err(e.into());\n+ // return Ok(HttpResponse::new(StatusCode::BAD_REQUEST)\n+ // .into_builder()\n+ // .json(\"Invalid SSID!\"));\n}\nKI.set_uci_var(\n&format!(\"wireless.{}.channel\", wifi_channel.radio),\n&wifi_channel.channel.to_string(),\n)?;\n- KI.uci_commit(\"wireless\")?;\n- KI.openwrt_reset_wireless()?;\n- // We edited disk contents, force global sync\n- KI.fs_sync()?;\n- // we have invalidated the old nat rules, update them\n- KI.create_client_nat_rules()?;\n+ Ok(())\n+}\n- Ok(HttpResponse::Ok().json(()))\n+#[derive(Clone, Debug)]\n+pub struct WifiDisabledReturn {\n+ pub needs_reboot: bool,\n+}\n+\n+#[derive(Serialize, Deserialize, Default, Clone, Debug)]\n+pub struct WifiDisabled {\n+ pub radio: String,\n+ pub disabled: bool,\n+}\n+\n+/// Disables the wifi on the specified radio\n+fn set_disabled(wifi_disabled: &WifiDisabled) -> Result<WifiDisabledReturn, Error> {\n+ let current_disabled: bool =\n+ KI.get_uci_var(&format!(\"wireless.{}.disabled\", wifi_disabled.radio))? == \"1\";\n+\n+ if current_disabled == wifi_disabled.disabled {\n+ return Ok(WifiDisabledReturn {\n+ needs_reboot: false,\n+ });\n+ }\n+\n+ KI.set_uci_var(\n+ &format!(\"wireless.{}.disabled\", wifi_disabled.radio),\n+ if wifi_disabled.disabled { \"1\" } else { \"0\" },\n+ )?;\n+\n+ Ok(WifiDisabledReturn { needs_reboot: true })\n+}\n+\n+#[derive(Serialize, Deserialize)]\n+struct RebootJsonResponse {\n+ needs_reboot: bool,\n+}\n+\n+#[derive(Serialize, Deserialize)]\n+struct ErrorJsonResponse {\n+ error: String,\n+}\n+\n+#[derive(Serialize, Deserialize, Clone, Debug)]\n+pub enum WifiToken {\n+ WifiChannel(WifiChannel),\n+ WifiSsid(WifiSsid),\n+ WifiPass(WifiPass),\n+ WifiDisabled(WifiDisabled),\n}\n/// an endpoint that takes a series of wifi tokens in json format and applies them all at once\n@@ -226,13 +248,60 @@ fn set_channel(wifi_channel: &WifiChannel) -> Result<HttpResponse, Error> {\n/// so in order to have all the changes 'take' we need to have a single endpoint for all changes\npub fn set_wifi_multi(wifi_changes: Json<Vec<WifiToken>>) -> Result<HttpResponse, Error> {\ntrace!(\"Got multi wifi change!\");\n+ let mut needs_reboot = false;\n+\nfor token in wifi_changes.into_inner().iter() {\nmatch token {\n- WifiToken::WifiChannel(val) => set_channel(val)?,\n- WifiToken::WifiPass(val) => set_pass(val)?,\n- WifiToken::WifiSsid(val) => set_ssid(val)?,\n+ WifiToken::WifiChannel(val) => {\n+ if let Err(e) = set_channel(val) {\n+ return Ok(HttpResponse::new(StatusCode::BAD_REQUEST)\n+ .into_builder()\n+ .json(ErrorJsonResponse {\n+ error: format!(\"Failed to set channel: {}\", e),\n+ }));\n+ }\n+ }\n+ WifiToken::WifiPass(val) => {\n+ if let Err(e) = set_pass(val) {\n+ return Ok(HttpResponse::new(StatusCode::BAD_REQUEST)\n+ .into_builder()\n+ .json(ErrorJsonResponse {\n+ error: format!(\"Failed to set password: {}\", e),\n+ }));\n+ }\n+ }\n+ WifiToken::WifiSsid(val) => {\n+ if let Err(e) = set_ssid(val) {\n+ return Ok(HttpResponse::new(StatusCode::BAD_REQUEST)\n+ .into_builder()\n+ .json(ErrorJsonResponse {\n+ error: format!(\"Failed to set SSID: {}\", e),\n+ }));\n+ }\n+ }\n+ WifiToken::WifiDisabled(val) => {\n+ let result = set_disabled(val)?;\n+ if result.needs_reboot {\n+ needs_reboot = true;\n+ }\n+ }\n};\n}\n+\n+ KI.uci_commit(\"wireless\")?;\n+ KI.openwrt_reset_wireless()?;\n+\n+ // We edited disk contents, force global sync\n+ KI.fs_sync()?;\n+ // we have invalidated the old nat rules, update them\n+ KI.create_client_nat_rules()?;\n+\n+ if needs_reboot {\n+ info!(\"Changed a radio's active state, rebooting\");\n+ KI.run_command(\"reboot\", &[])?;\n+ return Ok(HttpResponse::Ok().json(RebootJsonResponse { needs_reboot: true }));\n+ }\n+\nOk(HttpResponse::Ok().json(()))\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Rita support for disabling radios
20,255
29.10.2021 12:09:33
25,200
be33e8b4b5f2831b09ac84ac55bc19635521d10d
Added EthernetStats to Hardware Info. This has information of ethernet links being down and the speed at which they are operating. This helps us debug faulty wires
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/hardware_info.rs", "new_path": "althea_kernel_interface/src/hardware_info.rs", "diff": "use crate::file_io::get_lines;\nuse crate::KernelInterfaceError as Error;\n+use althea_types::EthOperationMode;\n+use althea_types::EthernetStats;\nuse althea_types::HardwareInfo;\nuse althea_types::SensorReading;\nuse std::fs;\n@@ -35,6 +37,8 @@ pub fn get_hardware_info(device_name: Option<String>) -> Result<HardwareInfo, Er\nlet (entire_system_kernel_version, system_kernel_version) =\nparse_kernel_version(system_kernel_version)?;\n+ let ethernet_stats = get_ethernet_stats();\n+\nOk(HardwareInfo {\nlogical_processors: num_cpus,\nload_avg_one_minute: one_minute_load_avg,\n@@ -47,6 +51,7 @@ pub fn get_hardware_info(device_name: Option<String>) -> Result<HardwareInfo, Er\nsystem_uptime,\nsystem_kernel_version,\nentire_system_kernel_version,\n+ ethernet_stats,\n})\n}\n@@ -263,6 +268,68 @@ fn get_sensor_readings() -> Option<Vec<SensorReading>> {\nSome(ret)\n}\n}\n+\n+fn get_ethernet_stats() -> Option<Vec<EthernetStats>> {\n+ let mut eth = 0;\n+ let mut ret = Vec::new();\n+ let mut path = format!(\"/sys/class/net/eth{}\", eth);\n+ while fs::metadata(path.clone()).is_ok() {\n+ if let Some(is_up) = maybe_get_single_line_string(&format!(\"{}/operstate\", path)) {\n+ let is_up = is_up.contains(\"up\");\n+ if let (Some(speed), Some(duplex)) = (\n+ maybe_get_single_line_u64(&format!(\"{}/speed\", path)),\n+ maybe_get_single_line_string(&format!(\"{}/duplex\", path)),\n+ ) {\n+ if let (\n+ Some(tx_errors),\n+ Some(rx_errors),\n+ Some(tx_packet_count),\n+ Some(rx_packet_count),\n+ ) = (\n+ maybe_get_single_line_u64(&format!(\"{}/statistics/tx_errors\", path)),\n+ maybe_get_single_line_u64(&format!(\"{}/statistics/rx_errors\", path)),\n+ maybe_get_single_line_u64(&format!(\"{}/statistics/tx_packets\", path)),\n+ maybe_get_single_line_u64(&format!(\"{}/statistics/rx_packets\", path)),\n+ ) {\n+ ret.push(EthernetStats {\n+ is_up,\n+ mode_of_operation: get_ethernet_operation_mode(speed, duplex),\n+ tx_packet_count,\n+ tx_errors,\n+ rx_packet_count,\n+ rx_errors,\n+ })\n+ }\n+ }\n+ }\n+ eth += 1;\n+ path = format!(\"/sys/class/net/eth{}\", eth);\n+ }\n+\n+ if ret.is_empty() {\n+ None\n+ } else {\n+ Some(ret)\n+ }\n+}\n+\n+/// Take eth speed and duplex mode and create an enum\n+fn get_ethernet_operation_mode(speed: u64, duplex: String) -> EthOperationMode {\n+ match (speed, duplex.contains(\"full\")) {\n+ (40000, _) => EthOperationMode::FullDup40GBase,\n+ (25000, _) => EthOperationMode::FullDup25GBase,\n+ (10000, _) => EthOperationMode::FullDup10GBase,\n+ (5000, _) => EthOperationMode::FullDup5GBase,\n+ (1000, true) => EthOperationMode::FullDup1000MBBase,\n+ (1000, false) => EthOperationMode::HalfDup1000MBBase,\n+ (100, true) => EthOperationMode::FullDup100MBBase,\n+ (100, false) => EthOperationMode::HalfDup100MBBase,\n+ (10, true) => EthOperationMode::FullDup10GBase,\n+ (10, false) => EthOperationMode::HalfDup10MBBase,\n+ _ => EthOperationMode::Unknown,\n+ }\n+}\n+\n// Test for kernel version\n#[cfg(test)]\nmod test {\n@@ -289,6 +356,12 @@ mod test {\nprintln!(\"{:?}\", res);\n}\n+ #[test]\n+ fn test_ethernet_stats() {\n+ let res = get_ethernet_stats();\n+ println!(\"{:?}\", res);\n+ }\n+\n#[test]\nfn test_sys_time() {\nlet res = get_sys_uptime();\n" }, { "change_type": "MODIFY", "old_path": "althea_types/src/interop.rs", "new_path": "althea_types/src/interop.rs", "diff": "@@ -583,6 +583,8 @@ pub struct HardwareInfo {\n/// information. It may be useful for debugging purposes.\n#[serde(default = \"default_kernel_version\")]\npub entire_system_kernel_version: String,\n+ /// Vector of eth data i.e. whether a link is up and if so what the link speed is\n+ pub ethernet_stats: Option<Vec<EthernetStats>>,\n}\nfn default_kernel_version() -> String {\n@@ -608,6 +610,35 @@ pub struct SensorReading {\npub crit: Option<u64>,\n}\n+/// Struct that hold information about the ethernet interfaces, i.e. whether a link is\n+/// up and the speed of the link\\\n+#[derive(Debug, Clone, Serialize, Deserialize)]\n+pub struct EthernetStats {\n+ pub is_up: bool,\n+ pub mode_of_operation: EthOperationMode,\n+ pub tx_packet_count: u64,\n+ pub tx_errors: u64,\n+ pub rx_packet_count: u64,\n+ pub rx_errors: u64,\n+}\n+\n+#[derive(Debug, Clone, Serialize, Deserialize)]\n+/// Enum that encompases base speed and duplex: full or half. TODO need to add physical medium, twisted pair or fiber.\n+/// It is possible to get this information since ethtool shows this\n+pub enum EthOperationMode {\n+ FullDup40GBase,\n+ FullDup25GBase,\n+ FullDup10GBase,\n+ FullDup5GBase,\n+ FullDup1000MBBase,\n+ HalfDup1000MBBase,\n+ FullDup100MBBase,\n+ HalfDup100MBBase,\n+ FullDup10MBBase,\n+ HalfDup10MBBase,\n+ Unknown,\n+}\n+\n/// Struct for storing peer status data for reporting to the operator tools server\n/// the goal is to give a full picture of all links in the network to the operator\n/// so we include not only the link speed but also the stats history of the link\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Added EthernetStats to Hardware Info. This has information of ethernet links being down and the speed at which they are operating. This helps us debug faulty wires
20,244
01.11.2021 08:58:30
14,400
2930080ec9e6c529da1c871506f7583f2cd3ca1b
Update Rita for Beta 18 RC4
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -3241,7 +3241,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.18.3\"\n+version = \"0.18.4\"\ndependencies = [\n\"actix 0.11.1\",\n\"actix 0.7.11\",\n@@ -3277,7 +3277,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.18.3\"\n+version = \"0.18.4\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3317,7 +3317,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.18.3\"\n+version = \"0.18.4\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.18.3\"\n+version = \"0.18.4\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\nbuild = \"build.rs\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "[package]\nname = \"rita_client\"\n-version = \"0.18.3\"\n+version = \"0.18.4\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "[package]\nname = \"rita_common\"\n-version = \"0.18.3\"\n+version = \"0.18.4\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/dashboard/own_info.rs", "new_path": "rita_common/src/dashboard/own_info.rs", "diff": "@@ -5,7 +5,7 @@ use clarity::Address;\nuse failure::Error;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 18 RC3\";\n+pub static READABLE_VERSION: &str = \"Beta 18 RC4\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Update Rita for Beta 18 RC4
20,255
02.11.2021 12:07:28
25,200
069ed08a66ba0f04a8f3bfb0620473bd7e119dfe
Changes heartbeats so that they are sent without exit connection During development mode, having an exit connection is not feasible so we return a dummy exit and allow the router to send heartbeat update to op tools
[ { "change_type": "ADD", "old_path": null, "new_path": "rita_client/src/heartbeat/dummy.rs", "diff": "+//! This module contains a bunch of dummy functions that are called to populate a dummy exit so that heart beats\n+//! send data to op tools without actually being connected to an exit\n+use althea_types::ExitDetails;\n+use althea_types::FromStr;\n+use althea_types::Identity;\n+use althea_types::LocalIdentity;\n+use althea_types::WgKey;\n+use babel_monitor::Neighbor as NeighborLegacy;\n+use babel_monitor::Route as RouteLegacy;\n+use clarity::Address;\n+use ipnetwork::IpNetwork;\n+use rita_common::tunnel_manager::Neighbor as RitaNeighbor;\n+use std::net::IpAddr;\n+use std::net::Ipv4Addr;\n+\n+/// Creates a dummy babel monitor route\n+#[allow(dead_code)]\n+pub fn dummy_route() -> RouteLegacy {\n+ RouteLegacy {\n+ id: \"dummy\".to_string(),\n+ iface: \"dummy_if\".to_string(),\n+ xroute: false,\n+ installed: true,\n+ neigh_ip: IpAddr::V4(Ipv4Addr::new(1, 1, 1, 1)),\n+ prefix: IpNetwork::new(IpAddr::V4(Ipv4Addr::new(1, 1, 1, 1)), 16).unwrap(),\n+ metric: 100,\n+ refmetric: 200,\n+ full_path_rtt: 200.0,\n+ price: 100,\n+ fee: 100,\n+ }\n+}\n+\n+/// Creates a dummy babel monitor neighbor\n+#[allow(dead_code)]\n+pub fn dummy_neigh_babel() -> NeighborLegacy {\n+ NeighborLegacy {\n+ id: \"dummy_nei\".to_string(),\n+ address: IpAddr::V4(Ipv4Addr::new(1, 1, 1, 1)),\n+ iface: \"dummy_iface\".to_string(),\n+ reach: 10,\n+ txcost: 10,\n+ rxcost: 10,\n+ rtt: 10.0,\n+ rttcost: 10,\n+ cost: 10,\n+ }\n+}\n+\n+/// creates a dummy rita neighbor\n+#[allow(dead_code)]\n+pub fn dummy_neigh_tunnel() -> RitaNeighbor {\n+ RitaNeighbor {\n+ identity: LocalIdentity {\n+ wg_port: 10,\n+ have_tunnel: None,\n+ global: Identity {\n+ mesh_ip: IpAddr::V4(Ipv4Addr::new(1, 1, 1, 1)),\n+ eth_address: Address::parse_and_validate(\n+ \"0x9CAFD25b8b5982F1edA0691DEF8997C55a4d8188\",\n+ )\n+ .unwrap(),\n+ wg_public_key: WgKey::from_str(\"8BeCExnthLe5ou0EYec5jNqJ/PduZ1x2o7lpXJOpgXk=\")\n+ .unwrap(),\n+ nickname: None,\n+ },\n+ },\n+ iface_name: \"dummy_iface\".to_string(),\n+ tunnel_ip: IpAddr::V4(Ipv4Addr::new(1, 1, 1, 1)),\n+ speed_limit: None,\n+ }\n+}\n+\n+/// Creates dummy 'ExitDetails' struct\n+#[allow(dead_code)]\n+pub fn dummy_selected_exit_details() -> ExitDetails {\n+ ExitDetails {\n+ server_internal_ip: IpAddr::V4(Ipv4Addr::new(1, 1, 1, 1)),\n+ netmask: 200,\n+ wg_exit_port: 100,\n+ exit_price: 100,\n+ exit_currency: althea_types::SystemChain::Ethereum,\n+ description: \"\".to_string(),\n+ verif_mode: althea_types::ExitVerifMode::Off,\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/heartbeat/mod.rs", "new_path": "rita_client/src/heartbeat/mod.rs", "diff": "//! WgKey, Nonce, Ciphertext for the HeartBeatMessage. This consumes 32 bytes, 24 bytes, and to the end of the message\nuse crate::rita_loop::CLIENT_LOOP_TIMEOUT;\n+use althea_types::ExitDetails;\n+\nuse babel_monitor::get_installed_route;\nuse babel_monitor::get_neigh_given_route;\n+\n+use dummy::dummy_selected_exit_details;\n+\nuse rita_common::network_monitor::GetNetworkInfo;\nuse rita_common::network_monitor::NetworkMonitor;\nuse rita_common::tunnel_manager::Neighbor as RitaNeighbor;\n@@ -32,6 +37,15 @@ use futures01::future::Future;\nuse settings::client::ExitServer;\nuse sodiumoxide::crypto::box_;\nuse std::collections::VecDeque;\n+\n+#[allow(unused_imports)]\n+use dummy::dummy_neigh_babel;\n+#[allow(unused_imports)]\n+use dummy::dummy_neigh_tunnel;\n+///These are used during development\n+#[allow(unused_imports)]\n+use dummy::dummy_route;\n+\nuse std::net::{SocketAddr, UdpSocket};\nuse std::sync::Arc;\nuse std::sync::RwLock;\n@@ -39,6 +53,7 @@ use std::time::Duration;\ntype Resolver = resolver::Resolver;\n+mod dummy;\npub struct HeartbeatCache {\ndns: VecDeque<SocketAddr>,\nexit_route: RouteLegacy,\n@@ -76,19 +91,36 @@ pub fn send_udp_heartbeat() {\nlet network_info = NetworkMonitor::from_registry()\n.send(GetNetworkInfo {})\n.timeout(CLIENT_LOOP_TIMEOUT);\n+\n// Check for the basics first, before doing any of the hard futures work\n- let (our_id, selected_exit_details) = if let (Some(id), Some(exit)) = (\n+ #[allow(unused_assignments, unused_mut)]\n+ let mut our_id: Identity = if settings::get_rita_client().get_identity().is_some() {\n+ settings::get_rita_client().get_identity().unwrap()\n+ } else {\n+ return;\n+ };\n+ #[allow(unused_assignments, unused_mut)]\n+ let mut selected_exit_details: ExitDetails = dummy_selected_exit_details();\n+\n+ #[cfg(not(feature = \"operator_debug\"))]\n+ {\n+ if let (Some(id), Some(exit)) = (\nsettings::get_rita_client().get_identity(),\nget_selected_exit(),\n) {\nlet exit_info = exit.info;\nmatch exit_info.general_details() {\n- Some(details) => (id, details.clone()),\n+ Some(details) => {\n+ our_id = id;\n+ selected_exit_details = details.clone();\n+ }\nNone => return,\n}\n} else {\nreturn;\n};\n+ }\n+\ntrace!(\"we have heartbeat basic info\");\nlet res = dns_request.join(network_info).then(move |res| {\n@@ -97,12 +129,23 @@ pub fn send_udp_heartbeat() {\n// if for some reason the cache update fails, we can still progress with the heartbeat\nmatch res {\nOk((Ok(dnsresult), Ok(network_info))) => {\n- match get_selected_exit_route(&network_info.babel_routes) {\n+ #[cfg(not(feature = \"operator_debug\"))]\n+ let selected_exit_route = get_selected_exit_route(&network_info.babel_routes);\n+ #[cfg(feature = \"operator_debug\")]\n+ let selected_exit_route: Result<RouteLegacy, Error> = Ok(dummy_route());\n+\n+ match selected_exit_route {\nOk(route) => {\n+ #[allow(unused_variables)]\nlet neigh_option =\nget_neigh_given_route(&route, &network_info.babel_neighbors);\n+\n+ #[cfg(not(feature = \"operator_debug\"))]\nlet neigh_option =\nget_rita_neigh_option(neigh_option, &network_info.rita_neighbors);\n+ #[cfg(feature = \"operator_debug\")]\n+ let neigh_option = Some((dummy_neigh_babel(), dummy_neigh_tunnel()));\n+\nif let Some((neigh, rita_neigh)) = neigh_option {\n// Now that we have all the info we can stop and try to update the\n// heartbeat cache\n@@ -171,6 +214,7 @@ pub fn send_udp_heartbeat() {\nArbiter::spawn(res);\n}\n+#[allow(dead_code)]\nfn get_selected_exit_route(route_dump: &[RouteLegacy]) -> Result<RouteLegacy, Error> {\nlet rita_client = settings::get_rita_client();\nlet exit_client = rita_client.exit_client;\n@@ -184,6 +228,7 @@ fn get_selected_exit_route(route_dump: &[RouteLegacy]) -> Result<RouteLegacy, Er\nget_installed_route(&exit_mesh_ip, route_dump)\n}\n+#[allow(dead_code)]\nfn get_selected_exit() -> Option<ExitServer> {\nlet rita_client = settings::get_rita_client();\nlet exit_client = rita_client.exit_client;\n@@ -191,6 +236,7 @@ fn get_selected_exit() -> Option<ExitServer> {\nSome(exit.clone())\n}\n+#[allow(dead_code)]\nfn get_rita_neigh_option(\nneigh: Option<NeighborLegacy>,\nrita_neighbors: &[RitaNeighbor],\n@@ -203,6 +249,7 @@ fn get_rita_neigh_option(\n}\n}\n+#[allow(dead_code)]\nfn get_rita_neighbor(\nneigh: &NeighborLegacy,\nrita_neighbors: &[RitaNeighbor],\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/operator_update/mod.rs", "new_path": "rita_client/src/operator_update/mod.rs", "diff": "@@ -265,6 +265,10 @@ fn checkin() {\nrita_client.operator.operator_address = new_address;\n}\nSome(OperatorAction::Update { instruction }) => {\n+ info!(\n+ \"Received an update command from op tools! The instruction is {:?}\",\n+ instruction\n+ );\nlet _res = update_rita(instruction);\n}\nSome(OperatorAction::ChangeReleaseFeedAndUpdate { feed: _ }) => {}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Changes heartbeats so that they are sent without exit connection During development mode, having an exit connection is not feasible so we return a dummy exit and allow the router to send heartbeat update to op tools
20,244
05.11.2021 10:31:48
14,400
a0dc1469823004da5f7781bd43c353dd4e0eba94
Remove MAX_GAS and use higher level send_transaction This patch uses the higher level send_transaction function in both payment_controller and the simulated_transaction_fee modules. When these modules where first written there was no higher level interface available. Now in the latest version of web30 this interface is well tested and should be used universally.
[ { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/system_chain.rs", "new_path": "rita_client/src/dashboard/system_chain.rs", "diff": "@@ -5,10 +5,8 @@ use althea_types::SystemChain;\nuse failure::Error;\nuse settings::payment::PaymentSettings;\nuse settings::payment::ETH_FEE_MULTIPLIER;\n-use settings::payment::ETH_MAX_GAS;\nuse settings::payment::ETH_MIN_GAS;\nuse settings::payment::XDAI_FEE_MULTIPLIER;\n-use settings::payment::XDAI_MAX_GAS;\nuse settings::payment::XDAI_MIN_GAS;\nuse settings::FileWrite;\n@@ -58,7 +56,6 @@ pub fn set_system_blockchain(id: SystemChain, payment: &mut PaymentSettings) {\n// reset balance so that things take effect immediatley in the UI\npayment.balance = 0u32.into();\npayment.dynamic_fee_multiplier = ETH_FEE_MULTIPLIER;\n- payment.max_gas = ETH_MAX_GAS;\npayment.min_gas = ETH_MIN_GAS;\n}\nSystemChain::Xdai => {\n@@ -69,7 +66,6 @@ pub fn set_system_blockchain(id: SystemChain, payment: &mut PaymentSettings) {\n// reset balance so that things take effect immediatley in the UI\npayment.balance = 0u32.into();\npayment.dynamic_fee_multiplier = XDAI_FEE_MULTIPLIER;\n- payment.max_gas = XDAI_MAX_GAS;\npayment.min_gas = XDAI_MIN_GAS;\n}\nSystemChain::Rinkeby => {\n@@ -81,7 +77,6 @@ pub fn set_system_blockchain(id: SystemChain, payment: &mut PaymentSettings) {\n// reset balance so that things take effect immediatley in the UI\npayment.balance = 0u32.into();\npayment.dynamic_fee_multiplier = ETH_FEE_MULTIPLIER;\n- payment.max_gas = ETH_MAX_GAS;\npayment.min_gas = ETH_MIN_GAS;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/blockchain_oracle/mod.rs", "new_path": "rita_common/src/blockchain_oracle/mod.rs", "diff": "@@ -197,14 +197,12 @@ fn update_gas_price(\nvalue = value.clone() + (value / 20u32.into());\n// enforce minimum and maximum gas price rules\n+ // TODO This can be removed post xdai EIP1559 as it resolves the issues that\n+ // require this\nlet min_gas: Uint256 = payment_settings.min_gas.into();\n- let max_gas: Uint256 = payment_settings.max_gas.into();\npayment_settings.gas_price = if value < min_gas {\ninfo!(\"gas price is low setting to! {}\", min_gas);\nmin_gas\n- } else if value > max_gas {\n- trace!(\"gas price is high setting to! {}\", max_gas);\n- max_gas\n} else {\nvalue\n};\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/payment_controller/mod.rs", "new_path": "rita_common/src/payment_controller/mod.rs", "diff": "use althea_types::PaymentTx;\nuse async_web30::client::Web3;\n+use async_web30::types::SendTxOption;\nuse awc;\n-use clarity::Transaction;\nuse futures::future::join_all;\nuse num256::Uint256;\nuse std::error::Error;\n@@ -78,7 +78,6 @@ pub enum PaymentControllerError {\n},\nZeroPayment,\nFailedToSendPayment,\n- FailedToGenerateTransaction(clarity::Error),\n}\nimpl Display for PaymentControllerError {\n@@ -89,9 +88,6 @@ impl Display for PaymentControllerError {\nwrite!(f, \"Can not send amount {} with balance {}\", amount, balance)\n}\nSelf::ZeroPayment => write!(f, \"Attempted to send zero value payment!\"),\n- Self::FailedToGenerateTransaction(e) => {\n- write!(f, \"Failed to generate transaction! {:?}\", e)\n- }\nSelf::FailedToSendPayment => write!(f, \"Failed to send payment!\"),\n}\n}\n@@ -186,28 +182,20 @@ async fn make_payment(mut pmt: PaymentTx) -> Result<(), PaymentControllerError>\nlet full_node = get_web3_server();\nlet web3 = Web3::new(&full_node, TRANSACTION_SUBMISSION_TIMEOUT);\n- let tx = Transaction {\n- nonce: nonce.clone(),\n- gas_price,\n- gas_limit: \"21000\".parse().unwrap(),\n- to: pmt.to.eth_address,\n- value: pmt.amount.clone(),\n- data: Vec::new(),\n- signature: None,\n- };\n- let transaction_signed = tx.sign(\n- &payment_settings\n- .eth_private_key\n- .expect(\"No private key configured!\"),\n- payment_settings.net_version,\n- );\n-\n- let transaction_bytes = match transaction_signed.to_bytes() {\n- Ok(bytes) => bytes,\n- Err(e) => return Err(PaymentControllerError::FailedToGenerateTransaction(e)),\n- };\n+ let transaction_status = web3\n+ .send_transaction(\n+ pmt.to.eth_address,\n+ Vec::new(),\n+ pmt.amount.clone(),\n+ our_address,\n+ *our_private_key,\n+ vec![\n+ SendTxOption::Nonce(nonce.clone()),\n+ SendTxOption::GasPrice(gas_price),\n+ ],\n+ )\n+ .await;\n- let transaction_status = web3.eth_send_raw_transaction(transaction_bytes).await;\nif transaction_status.is_err() {\nerror!(\n\"Failed to send payment {:?} to {:?} with {:?}\",\n@@ -254,15 +242,14 @@ async fn make_payment(mut pmt: PaymentTx) -> Result<(), PaymentControllerError>\ninfo!(\n\"Payment with txid: {:#066x} is sent to our neighbor with {:?}, using full node {} and amount {:?}\",\ntx_id,\n- val,\n+ val.status(),\nfull_node,\npmt.amount\n);\n} else {\nerror!(\n\"We published txid: {:#066x} but our neighbor responded with an error {:?}, will retry\",\n- tx_id, val\n- );\n+ tx_id, val);\nqueue_resend(resend_info);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/simulated_txfee_manager/mod.rs", "new_path": "rita_common/src/simulated_txfee_manager/mod.rs", "diff": "@@ -6,10 +6,9 @@ use crate::usage_tracker::update_payments;\nuse althea_types::Identity;\nuse althea_types::PaymentTx;\nuse async_web30::client::Web3;\n-use clarity::Transaction;\n+use async_web30::types::SendTxOption;\nuse num256::Uint256;\nuse num_traits::{Signed, Zero};\n-\nuse std::sync::Arc;\nuse std::sync::RwLock;\n@@ -34,7 +33,8 @@ pub fn add_tx_to_total(amount: Uint256) {\npub async fn tick_simulated_tx() {\nlet payment_settings = settings::get_rita_common().payment;\n- let eth_private_key = payment_settings.eth_private_key;\n+ let eth_private_key = payment_settings.eth_private_key.unwrap();\n+ let eth_address = eth_private_key.to_public_key().unwrap();\nlet our_id = match settings::get_rita_common().get_identity() {\nSome(id) => id,\nNone => return,\n@@ -46,7 +46,6 @@ pub async fn tick_simulated_tx() {\nlet simulated_transaction_fee = payment_settings.simulated_transaction_fee;\nlet amount_to_pay = AMOUNT_OWED.read().unwrap().clone();\nlet should_pay = amount_to_pay > pay_threshold.abs().to_uint256().unwrap();\n- let net_version = payment_settings.net_version;\ndrop(payment_settings);\ntrace!(\n\"We should pay the simulated tx fee {} of 1/{} % to {}\",\n@@ -72,30 +71,18 @@ pub async fn tick_simulated_tx() {\nlet full_node = get_web3_server();\nlet web3 = Web3::new(&full_node, TRANSACTION_SUBMISSION_TIMEOUT);\n- let tx = Transaction {\n- nonce,\n- gas_price,\n- gas_limit: \"21000\".parse().unwrap(),\n- to: simulated_transaction_fee_address,\n- value: amount_to_pay.clone(),\n- data: Vec::new(),\n- signature: None,\n- };\n- let transaction_signed = tx.sign(\n- &eth_private_key.expect(\"No private key configured!\"),\n- net_version,\n+ let transaction_status = web3.send_transaction(\n+ simulated_transaction_fee_address,\n+ Vec::new(),\n+ amount_to_pay.clone(),\n+ eth_address,\n+ eth_private_key,\n+ vec![\n+ SendTxOption::Nonce(nonce.clone()),\n+ SendTxOption::GasPrice(gas_price),\n+ ],\n);\n- let transaction_bytes = match transaction_signed.to_bytes() {\n- Ok(bytes) => bytes,\n- Err(e) => {\n- error!(\"Failed to generate simulated txfee transaction, {:?}\", e);\n- return;\n- }\n- };\n-\n- let transaction_status = web3.eth_send_raw_transaction(transaction_bytes);\n-\n// in theory this may fail, for now there is no handler and\n// we will just underpay when that occurs\nmatch transaction_status.await {\n" }, { "change_type": "MODIFY", "old_path": "settings/src/payment.rs", "new_path": "settings/src/payment.rs", "diff": "@@ -5,9 +5,7 @@ use clarity::{Address, PrivateKey};\nuse num256::{Int256, Uint256};\npub const XDAI_FEE_MULTIPLIER: u32 = 6000;\n-pub const XDAI_MAX_GAS: u64 = 1_000_000_000;\n-pub const XDAI_MIN_GAS: u64 = XDAI_MAX_GAS;\n-pub const ETH_MAX_GAS: u64 = 200_000_000_000;\n+pub const XDAI_MIN_GAS: u64 = 1_000_000_000;\npub const ETH_MIN_GAS: u64 = 1;\npub const ETH_FEE_MULTIPLIER: u32 = 20;\n@@ -86,12 +84,7 @@ fn default_simulated_transaction_fee() -> u8 {\n/// is inactive min gas will be zero, but you can't actually send\n/// transactions with that\nfn default_min_gas() -> u64 {\n- XDAI_MAX_GAS\n-}\n-\n-/// 1gwei valid for Xdai change this if you change the default blockchain\n-fn default_max_gas() -> u64 {\n- XDAI_MAX_GAS\n+ XDAI_MIN_GAS\n}\n/// By default we forgive nodes of their debts on reboot\n@@ -194,9 +187,6 @@ pub struct PaymentSettings {\npub simulated_transaction_fee_address: Address,\n#[serde(default = \"default_simulated_transaction_fee\")]\npub simulated_transaction_fee: u8,\n- /// the maximum we will pay for gas on our current blockchain\n- #[serde(default = \"default_max_gas\")]\n- pub max_gas: u64,\n/// the minimum we will pay for gas on our current blockchain\n#[serde(default = \"default_min_gas\")]\npub min_gas: u64,\n@@ -239,7 +229,6 @@ impl Default for PaymentSettings {\nsimulated_transaction_fee_address: default_simulated_transaction_fee_address(),\nsimulated_transaction_fee: default_simulated_transaction_fee(),\nmin_gas: default_min_gas(),\n- max_gas: default_max_gas(),\nforgive_on_reboot: default_forgive_on_reboot(),\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove MAX_GAS and use higher level send_transaction This patch uses the higher level send_transaction function in both payment_controller and the simulated_transaction_fee modules. When these modules where first written there was no higher level interface available. Now in the latest version of web30 this interface is well tested and should be used universally.
20,244
05.11.2021 16:29:10
14,400
c93c16be96a2209093e4ed12d71c3c693db134f0
Migrate operator fee module to async/await This migration allows us to use an updated and EIP1559 compatible version of web30. It has required backporting a async loop for rita client.
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -3311,7 +3311,7 @@ dependencies = [\n\"tokio 0.1.22\",\n\"tokio-codec\",\n\"tokio-io\",\n- \"web30 0.4.3\",\n+ \"web30 0.17.1\",\n]\n[[package]]\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "@@ -33,7 +33,7 @@ tokio-io = \"0.1\"\ntokio-codec = \"0.1\"\nsodiumoxide = \"0.2\"\nclu = { path = \"../clu\" }\n-web30 = {git = \"https://github.com/althea-net/web30\", rev = \"a600b8b8ebf2c49badee6b65ac90a56bbdad4ab9\"}\n+web30 = \"0.17\"\nactix = \"0.7\"\nawc = \"3.0.0-beta.8\"\nipnetwork = \"0.14\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/operator_fee_manager/mod.rs", "new_path": "rita_client/src/operator_fee_manager/mod.rs", "diff": "//! will need to be re-written to better reflect a normal billing system at some point, perhaps\n//! querying an API for an individual bill. As this is not designed to be a trustless payment\n-use rita_common::payment_controller::TRANSACTION_SUBMISSION_TIMEOUT;\n-use rita_common::rita_loop::get_web3_server;\n-use rita_common::simulated_txfee_manager::add_tx_to_total;\n-use rita_common::usage_tracker::handle_payment_data;\n-use rita_common::usage_tracker::UpdatePayments;\n-\n-use ::actix::{Actor, Arbiter, Context, Handler, Message, Supervised, SystemService};\nuse althea_types::Identity;\nuse althea_types::PaymentTx;\n-use clarity::Transaction;\n-use futures01::future::Future;\nuse num256::Int256;\nuse num256::Uint256;\n+use rita_common::payment_controller::TRANSACTION_SUBMISSION_TIMEOUT;\n+use rita_common::rita_loop::get_web3_server;\n+use rita_common::simulated_txfee_manager::add_tx_to_total;\n+use rita_common::usage_tracker::update_payments;\nuse std::sync::{Arc, RwLock};\nuse std::time::Instant;\nuse web30::client::Web3;\n+use web30::types::SendTxOption;\nlazy_static! {\n- static ref OPERATOR_FEE_DEBT: Arc<RwLock<Uint256>> = Arc::new(RwLock::new(Uint256::from(0u8)));\n+ static ref OPERATOR_FEE_DATA: Arc<RwLock<OperatorFeeManager>> =\n+ Arc::new(RwLock::new(OperatorFeeManager::new()));\n}\npub fn get_operator_fee_debt() -> Uint256 {\n- OPERATOR_FEE_DEBT.read().unwrap().clone()\n+ let state = OPERATOR_FEE_DATA.read().unwrap();\n+ state.operator_debt.clone()\n}\n-pub struct OperatorFeeManager {\n+struct OperatorFeeManager {\n/// the operator fee is denominated in wei per second, so every time this routine runs\n/// we take the number of seconds since the last time it ran and multiply that by the\n/// operator fee and add to operator_fee_debt which we eventually pay\nlast_updated: Instant,\n- /// the amount in operator fees we owe to the operator address\n- operator_fee_debt: Uint256,\n-}\n-\n-impl Actor for OperatorFeeManager {\n- type Context = Context<Self>;\n-}\n-impl Supervised for OperatorFeeManager {}\n-impl SystemService for OperatorFeeManager {\n- fn service_started(&mut self, _ctx: &mut Context<Self>) {\n- info!(\"OperatorFee manager started\");\n- }\n-}\n-\n-impl Default for OperatorFeeManager {\n- fn default() -> OperatorFeeManager {\n- OperatorFeeManager::new()\n- }\n+ /// How much we owe the operator, note this *CAN NOT* be safely eliminated and replaced\n+ /// by just computing off of the last updated time, if the operator fee is changed while\n+ /// the node is live it will result in a large back-payment\n+ operator_debt: Uint256,\n}\nimpl OperatorFeeManager {\nfn new() -> OperatorFeeManager {\nOperatorFeeManager {\nlast_updated: Instant::now(),\n- operator_fee_debt: 0u8.into(),\n+ operator_debt: 0u8.into(),\n}\n}\n}\n-pub struct SuccessfulPayment {\n- amount: Uint256,\n-}\n-impl Message for SuccessfulPayment {\n- type Result = ();\n-}\n-\n-impl Handler<SuccessfulPayment> for OperatorFeeManager {\n- type Result = ();\n-\n- fn handle(&mut self, msg: SuccessfulPayment, _: &mut Context<Self>) -> Self::Result {\n- if msg.amount > self.operator_fee_debt {\n- self.operator_fee_debt = 0u8.into();\n- // this should never happen, in theory the amount might go up (routine gets run again\n- // before this call back is run) but there's no way I can think of for the counter to\n- // run backwards, nonetheless we should handle it.\n- error!(\n- \"Payment is greater than op debt? Should be impossible! {} > {}\",\n- msg.amount, self.operator_fee_debt\n- )\n- } else {\n- self.operator_fee_debt -= msg.amount;\n- }\n- }\n-}\n-\n-/// Very basic loop for Operator payments\n-pub struct Tick;\n-impl Message for Tick {\n- type Result = ();\n-}\n-\n-impl Handler<Tick> for OperatorFeeManager {\n- type Result = ();\n-\n- fn handle(&mut self, _msg: Tick, _: &mut Context<Self>) -> Self::Result {\n+/// Very basic loop for async operator payments\n+pub async fn tick_operator_payments() {\n// get variables\n- let mut rita_client = settings::get_rita_client();\n- let operator_settings = rita_client.operator;\n- let payment_settings = rita_client.payment;\n- let eth_private_key = payment_settings.eth_private_key;\n- let our_id = match settings::get_rita_client().get_identity() {\n+ let common = settings::get_rita_common();\n+ let client = settings::get_rita_client();\n+ let our_id = match common.get_identity() {\nSome(id) => id,\nNone => return,\n};\n+ let operator_settings = client.operator;\n+ let payment_settings = common.payment;\n+ let eth_private_key = payment_settings.eth_private_key.unwrap();\n+ let eth_address = payment_settings.eth_address.unwrap();\nlet our_balance = payment_settings.balance.clone();\nlet gas_price = payment_settings.gas_price.clone();\nlet nonce = payment_settings.nonce.clone();\n@@ -127,24 +79,20 @@ impl Handler<Tick> for OperatorFeeManager {\nNone => return,\n};\nlet operator_fee = operator_settings.operator_fee.clone();\n- let net_version = payment_settings.net_version;\n- // accumulate what we owe\n- self.operator_fee_debt +=\n- Uint256::from(self.last_updated.elapsed().as_secs()) * operator_fee;\n- self.last_updated = Instant::now();\n+ let mut state = OPERATOR_FEE_DATA.write().unwrap();\n- // reassign to immutable variable to avoid accidents\n- let amount_to_pay = self.operator_fee_debt.clone();\n+ // accumulate, if we don't pay this will count up, if we do pay we will pay the full amount\n+ let last_updated = state.last_updated.elapsed().as_secs();\n+ state.operator_debt += Uint256::from(last_updated) * operator_fee;\n+ state.last_updated = Instant::now();\n- // update globally accessible lock value, will be removed when this module goes async\n- *OPERATOR_FEE_DEBT.write().unwrap() = amount_to_pay.clone();\n+ // reassign to an immutable variable to prevent mistakes\n+ let amount_to_pay = state.operator_debt.clone();\n// we should pay if the amount is greater than the pay threshold and if we have the\n- // balance to do so. If we don't have the balance then we'll do all the signing and\n- // network request for nothing\n- let should_pay = amount_to_pay.to_int256().unwrap_or_else(|| Int256::from(0))\n- > pay_threshold\n+ // balance to do so.\n+ let should_pay = amount_to_pay.to_int256().unwrap_or_else(|| Int256::from(0)) > pay_threshold\n&& amount_to_pay <= our_balance;\ntrace!(\"We should pay our operator {}\", should_pay);\n@@ -165,63 +113,41 @@ impl Handler<Tick> for OperatorFeeManager {\nlet full_node = get_web3_server();\nlet web3 = Web3::new(&full_node, TRANSACTION_SUBMISSION_TIMEOUT);\n- let tx = Transaction {\n- nonce,\n- gas_price,\n- gas_limit: \"21000\".parse().unwrap(),\n- to: operator_address,\n- value: amount_to_pay.clone(),\n- data: Vec::new(),\n- signature: None,\n- };\n- let transaction_signed = tx.sign(\n- &eth_private_key.expect(\"No private key configured!\"),\n- net_version,\n- );\n-\n- let transaction_bytes = match transaction_signed.to_bytes() {\n- Ok(bytes) => bytes,\n- Err(e) => {\n- error!(\"Failed to generate operator fee transaction, {:?}\", e);\n- return;\n- }\n- };\n-\n- let transaction_status = web3.eth_send_raw_transaction(transaction_bytes);\n+ let transaction_status = web3\n+ .send_transaction(\n+ operator_address,\n+ Vec::new(),\n+ amount_to_pay.clone(),\n+ eth_address,\n+ eth_private_key,\n+ vec![\n+ SendTxOption::Nonce(nonce.clone()),\n+ SendTxOption::GasPrice(gas_price),\n+ ],\n+ )\n+ .await;\n// in theory this may fail to get into a block, for now there is no handler and\n// we will just underpay when that occurs. Failure to successfully submit the tx\n// will be properly retried\n- Arbiter::spawn(transaction_status.then(move |res| match res {\n+ match transaction_status {\nOk(txid) => {\ninfo!(\n\"Successfully paid the operator {} wei with txid: {:#066x}!\",\namount_to_pay, txid\n);\n-\n- handle_payment_data(UpdatePayments {\n- payment: PaymentTx {\n+ update_payments(PaymentTx {\nto: operator_identity,\nfrom: our_id,\namount: amount_to_pay.clone(),\ntxid: Some(txid),\n- },\n});\n-\nadd_tx_to_total(amount_to_pay.clone());\n- OperatorFeeManager::from_registry().do_send(SuccessfulPayment {\n- amount: amount_to_pay,\n- });\n- Ok(())\n+ state.operator_debt -= amount_to_pay;\n}\nErr(e) => {\nwarn!(\"Failed to pay the operator! {:?}\", e);\n- Ok(())\n}\n- }));\n}\n- rita_client.operator = operator_settings;\n- rita_client.payment = payment_settings;\n- settings::set_rita_client(rita_client);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/rita_loop/mod.rs", "new_path": "rita_client/src/rita_loop/mod.rs", "diff": "@@ -9,8 +9,7 @@ use crate::heartbeat::send_udp_heartbeat;\nuse crate::light_client_manager::light_client_hello_response;\nuse crate::light_client_manager::LightClientManager;\nuse crate::light_client_manager::Watch;\n-use crate::operator_fee_manager::OperatorFeeManager;\n-use crate::operator_fee_manager::Tick as OperatorTick;\n+use crate::operator_fee_manager::tick_operator_payments;\nuse crate::operator_update::{OperatorUpdate, Update};\nuse crate::traffic_watcher::GetExitDestPrice;\nuse crate::traffic_watcher::TrafficWatcherActor;\n@@ -22,17 +21,15 @@ use actix::{\nActor, ActorContext, Addr, Arbiter, AsyncContext, Context, Handler, Message, Supervised,\nSystem, SystemService,\n};\n+use actix_async::System as AsyncSystem;\nuse actix_web::http::Method;\nuse actix_web::{server, App};\n-\n-use actix_async::System as AsyncSystem;\n-use std::thread;\n-use std::time::{Duration, Instant};\n-\nuse althea_types::ExitState;\nuse failure::Error;\nuse futures01::future::Future;\nuse std::sync::atomic::{AtomicBool, Ordering};\n+use std::thread;\n+use std::time::{Duration, Instant};\nlazy_static! {\n/// see the comment on check_for_gateway_client_billing_corner_case()\n@@ -143,8 +140,6 @@ impl Handler<Tick> for RitaLoop {\nsend_udp_heartbeat();\n}\n- // Check Operator payments\n- OperatorFeeManager::from_registry().do_send(OperatorTick);\n// Check in with Operator\nOperatorUpdate::from_registry().do_send(Update);\n@@ -177,7 +172,12 @@ pub fn start_rita_loop() {\nlet runner = AsyncSystem::new();\nrunner.block_on(async move {\n+ // update the client exit manager, which handles exit registrations\n+ // and manages the exit state machine in general. This includes\n+ // updates to the local ip and description from the exit side\nexit_manager_tick().await;\n+ // sends an operator payment if enough time has elapsed\n+ tick_operator_payments().await\n});\n// sleep until it has been CLIENT_LOOP_SPEED seconds from start, whenever that may be\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Migrate operator fee module to async/await This migration allows us to use an updated and EIP1559 compatible version of web30. It has required backporting a async loop for rita client.
20,244
05.11.2021 18:07:32
14,400
a57794bc9fec540ec21e1719e3242230fedc1c49
Remove futures web30 Becuase everything using futures web30 was just migrated we can finally eliminate this old futures dependency. The first of many.
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -531,17 +531,6 @@ version = \"0.9.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"71938f30533e4d95a6d17aa530939da3842c2ab6f4f84b9dae68447e4129f74a\"\n-[[package]]\n-name = \"assert-json-diff\"\n-version = \"1.1.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4259cbe96513d2f1073027a259fc2ca917feb3026a5a8d984e3628e490255cc0\"\n-dependencies = [\n- \"extend\",\n- \"serde 1.0.130\",\n- \"serde_json\",\n-]\n-\n[[package]]\nname = \"atty\"\nversion = \"0.2.14\"\n@@ -568,7 +557,7 @@ dependencies = [\n\"serde 1.0.130\",\n\"serde_derive\",\n\"tokio 1.13.0\",\n- \"web30 0.17.1\",\n+ \"web30\",\n]\n[[package]]\n@@ -1361,18 +1350,6 @@ dependencies = [\n\"serde_json\",\n]\n-[[package]]\n-name = \"extend\"\n-version = \"0.1.2\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f47da3a72ec598d9c8937a7ebca8962a5c7a1f28444e38c2b33c771ba3f55f05\"\n-dependencies = [\n- \"proc-macro-error\",\n- \"proc-macro2 1.0.32\",\n- \"quote 1.0.10\",\n- \"syn 1.0.81\",\n-]\n-\n[[package]]\nname = \"failure\"\nversion = \"0.1.8\"\n@@ -1577,15 +1554,6 @@ version = \"0.3.17\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99\"\n-[[package]]\n-name = \"futures-timer\"\n-version = \"0.1.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a5cedfe9b6dc756220782cc1ba5bcb1fa091cdcba155e40d3556159c3db58043\"\n-dependencies = [\n- \"futures 0.1.31\",\n-]\n-\n[[package]]\nname = \"futures-util\"\nversion = \"0.3.17\"\n@@ -2855,30 +2823,6 @@ dependencies = [\n\"vcpkg\",\n]\n-[[package]]\n-name = \"proc-macro-error\"\n-version = \"1.0.4\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c\"\n-dependencies = [\n- \"proc-macro-error-attr\",\n- \"proc-macro2 1.0.32\",\n- \"quote 1.0.10\",\n- \"syn 1.0.81\",\n- \"version_check 0.9.3\",\n-]\n-\n-[[package]]\n-name = \"proc-macro-error-attr\"\n-version = \"1.0.4\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869\"\n-dependencies = [\n- \"proc-macro2 1.0.32\",\n- \"quote 1.0.10\",\n- \"version_check 0.9.3\",\n-]\n-\n[[package]]\nname = \"proc-macro-hack\"\nversion = \"0.5.19\"\n@@ -3311,7 +3255,7 @@ dependencies = [\n\"tokio 0.1.22\",\n\"tokio-codec\",\n\"tokio-io\",\n- \"web30 0.17.1\",\n+ \"web30\",\n]\n[[package]]\n@@ -3352,8 +3296,7 @@ dependencies = [\n\"serde_json\",\n\"settings\",\n\"tokio 0.1.22\",\n- \"web30 0.17.1\",\n- \"web30 0.4.3\",\n+ \"web30\",\n]\n[[package]]\n@@ -4643,27 +4586,6 @@ dependencies = [\n\"wasm-bindgen\",\n]\n-[[package]]\n-name = \"web30\"\n-version = \"0.4.3\"\n-source = \"git+https://github.com/althea-net/web30?rev=a600b8b8ebf2c49badee6b65ac90a56bbdad4ab9#a600b8b8ebf2c49badee6b65ac90a56bbdad4ab9\"\n-dependencies = [\n- \"actix 0.7.11\",\n- \"actix-web 0.7.19\",\n- \"assert-json-diff\",\n- \"bytes 1.1.0\",\n- \"clarity\",\n- \"failure\",\n- \"futures 0.1.31\",\n- \"futures-timer\",\n- \"log\",\n- \"num256\",\n- \"serde 1.0.130\",\n- \"serde_derive\",\n- \"serde_json\",\n- \"tokio 0.1.22\",\n-]\n-\n[[package]]\nname = \"web30\"\nversion = \"0.17.1\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "@@ -25,7 +25,6 @@ settings = { path = \"../settings\" }\nclarity = \"0.4\"\nfutures = { version = \"0.3\", features = [\"compat\"] }\nnum256 = \"0.3\"\n-web30 = {git = \"https://github.com/althea-net/web30\", rev = \"a600b8b8ebf2c49badee6b65ac90a56bbdad4ab9\"}\nnum-traits=\"0.2\"\nfailure = \"0.1\"\nfutures01 = { package = \"futures\", version = \"0.1\"}\n@@ -37,7 +36,7 @@ althea_kernel_interface = { path = \"../althea_kernel_interface\" }\nactix-web-httpauth = {git = \"https://github.com/althea-net/actix-web-httpauth\"}\nactix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\nawc = {version = \"3.0.0-beta.8\", default-features = false, features=[\"openssl\", \"compress-gzip\", \"compress-zstd\"]}\n-async-web30 = {package=\"web30\", version = \"0.17\"}\n+web30 = \"0.17\"\nalthea_types = { path = \"../althea_types\" }\nbabel_monitor_legacy = {path = \"../babel_monitor_legacy\"}\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/blockchain_oracle/mod.rs", "new_path": "rita_common/src/blockchain_oracle/mod.rs", "diff": "use crate::rita_loop::fast_loop::FAST_LOOP_TIMEOUT;\nuse crate::rita_loop::get_web3_server;\n-use async_web30::client::Web3;\nuse clarity::Address;\nuse futures::future::join4;\nuse num256::Int256;\nuse num256::Uint256;\nuse num_traits::identities::Zero;\nuse settings::payment::PaymentSettings;\n+use web30::client::Web3;\nuse std::sync::Arc;\nuse std::sync::RwLock;\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/dashboard/wallet.rs", "new_path": "rita_common/src/dashboard/wallet.rs", "diff": "@@ -6,13 +6,13 @@ use actix_web::http::StatusCode;\nuse actix_web::HttpResponse;\nuse actix_web::Path;\nuse althea_types::SystemChain;\n-use async_web30::client::Web3;\n-use async_web30::types::SendTxOption;\nuse clarity::Address;\nuse num256::Uint256;\nuse std::sync::Arc;\nuse std::sync::RwLock;\nuse std::time::Duration;\n+use web30::client::Web3;\n+use web30::types::SendTxOption;\n// this is required until we migrate our endpoints to async actix\n// this way we can queue a withdraw from the old futures endpoint\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/payment_controller/mod.rs", "new_path": "rita_common/src/payment_controller/mod.rs", "diff": "//! the blockchain it's up to the reciever to validate that it's correct\nuse althea_types::PaymentTx;\n-use async_web30::client::Web3;\n-use async_web30::types::SendTxOption;\nuse awc;\nuse futures::future::join_all;\nuse num256::Uint256;\n@@ -15,6 +13,8 @@ use std::fmt::{Display, Formatter};\nuse std::sync::{Arc, RwLock};\nuse std::time::Duration;\nuse std::time::Instant;\n+use web30::client::Web3;\n+use web30::types::SendTxOption;\nuse crate::debt_keeper::payment_failed;\nuse crate::payment_validator::{validate_later, ToValidate};\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/payment_validator/mod.rs", "new_path": "rita_common/src/payment_validator/mod.rs", "diff": "@@ -15,9 +15,9 @@ use crate::usage_tracker::update_payments;\nuse actix::System;\nuse althea_types::PaymentTx;\n-use async_web30::client::Web3;\n-use async_web30::types::TransactionResponse;\nuse num256::Uint256;\n+use web30::client::Web3;\n+use web30::types::TransactionResponse;\nuse std::collections::HashSet;\nuse std::fmt;\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/simulated_txfee_manager/mod.rs", "new_path": "rita_common/src/simulated_txfee_manager/mod.rs", "diff": "@@ -5,12 +5,12 @@ use crate::rita_loop::get_web3_server;\nuse crate::usage_tracker::update_payments;\nuse althea_types::Identity;\nuse althea_types::PaymentTx;\n-use async_web30::client::Web3;\n-use async_web30::types::SendTxOption;\nuse num256::Uint256;\nuse num_traits::{Signed, Zero};\nuse std::sync::Arc;\nuse std::sync::RwLock;\n+use web30::client::Web3;\n+use web30::types::SendTxOption;\nlazy_static! {\nstatic ref AMOUNT_OWED: Arc<RwLock<Uint256>> = Arc::new(RwLock::new(Uint256::zero()));\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/token_bridge/mod.rs", "new_path": "rita_common/src/token_bridge/mod.rs", "diff": "use crate::rita_loop::slow_loop::SLOW_LOOP_TIMEOUT;\nuse althea_types::SystemChain;\n-use async_web30::jsonrpc::error::Web3Error;\nuse auto_bridge::check_relayed_message;\nuse auto_bridge::get_payload_for_funds_unlock;\nuse auto_bridge::HelperWithdrawInfo;\n@@ -36,6 +35,7 @@ use num256::Uint256;\nuse num_traits::identities::Zero;\nuse rand::{thread_rng, Rng};\nuse settings::payment::PaymentSettings;\n+use web30::jsonrpc::error::Web3Error;\nuse std::cmp::Ordering;\nuse std::collections::HashSet;\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove futures web30 Becuase everything using futures web30 was just migrated we can finally eliminate this old futures dependency. The first of many.
20,244
05.11.2021 18:09:35
14,400
00b0ad1009147a08b9d0648f8123c3d211811ed9
Update actix-web to match web30 These two should generally be the same version to prevent dependency duplication at the very least and strange actix executor problems at the worst.
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -30,30 +30,6 @@ dependencies = [\n\"uuid\",\n]\n-[[package]]\n-name = \"actix\"\n-version = \"0.11.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"543c47e7827f8fcc9d1445bd98ba402137bfce80ee2187429de49c52b5131bd3\"\n-dependencies = [\n- \"actix-rt\",\n- \"actix_derive 0.6.0\",\n- \"bitflags\",\n- \"bytes 1.1.0\",\n- \"crossbeam-channel 0.5.1\",\n- \"futures-core\",\n- \"futures-sink\",\n- \"futures-task\",\n- \"futures-util\",\n- \"log\",\n- \"once_cell\",\n- \"parking_lot 0.11.2\",\n- \"pin-project-lite\",\n- \"smallvec 1.7.0\",\n- \"tokio 1.13.0\",\n- \"tokio-util\",\n-]\n-\n[[package]]\nname = \"actix\"\nversion = \"0.12.0\"\n@@ -3186,7 +3162,7 @@ dependencies = [\nname = \"rita_bin\"\nversion = \"0.18.4\"\ndependencies = [\n- \"actix 0.11.1\",\n+ \"actix 0.12.0\",\n\"actix 0.7.11\",\n\"actix-web 0.7.19\",\n\"actix-web 4.0.0-beta.10\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "@@ -18,8 +18,8 @@ althea_kernel_interface = { path = \"../althea_kernel_interface\" }\nalthea_types = { path = \"../althea_types\", features = [\"actix\"]}\nclu = { path = \"../clu\" }\nactix-web-httpauth = {git = \"https://github.com/althea-net/actix-web-httpauth\"}\n-actix-async = {package=\"actix\", version = \"0.11\"}\n-actix-web-async = {package=\"actix-web\", version = \"4.0.0-beta.6\", default_features = false, features= [\"openssl\"] }\n+actix-async = {package=\"actix\", version = \"0.12\"}\n+actix-web-async = {package=\"actix-web\", version = \"4.0.0-beta.8\", default_features = false, features= [\"openssl\"] }\nactix = \"0.7\"\nactix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\nactix_derive = \"0.6\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Update actix-web to match web30 These two should generally be the same version to prevent dependency duplication at the very least and strange actix executor problems at the worst.
20,244
05.11.2021 18:45:01
14,400
da59183923a5991e9f49cd994c57a9f26542792e
Bump for Beta 18 RC5
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -3160,7 +3160,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.18.4\"\n+version = \"0.18.5\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3196,7 +3196,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.18.4\"\n+version = \"0.18.5\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3236,7 +3236,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.18.4\"\n+version = \"0.18.5\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3277,7 +3277,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.18.3\"\n+version = \"0.18.5\"\ndependencies = [\n\"actix 0.7.11\",\n\"actix-web 0.7.19\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.18.4\"\n+version = \"0.18.5\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\nbuild = \"build.rs\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "[package]\nname = \"rita_client\"\n-version = \"0.18.4\"\n+version = \"0.18.5\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "[package]\nname = \"rita_common\"\n-version = \"0.18.4\"\n+version = \"0.18.5\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/dashboard/own_info.rs", "new_path": "rita_common/src/dashboard/own_info.rs", "diff": "@@ -5,7 +5,7 @@ use clarity::Address;\nuse failure::Error;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 18 RC4\";\n+pub static READABLE_VERSION: &str = \"Beta 18 RC5\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/Cargo.toml", "new_path": "rita_exit/Cargo.toml", "diff": "[package]\nname = \"rita_exit\"\n-version = \"0.18.3\"\n+version = \"0.18.5\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 18 RC5
20,244
06.11.2021 12:35:18
14,400
2096b1e3b7eddb794a599d4dea9945e755787aa6
Re-add UpdateNow operator action This patch restores the UpdateNow operator action for backwards compatibility, until we can finish updating routers still using it in the field.
[ { "change_type": "MODIFY", "old_path": "althea_types/src/interop.rs", "new_path": "althea_types/src/interop.rs", "diff": "@@ -396,6 +396,8 @@ pub enum OperatorAction {\n/// routing processes. For x86 machines this action comes with some risk as devices may\n/// get stuck in the BIOS if not configured properly.\nReboot,\n+ /// Legacy action, remaining here for database backwards compatibility\n+ UpdateNow,\n/// Sends instructions from op tools about the type of update to perform, either a sysupgrade\n/// or an opkg update\nUpdate { instruction: UpdateType },\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/operator_update/mod.rs", "new_path": "rita_client/src/operator_update/mod.rs", "diff": "@@ -271,7 +271,10 @@ fn checkin() {\n);\nlet _res = update_rita(instruction);\n}\n+ // both of these actions have been removed, but need to be kept\n+ // for backwards compatibility for a while\nSome(OperatorAction::ChangeReleaseFeedAndUpdate { feed: _ }) => {}\n+ Some(OperatorAction::UpdateNow) => {}\nNone => {}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Re-add UpdateNow operator action This patch restores the UpdateNow operator action for backwards compatibility, until we can finish updating routers still using it in the field.
20,244
08.11.2021 08:10:08
18,000
73d093f5abd76ab2c5d5708c67ddafadc9c46fd3
Remove actix feature from althea_types This never seems to be used in any context
[ { "change_type": "MODIFY", "old_path": "althea_types/Cargo.toml", "new_path": "althea_types/Cargo.toml", "diff": "@@ -16,7 +16,6 @@ serde = \"1.0\"\nserde_json = \"1.0\"\nhex = \"0.4\"\nsodiumoxide = \"0.2\"\n-actix = { version = \"0.7\", optional = true}\nclarity = \"0.4\"\narrayvec = {version= \"0.7\", features = [\"serde\"]}\nphonenumber = \"0.3\"\n" }, { "change_type": "MODIFY", "old_path": "exit_db/Cargo.toml", "new_path": "exit_db/Cargo.toml", "diff": "@@ -7,7 +7,7 @@ edition = \"2018\"\n[dependencies]\ndiesel = { version = \"1.4\", features = [\"postgres\"] }\ndotenv = \"0.15\"\n-althea_types = { path = \"../althea_types\", features = [\"actix\"]}\n+althea_types = { path = \"../althea_types\"}\nserde = \"1.0\"\nserde_derive = \"1.0\"\nserde_json = \"1.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "@@ -15,7 +15,7 @@ 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\"}\nclu = { path = \"../clu\" }\nactix-web-httpauth = {git = \"https://github.com/althea-net/actix-web-httpauth\"}\nactix-async = {package=\"actix\", version = \"0.12\"}\n" }, { "change_type": "MODIFY", "old_path": "settings/Cargo.toml", "new_path": "settings/Cargo.toml", "diff": "@@ -6,7 +6,7 @@ edition = \"2018\"\n[dependencies]\nconfig = \"0.11\"\n-althea_types = { path = \"../althea_types\", features = [\"actix\"]}\n+althea_types = { path = \"../althea_types\"}\nalthea_kernel_interface = { path = \"../althea_kernel_interface\" }\nauto-bridge = { path = \"../auto_bridge\" }\nnum256 = \"0.3\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove actix feature from althea_types This never seems to be used in any context
20,244
08.11.2021 08:10:52
18,000
9bc18e85dc5b1b7e7963eeb8547f08f329dff732
Bump for Beta 18 RC6
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -428,7 +428,6 @@ dependencies = [\nname = \"althea_types\"\nversion = \"0.1.0\"\ndependencies = [\n- \"actix 0.7.11\",\n\"arrayvec 0.7.2\",\n\"babel_monitor\",\n\"babel_monitor_legacy\",\n@@ -3160,7 +3159,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.18.5\"\n+version = \"0.18.6\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3196,7 +3195,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.18.5\"\n+version = \"0.18.6\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3236,7 +3235,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.18.5\"\n+version = \"0.18.6\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3277,7 +3276,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.18.5\"\n+version = \"0.18.6\"\ndependencies = [\n\"actix 0.7.11\",\n\"actix-web 0.7.19\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.18.5\"\n+version = \"0.18.6\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\nbuild = \"build.rs\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "[package]\nname = \"rita_client\"\n-version = \"0.18.5\"\n+version = \"0.18.6\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "[package]\nname = \"rita_common\"\n-version = \"0.18.5\"\n+version = \"0.18.6\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/dashboard/own_info.rs", "new_path": "rita_common/src/dashboard/own_info.rs", "diff": "@@ -5,7 +5,7 @@ use clarity::Address;\nuse failure::Error;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 18 RC5\";\n+pub static READABLE_VERSION: &str = \"Beta 18 RC6\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/Cargo.toml", "new_path": "rita_exit/Cargo.toml", "diff": "[package]\nname = \"rita_exit\"\n-version = \"0.18.5\"\n+version = \"0.18.6\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 18 RC6
20,244
08.11.2021 13:19:17
18,000
5dd9112da402713a79d1261f63c0533b0a3ce6e5
Sleep before continue in antenna forwarder client loop This should prevent this loop from going crazy on dns failures. Right now it will look at maximum speed until a successfull dns resolution occurs.
[ { "change_type": "MODIFY", "old_path": "antenna_forwarding_client/src/lib.rs", "new_path": "antenna_forwarding_client/src/lib.rs", "diff": "@@ -83,12 +83,14 @@ pub fn start_antenna_forwarding_proxy<S: 'static + std::marker::Send + ::std::ha\nlast_val\n} else {\nerror!(\"Could not perform DNS lookup for {}!\", checkin_address);\n+ thread::sleep(SLEEP_TIME);\ncontinue;\n}\n}\n},\nErr(_) => {\nerror!(\"Could not parse {}!\", checkin_address);\n+ thread::sleep(SLEEP_TIME);\ncontinue;\n}\n};\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Sleep before continue in antenna forwarder client loop This should prevent this loop from going crazy on dns failures. Right now it will look at maximum speed until a successfull dns resolution occurs.
20,244
08.11.2021 16:30:41
18,000
d195e6422d014822e476e8ea6775cd0f35dea278
Reduce Anteanna forwarding loop frequency This reduces the run frequency of the antenna forwader from once every 10 seconds to once every 20 seconds. This should halve the load on the server without dramatically increasing user wait time since the frontend only refreshes every 30 seconds.
[ { "change_type": "MODIFY", "old_path": "antenna_forwarding_client/src/lib.rs", "new_path": "antenna_forwarding_client/src/lib.rs", "diff": "@@ -38,8 +38,8 @@ lazy_static! {\npub static ref KI: Box<dyn KernelInterface> = Box::new(LinuxCommandRunner {});\n}\n-const SLEEP_TIME: Duration = Duration::from_secs(10);\n-/// The timeout time for pinging a local antenna, 25ms is very\n+const SLEEP_TIME: Duration = Duration::from_secs(20);\n+/// The timeout time for pinging a local antenna, 100ms is very\n/// very generous here as they should all respond really within 5ms\nconst PING_TIMEOUT: Duration = Duration::from_millis(100);\n/// the amount of time with no activity before we close a forwarding session\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Reduce Anteanna forwarding loop frequency This reduces the run frequency of the antenna forwader from once every 10 seconds to once every 20 seconds. This should halve the load on the server without dramatically increasing user wait time since the frontend only refreshes every 30 seconds.
20,244
10.11.2021 07:58:41
18,000
6b4bb30fd1799698bc4d4aaa0bfb403f3d3beaa1
Implement Debug for WgKey When we derive debug we get an unreadable bytes dump any time we debug print a struct containing a WgKey. This change will allow us to read these addresses as normal strings rather than having to hand decode a byte array to figure out what router is being referenced.
[ { "change_type": "MODIFY", "old_path": "althea_types/src/wg_key.rs", "new_path": "althea_types/src/wg_key.rs", "diff": "@@ -8,7 +8,7 @@ use sodiumoxide::crypto::box_::curve25519xsalsa20poly1305::SecretKey;\nuse std::fmt;\nuse std::str::FromStr;\n-#[derive(Hash, Debug, Copy, Clone, Eq, PartialEq)]\n+#[derive(Hash, Copy, Clone, Eq, PartialEq)]\npub struct WgKey([u8; 32]);\nimpl AsRef<[u8]> for WgKey {\n@@ -50,6 +50,12 @@ impl fmt::Display for WgKey {\n}\n}\n+impl fmt::Debug for WgKey {\n+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {\n+ write!(f, \"{}\", base64::encode(&self))\n+ }\n+}\n+\nimpl FromStr for WgKey {\ntype Err = AltheaTypesError;\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Implement Debug for WgKey When we derive debug we get an unreadable bytes dump any time we debug print a struct containing a WgKey. This change will allow us to read these addresses as normal strings rather than having to hand decode a byte array to figure out what router is being referenced.
20,244
10.11.2021 13:00:21
18,000
2aea757631775eb1efe77b029c7d5d34e9ca8901
Remove actix feature flags in althea_types The feature itself was removed in a previous commit but I missed the actual feature flags.
[ { "change_type": "MODIFY", "old_path": "althea_types/src/interop.rs", "new_path": "althea_types/src/interop.rs", "diff": "@@ -13,9 +13,6 @@ use std::net::Ipv4Addr;\nuse std::str::FromStr;\nuse std::time::Duration;\n-#[cfg(feature = \"actix\")]\n-use actix::Message;\n-\n/// This is how nodes are identified.\n#[derive(Debug, Serialize, Deserialize, Clone, Copy)]\npub struct Identity {\n@@ -279,11 +276,6 @@ pub struct ExitClientDetails {\npub client_internal_ip: IpAddr,\n}\n-#[cfg(feature = \"actix\")]\n-impl Message for Identity {\n- type Result = ();\n-}\n-\n/// This is all the data we need to give a neighbor to open a wg connection\n/// this is also known as a \"hello\" packet or message\n#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Hash, Clone, Copy)]\n@@ -293,11 +285,6 @@ pub struct LocalIdentity {\npub global: Identity,\n}\n-#[cfg(feature = \"actix\")]\n-impl Message for LocalIdentity {\n- type Result = ();\n-}\n-\n/// This is all the data a light client needs to open a light client tunnel\n#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Hash, Clone, Copy)]\npub struct LightClientLocalIdentity {\n@@ -313,11 +300,6 @@ pub struct LightClientLocalIdentity {\npub price: u128,\n}\n-#[cfg(feature = \"actix\")]\n-impl Message for LightClientLocalIdentity {\n- type Result = ();\n-}\n-\n/// This represents a generic payment that may be to or from us\n/// when completed it contains a txid from a published transaction\n/// that should be validated against the blockchain\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove actix feature flags in althea_types The feature itself was removed in a previous commit but I missed the actual feature flags.
20,244
10.11.2021 13:02:50
18,000
cfaff6d5ee1ba04dbebb1c10178d7de63d4ae5a9
Don't construct MakePayment twice This patch avoids constructing MakePayment twice and instead just clones the value. This decreases the changes of actually returning and setting different values.
[ { "change_type": "MODIFY", "old_path": "rita_common/src/debt_keeper/mod.rs", "new_path": "rita_common/src/debt_keeper/mod.rs", "diff": "@@ -549,13 +549,10 @@ impl DebtKeeper {\ndebt_data.action = DebtAction::MakePayment {\nto: *ident,\n- amount: to_pay.clone(),\n+ amount: to_pay,\n};\n- Ok(DebtAction::MakePayment {\n- to: *ident,\n- amount: to_pay,\n- })\n+ Ok(debt_data.action.clone())\n}\n(false, false, _) => {\n// Check if there is any unapplied credit\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Don't construct MakePayment twice This patch avoids constructing MakePayment twice and instead just clones the value. This decreases the changes of actually returning and setting different values.
20,244
10.11.2021 17:43:47
18,000
d19e4cfbbf3aa5c300c2932bbde78c0424692a10
Restore Anteann forwarder in rita_client An attempt had been made to remove the antenna forwarder for placement into a distinct repo that was not reversed with much care. Resulting int he antenna forwarder code remaining in this repo but not actually being started in rita_client. This patch corrects this.
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -3203,6 +3203,7 @@ dependencies = [\n\"actix-web 0.7.19\",\n\"althea_kernel_interface\",\n\"althea_types\",\n+ \"antenna_forwarding_client\",\n\"arrayvec 0.7.2\",\n\"awc\",\n\"babel_monitor\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/src/client.rs", "new_path": "rita_bin/src/client.rs", "diff": "@@ -29,6 +29,7 @@ use rita_client::dashboard::start_client_dashboard;\nuse rita_client::get_client_usage;\nuse rita_client::logging::enable_remote_logging;\nuse rita_client::rita_loop::check_rita_client_actors;\n+use rita_client::rita_loop::start_antenna_forwarder;\nuse rita_client::rita_loop::start_rita_client_endpoints;\nuse rita_client::wait_for_settings;\nuse rita_client::Args;\n@@ -117,6 +118,7 @@ fn main() {\nstart_core_rita_endpoints(4);\nstart_rita_client_endpoints(1);\nstart_client_dashboard(settings.network.rita_dashboard_port);\n+ start_antenna_forwarder(settings);\nsystem.run();\ninfo!(\"Started Rita Client!\");\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "@@ -20,6 +20,7 @@ futures01 = { package = \"futures\", version = \"0.1\"}\nlog = { version = \"0.4\", features = [\"release_max_level_info\"] }\nalthea_types = { path = \"../althea_types\" }\nalthea_kernel_interface = { path = \"../althea_kernel_interface\" }\n+antenna_forwarding_client = { path = \"../antenna_forwarding_client\" }\nsettings = { path = \"../settings\" }\nsha3 = \"0.9\"\nlettre = \"0.9\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/rita_loop/mod.rs", "new_path": "rita_client/src/rita_loop/mod.rs", "diff": "use crate::exit_manager::exit_manager_tick;\nuse crate::heartbeat::send_udp_heartbeat;\n+use crate::heartbeat::HEARTBEAT_SERVER_KEY;\nuse crate::light_client_manager::light_client_hello_response;\nuse crate::light_client_manager::LightClientManager;\nuse crate::light_client_manager::Watch;\nuse crate::operator_fee_manager::tick_operator_payments;\nuse crate::operator_update::{OperatorUpdate, Update};\nuse crate::traffic_watcher::get_exit_dest_price;\n-use rita_common::tunnel_manager::GetNeighbors;\n-use rita_common::tunnel_manager::GetTunnels;\n-use rita_common::tunnel_manager::TunnelManager;\n-\nuse actix::{\nActor, ActorContext, Addr, Arbiter, AsyncContext, Context, Handler, Message, Supervised,\nSystem, SystemService,\n@@ -24,8 +21,13 @@ use actix_async::System as AsyncSystem;\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;\n+use rita_common::tunnel_manager::GetNeighbors;\n+use rita_common::tunnel_manager::GetTunnels;\n+use rita_common::tunnel_manager::TunnelManager;\n+use settings::client::RitaClientSettings;\nuse std::sync::atomic::{AtomicBool, Ordering};\nuse std::thread;\nuse std::time::{Duration, Instant};\n@@ -269,3 +271,25 @@ pub fn start_rita_client_endpoints(workers: usize) {\n}\n}\n}\n+\n+pub fn start_antenna_forwarder(settings: RitaClientSettings) {\n+ if metrics_permitted() {\n+ #[cfg(not(feature = \"operator_debug\"))]\n+ let url = \"operator.althea.net:33334\";\n+ #[cfg(feature = \"operator_debug\")]\n+ let url = \"192.168.10.2:33334\";\n+\n+ let our_id = settings.get_identity().unwrap();\n+ let network = settings.network;\n+ let mut interfaces = network.peer_interfaces.clone();\n+ interfaces.insert(\"br-pbs\".to_string());\n+ start_antenna_forwarding_proxy(\n+ url.to_string(),\n+ our_id,\n+ *HEARTBEAT_SERVER_KEY,\n+ network.wg_public_key.unwrap(),\n+ network.wg_private_key.unwrap(),\n+ interfaces,\n+ );\n+ }\n+}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Restore Anteann forwarder in rita_client An attempt had been made to remove the antenna forwarder for placement into a distinct repo that was not reversed with much care. Resulting int he antenna forwarder code remaining in this repo but not actually being started in rita_client. This patch corrects this.
20,244
14.11.2021 18:22:42
18,000
b40ea8562919defb7e6538a01756d94516623116
Bump for Beta 18 RC7
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -321,7 +321,7 @@ dependencies = [\n\"serde_urlencoded 0.7.0\",\n\"smallvec 1.7.0\",\n\"socket2 0.4.2\",\n- \"time 0.3.4\",\n+ \"time 0.3.5\",\n\"url 2.2.2\",\n]\n@@ -802,9 +802,9 @@ checksum = \"4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b\"\n[[package]]\nname = \"cc\"\n-version = \"1.0.71\"\n+version = \"1.0.72\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd\"\n+checksum = \"22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee\"\ndependencies = [\n\"jobserver\",\n]\n@@ -1696,9 +1696,9 @@ checksum = \"7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70\"\n[[package]]\nname = \"hex-literal\"\n-version = \"0.3.3\"\n+version = \"0.3.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"21e4590e13640f19f249fe3e4eca5113bc4289f2497710378190e7f4bd96f45b\"\n+checksum = \"7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0\"\n[[package]]\nname = \"hostname\"\n@@ -3160,7 +3160,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.18.6\"\n+version = \"0.18.7\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3196,7 +3196,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.18.6\"\n+version = \"0.18.7\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3237,7 +3237,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.18.6\"\n+version = \"0.18.7\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3278,7 +3278,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.18.6\"\n+version = \"0.18.7\"\ndependencies = [\n\"actix 0.7.11\",\n\"actix-web 0.7.19\",\n@@ -3539,9 +3539,9 @@ dependencies = [\n[[package]]\nname = \"serde_json\"\n-version = \"1.0.69\"\n+version = \"1.0.70\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e466864e431129c7e0d3476b92f20458e5879919a0596c6472738d9fa2d342f8\"\n+checksum = \"e277c495ac6cd1a01a58d0a0c574568b4d1ddf14f59965c6a58b8d96400b54f3\"\ndependencies = [\n\"itoa\",\n\"ryu\",\n@@ -3902,9 +3902,9 @@ dependencies = [\n[[package]]\nname = \"time\"\n-version = \"0.3.4\"\n+version = \"0.3.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"99beeb0daeac2bd1e86ac2c21caddecb244b39a093594da1a661ec2060c7aedd\"\n+checksum = \"41effe7cfa8af36f439fac33861b66b049edc6f9a32331e2312660529c1c24ad\"\ndependencies = [\n\"itoa\",\n\"libc\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.18.6\"\n+version = \"0.18.7\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\nbuild = \"build.rs\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "[package]\nname = \"rita_client\"\n-version = \"0.18.6\"\n+version = \"0.18.7\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "[package]\nname = \"rita_common\"\n-version = \"0.18.6\"\n+version = \"0.18.7\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/dashboard/own_info.rs", "new_path": "rita_common/src/dashboard/own_info.rs", "diff": "@@ -5,7 +5,7 @@ use clarity::Address;\nuse failure::Error;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 18 RC6\";\n+pub static READABLE_VERSION: &str = \"Beta 18 RC7\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/Cargo.toml", "new_path": "rita_exit/Cargo.toml", "diff": "[package]\nname = \"rita_exit\"\n-version = \"0.18.6\"\n+version = \"0.18.7\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 18 RC7
20,247
17.11.2021 16:10:16
28,800
bef3ce3f88993e374bfd86f89a61edf415ed2d64
Restrict e5600 to 5ghz channel 36
[ { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/wifi.rs", "new_path": "rita_client/src/dashboard/wifi.rs", "diff": "@@ -24,8 +24,8 @@ pub const ALLOWED_FIVE_40: [u16; 12] = [36, 44, 52, 60, 100, 108, 116, 124, 132,\npub const ALLOWED_FIVE_80: [u16; 6] = [36, 52, 100, 116, 132, 149];\n/// list of nonoverlapping 80mhz channels for the GLB1300/EA6350v3\npub const ALLOWED_FIVE_80_IPQ40XX: [u16; 2] = [36, 149];\n-/// list of nonoverlapping 80mhz channels for the TPLink-a6v3/wr-2100\n-pub const ALLOWED_FIVE_80_TPLINK_A6V3: [u16; 1] = [36];\n+/// list of nonoverlapping 80mhz channels for the TPLink-a6v3/wr-2100/e5600\n+pub const ALLOWED_FIVE_80_MT7621: [u16; 1] = [36];\n/// list of nonoverlapping 160mhz channels generally legal in NA, SA, EU, AU\npub const ALLOWED_FIVE_160: [u16; 2] = [36, 100];\n@@ -361,14 +361,16 @@ fn validate_channel(\n\"80\".to_string(),\nformat!(\"{:?}\", ALLOWED_FIVE_80_IPQ40XX),\n))\n- } else if (mdl.contains(\"tplink_archer-a6-v3\") || mdl.contains(\"cudy_wr2100\"))\n+ } else if (mdl.contains(\"tplink_archer-a6-v3\")\n+ || mdl.contains(\"cudy_wr2100\")\n+ || mdl.contains(\"linksys_e5600\"))\n&& new_is_five\n&& channel_width_is_80\n- && !ALLOWED_FIVE_80_TPLINK_A6V3.contains(&new_val)\n+ && !ALLOWED_FIVE_80_MT7621.contains(&new_val)\n{\nErr(ValidationError::BadChannel(\n\"80\".to_string(),\n- format!(\"{:?}\", ALLOWED_FIVE_80_TPLINK_A6V3),\n+ format!(\"{:?}\", ALLOWED_FIVE_80_MT7621),\n))\n} else {\nOk(())\n@@ -401,10 +403,11 @@ pub fn get_allowed_wifi_channels(radio: Path<String>) -> Result<HttpResponse, Er\nOk(HttpResponse::Ok().json(ALLOWED_FIVE_80_IPQ40XX))\n} else if model.is_some()\n&& (model.clone().unwrap().contains(\"tplink_archer-a6-v3\")\n- || model.unwrap().contains(\"cudy_wr2100\"))\n+ || model.clone().unwrap().contains(\"cudy_wr2100\")\n+ || model.unwrap().contains(\"linksys_e5600\"))\n&& five_channel_width.contains(\"80\")\n{\n- Ok(HttpResponse::Ok().json(ALLOWED_FIVE_80_TPLINK_A6V3))\n+ Ok(HttpResponse::Ok().json(ALLOWED_FIVE_80_MT7621))\n// model specific values end here\n} else if five_channel_width.contains(\"20\") {\nOk(HttpResponse::Ok().json(ALLOWED_FIVE_20))\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Restrict e5600 to 5ghz channel 36
20,247
01.12.2021 10:38:27
28,800
92e422e24627dd1045d2e3666fe5debd2f89d6a2
Move enable_remote_logging fn into rita_common This is used by all rita derivatives and can live in rita_common with only minor changes that make no assumptions about the client binary.
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -3254,6 +3254,7 @@ dependencies = [\n\"byteorder\",\n\"bytes 1.1.0\",\n\"clarity\",\n+ \"compressed_log\",\n\"docopt\",\n\"failure\",\n\"flate2\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/src/client.rs", "new_path": "rita_bin/src/client.rs", "diff": "@@ -27,12 +27,12 @@ use althea_kernel_interface::LinuxCommandRunner;\nuse docopt::Docopt;\nuse rita_client::dashboard::start_client_dashboard;\nuse rita_client::get_client_usage;\n-use rita_client::logging::enable_remote_logging;\nuse rita_client::rita_loop::check_rita_client_actors;\nuse rita_client::rita_loop::start_antenna_forwarder;\nuse rita_client::rita_loop::start_rita_client_endpoints;\nuse rita_client::wait_for_settings;\nuse rita_client::Args;\n+use rita_common::logging::enable_remote_logging;\nuse rita_common::rita_loop::check_rita_common_actors;\nuse rita_common::rita_loop::start_core_rita_endpoints;\nuse rita_common::utils::env_vars_contains;\n@@ -89,7 +89,15 @@ fn main() {\nif !should_remote_log || env_vars_contains(\"NO_REMOTE_LOG\") {\nenv_logger::init();\n} else {\n- let res = enable_remote_logging();\n+ let log = settings.log.clone();\n+ let key = settings\n+ .network\n+ .wg_public_key\n+ .expect(\"Tried to init remote logging without WgKey!\");\n+\n+ let res =\n+ enable_remote_logging(\"rita\".to_string(), log.dest_url, log.level, key.to_string());\n+\nprintln!(\"logging status {:?}\", res);\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/src/exit.rs", "new_path": "rita_bin/src/exit.rs", "diff": "@@ -23,11 +23,11 @@ static GLOBAL: Jemalloc = Jemalloc;\nextern crate log;\nuse docopt::Docopt;\n+use rita_common::logging::enable_remote_logging;\nuse rita_common::rita_loop::check_rita_common_actors;\nuse rita_common::rita_loop::start_core_rita_endpoints;\nuse rita_common::utils::env_vars_contains;\nuse rita_exit::database::sms::send_admin_notification_sms;\n-use rita_exit::logging::enable_remote_logging;\nuse rita_exit::rita_loop::check_rita_exit_actors;\nuse rita_exit::rita_loop::start_rita_exit_endpoints;\nuse rita_exit::rita_loop::start_rita_exit_loop;\n@@ -78,7 +78,16 @@ fn main() {\nif !should_remote_log || env_vars_contains(\"NO_REMOTE_LOG\") {\nenv_logger::init();\n} else {\n- let res = enable_remote_logging();\n+ let logging_url: String = \"https://stats.altheamesh.com:9999/compressed_sink\".into();\n+ let level: String = \"INFO\".to_string();\n+\n+ let key = settings\n+ .network\n+ .wg_public_key\n+ .expect(\"Tried to init remote logging without WgKey!\");\n+\n+ let res =\n+ enable_remote_logging(\"rita_exit\".to_string(), logging_url, level, key.to_string());\nprintln!(\"logging status {:?}\", res);\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "@@ -13,6 +13,7 @@ hex-literal = \"0.3\"\ndocopt = \"1.1\"\nserde = \"1.0\"\nbytes = \"1.0\"\n+compressed_log = \"0.3.9\"\nbyteorder = { version = \"1.4\", features = [\"i128\"] }\narrayvec = {version= \"0.7\", features = [\"serde\"]}\nbabel_monitor = { path = \"../babel_monitor\" }\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/lib.rs", "new_path": "rita_common/src/lib.rs", "diff": "@@ -23,6 +23,7 @@ pub mod blockchain_oracle;\npub mod dashboard;\npub mod debt_keeper;\npub mod hello_handler;\n+pub mod logging;\npub mod middleware;\npub mod network_endpoints;\npub mod network_monitor;\n@@ -47,6 +48,7 @@ pub use crate::dashboard::token_bridge::*;\npub use crate::dashboard::usage::*;\npub use crate::dashboard::wallet::*;\npub use crate::dashboard::wg_key::*;\n+pub use crate::logging::*;\npub use crate::peer_listener::message::*;\npub use crate::rita_loop::fast_loop::*;\npub use crate::rita_loop::slow_loop::*;\n" }, { "change_type": "RENAME", "old_path": "rita_exit/src/logging.rs", "new_path": "rita_common/src/logging.rs", "diff": "@@ -5,16 +5,17 @@ use log::LevelFilter;\nuse log::Record;\n/// enables remote logging if the user has configured it\n-pub fn enable_remote_logging() -> Result<(), Error> {\n+pub fn enable_remote_logging(\n+ log_label: String,\n+ log_url: String,\n+ log_level: String,\n+ wg_public_key: String,\n+) -> Result<(), Error> {\ntrace!(\"About to enable remote logging\");\n-\n- let logging_url = \"https://stats.altheamesh.com:9999/compressed_sink\";\n- let level = LevelFilter::Info;\n-\n- let key = settings::get_rita_exit()\n- .network\n- .wg_public_key\n- .expect(\"Tried to init remote logging without WgKey!\");\n+ let level: LevelFilter = match log_level.parse() {\n+ Ok(level) => level,\n+ Err(_) => LevelFilter::Error,\n+ };\nlet logger = LoggerBuilder::default()\n.set_level(\n@@ -23,13 +24,14 @@ pub fn enable_remote_logging() -> Result<(), Error> {\n.ok_or_else(|| format_err!(\"Unable to convert level filter to a level\"))?,\n)\n.set_compression_level(Compression::Fast)\n- .set_sink_url(logging_url)\n- .set_threshold(1_000)\n+ .set_sink_url(log_url.as_str())\n+ .set_threshold(1000)\n.set_format(Box::new(move |record: &Record| {\nformat!(\n- \"{} {} rita_exit: {}\\n\",\n- key,\n+ \"{} {} {}: {}\\n\",\n+ wg_public_key,\nenv!(\"CARGO_PKG_VERSION\"),\n+ log_label,\nrecord.args()\n)\n}))\n@@ -44,9 +46,6 @@ pub fn enable_remote_logging() -> Result<(), Error> {\n}\nlog::set_max_level(level);\n- println!(\n- \"Remote compressed logging enabled with target {}\",\n- logging_url\n- );\n+ println!(\"Remote compressed logging enabled with target {}\", log_url);\nOk(())\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/lib.rs", "new_path": "rita_exit/src/lib.rs", "diff": "@@ -11,7 +11,6 @@ extern crate failure;\nextern crate serde_derive;\npub mod database;\n-pub mod logging;\npub mod network_endpoints;\npub mod rita_loop;\npub mod traffic_watcher;\n@@ -22,7 +21,6 @@ pub use crate::database::db_client::*;\npub use crate::database::email::*;\npub use crate::database::geoip::*;\npub use crate::database::sms::*;\n-pub use crate::logging::*;\nuse crate::network_endpoints::nuke_db;\nuse actix_web::http::Method;\nuse actix_web::{server, App};\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Move enable_remote_logging fn into rita_common This is used by all rita derivatives and can live in rita_common with only minor changes that make no assumptions about the client binary.
20,255
29.11.2021 14:44:31
28,800
6b248a060813631ed97fe088c65cb6644524af77
Made changes for optools dev enviornment when the dev_env flag is enabled, we report to localhost(0.0.0.0) instead of 192.168.10.2 for operator checkin, heartbeats, wyre payments and antenna forwarder
[ { "change_type": "MODIFY", "old_path": "Cargo.toml", "new_path": "Cargo.toml", "diff": "@@ -10,6 +10,7 @@ dash_debug = [\"rita_bin/dash_debug\"]\nserver = [\"rita_bin/server\"]\nbundle_openssl = [\"rita_bin/bundle_openssl\"]\njemalloc = [\"rita_bin/jemalloc\"]\n+optools_dev_env = [\"rita_bin/optools_dev_env\"]\n[dependencies]\nrita_bin = { path = \"./rita_bin\" }\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "@@ -59,4 +59,7 @@ server = [\"jemalloc\", \"openssl\"]\ndash_debug = []\n# changes operator urls\noperator_debug = []\n+dev_env = []\ndevelopment = [\"rita_common/dash_debug\",\"rita_client/operator_debug\"]\n+# Op tools dev environement\n+optools_dev_env = [\"rita_client/dev_env\"]\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "@@ -49,3 +49,4 @@ path = \"src/lib.rs\"\n[features]\n# changes operator urls\noperator_debug = []\n+dev_env = []\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/localization.rs", "new_path": "rita_client/src/dashboard/localization.rs", "diff": "@@ -69,10 +69,16 @@ pub fn get_wyre_reservation(\nrita_client.exit_client = exit_client;\nrita_client.operator = operator;\nsettings::set_rita_client(rita_client);\n- #[cfg(not(feature = \"operator_debug\"))]\n- let api_url = \"https://operator.althea.net:8080/wyre_reservation\";\n- #[cfg(feature = \"operator_debug\")]\n- let api_url = \"http://192.168.10.2:8080/wyre_reservation\";\n+\n+ let api_url: &str;\n+ if cfg!(feature = \"dev_env\") {\n+ api_url = \"0.0.0.0:8080/wyre_reservation\";\n+ } else if cfg!(feature = \"operator_debug\") {\n+ api_url = \"http://192.168.10.2:8080/wyre_reservation\";\n+ } else {\n+ api_url = \"https://operator.althea.net:8080/wyre_reservation\";\n+ }\n+\nBox::new(\nclient::post(&api_url)\n.timeout(Duration::from_secs(10))\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/heartbeat/mod.rs", "new_path": "rita_client/src/heartbeat/mod.rs", "diff": "@@ -79,10 +79,17 @@ lazy_static! {\n}\npub fn send_udp_heartbeat() {\n- #[cfg(not(feature = \"operator_debug\"))]\n- let heartbeat_url = \"operator.althea.net:33333\";\n- #[cfg(feature = \"operator_debug\")]\n- let heartbeat_url = \"192.168.10.2:33333\";\n+ let heartbeat_url: &str;\n+ if cfg!(feature = \"dev_env\") {\n+ heartbeat_url = \"0.0.0.0:33333\";\n+ info!(\"We are using localhost heartbeart url\");\n+ } else if cfg!(feature = \"operator_debug\") {\n+ heartbeat_url = \"192.168.10.2:33333\";\n+ info!(\"We are setting operator debug heartbeart url\");\n+ } else {\n+ heartbeat_url = \"operator.althea.net:33333\";\n+ info!(\"We are setting regular heartbeart url\");\n+ }\ntrace!(\"attempting to send heartbeat\");\nlet dns_request = Resolver::from_registry()\n@@ -195,7 +202,6 @@ pub fn send_udp_heartbeat() {\n// this is intentional behavior, if we have multiple DNS records we should\n// send heartbeats to all of them\nfor dns_socket in hb_cache.dns.iter() {\n- trace!(\"sending heartbeat\");\nsend_udp_heartbeat_packet(\ndns_socket,\nour_id,\n@@ -285,20 +291,27 @@ fn send_udp_heartbeat_packet(\nlet their_publickey = their_publickey.into();\ndrop(network_settings);\n- let remote_ip = dns_socket.ip();\nlet remote_port = dns_socket.port();\nlet remote = dns_socket;\n- let local_socketaddr = SocketAddr::from(([0, 0, 0, 0], remote_port));\n+ // Senders address is dummy\n+ let local_socketaddr = SocketAddr::from(([0, 0, 0, 0], remote_port + 2));\n+\nlet local_socket = match UdpSocket::bind(&local_socketaddr) {\nOk(s) => s,\nErr(e) => {\n- error!(\"Couldn't bind to UDP heartbeat socket {:?}\", e);\n+ error!(\n+ \"Couldn't bind to UDP heartbeat socket of addr {:?} with error {:?}\",\n+ local_socketaddr, e\n+ );\nreturn;\n}\n};\n- trace!(\"Sending heartbeat to {:?}\", remote_ip);\n+ info!(\n+ \"Sending heartbeat to {:?} from {:?}\",\n+ remote, local_socketaddr\n+ );\nlet mut rita_client = settings::get_rita_client();\nlet payment = rita_client.payment;\nlet message = HeartbeatMessage {\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/operator_update/mod.rs", "new_path": "rita_client/src/operator_update/mod.rs", "diff": "@@ -129,10 +129,14 @@ impl Handler<Update> for OperatorUpdate {\n/// Checks in with the operator server\nfn checkin() {\n- #[cfg(not(feature = \"operator_debug\"))]\n- let url = \"https://operator.althea.net:8080/checkin\";\n- #[cfg(feature = \"operator_debug\")]\n- let url = \"http://192.168.10.2:8080/checkin\";\n+ let url: &str;\n+ if cfg!(feature = \"dev_env\") {\n+ url = \"http://0.0.0.0:8080/checkin\";\n+ } else if cfg!(feature = \"operator_debug\") {\n+ url = \"http://192.168.10.2:8080/checkin\";\n+ } else {\n+ url = \"https://operator.althea.net:8080/checkin\";\n+ }\nlet rita_client = settings::get_rita_client();\nlet id = rita_client.get_identity().unwrap();\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/rita_loop/mod.rs", "new_path": "rita_client/src/rita_loop/mod.rs", "diff": "@@ -274,10 +274,14 @@ pub fn start_rita_client_endpoints(workers: usize) {\npub fn start_antenna_forwarder(settings: RitaClientSettings) {\nif metrics_permitted() {\n- #[cfg(not(feature = \"operator_debug\"))]\n- let url = \"operator.althea.net:33334\";\n- #[cfg(feature = \"operator_debug\")]\n- let url = \"192.168.10.2:33334\";\n+ let url: &str;\n+ if cfg!(feature = \"dev_env\") {\n+ url = \"0.0.0.0:33300\";\n+ } else if cfg!(feature = \"operator_debug\") {\n+ url = \"192.168.10.2:33334\";\n+ } else {\n+ url = \"operator.althea.net:33334\";\n+ }\nlet our_id = settings.get_identity().unwrap();\nlet network = settings.network;\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Made changes for optools dev enviornment when the dev_env flag is enabled, we report to localhost(0.0.0.0) instead of 192.168.10.2 for operator checkin, heartbeats, wyre payments and antenna forwarder
20,255
06.12.2021 10:21:24
28,800
27ecbb264587fc05d4223a2f857b4767e8dcea9b
Removed "use satackey/action-docker-layer-caching@v0.0.11" in github ci
[ { "change_type": "MODIFY", "old_path": ".github/workflows/rust.yml", "new_path": ".github/workflows/rust.yml", "diff": "@@ -93,7 +93,6 @@ jobs:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v2\n- - uses: satackey/action-docker-layer-caching@v0.0.11\n- name: Install Wireguard\nrun: sudo apt-get update && sudo apt install -y wireguard linux-source linux-headers-$(uname -r) build-essential && sudo modprobe wireguard\n- name: Run integration test\n@@ -103,7 +102,6 @@ jobs:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v2\n- - uses: satackey/action-docker-layer-caching@v0.0.11\n- name: Install Wireguard\nrun: sudo apt-get update && sudo apt install -y wireguard linux-source linux-headers-$(uname -r) build-essential && sudo modprobe wireguard\n- name: Run integration test\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Removed "use satackey/action-docker-layer-caching@v0.0.11" in github ci
20,244
06.12.2021 16:30:58
18,000
cfce68664ffe74c94acef426897018d1aa7ff87a
Bump for Beta 18 RC8
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -3160,7 +3160,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.18.7\"\n+version = \"0.18.8\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3196,7 +3196,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.18.7\"\n+version = \"0.18.8\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3237,7 +3237,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.18.7\"\n+version = \"0.18.8\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.18.7\"\n+version = \"0.18.8\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\nbuild = \"build.rs\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "[package]\nname = \"rita_client\"\n-version = \"0.18.7\"\n+version = \"0.18.8\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "[package]\nname = \"rita_common\"\n-version = \"0.18.7\"\n+version = \"0.18.8\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/dashboard/own_info.rs", "new_path": "rita_common/src/dashboard/own_info.rs", "diff": "@@ -5,7 +5,7 @@ use clarity::Address;\nuse failure::Error;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 18 RC7\";\n+pub static READABLE_VERSION: &str = \"Beta 18 RC8\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 18 RC8
20,255
06.12.2021 14:07:24
28,800
bf3e596139a44e4c0dfaf8ca71fffa018dd48a49
Fixed new clippy for rust update
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/udp_socket_table.rs", "new_path": "althea_kernel_interface/src/udp_socket_table.rs", "diff": "@@ -48,7 +48,7 @@ impl dyn KernelInterface {\nlet ports: Vec<u16> = lines\n.take_while(|line| !line.is_empty()) // until end of the table is reached,\n- .map(|line| parse_local_port(line)) // parse each udp port,\n+ .map(parse_local_port) // parse each udp port,\n.filter_map(Result::ok) // only taking those which parsed successfully\n.collect();\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/exit_manager/mod.rs", "new_path": "rita_client/src/exit_manager/mod.rs", "diff": "@@ -66,7 +66,7 @@ pub enum WarningType {\n/// This struct holds all the blacklisted ip that are considered when exit switching as well as keeps track\n/// of non reponsive exits with a penalty system. After 'n' strikes this ip is added to a the blacklist\n-#[derive(Debug, Clone)]\n+#[derive(Default, Debug, Clone)]\npub struct ExitBlacklist {\nblacklisted_exits: HashSet<IpAddr>,\npotential_blacklists: HashMap<IpAddr, u16>,\n@@ -81,15 +81,6 @@ pub struct ExitManager {\npub exit_blacklist: ExitBlacklist,\n}\n-impl Default for ExitBlacklist {\n- fn default() -> Self {\n- Self {\n- blacklisted_exits: HashSet::new(),\n- potential_blacklists: HashMap::new(),\n- }\n- }\n-}\n-\nfn linux_setup_exit_tunnel(\ncurrent_exit: &ExitServer,\ngeneral_details: &ExitDetails,\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/rita_loop/mod.rs", "new_path": "rita_client/src/rita_loop/mod.rs", "diff": "@@ -61,14 +61,9 @@ pub fn metrics_permitted() -> bool {\n.is_some()\n}\n+#[derive(Default)]\npub struct RitaLoop {}\n-impl Default for RitaLoop {\n- fn default() -> Self {\n- RitaLoop {}\n- }\n-}\n-\n// the speed in seconds for the client loop\npub const CLIENT_LOOP_SPEED: u64 = 5;\npub const CLIENT_LOOP_TIMEOUT: Duration = Duration::from_secs(4);\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/traffic_watcher/mod.rs", "new_path": "rita_client/src/traffic_watcher/mod.rs", "diff": "@@ -46,6 +46,7 @@ lazy_static! {\nArc::new(RwLock::new(TrafficWatcher::default()));\n}\n+#[derive(Default)]\npub struct TrafficWatcher {\n// last read download\nlast_read_input: u64,\n@@ -55,16 +56,6 @@ pub struct TrafficWatcher {\nlast_exit_dest_price: u128,\n}\n-impl Default for TrafficWatcher {\n- fn default() -> TrafficWatcher {\n- TrafficWatcher {\n- last_read_input: 0,\n- last_read_output: 0,\n- last_exit_dest_price: 0,\n- }\n- }\n-}\n-\n/// Used to request what the exits thinks this clients debts are. We will compare\n/// this value to our own computation and alert to any large discrepencies, but in\n/// general we have to trust the exit. In a pay per forward system nodes within the\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/dashboard/mod.rs", "new_path": "rita_common/src/dashboard/mod.rs", "diff": "@@ -16,6 +16,7 @@ pub mod usage;\npub mod wallet;\npub mod wg_key;\n+#[derive(Default)]\npub struct Dashboard;\nimpl Actor for Dashboard {\n@@ -28,9 +29,3 @@ impl SystemService for Dashboard {\ninfo!(\"Dashboard started\");\n}\n}\n-\n-impl Default for Dashboard {\n- fn default() -> Dashboard {\n- Dashboard {}\n- }\n-}\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/peer_listener/mod.rs", "new_path": "rita_common/src/peer_listener/mod.rs", "diff": "@@ -152,7 +152,6 @@ pub struct ListenInterface {\nifname: String,\nifidx: u32,\nmulticast_socketaddr: SocketAddrV6,\n- linklocal_socketaddr: SocketAddrV6,\npub multicast_socket: UdpSocket,\npub linklocal_socket: UdpSocket,\nlinklocal_ip: Ipv6Addr,\n@@ -198,7 +197,6 @@ impl ListenInterface {\nmulticast_socket,\nlinklocal_socket,\nmulticast_socketaddr,\n- linklocal_socketaddr,\nlinklocal_ip: link_ip,\n})\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/rita_loop/fast_loop.rs", "new_path": "rita_common/src/rita_loop/fast_loop.rs", "diff": "@@ -40,14 +40,9 @@ pub const FAST_LOOP_TIMEOUT: Duration = Duration::from_secs(4);\npub const TUNNEL_TIMEOUT: Duration = Duration::from_secs(900);\npub const TUNNEL_HANDSHAKE_TIMEOUT: Duration = TUNNEL_TIMEOUT;\n+#[derive(Default)]\npub struct RitaFastLoop {}\n-impl Default for RitaFastLoop {\n- fn default() -> RitaFastLoop {\n- RitaFastLoop {}\n- }\n-}\n-\nimpl Actor for RitaFastLoop {\ntype Context = Context<Self>;\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/traffic_watcher/mod.rs", "new_path": "rita_common/src/traffic_watcher/mod.rs", "diff": "@@ -21,6 +21,7 @@ use ipnetwork::IpNetwork;\nuse std::collections::HashMap;\nuse std::net::IpAddr;\n+#[derive(Default)]\npub struct TrafficWatcher;\nimpl Actor for TrafficWatcher {\n@@ -44,12 +45,6 @@ impl SystemService for TrafficWatcher {\n}\n}\n-impl Default for TrafficWatcher {\n- fn default() -> TrafficWatcher {\n- TrafficWatcher {}\n- }\n-}\n-\npub struct Watch {\n/// List of neighbors to watch\npub neighbors: Vec<Neighbor>,\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/traffic_watcher/mod.rs", "new_path": "rita_exit/src/traffic_watcher/mod.rs", "diff": "@@ -26,6 +26,8 @@ use failure::Error;\nuse ipnetwork::IpNetwork;\nuse std::collections::HashMap;\nuse std::net::IpAddr;\n+\n+#[derive(Default)]\npub struct TrafficWatcher {\nlast_seen_bytes: HashMap<WgKey, WgUsage>,\n}\n@@ -40,13 +42,6 @@ impl SystemService for TrafficWatcher {\ninfo!(\"Traffic Watcher started\");\n}\n}\n-impl Default for TrafficWatcher {\n- fn default() -> TrafficWatcher {\n- TrafficWatcher {\n- last_seen_bytes: HashMap::new(),\n- }\n- }\n-}\npub struct Watch {\npub users: Vec<Identity>,\n" }, { "change_type": "MODIFY", "old_path": "settings/src/client.rs", "new_path": "settings/src/client.rs", "diff": "@@ -63,7 +63,7 @@ pub struct OldExitServer {\n}\n/// Simple struct that keeps track of details related to the exit we are currently connected to, as well as the next potential exit to switch to\n-#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]\n+#[derive(Default, Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]\npub struct SelectedExit {\n// Exit we currently forward to\npub selected_id: Option<IpAddr>,\n@@ -79,17 +79,6 @@ pub struct SelectedExit {\npub tracking_exit: Option<IpAddr>,\n}\n-impl Default for SelectedExit {\n- fn default() -> Self {\n- SelectedExit {\n- selected_id: None,\n- selected_id_metric: None,\n- selected_id_degradation: None,\n- tracking_exit: None,\n- }\n- }\n-}\n-\n/// This is the state machine for exit switching logic. Given there are three exits we track: current, best, and tracking, there are several situations we can be in\n/// Given that there are several scenarios to be in, We use this enum to tracking our state during every tick\n///\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fixed new clippy for rust update
20,247
09.12.2021 18:47:08
28,800
a069c84497b97f208c90a4f29caa6aa2d45155ae
Exit: Add simple cross builder script Uses a docker container to provide necessary deps to cross build rita-exit
[ { "change_type": "ADD", "old_path": null, "new_path": "cross-builders/exit/Cross.toml", "diff": "+[target.x86_64-unknown-linux-gnu]\n+image = \"cross-with-clang-ssl\"\n+[target.x86_64-unknown-linux-musl]\n+image = \"cross-with-clang-ssl\"\n+\n+[build.env]\n+passthrough = [\n+ \"RUST_BACKTRACE\",\n+ \"RUST_LOG\",\n+ \"RUSTFLAGS\",\n+]\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "cross-builders/exit/Dockerfile", "diff": "+FROM rustembedded/cross:x86_64-unknown-linux-gnu-0.2.0\n+RUN apt-get update && apt-get install clang-6.0 libclang-6.0-dev llvm-dev libssl-dev postgresql-server-dev-all -y\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "scripts/build_exit.sh", "diff": "+cd cross-builders/exit\n+docker build -t cross-with-clang-ssl .\n+cp Cross.toml ../..\n+cd ../..\n+cross build --release --target x86_64-unknown-linux-gnu -p rita_bin --bin rita_exit\n+rm Cross.toml\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Exit: Add simple cross builder script Uses a docker container to provide necessary deps to cross build rita-exit
20,247
09.12.2021 18:47:44
28,800
12478a23a1f725072d5ca3c7ba0d066c4f536445
Exit: bump to v0.18.8
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -3289,7 +3289,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.18.7\"\n+version = \"0.18.8\"\ndependencies = [\n\"actix 0.7.11\",\n\"actix-web 0.7.19\",\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/Cargo.toml", "new_path": "rita_exit/Cargo.toml", "diff": "[package]\nname = \"rita_exit\"\n-version = \"0.18.7\"\n+version = \"0.18.8\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Exit: bump to v0.18.8
20,247
10.12.2021 07:24:58
28,800
00a2772b82d3740d0cab44cf1a37da3bf1e8d178
Exit: improve build script
[ { "change_type": "MODIFY", "old_path": "scripts/build_exit.sh", "new_path": "scripts/build_exit.sh", "diff": "-cd cross-builders/exit\n+#!/bin/bash\n+set -eux\n+DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\n+echo $DIR\n+\n+pushd $DIR/../cross-builders/exit\ndocker build -t cross-with-clang-ssl .\ncp Cross.toml ../..\n-cd ../..\n+popd\n+pushd $DIR/..\ncross build --release --target x86_64-unknown-linux-gnu -p rita_bin --bin rita_exit\nrm Cross.toml\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Exit: improve build script
20,247
10.12.2021 23:03:17
28,800
ec87fa49a5fb6cfa39be3b8227463f8db65a2b05
Change OpenWrt check to check for /etc/openwrt_release This failed if the hostname was changed to something custom
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/is_openwrt.rs", "new_path": "althea_kernel_interface/src/is_openwrt.rs", "diff": "@@ -4,8 +4,8 @@ use std::process::{Command, Stdio};\nimpl dyn KernelInterface {\n/// Checks if the local system is openwrt\npub fn is_openwrt(&self) -> bool {\n- let uname = Command::new(\"uname\")\n- .args(&[\"-a\"])\n+ let uname = Command::new(\"cat\")\n+ .args(&[\"/etc/openwrt_release\"])\n.stdout(Stdio::piped())\n.output()\n.unwrap();\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Change OpenWrt check to check for /etc/openwrt_release This failed if the hostname was changed to something custom
20,247
11.12.2021 08:47:59
28,800
3f817144745d7ca5bbf1238accdbda59991d0f65
Add app_name to settings This enables a default config file path, or restarting a service file based on the app_name, both of which can be overridden.
[ { "change_type": "MODIFY", "old_path": "rita_bin/src/client.rs", "new_path": "rita_bin/src/client.rs", "diff": "@@ -53,6 +53,8 @@ fn main() {\n.unwrap_or_else(|e| e.exit());\nlet settings_file = args.flag_config;\n+ println!(\"Settings file {}\", settings_file);\n+\nwait_for_settings(&settings_file);\n// load the settings file, setup a thread to save it out every so often\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/logging.rs", "new_path": "rita_client/src/dashboard/logging.rs", "diff": "@@ -16,15 +16,21 @@ pub fn remote_logging(path: Path<bool>) -> Result<HttpResponse, Error> {\nlet mut rita_client = settings::get_rita_client();\nrita_client.log.enabled = enabled;\n+\n+ let service_path: String = format!(\"/etc/init.d/{}\", rita_client.app_name);\n+\nsettings::set_rita_client(rita_client);\nif let Err(e) = settings::write_config() {\n- return Err(e);\n+ return Ok(HttpResponse::new(StatusCode::INTERNAL_SERVER_ERROR)\n+ .into_builder()\n+ .json(format!(\"Failed to write config {:?}\", e)));\n}\n- // FIXME get binary name from somewhere\n- if let Err(e) = KI.run_command(\"/etc/init.d/rita\", &[\"restart\"]) {\n- return Err(e.into());\n+ if let Err(e) = KI.run_command(service_path.as_str(), &[\"restart\"]) {\n+ return Ok(HttpResponse::new(StatusCode::INTERNAL_SERVER_ERROR)\n+ .into_builder()\n+ .json(format!(\"Failed to restart service {:?}\", e)));\n}\nOk(HttpResponse::Ok().json(()))\n@@ -52,15 +58,21 @@ pub fn remote_logging_level(path: Path<String>) -> Result<HttpResponse, Error> {\nlet mut rita_client = settings::get_rita_client();\nrita_client.log.level = log_level.to_string();\n+\n+ let service_path: String = format!(\"/etc/init.d/{}\", rita_client.app_name);\n+\nsettings::set_rita_client(rita_client);\nif let Err(e) = settings::write_config() {\n- return Err(e);\n+ return Ok(HttpResponse::new(StatusCode::INTERNAL_SERVER_ERROR)\n+ .into_builder()\n+ .json(format!(\"Failed to write config {:?}\", e)));\n}\n- // FIXME get binary name from somewhere\n- if let Err(e) = KI.run_command(\"/etc/init.d/rita\", &[\"restart\"]) {\n- return Err(e.into());\n+ if let Err(e) = KI.run_command(service_path.as_str(), &[\"restart\"]) {\n+ return Ok(HttpResponse::new(StatusCode::INTERNAL_SERVER_ERROR)\n+ .into_builder()\n+ .json(format!(\"Failed to restart service {:?}\", e)));\n}\nOk(HttpResponse::Ok().json(()))\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/lib.rs", "new_path": "rita_client/src/lib.rs", "diff": "@@ -42,23 +42,33 @@ pub use crate::dashboard::router::*;\npub use crate::dashboard::system_chain::*;\npub use crate::dashboard::usage;\npub use crate::dashboard::wifi::*;\n-use settings::client::RitaClientSettings;\n+use settings::client::{default_config_path, RitaClientSettings, APP_NAME};\nuse std::time::{Duration, Instant};\n-#[derive(Debug, Deserialize, Default)]\n+#[derive(Debug, Deserialize)]\npub struct Args {\n+ #[serde(default = \"default_config_path\")]\npub flag_config: String,\npub flag_platform: String,\npub flag_future: bool,\n}\n-// TODO we should remove --platform as it's not used, but that requires\n-// changing how rita is invoked everywhere, because that's difficult\n-// with in the field routers this is waiting on another more pressing\n-// upgrade to the init file for Rita on the routers\n+impl Default for Args {\n+ fn default() -> Self {\n+ Args {\n+ flag_config: default_config_path(),\n+ flag_platform: \"linux\".to_string(),\n+ flag_future: false,\n+ }\n+ }\n+}\n+\n+/// TODO platform is in the process of being removed as a support argument\n+/// as it's not even used. Config can still be used but has a sane default\n+/// and does not need to be specified.\npub fn get_client_usage(version: &str, git_hash: &str) -> String {\nformat!(\n- \"Usage: rita --config=<settings> --platform=<platform> [--future]\n+ \"Usage: {} [--config=<settings>] [--platform=<platform>] [--future]\nOptions:\n-c, --config=<settings> Name of config file\n-p, --platform=<platform> Platform (linux or OpenWrt)\n@@ -66,7 +76,7 @@ Options:\nAbout:\nVersion {} - {}\ngit hash {}\",\n- READABLE_VERSION, version, git_hash\n+ APP_NAME, READABLE_VERSION, version, git_hash\n)\n}\n" }, { "change_type": "MODIFY", "old_path": "settings/src/client.rs", "new_path": "settings/src/client.rs", "diff": "@@ -14,6 +14,16 @@ use std::collections::{HashMap, HashSet};\nuse std::net::IpAddr;\nuse std::path::Path;\n+pub const APP_NAME: &str = \"rita\";\n+\n+pub fn default_app_name() -> String {\n+ APP_NAME.to_string()\n+}\n+\n+pub fn default_config_path() -> String {\n+ format!(\"/etc/{}.toml\", APP_NAME)\n+}\n+\n/// This struct is used by rita to store exit specific information\n/// There is one instance per exit\n#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]\n@@ -197,6 +207,8 @@ pub struct RitaClientSettings {\npub exit_client: ExitClientSettings,\n#[serde(skip)]\npub future: bool,\n+ #[serde(default = \"default_app_name\")]\n+ pub app_name: String,\n}\nimpl RitaClientSettings {\n" }, { "change_type": "MODIFY", "old_path": "settings/src/lib.rs", "new_path": "settings/src/lib.rs", "diff": "@@ -430,6 +430,7 @@ pub fn update_config(\nnetwork: old_settings.network,\nexit_client: old_settings.exit_client.clone(),\nfuture: old_settings.future,\n+ app_name: old_settings.app_name,\n};\n// we have already updated to reading the new settings\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add app_name to settings This enables a default config file path, or restarting a service file based on the app_name, both of which can be overridden.
20,247
15.12.2021 14:56:49
28,800
aa2d2d50b1d6478e3ff37429979a05b6dd4f22fc
KI: add utility fns for setting up interfaces
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/interface_tools.rs", "new_path": "althea_kernel_interface/src/interface_tools.rs", "diff": "@@ -111,6 +111,19 @@ impl dyn KernelInterface {\nOk(ret)\n}\n+\n+ /// calls iproute2 to set an interface up or down\n+ pub fn set_if_up_down(&self, if_name: &str, up_down: &str) -> Result<(), Error> {\n+ let output = self.run_command(\"ip\", &[\"link\", \"set\", \"dev\", if_name, up_down])?;\n+ if !output.stderr.is_empty() {\n+ return Err(Error::RuntimeError(format!(\n+ \"received error setting wg interface up: {}\",\n+ String::from_utf8(output.stderr)?\n+ )));\n+ } else {\n+ Ok(())\n+ }\n+ }\n}\n#[test]\n" }, { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/ip_addr.rs", "new_path": "althea_kernel_interface/src/ip_addr.rs", "diff": "@@ -43,6 +43,36 @@ impl dyn KernelInterface {\n))),\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_mask(&self, ip: Ipv4Addr, mask: u32, 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(\n+ \"ip\",\n+ &[\"addr\", \"add\", &format!(\"{}/{}\", ip, mask), \"dev\", dev],\n+ )\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(Error::RuntimeError(format!(\"Error setting ip {}\", line)))\n+ }\n+ }\n+ None => Ok(true),\n+ },\n+ Err(e) => Err(Error::RuntimeError(format!(\n+ \"Could not decode stderr from ip with {:?}\",\n+ e\n+ ))),\n+ }\n+ }\n}\n#[test]\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
KI: add utility fns for setting up interfaces
20,247
22.12.2021 12:40:05
28,800
977fd5b874954cf66bab412c7cf8303b0571b9d4
linksys_mr8300: Enforce 5ghz radio channel ranges The first 5 GHz radio (IPQ4019) is limited to ch. 64 and below. The second 5 GHz radio (QCA9888), is limited to ch. 100 and above.
[ { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/wifi.rs", "new_path": "rita_client/src/dashboard/wifi.rs", "diff": "@@ -26,6 +26,14 @@ pub const ALLOWED_FIVE_80: [u16; 6] = [36, 52, 100, 116, 132, 149];\npub const ALLOWED_FIVE_80_IPQ40XX: [u16; 2] = [36, 149];\n/// list of nonoverlapping 80mhz channels for the TPLink-a6v3/wr-2100/e5600\npub const ALLOWED_FIVE_80_MT7621: [u16; 1] = [36];\n+/// NOTE: linksys_mr8300: The first 5 GHz radio (IPQ4019) is limited to ch. 64 and below. The second 5 GHz radio (QCA9888), is limited to ch. 100 and above.\n+pub const ALLOWED_FIVE_80_LOW: [u16; 2] = [36, 52];\n+pub const ALLOWED_FIVE_80_HIGH: [u16; 4] = [100, 116, 132, 149];\n+pub const ALLOWED_FIVE_40_LOW: [u16; 4] = [36, 44, 52, 60];\n+pub const ALLOWED_FIVE_40_HIGH: [u16; 8] = [100, 108, 116, 124, 132, 140, 149, 157];\n+\n+pub const ALLOWED_NONE: [u16; 0] = [];\n+\n/// list of nonoverlapping 160mhz channels generally legal in NA, SA, EU, AU\npub const ALLOWED_FIVE_160: [u16; 2] = [36, 100];\n@@ -179,7 +187,12 @@ fn set_channel(wifi_channel: &WifiChannel) -> Result<(), Error> {\n.parse()?;\nlet channel_width = KI.get_uci_var(&format!(\"wireless.{}.htmode\", wifi_channel.radio))?;\n- if let Err(e) = validate_channel(current_channel, wifi_channel.channel, &channel_width) {\n+ if let Err(e) = validate_channel(\n+ current_channel,\n+ wifi_channel.channel,\n+ &channel_width,\n+ wifi_channel,\n+ ) {\ninfo!(\"Setting of invalid SSID was requested: {}\", e);\nreturn Err(e.into());\n// return Ok(HttpResponse::new(StatusCode::BAD_REQUEST)\n@@ -311,6 +324,7 @@ fn validate_channel(\nold_val: u16,\nnew_val: u16,\nchannel_width: &str,\n+ wifi_channel: &WifiChannel,\n) -> Result<(), ValidationError> {\nlet old_is_two = old_val < 20;\nlet old_is_five = !old_is_two;\n@@ -372,6 +386,14 @@ fn validate_channel(\n\"80\".to_string(),\nformat!(\"{:?}\", ALLOWED_FIVE_80_MT7621),\n))\n+ }\n+ // NOTE: linksys_mr8300: The first 5 GHz radio (IPQ4019) is limited to ch. 64 and below. The second 5 GHz radio (QCA9888), is limited to ch. 100 and above.\n+ else if mdl.contains(\"linksys_mr8300\")\n+ && new_is_five\n+ && ((wifi_channel.radio == \"radio0\" && new_val > 64)\n+ || (wifi_channel.radio == \"radio2\" && new_val < 100))\n+ {\n+ Err(ValidationError::InvalidChoice)\n} else {\nOk(())\n}\n@@ -395,6 +417,18 @@ pub fn get_allowed_wifi_channels(radio: Path<String>) -> Result<HttpResponse, Er\nOk(HttpResponse::Ok().json(ALLOWED_TWO))\n// model specific values start here\n+ } else if model.is_some() && (model.clone().unwrap().contains(\"linksys_mr8300\")) {\n+ if five_channel_width.contains(\"80\") && radio == \"radio0\" {\n+ Ok(HttpResponse::Ok().json(ALLOWED_FIVE_80_LOW))\n+ } else if five_channel_width.contains(\"80\") && radio == \"radio2\" {\n+ Ok(HttpResponse::Ok().json(ALLOWED_FIVE_80_HIGH))\n+ } else if five_channel_width.contains(\"40\") && radio == \"radio0\" {\n+ Ok(HttpResponse::Ok().json(ALLOWED_FIVE_40_LOW))\n+ } else if five_channel_width.contains(\"40\") && radio == \"radio2\" {\n+ Ok(HttpResponse::Ok().json(ALLOWED_FIVE_40_HIGH))\n+ } else {\n+ Ok(HttpResponse::Ok().json(ALLOWED_NONE))\n+ }\n} else if model.is_some()\n&& (model.clone().unwrap().contains(\"gl-b1300\")\n|| model.clone().unwrap().contains(\"linksys_ea6350v3\"))\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
linksys_mr8300: Enforce 5ghz radio channel ranges The first 5 GHz radio (IPQ4019) is limited to ch. 64 and below. The second 5 GHz radio (QCA9888), is limited to ch. 100 and above.
20,244
24.12.2021 08:03:13
18,000
949186400c32e7c8c58839cfbe0e2467aaffc29e
Demote debt update logs to trace these mostly clog up the logging output and do not help at all with debugging on exits.
[ { "change_type": "MODIFY", "old_path": "rita_common/src/debt_keeper/mod.rs", "new_path": "rita_common/src/debt_keeper/mod.rs", "diff": "@@ -487,9 +487,11 @@ impl DebtKeeper {\n// the debt we started this round with\nif debt_data.debt != Int256::zero() {\n- info!(\n+ trace!(\n\"debt update for {}: debt: {}, payment balance: {}\",\n- ident.wg_public_key, debt_data.debt, debt_data.incoming_payments,\n+ ident.wg_public_key,\n+ debt_data.debt,\n+ debt_data.incoming_payments,\n);\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Demote debt update logs to trace these mostly clog up the logging output and do not help at all with debugging on exits.
20,255
29.12.2021 11:30:37
28,800
b4dd900381b5d1c281f94c7bcaf6c7b62949d40d
Bumped Clarity to 0.5
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -73,9 +73,9 @@ dependencies = [\n[[package]]\nname = \"actix-http\"\n-version = \"3.0.0-beta.16\"\n+version = \"3.0.0-beta.17\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6294c508c1413346857838356f53f45dbfd257ea31dca19470d9ce78750a7d37\"\n+checksum = \"dac76407e2be239b5e544c9d83bdac4a0d68ae188031ac0424aa3e4868a669be\"\ndependencies = [\n\"actix-codec\",\n\"actix-rt\",\n@@ -92,12 +92,11 @@ dependencies = [\n\"encoding_rs\",\n\"flate2\",\n\"futures-core\",\n- \"futures-task\",\n\"h2 0.3.9\",\n\"http 0.2.5\",\n\"httparse\",\n\"httpdate\",\n- \"itoa 0.4.8\",\n+ \"itoa 1.0.1\",\n\"language-tags 0.3.2\",\n\"local-channel\",\n\"log\",\n@@ -105,7 +104,7 @@ dependencies = [\n\"percent-encoding 2.1.0\",\n\"pin-project-lite\",\n\"rand 0.8.4\",\n- \"sha-1 0.9.8\",\n+ \"sha-1 0.10.0\",\n\"smallvec 1.7.0\",\n\"zstd\",\n]\n@@ -116,8 +115,8 @@ version = \"0.2.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6\"\ndependencies = [\n- \"quote 1.0.10\",\n- \"syn 1.0.82\",\n+ \"quote 1.0.14\",\n+ \"syn 1.0.84\",\n]\n[[package]]\n@@ -174,9 +173,9 @@ dependencies = [\n[[package]]\nname = \"actix-server\"\n-version = \"2.0.0-rc.1\"\n+version = \"2.0.0-rc.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"78c9b22794b8af1c2e02434873ef858f2a7db40dbbf861ce77a04cd81ac6b767\"\n+checksum = \"29b7894a5b47aa84e15fbe8d89ee953568296a3739c5f6e6b5858802a561390c\"\ndependencies = [\n\"actix-rt\",\n\"actix-service\",\n@@ -203,9 +202,9 @@ dependencies = [\n[[package]]\nname = \"actix-tls\"\n-version = \"3.0.0-rc.2\"\n+version = \"3.0.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"bcebfd4a6255a2a75b7b87c1a3a723c57f08293ca9a7fade692e94515585f7a6\"\n+checksum = \"b5ef5760747cdfb108a1f35e6911a7a40939da893f95e035f9eee0c18b4b4025\"\ndependencies = [\n\"actix-codec\",\n\"actix-rt\",\n@@ -286,9 +285,9 @@ dependencies = [\n[[package]]\nname = \"actix-web\"\n-version = \"4.0.0-beta.15\"\n+version = \"4.0.0-beta.18\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4609cf57246040316642d4dc4c03d7f3d4a083a892122829dbd9e6ec8db7cd67\"\n+checksum = \"a542a92e385844d988b34f1af289dbb0ca927c23740076a56fdf770b1af69fbc\"\ndependencies = [\n\"actix-codec\",\n\"actix-http\",\n@@ -307,12 +306,11 @@ dependencies = [\n\"encoding_rs\",\n\"futures-core\",\n\"futures-util\",\n- \"itoa 0.4.8\",\n+ \"itoa 1.0.1\",\n\"language-tags 0.3.2\",\n\"log\",\n\"mime\",\n\"once_cell\",\n- \"paste\",\n\"pin-project-lite\",\n\"regex\",\n\"serde 1.0.132\",\n@@ -331,9 +329,9 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"30a90b7f6c2fde9a1fe3df4da758c2c3c9d620dfa3eae4da0b6925dc0a13444a\"\ndependencies = [\n\"actix-router\",\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n- \"syn 1.0.82\",\n+ \"proc-macro2 1.0.36\",\n+ \"quote 1.0.14\",\n+ \"syn 1.0.84\",\n]\n[[package]]\n@@ -363,9 +361,9 @@ version = \"0.6.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"6d44b8fee1ced9671ba043476deddef739dd0959bf77030b26b738cc591737a7\"\ndependencies = [\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n- \"syn 1.0.82\",\n+ \"proc-macro2 1.0.36\",\n+ \"quote 1.0.14\",\n+ \"syn 1.0.84\",\n]\n[[package]]\n@@ -391,7 +389,7 @@ checksum = \"fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47\"\ndependencies = [\n\"getrandom\",\n\"once_cell\",\n- \"version_check 0.9.3\",\n+ \"version_check 0.9.4\",\n]\n[[package]]\n@@ -549,9 +547,9 @@ checksum = \"cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a\"\n[[package]]\nname = \"awc\"\n-version = \"3.0.0-beta.14\"\n+version = \"3.0.0-beta.17\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8c7f4bbe98c31efbf5182545d1b0a423df909ee27281c66f3c9aaeb58120cf8b\"\n+checksum = \"2e79692bb8a7966b27f7e908a3bcb46c4ba4eb41ffb736344481b1ace08865d0\"\ndependencies = [\n\"actix-codec\",\n\"actix-http\",\n@@ -563,13 +561,13 @@ dependencies = [\n\"base64 0.13.0\",\n\"bytes 1.1.0\",\n\"cfg-if 1.0.0\",\n- \"cookie 0.15.1\",\n+ \"cookie 0.16.0\",\n\"derive_more\",\n\"futures-core\",\n\"futures-util\",\n\"h2 0.3.9\",\n\"http 0.2.5\",\n- \"itoa 0.4.8\",\n+ \"itoa 1.0.1\",\n\"log\",\n\"mime\",\n\"openssl\",\n@@ -637,12 +635,6 @@ dependencies = [\n\"rustc-demangle\",\n]\n-[[package]]\n-name = \"base-x\"\n-version = \"0.2.8\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b\"\n-\n[[package]]\nname = \"base64\"\nversion = \"0.9.3\"\n@@ -716,6 +708,15 @@ dependencies = [\n\"generic-array 0.14.4\",\n]\n+[[package]]\n+name = \"block-buffer\"\n+version = \"0.10.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"f1d36a02058e76b040de25a4464ba1c80935655595b661505c8b39b664828b95\"\n+dependencies = [\n+ \"generic-array 0.14.4\",\n+]\n+\n[[package]]\nname = \"block-padding\"\nversion = \"0.1.5\"\n@@ -842,9 +843,9 @@ dependencies = [\n[[package]]\nname = \"clarity\"\n-version = \"0.4.16\"\n+version = \"0.5.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"309ac0ae526b740d40038944bf41c3679acb212657154e1f6bb678704cba37da\"\n+checksum = \"f8b52c587db3d2ad2be8ee522fda467592adfb2ff39d474993e31232f64780c6\"\ndependencies = [\n\"lazy_static\",\n\"num-bigint 0.4.3\",\n@@ -855,7 +856,7 @@ dependencies = [\n\"serde-rlp\",\n\"serde_bytes\",\n\"serde_derive\",\n- \"sha3\",\n+ \"sha3 0.10.0\",\n]\n[[package]]\n@@ -923,12 +924,6 @@ dependencies = [\n\"yaml-rust\",\n]\n-[[package]]\n-name = \"const_fn\"\n-version = \"0.4.8\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7\"\n-\n[[package]]\nname = \"convert_case\"\nversion = \"0.4.0\"\n@@ -947,13 +942,13 @@ dependencies = [\n[[package]]\nname = \"cookie\"\n-version = \"0.15.1\"\n+version = \"0.16.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d5f1c7727e460397e56abc4bddc1d49e07a1ad78fc98eb2e1c8f032a58a2f80d\"\n+checksum = \"94d4706de1b0fa5b132270cddffa8585166037822e260a944fe161acd137ca05\"\ndependencies = [\n\"percent-encoding 2.1.0\",\n- \"time 0.2.27\",\n- \"version_check 0.9.3\",\n+ \"time 0.3.5\",\n+ \"version_check 0.9.4\",\n]\n[[package]]\n@@ -1077,6 +1072,15 @@ dependencies = [\n\"lazy_static\",\n]\n+[[package]]\n+name = \"crypto-common\"\n+version = \"0.1.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"683d6b536309245c849479fba3da410962a43ed8e51c26b729208ec0ac2798d0\"\n+dependencies = [\n+ \"generic-array 0.14.4\",\n+]\n+\n[[package]]\nname = \"crypto-mac\"\nversion = \"0.8.0\"\n@@ -1094,10 +1098,10 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321\"\ndependencies = [\n\"convert_case\",\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n+ \"proc-macro2 1.0.36\",\n+ \"quote 1.0.14\",\n\"rustc_version 0.4.0\",\n- \"syn 1.0.82\",\n+ \"syn 1.0.84\",\n]\n[[package]]\n@@ -1119,9 +1123,9 @@ version = \"1.4.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3\"\ndependencies = [\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n- \"syn 1.0.82\",\n+ \"proc-macro2 1.0.36\",\n+ \"quote 1.0.14\",\n+ \"syn 1.0.84\",\n]\n[[package]]\n@@ -1143,10 +1147,15 @@ dependencies = [\n]\n[[package]]\n-name = \"discard\"\n-version = \"1.0.4\"\n+name = \"digest\"\n+version = \"0.10.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0\"\n+checksum = \"b697d66081d42af4fba142d56918a3cb21dc8eb63372c6b85d14f44fb9c5979b\"\n+dependencies = [\n+ \"block-buffer 0.10.0\",\n+ \"crypto-common\",\n+ \"generic-array 0.14.4\",\n+]\n[[package]]\nname = \"docopt\"\n@@ -1349,9 +1358,9 @@ version = \"0.1.8\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4\"\ndependencies = [\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n- \"syn 1.0.82\",\n+ \"proc-macro2 1.0.36\",\n+ \"quote 1.0.14\",\n+ \"syn 1.0.84\",\n\"synstructure\",\n]\n@@ -1518,9 +1527,9 @@ version = \"0.3.19\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"6dbd947adfffb0efc70599b3ddcf7b5597bb5fa9e245eb99f62b3a5f7bb8bd3c\"\ndependencies = [\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n- \"syn 1.0.82\",\n+ \"proc-macro2 1.0.36\",\n+ \"quote 1.0.14\",\n+ \"syn 1.0.84\",\n]\n[[package]]\n@@ -1576,7 +1585,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817\"\ndependencies = [\n\"typenum\",\n- \"version_check 0.9.3\",\n+ \"version_check 0.9.4\",\n]\n[[package]]\n@@ -2336,7 +2345,7 @@ checksum = \"ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af\"\ndependencies = [\n\"lexical-core\",\n\"memchr\",\n- \"version_check 0.9.3\",\n+ \"version_check 0.9.4\",\n]\n[[package]]\n@@ -2424,9 +2433,9 @@ version = \"0.3.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d\"\ndependencies = [\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n- \"syn 1.0.82\",\n+ \"proc-macro2 1.0.36\",\n+ \"quote 1.0.14\",\n+ \"syn 1.0.84\",\n]\n[[package]]\n@@ -2731,9 +2740,9 @@ checksum = \"99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55\"\ndependencies = [\n\"pest\",\n\"pest_meta\",\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n- \"syn 1.0.82\",\n+ \"proc-macro2 1.0.36\",\n+ \"quote 1.0.14\",\n+ \"syn 1.0.84\",\n]\n[[package]]\n@@ -2800,12 +2809,6 @@ dependencies = [\n\"vcpkg\",\n]\n-[[package]]\n-name = \"proc-macro-hack\"\n-version = \"0.5.19\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5\"\n-\n[[package]]\nname = \"proc-macro2\"\nversion = \"0.4.30\"\n@@ -2817,9 +2820,9 @@ dependencies = [\n[[package]]\nname = \"proc-macro2\"\n-version = \"1.0.34\"\n+version = \"1.0.36\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"2f84e92c0f7c9d58328b85a78557813e4bd845130db68d7184635344399423b1\"\n+checksum = \"c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029\"\ndependencies = [\n\"unicode-xid 0.2.2\",\n]\n@@ -2856,11 +2859,11 @@ dependencies = [\n[[package]]\nname = \"quote\"\n-version = \"1.0.10\"\n+version = \"1.0.14\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05\"\n+checksum = \"47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d\"\ndependencies = [\n- \"proc-macro2 1.0.34\",\n+ \"proc-macro2 1.0.36\",\n]\n[[package]]\n@@ -3160,7 +3163,7 @@ dependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n\"actix-web 0.7.19\",\n- \"actix-web 4.0.0-beta.15\",\n+ \"actix-web 4.0.0-beta.18\",\n\"actix-web-httpauth\",\n\"actix_derive 0.6.0\",\n\"althea_kernel_interface\",\n@@ -3222,7 +3225,7 @@ dependencies = [\n\"serde_derive\",\n\"serde_json\",\n\"settings\",\n- \"sha3\",\n+ \"sha3 0.9.1\",\n\"sodiumoxide\",\n\"tokio 0.1.22\",\n\"tokio-codec\",\n@@ -3516,9 +3519,9 @@ version = \"1.0.132\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"ecc0db5cb2556c0e558887d9bbdcf6ac4471e83ff66cf696e5419024d1606276\"\ndependencies = [\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n- \"syn 1.0.82\",\n+ \"proc-macro2 1.0.36\",\n+ \"quote 1.0.14\",\n+ \"syn 1.0.84\",\n]\n[[package]]\n@@ -3593,15 +3596,13 @@ dependencies = [\n[[package]]\nname = \"sha-1\"\n-version = \"0.9.8\"\n+version = \"0.10.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6\"\n+checksum = \"028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f\"\ndependencies = [\n- \"block-buffer 0.9.0\",\n\"cfg-if 1.0.0\",\n\"cpufeatures\",\n- \"digest 0.9.0\",\n- \"opaque-debug 0.3.0\",\n+ \"digest 0.10.1\",\n]\n[[package]]\n@@ -3622,6 +3623,16 @@ dependencies = [\n\"opaque-debug 0.3.0\",\n]\n+[[package]]\n+name = \"sha3\"\n+version = \"0.10.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"31f935e31cf406e8c0e96c2815a5516181b7004ae8c5f296293221e9b1e356bd\"\n+dependencies = [\n+ \"digest 0.10.1\",\n+ \"keccak\",\n+]\n+\n[[package]]\nname = \"signal-hook-registry\"\nversion = \"1.4.0\"\n@@ -3697,70 +3708,12 @@ version = \"1.2.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3\"\n-[[package]]\n-name = \"standback\"\n-version = \"0.2.17\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff\"\n-dependencies = [\n- \"version_check 0.9.3\",\n-]\n-\n[[package]]\nname = \"static_assertions\"\nversion = \"1.1.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f\"\n-[[package]]\n-name = \"stdweb\"\n-version = \"0.4.20\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5\"\n-dependencies = [\n- \"discard\",\n- \"rustc_version 0.2.3\",\n- \"stdweb-derive\",\n- \"stdweb-internal-macros\",\n- \"stdweb-internal-runtime\",\n- \"wasm-bindgen\",\n-]\n-\n-[[package]]\n-name = \"stdweb-derive\"\n-version = \"0.5.3\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef\"\n-dependencies = [\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n- \"serde 1.0.132\",\n- \"serde_derive\",\n- \"syn 1.0.82\",\n-]\n-\n-[[package]]\n-name = \"stdweb-internal-macros\"\n-version = \"0.2.9\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11\"\n-dependencies = [\n- \"base-x\",\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n- \"serde 1.0.132\",\n- \"serde_derive\",\n- \"serde_json\",\n- \"sha1\",\n- \"syn 1.0.82\",\n-]\n-\n-[[package]]\n-name = \"stdweb-internal-runtime\"\n-version = \"0.1.5\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0\"\n-\n[[package]]\nname = \"string\"\nversion = \"0.2.1\"\n@@ -3795,12 +3748,12 @@ dependencies = [\n[[package]]\nname = \"syn\"\n-version = \"1.0.82\"\n+version = \"1.0.84\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59\"\n+checksum = \"ecb2e6da8ee5eb9a61068762a32fa9619cc591ceb055b3687f4cd4051ec2e06b\"\ndependencies = [\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n+ \"proc-macro2 1.0.36\",\n+ \"quote 1.0.14\",\n\"unicode-xid 0.2.2\",\n]\n@@ -3810,9 +3763,9 @@ version = \"0.12.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f\"\ndependencies = [\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n- \"syn 1.0.82\",\n+ \"proc-macro2 1.0.36\",\n+ \"quote 1.0.14\",\n+ \"syn 1.0.84\",\n\"unicode-xid 0.2.2\",\n]\n@@ -3854,9 +3807,9 @@ version = \"1.0.30\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b\"\ndependencies = [\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n- \"syn 1.0.82\",\n+ \"proc-macro2 1.0.36\",\n+ \"quote 1.0.14\",\n+ \"syn 1.0.84\",\n]\n[[package]]\n@@ -3869,21 +3822,6 @@ dependencies = [\n\"winapi 0.3.9\",\n]\n-[[package]]\n-name = \"time\"\n-version = \"0.2.27\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242\"\n-dependencies = [\n- \"const_fn\",\n- \"libc\",\n- \"standback\",\n- \"stdweb\",\n- \"time-macros\",\n- \"version_check 0.9.3\",\n- \"winapi 0.3.9\",\n-]\n-\n[[package]]\nname = \"time\"\nversion = \"0.3.5\"\n@@ -3892,30 +3830,14 @@ checksum = \"41effe7cfa8af36f439fac33861b66b049edc6f9a32331e2312660529c1c24ad\"\ndependencies = [\n\"itoa 0.4.8\",\n\"libc\",\n+ \"time-macros\",\n]\n[[package]]\nname = \"time-macros\"\n-version = \"0.1.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1\"\n-dependencies = [\n- \"proc-macro-hack\",\n- \"time-macros-impl\",\n-]\n-\n-[[package]]\n-name = \"time-macros-impl\"\n-version = \"0.1.2\"\n+version = \"0.2.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f\"\n-dependencies = [\n- \"proc-macro-hack\",\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n- \"standback\",\n- \"syn 1.0.82\",\n-]\n+checksum = \"25eb0ca3468fc0acc11828786797f6ef9aa1555e4a211a60d64cc8e4d1be47d6\"\n[[package]]\nname = \"tinyvec\"\n@@ -4034,9 +3956,9 @@ version = \"1.7.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7\"\ndependencies = [\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n- \"syn 1.0.82\",\n+ \"proc-macro2 1.0.36\",\n+ \"quote 1.0.14\",\n+ \"syn 1.0.84\",\n]\n[[package]]\n@@ -4315,9 +4237,9 @@ checksum = \"1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887\"\n[[package]]\nname = \"typenum\"\n-version = \"1.14.0\"\n+version = \"1.15.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec\"\n+checksum = \"dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987\"\n[[package]]\nname = \"ucd-trie\"\n@@ -4331,7 +4253,7 @@ version = \"2.6.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6\"\ndependencies = [\n- \"version_check 0.9.3\",\n+ \"version_check 0.9.4\",\n]\n[[package]]\n@@ -4410,9 +4332,9 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"c2ca2a14bc3fc5b64d188b087a7d3a927df87b152e941ccfbc66672e20c467ae\"\ndependencies = [\n\"nom 4.2.3\",\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n- \"syn 1.0.82\",\n+ \"proc-macro2 1.0.36\",\n+ \"quote 1.0.14\",\n+ \"syn 1.0.84\",\n]\n[[package]]\n@@ -4439,9 +4361,9 @@ checksum = \"914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd\"\n[[package]]\nname = \"version_check\"\n-version = \"0.9.3\"\n+version = \"0.9.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe\"\n+checksum = \"49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f\"\n[[package]]\nname = \"walkdir\"\n@@ -4489,9 +4411,9 @@ dependencies = [\n\"bumpalo\",\n\"lazy_static\",\n\"log\",\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n- \"syn 1.0.82\",\n+ \"proc-macro2 1.0.36\",\n+ \"quote 1.0.14\",\n+ \"syn 1.0.84\",\n\"wasm-bindgen-shared\",\n]\n@@ -4513,7 +4435,7 @@ version = \"0.2.78\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9\"\ndependencies = [\n- \"quote 1.0.10\",\n+ \"quote 1.0.14\",\n\"wasm-bindgen-macro-support\",\n]\n@@ -4523,9 +4445,9 @@ version = \"0.2.78\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab\"\ndependencies = [\n- \"proc-macro2 1.0.34\",\n- \"quote 1.0.10\",\n- \"syn 1.0.82\",\n+ \"proc-macro2 1.0.36\",\n+ \"quote 1.0.14\",\n+ \"syn 1.0.84\",\n\"wasm-bindgen-backend\",\n\"wasm-bindgen-shared\",\n]\n@@ -4548,9 +4470,9 @@ dependencies = [\n[[package]]\nname = \"web30\"\n-version = \"0.17.3\"\n+version = \"0.17.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4fbd63d5204c3038909fb270d4ecdc1f976000c3a9bb46b53f4fa7a05879b90f\"\n+checksum = \"645e8db5ecdf11ddd9a7b054d013a224f8b1afa06455daf9220945da6b5587ac\"\ndependencies = [\n\"awc\",\n\"clarity\",\n@@ -4662,18 +4584,18 @@ dependencies = [\n[[package]]\nname = \"zstd\"\n-version = \"0.9.0+zstd.1.5.0\"\n+version = \"0.9.1+zstd.1.5.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"07749a5dc2cb6b36661290245e350f15ec3bbb304e493db54a1d354480522ccd\"\n+checksum = \"538b8347df9257b7fbce37677ef7535c00a3c7bf1f81023cc328ed7fe4b41de8\"\ndependencies = [\n\"zstd-safe\",\n]\n[[package]]\nname = \"zstd-safe\"\n-version = \"4.1.1+zstd.1.5.0\"\n+version = \"4.1.2+zstd.1.5.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c91c90f2c593b003603e5e0493c837088df4469da25aafff8bce42ba48caf079\"\n+checksum = \"9fb4cfe2f6e6d35c5d27ecd9d256c4b6f7933c4895654917460ec56c29336cc1\"\ndependencies = [\n\"libc\",\n\"zstd-sys\",\n@@ -4681,9 +4603,9 @@ dependencies = [\n[[package]]\nname = \"zstd-sys\"\n-version = \"1.6.1+zstd.1.5.0\"\n+version = \"1.6.2+zstd.1.5.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"615120c7a2431d16cf1cf979e7fc31ba7a5b5e5707b29c8a99e5dbf8a8392a33\"\n+checksum = \"2daf2f248d9ea44454bfcb2516534e8b8ad2fc91bf818a1885495fc42bc8ac9f\"\ndependencies = [\n\"cc\",\n\"libc\",\n" }, { "change_type": "MODIFY", "old_path": "althea_types/Cargo.toml", "new_path": "althea_types/Cargo.toml", "diff": "@@ -16,7 +16,7 @@ serde = \"1.0\"\nserde_json = \"1.0\"\nhex = \"0.4\"\nsodiumoxide = \"0.2\"\n-clarity = \"0.4\"\n+clarity = \"0.5\"\narrayvec = {version= \"0.7\", features = [\"serde\"]}\nphonenumber = \"0.3\"\nlettre = {version = \"0.9\", features = [\"serde\"]}\n" }, { "change_type": "MODIFY", "old_path": "antenna_forwarding_protocol/Cargo.toml", "new_path": "antenna_forwarding_protocol/Cargo.toml", "diff": "@@ -11,7 +11,7 @@ serde_derive = \"1.0\"\nserde = \"1.0\"\nsodiumoxide = \"0.2\"\nfailure = \"0.1\"\n-clarity = \"0.4\"\n+clarity = \"0.5\"\nlog = \"0.4\"\nlazy_static = \"1.4\"\n" }, { "change_type": "MODIFY", "old_path": "auto_bridge/Cargo.toml", "new_path": "auto_bridge/Cargo.toml", "diff": "@@ -5,9 +5,9 @@ authors = [\"Jehan <jehan.tremback@gmail.com>, Justin <justin@althea.net>\"]\nedition = \"2018\"\n[dependencies]\n-web30 = \"=0.17.3\"\n+web30 = \"0.17\"\nnum256 = \"0.3\"\n-clarity = \"0.4\"\n+clarity = \"0.5\"\nrand = \"0.8\"\nnum = \"0.4\"\nlog = \"0.4\"\n" }, { "change_type": "MODIFY", "old_path": "auto_bridge/src/lib.rs", "new_path": "auto_bridge/src/lib.rs", "diff": "@@ -607,7 +607,7 @@ mod tests {\nTokenBridge::new(\ndefault_bridge_addresses(),\n- pk.to_public_key().unwrap(),\n+ pk.to_address(),\npk,\n\"https://eth.altheamesh.com\".into(),\n\"https://dai.altheamesh.com\".into(),\n" }, { "change_type": "MODIFY", "old_path": "clu/Cargo.toml", "new_path": "clu/Cargo.toml", "diff": "@@ -17,7 +17,7 @@ rand = \"0.8\"\nserde = \"1.0\"\nserde_derive = \"1.0\"\nserde_json = \"1.0\"\n-clarity = \"0.4\"\n+clarity = \"0.5\"\nsodiumoxide = \"0.2\"\n[dependencies.regex]\n" }, { "change_type": "MODIFY", "old_path": "clu/src/lib.rs", "new_path": "clu/src/lib.rs", "diff": "@@ -170,10 +170,10 @@ fn linux_init(settings: RitaClientSettings) -> Result<RitaClientSettings, Error>\nSome(existing_eth_private_key) => {\ninfo!(\n\"Starting with Eth address {:?}\",\n- existing_eth_private_key.to_public_key()?\n+ existing_eth_private_key.to_address()\n);\n- payment_settings.eth_address = Some(existing_eth_private_key.to_public_key()?);\n+ payment_settings.eth_address = Some(existing_eth_private_key.to_address());\n}\nNone => {\ninfo!(\"Eth key details not configured, generating\");\n@@ -181,7 +181,7 @@ fn linux_init(settings: RitaClientSettings) -> Result<RitaClientSettings, Error>\nlet new_private_key = PrivateKey::from_slice(&key_buf)?;\npayment_settings.eth_private_key = Some(new_private_key);\n- payment_settings.eth_address = Some(new_private_key.to_public_key()?)\n+ payment_settings.eth_address = Some(new_private_key.to_address())\n}\n}\n@@ -250,10 +250,10 @@ fn linux_exit_init(settings: RitaExitSettingsStruct) -> Result<RitaExitSettingsS\nSome(existing_eth_private_key) => {\ninfo!(\n\"Starting with Eth address {:?}\",\n- existing_eth_private_key.to_public_key()?\n+ existing_eth_private_key.to_address()\n);\n- payment_settings.eth_address = Some(existing_eth_private_key.to_public_key()?);\n+ payment_settings.eth_address = Some(existing_eth_private_key.to_address());\n}\nNone => {\ninfo!(\"Eth key details not configured, generating\");\n@@ -261,7 +261,7 @@ fn linux_exit_init(settings: RitaExitSettingsStruct) -> Result<RitaExitSettingsS\nlet new_private_key = PrivateKey::from_slice(&key_buf)?;\npayment_settings.eth_private_key = Some(new_private_key);\n- payment_settings.eth_address = Some(new_private_key.to_public_key()?)\n+ payment_settings.eth_address = Some(new_private_key.to_address())\n}\n}\nsettings.payment = payment_settings;\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "@@ -34,13 +34,13 @@ tokio-io = \"0.1\"\ntokio-codec = \"0.1\"\nsodiumoxide = \"0.2\"\nclu = { path = \"../clu\" }\n-web30 = \"=0.17.3\"\n+web30 = \"0.17\"\nactix = \"0.7\"\nawc = \"3.0.0-beta.8\"\nipnetwork = \"0.14\"\nactix-async = {package=\"actix\", version = \"0.12\"}\nactix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\n-clarity = \"0.4\"\n+clarity = \"0.5\"\n[lib]\nname = \"rita_client\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "@@ -23,7 +23,7 @@ auto-bridge = {path = \"../auto_bridge\"}\nserde_json = \"1.0\"\nlog = { version = \"0.4\", features = [\"release_max_level_info\"] }\nsettings = { path = \"../settings\" }\n-clarity = \"0.4\"\n+clarity = \"0.5\"\nfutures = { version = \"0.3\", features = [\"compat\"] }\nnum256 = \"0.3\"\nnum-traits=\"0.2\"\n@@ -37,7 +37,7 @@ althea_kernel_interface = { path = \"../althea_kernel_interface\" }\nactix-web-httpauth = {git = \"https://github.com/althea-net/actix-web-httpauth\"}\nactix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\nawc = {version = \"3.0.0-beta.8\", default-features = false, features=[\"openssl\", \"compress-gzip\", \"compress-zstd\"]}\n-web30 = \"=0.17.3\"\n+web30 = \"0.17\"\nalthea_types = { path = \"../althea_types\" }\nbabel_monitor_legacy = {path = \"../babel_monitor_legacy\"}\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/payment_controller/mod.rs", "new_path": "rita_common/src/payment_controller/mod.rs", "diff": "@@ -146,7 +146,7 @@ async fn make_payment(mut pmt: PaymentTx) -> Result<(), PaymentControllerError>\nlet our_private_key = &payment_settings\n.eth_private_key\n.expect(\"No private key configured!\");\n- let our_address = our_private_key.to_public_key().unwrap();\n+ let our_address = our_private_key.to_address();\ninfo!(\n\"current balance: {:?}, payment of {:?}, from address {} to address {} with nonce {}\",\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/simulated_txfee_manager/mod.rs", "new_path": "rita_common/src/simulated_txfee_manager/mod.rs", "diff": "@@ -34,7 +34,7 @@ pub fn add_tx_to_total(amount: Uint256) {\npub async fn tick_simulated_tx() {\nlet payment_settings = settings::get_rita_common().payment;\nlet eth_private_key = payment_settings.eth_private_key.unwrap();\n- let eth_address = eth_private_key.to_public_key().unwrap();\n+ let eth_address = eth_private_key.to_address();\nlet our_id = match settings::get_rita_common().get_identity() {\nSome(id) => id,\nNone => return,\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/token_bridge/mod.rs", "new_path": "rita_common/src/token_bridge/mod.rs", "diff": "@@ -630,7 +630,7 @@ mod tests {\nlet _bridge = TokenBridge::new(\ndefault_bridge_addresses(),\n- pk.to_public_key().unwrap(),\n+ pk.to_address(),\npk,\n\"https://eth.altheamesh.com\".into(),\n\"https://dai.altheamesh.com\".into(),\n@@ -679,7 +679,7 @@ mod tests {\nlet bridge = TokenBridge::new(\ndefault_bridge_addresses(),\n- pk.to_public_key().unwrap(),\n+ pk.to_address(),\npk,\n\"https://eth.altheamesh.com\".into(),\n\"https://dai.altheamesh.com\".into(),\n@@ -720,7 +720,7 @@ mod tests {\nlet bridge = TokenBridge::new(\ndefault_bridge_addresses(),\n- pk.to_public_key().unwrap(),\n+ pk.to_address(),\npk,\n\"https://eth.altheamesh.com\".into(),\n\"https://dai.altheamesh.com\".into(),\n@@ -765,7 +765,7 @@ mod tests {\nlet bridge = TokenBridge::new(\ndefault_bridge_addresses(),\n- pk.to_public_key().unwrap(),\n+ pk.to_address(),\npk,\n\"https://eth.altheamesh.com\".into(),\n\"https://dai.altheamesh.com\".into(),\n@@ -814,7 +814,7 @@ mod tests {\nlet bridge = TokenBridge::new(\ndefault_bridge_addresses(),\n- pk.to_public_key().unwrap(),\n+ pk.to_address(),\npk,\n\"https://eth.altheamesh.com\".into(),\n\"https://dai.altheamesh.com\".into(),\n@@ -880,7 +880,7 @@ mod tests {\nlet bridge = TokenBridge::new(\ndefault_bridge_addresses(),\n- pk.to_public_key().unwrap(),\n+ pk.to_address(),\npk,\n\"https://eth.altheamesh.com\".into(),\n\"https://dai.altheamesh.com\".into(),\n" }, { "change_type": "MODIFY", "old_path": "settings/Cargo.toml", "new_path": "settings/Cargo.toml", "diff": "@@ -18,7 +18,7 @@ log = \"0.4\"\nfailure = \"0.1\"\nowning_ref = \"0.4\"\nlazy_static = \"1.4\"\n-clarity = \"0.4\"\n+clarity = \"0.5\"\narrayvec = {version= \"0.7\", features = [\"serde\"]}\nphonenumber = \"0.3\"\nipnetwork = \"0.14\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bumped Clarity to 0.5
20,255
03.01.2022 08:45:13
28,800
05e0af0c6dabc6639f79f8de7e8b4f5587669525
Bumped Web30 to 0.18 There version of web30 has checks to ensure we get balance only from the node not in syncing state
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -4470,9 +4470,9 @@ dependencies = [\n[[package]]\nname = \"web30\"\n-version = \"0.17.4\"\n+version = \"0.18.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"645e8db5ecdf11ddd9a7b054d013a224f8b1afa06455daf9220945da6b5587ac\"\n+checksum = \"c569c7b89d91e29ea3d6aa5ff5aa4fe4645b108ae2305b8c4b69946d058cef2f\"\ndependencies = [\n\"awc\",\n\"clarity\",\n" }, { "change_type": "MODIFY", "old_path": "auto_bridge/Cargo.toml", "new_path": "auto_bridge/Cargo.toml", "diff": "@@ -5,7 +5,7 @@ authors = [\"Jehan <jehan.tremback@gmail.com>, Justin <justin@althea.net>\"]\nedition = \"2018\"\n[dependencies]\n-web30 = \"0.17\"\n+web30 = \"0.18\"\nnum256 = \"0.3\"\nclarity = \"0.5\"\nrand = \"0.8\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "@@ -34,7 +34,7 @@ tokio-io = \"0.1\"\ntokio-codec = \"0.1\"\nsodiumoxide = \"0.2\"\nclu = { path = \"../clu\" }\n-web30 = \"0.17\"\n+web30 = \"0.18\"\nactix = \"0.7\"\nawc = \"3.0.0-beta.8\"\nipnetwork = \"0.14\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "@@ -37,7 +37,7 @@ althea_kernel_interface = { path = \"../althea_kernel_interface\" }\nactix-web-httpauth = {git = \"https://github.com/althea-net/actix-web-httpauth\"}\nactix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\nawc = {version = \"3.0.0-beta.8\", default-features = false, features=[\"openssl\", \"compress-gzip\", \"compress-zstd\"]}\n-web30 = \"0.17\"\n+web30 = \"0.18\"\nalthea_types = { path = \"../althea_types\" }\nbabel_monitor_legacy = {path = \"../babel_monitor_legacy\"}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bumped Web30 to 0.18 There version of web30 has checks to ensure we get balance only from the node not in syncing state
20,244
04.01.2022 20:22:30
18,000
99141c7535daab80a4168307c25e12cfe7d21a0b
Bump Rita for Beta 18 RC9
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -3158,7 +3158,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.18.8\"\n+version = \"0.18.9\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3194,7 +3194,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.18.8\"\n+version = \"0.18.9\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3235,7 +3235,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.18.8\"\n+version = \"0.18.9\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3277,7 +3277,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.18.8\"\n+version = \"0.18.9\"\ndependencies = [\n\"actix 0.7.11\",\n\"actix-web 0.7.19\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.18.8\"\n+version = \"0.18.9\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\nbuild = \"build.rs\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "[package]\nname = \"rita_client\"\n-version = \"0.18.8\"\n+version = \"0.18.9\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "[package]\nname = \"rita_common\"\n-version = \"0.18.8\"\n+version = \"0.18.9\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/dashboard/own_info.rs", "new_path": "rita_common/src/dashboard/own_info.rs", "diff": "@@ -5,7 +5,7 @@ use clarity::Address;\nuse failure::Error;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 18 RC8\";\n+pub static READABLE_VERSION: &str = \"Beta 18 RC9\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/Cargo.toml", "new_path": "rita_exit/Cargo.toml", "diff": "[package]\nname = \"rita_exit\"\n-version = \"0.18.8\"\n+version = \"0.18.9\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump Rita for Beta 18 RC9
20,244
04.01.2022 20:24:19
18,000
80f09d4543b367a24fe74f67a2ead61f75916fe1
Features are not valid at the workspace level
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -418,9 +418,6 @@ dependencies = [\n[[package]]\nname = \"althea_rs\"\nversion = \"0.1.11\"\n-dependencies = [\n- \"rita_bin\",\n-]\n[[package]]\nname = \"althea_types\"\n" }, { "change_type": "MODIFY", "old_path": "Cargo.toml", "new_path": "Cargo.toml", "diff": "@@ -4,19 +4,8 @@ version = \"0.1.11\"\nauthors = [\"Stan Drozd <drozdziak1@gmail.com>\"]\nedition = \"2018\"\n-[features]\n-development = [\"rita_bin/development\"]\n-dash_debug = [\"rita_bin/dash_debug\"]\n-server = [\"rita_bin/server\"]\n-bundle_openssl = [\"rita_bin/bundle_openssl\"]\n-jemalloc = [\"rita_bin/jemalloc\"]\n-optools_dev_env = [\"rita_bin/optools_dev_env\"]\n-\n-[dependencies]\n-rita_bin = { path = \"./rita_bin\" }\n-\n[workspace]\n-members = [\"althea_kernel_interface\", \"settings\", \"clu\", \"exit_db\", \"antenna_forwarding_client\", \"antenna_forwarding_protocol\", \"auto_bridge\", \"babel_monitor_legacy\",\"rita_common\",\"rita_exit\",\"rita_client\"]\n+members = [\"althea_kernel_interface\", \"settings\", \"clu\", \"exit_db\", \"antenna_forwarding_client\", \"antenna_forwarding_protocol\", \"auto_bridge\", \"babel_monitor_legacy\",\"rita_common\",\"rita_exit\",\"rita_client\", \"rita_bin\"]\n[profile.release]\nopt-level = \"z\"\n" }, { "change_type": "MODIFY", "old_path": "scripts/test.sh", "new_path": "scripts/test.sh", "diff": "@@ -10,7 +10,7 @@ cargo clippy --all --all-targets --all-features -- -D warnings\ncargo fmt --all -- --check\n# test rita only on many architectures\n-CROSS_TEST_ARGS=\"--verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\"\n+CROSS_TEST_ARGS=\"--verbose -- --test-threads=1\"\ncross test --target x86_64-unknown-linux-musl $CROSS_TEST_ARGS\ncross test --target mips-unknown-linux-gnu $CROSS_TEST_ARGS\ncross test --target mipsel-unknown-linux-gnu $CROSS_TEST_ARGS\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Features are not valid at the workspace level
20,244
05.01.2022 07:59:15
18,000
41550d8ecd04baf3462e707202ae7d1f2b9ec17e
Fix actions for removal of workspace level features
[ { "change_type": "MODIFY", "old_path": ".github/workflows/rust.yml", "new_path": ".github/workflows/rust.yml", "diff": "@@ -47,7 +47,7 @@ jobs:\n- uses: actions/checkout@v2\n- uses: Swatinem/rust-cache@v1\n- name: Cross test mips\n- run: cargo install cross && cross test --target mips-unknown-linux-musl --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\n+ run: cargo install cross && cross test --target mips-unknown-linux-musl --verbose -- --test-threads=1\ncross-mipsel:\nneeds: test\nruns-on: ubuntu-latest\n@@ -55,7 +55,7 @@ jobs:\n- uses: actions/checkout@v2\n- uses: Swatinem/rust-cache@v1\n- name: Cross test mipsel\n- run: cargo install cross && cross test --target mipsel-unknown-linux-musl --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\n+ run: cargo install cross && cross test --target mipsel-unknown-linux-musl --verbose -- --test-threads=1\ncross-mips64:\nneeds: test\nruns-on: ubuntu-latest\n@@ -63,7 +63,7 @@ jobs:\n- uses: actions/checkout@v2\n- uses: Swatinem/rust-cache@v1\n- name: Cross test mips64\n- run: cargo install cross && cross test --target mips64-unknown-linux-gnuabi64 --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\n+ run: cargo install cross && cross test --target mips64-unknown-linux-gnuabi64 --verbose -- --test-threads=1\ncross-mips64el:\nneeds: test\nruns-on: ubuntu-latest\n@@ -71,7 +71,7 @@ jobs:\n- uses: actions/checkout@v2\n- uses: Swatinem/rust-cache@v1\n- name: Cross test mips64el\n- run: cargo install cross && cross test --target mips64el-unknown-linux-gnuabi64 --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\n+ run: cargo install cross && cross test --target mips64el-unknown-linux-gnuabi64 --verbose -- --test-threads=1\ncross-aarch64:\nneeds: test\nruns-on: ubuntu-latest\n@@ -79,7 +79,7 @@ jobs:\n- uses: actions/checkout@v2\n- uses: Swatinem/rust-cache@v1\n- name: Cross test aarch64\n- run: cargo install cross && cross test --target aarch64-unknown-linux-musl --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\n+ run: cargo install cross && cross test --target aarch64-unknown-linux-musl --verbose -- --test-threads=1\ncross-armv7:\nneeds: test\nruns-on: ubuntu-latest\n@@ -87,7 +87,7 @@ jobs:\n- uses: actions/checkout@v2\n- uses: Swatinem/rust-cache@v1\n- name: Cross test armv7\n- run: cargo install cross && cross test --target armv7-unknown-linux-musleabihf --verbose -p rita_bin --bin rita --features bundle_openssl -- --test-threads=1\n+ run: cargo install cross && cross test --target armv7-unknown-linux-musleabihf --verbose -- --test-threads=1\nintegration-test-with-backcompat:\nneeds: test\nruns-on: ubuntu-latest\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix actions for removal of workspace level features
20,255
07.01.2022 11:19:03
28,800
fd3ab8b95999c3587d6c63fc708baa0799266657
Removed Zero window checks from blockchain oracle since web30 syncing checks prevents this
[ { "change_type": "MODIFY", "old_path": "rita_common/src/blockchain_oracle/mod.rs", "new_path": "rita_common/src/blockchain_oracle/mod.rs", "diff": "@@ -9,35 +9,23 @@ use clarity::Address;\nuse futures::future::join4;\nuse num256::Int256;\nuse num256::Uint256;\n-use num_traits::identities::Zero;\nuse settings::payment::PaymentSettings;\nuse web30::client::Web3;\nuse std::sync::Arc;\nuse std::sync::RwLock;\nuse std::time::Duration;\n-use std::time::Instant;\n-\n-const ZERO_WINDOW_TIME: Duration = Duration::from_secs(300);\nlazy_static! {\nstatic ref ORACLE: Arc<RwLock<BlockchainOracle>> =\nArc::new(RwLock::new(BlockchainOracle::new()));\n}\n-pub struct BlockchainOracle {\n- /// An instant representing the start of a short period where the balance can\n- /// actually go to zero. This is because full nodes (including Infura) have an infuriating\n- /// chance of returning a zero balance if they are not fully synced, causing all sorts of\n- /// disruption. So instead when we manually zero the balance (send a withdraw_all) we open\n- /// up a short five minute window during which we will actually trust the full node if it\n- /// hands us a zero balance\n- zero_window: Option<Instant>,\n-}\n+pub struct BlockchainOracle {}\nimpl BlockchainOracle {\npub fn new() -> Self {\n- BlockchainOracle { zero_window: None }\n+ BlockchainOracle {}\n}\n}\n@@ -47,11 +35,6 @@ impl Default for BlockchainOracle {\n}\n}\n-pub fn zero_window_start() {\n- let mut res = ORACLE.write().unwrap();\n- res.zero_window = Some(Instant::now());\n-}\n-\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@@ -65,15 +48,10 @@ pub async fn update() {\nlet web3 = Web3::new(&full_node, ORACLE_TIMEOUT);\ninfo!(\"About to make web3 requests to {}\", full_node);\n- update_blockchain_info(our_address, web3, full_node, Some(Instant::now())).await;\n+ update_blockchain_info(our_address, web3, full_node).await;\n}\n-async fn update_blockchain_info(\n- our_address: Address,\n- web3: Web3,\n- full_node: String,\n- zero_window: Option<Instant>,\n-) {\n+async fn update_blockchain_info(our_address: Address, web3: Web3, full_node: String) {\nlet balance = web3.eth_get_balance(our_address);\nlet nonce = web3.eth_get_transaction_count(our_address);\nlet net_version = web3.net_version();\n@@ -82,12 +60,7 @@ async fn update_blockchain_info(\njoin4(balance, nonce, net_version, gas_price).await;\nlet mut settings = settings::get_rita_common();\nmatch balance {\n- Ok(balance) => update_balance(\n- &full_node,\n- zero_window,\n- &mut settings.payment.balance,\n- balance,\n- ),\n+ Ok(balance) => update_balance(&full_node, &mut settings.payment.balance, balance),\nErr(e) => warn!(\"Failed to update balance with {:?}\", e),\n}\nmatch gas_price {\n@@ -110,31 +83,15 @@ async fn update_blockchain_info(\n/// Gets the balance for the provided eth address and updates it\n/// in the global SETTING variable, do not use this function as a generic\n/// balance getter.\n-fn update_balance(\n- full_node: &str,\n- zero_window: Option<Instant>,\n- our_balance: &mut Uint256,\n- new_balance: Uint256,\n-) {\n+fn update_balance(full_node: &str, our_balance: &mut Uint256, new_balance: Uint256) {\nlet value = new_balance;\ninfo!(\n\"Got response from {} balance request {:?}\",\nfull_node, value\n);\n- // our balance was not previously zero and we now have a zero\n- let zeroed = *our_balance != Uint256::zero() && value == Uint256::zero();\n- match (zeroed, zero_window) {\n- (false, _) => {\n- *our_balance = value;\n- }\n- (true, Some(time)) => {\n- if Instant::now() - time <= ZERO_WINDOW_TIME {\n+\n*our_balance = value;\n}\n- }\n- (true, None) => {}\n- }\n-}\n/// Updates the net_version in our global setting variable, this function\n/// specifically runs into some security issues, a hostile node could provide\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/dashboard/wallet.rs", "new_path": "rita_common/src/dashboard/wallet.rs", "diff": "-use crate::blockchain_oracle::zero_window_start;\nuse crate::rita_loop::get_web3_server;\nuse crate::token_bridge::setup_withdraw as bridge_withdraw;\nuse crate::token_bridge::Withdraw as WithdrawMsg;\n@@ -54,7 +53,6 @@ fn withdraw_handler(address: Address, amount: Option<Uint256>) -> HttpResponse {\nlet tx_cost = gas_price * tx_gas;\nif amount.clone() + tx_cost.clone() >= balance {\n- zero_window_start();\namount = balance - tx_cost;\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Removed Zero window checks from blockchain oracle since web30 syncing checks prevents this
20,244
11.01.2022 17:27:12
18,000
e9469fd75488dd07c6860b5700d71ef97998c318
Bump for Beta 18 RC10 and update dependencies
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -40,7 +40,7 @@ dependencies = [\n\"actix_derive 0.6.0\",\n\"bitflags\",\n\"bytes 1.1.0\",\n- \"crossbeam-channel 0.5.1\",\n+ \"crossbeam-channel 0.5.2\",\n\"futures-core\",\n\"futures-sink\",\n\"futures-task\",\n@@ -56,9 +56,9 @@ dependencies = [\n[[package]]\nname = \"actix-codec\"\n-version = \"0.4.1\"\n+version = \"0.4.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"13895df506faee81e423febbae3a33b27fca71831b96bb3d60adf16ebcfea952\"\n+checksum = \"a36c014a3e811624313b51a227b775ecba55d36ef9462bbaac7d4f13e54c9271\"\ndependencies = [\n\"bitflags\",\n\"bytes 1.1.0\",\n@@ -73,9 +73,9 @@ dependencies = [\n[[package]]\nname = \"actix-http\"\n-version = \"3.0.0-beta.17\"\n+version = \"3.0.0-beta.18\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"dac76407e2be239b5e544c9d83bdac4a0d68ae188031ac0424aa3e4868a669be\"\n+checksum = \"05b95871724d27ac9a23d6db3246b23e4e42cd44a23145e1c6b04b78fb5271da\"\ndependencies = [\n\"actix-codec\",\n\"actix-rt\",\n@@ -92,8 +92,8 @@ dependencies = [\n\"encoding_rs\",\n\"flate2\",\n\"futures-core\",\n- \"h2 0.3.9\",\n- \"http 0.2.5\",\n+ \"h2 0.3.10\",\n+ \"http 0.2.6\",\n\"httparse\",\n\"httpdate\",\n\"itoa 1.0.1\",\n@@ -116,7 +116,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6\"\ndependencies = [\n\"quote 1.0.14\",\n- \"syn 1.0.84\",\n+ \"syn 1.0.85\",\n]\n[[package]]\n@@ -148,23 +148,23 @@ dependencies = [\n[[package]]\nname = \"actix-router\"\n-version = \"0.5.0-beta.3\"\n+version = \"0.5.0-beta.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ddd9f117b910fbcce6e9f45092ffd4ff017785a346d09e2d4fd049f4e20384f4\"\n+checksum = \"b53c1deabdbf3a8a8b9a949123edd3cafb873abd75da96b5933a8b590f9d6dc2\"\ndependencies = [\n\"bytestring\",\n\"firestorm\",\n- \"http 0.2.5\",\n+ \"http 0.2.6\",\n\"log\",\n\"regex\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n]\n[[package]]\nname = \"actix-rt\"\n-version = \"2.5.0\"\n+version = \"2.5.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"05c2f80ce8d0c990941c7a7a931f69fd0701b76d521f8d36298edf59cd3fbf1f\"\n+checksum = \"82cf33e04d9911b39bfb7be3c01309568b4315895d3358372dce64ed2c2bf32d\"\ndependencies = [\n\"actix-macros\",\n\"futures-core\",\n@@ -173,9 +173,9 @@ dependencies = [\n[[package]]\nname = \"actix-server\"\n-version = \"2.0.0-rc.2\"\n+version = \"2.0.0-rc.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"29b7894a5b47aa84e15fbe8d89ee953568296a3739c5f6e6b5858802a561390c\"\n+checksum = \"c9259b4f3cc9ca96d7d91a7da66b7b01c47653a0da5b0ba3f7f45a344480443b\"\ndependencies = [\n\"actix-rt\",\n\"actix-service\",\n@@ -202,9 +202,9 @@ dependencies = [\n[[package]]\nname = \"actix-tls\"\n-version = \"3.0.0\"\n+version = \"3.0.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b5ef5760747cdfb108a1f35e6911a7a40939da893f95e035f9eee0c18b4b4025\"\n+checksum = \"b161450ff646361005a300716e85856780ddc2fde569fd81335cc3c15b2e0933\"\ndependencies = [\n\"actix-codec\",\n\"actix-rt\",\n@@ -212,7 +212,7 @@ dependencies = [\n\"actix-utils\",\n\"derive_more\",\n\"futures-core\",\n- \"http 0.2.5\",\n+ \"http 0.2.6\",\n\"log\",\n\"openssl\",\n\"pin-project-lite\",\n@@ -264,7 +264,7 @@ dependencies = [\n\"percent-encoding 1.0.1\",\n\"rand 0.6.5\",\n\"regex\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_json\",\n\"serde_urlencoded 0.5.5\",\n\"sha1\",\n@@ -285,9 +285,9 @@ dependencies = [\n[[package]]\nname = \"actix-web\"\n-version = \"4.0.0-beta.18\"\n+version = \"4.0.0-beta.19\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a542a92e385844d988b34f1af289dbb0ca927c23740076a56fdf770b1af69fbc\"\n+checksum = \"229d0d2c11d6c734327cf1fbc15dd644b351b440bcb4608349258f5e00605bdc\"\ndependencies = [\n\"actix-codec\",\n\"actix-http\",\n@@ -313,7 +313,7 @@ dependencies = [\n\"once_cell\",\n\"pin-project-lite\",\n\"regex\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_json\",\n\"serde_urlencoded 0.7.0\",\n\"smallvec 1.7.0\",\n@@ -324,14 +324,14 @@ dependencies = [\n[[package]]\nname = \"actix-web-codegen\"\n-version = \"0.5.0-beta.6\"\n+version = \"0.5.0-rc.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"30a90b7f6c2fde9a1fe3df4da758c2c3c9d620dfa3eae4da0b6925dc0a13444a\"\n+checksum = \"98a793e4a7bd059e06e1bc1bd9943b57a47f806de3599d2437441682292c333e\"\ndependencies = [\n\"actix-router\",\n\"proc-macro2 1.0.36\",\n\"quote 1.0.14\",\n- \"syn 1.0.84\",\n+ \"syn 1.0.85\",\n]\n[[package]]\n@@ -363,7 +363,7 @@ checksum = \"6d44b8fee1ced9671ba043476deddef739dd0959bf77030b26b738cc591737a7\"\ndependencies = [\n\"proc-macro2 1.0.36\",\n\"quote 1.0.14\",\n- \"syn 1.0.84\",\n+ \"syn 1.0.85\",\n]\n[[package]]\n@@ -411,7 +411,7 @@ dependencies = [\n\"log\",\n\"oping\",\n\"regex\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_derive\",\n]\n@@ -433,7 +433,7 @@ dependencies = [\n\"num256\",\n\"phonenumber\",\n\"rand 0.8.4\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_derive\",\n\"serde_json\",\n\"sodiumoxide\",\n@@ -446,14 +446,14 @@ dependencies = [\n\"althea_kernel_interface\",\n\"althea_types\",\n\"antenna_forwarding_protocol\",\n- \"env_logger 0.9.0\",\n+ \"env_logger\",\n\"failure\",\n\"get_if_addrs\",\n\"lazy_static\",\n\"log\",\n\"oping\",\n\"rand 0.8.4\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_json\",\n\"sodiumoxide\",\n]\n@@ -468,7 +468,7 @@ dependencies = [\n\"lazy_static\",\n\"log\",\n\"rand 0.8.4\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_derive\",\n\"serde_json\",\n\"sodiumoxide\",\n@@ -486,7 +486,7 @@ version = \"0.7.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6\"\ndependencies = [\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n]\n[[package]]\n@@ -524,7 +524,7 @@ dependencies = [\n\"num 0.4.0\",\n\"num256\",\n\"rand 0.8.4\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_derive\",\n\"tokio 1.15.0\",\n\"web30\",\n@@ -544,9 +544,9 @@ checksum = \"cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a\"\n[[package]]\nname = \"awc\"\n-version = \"3.0.0-beta.17\"\n+version = \"3.0.0-beta.18\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"2e79692bb8a7966b27f7e908a3bcb46c4ba4eb41ffb736344481b1ace08865d0\"\n+checksum = \"23e43f507fc706cf150b5a923655c96101692db9360148038678700fc4172e0a\"\ndependencies = [\n\"actix-codec\",\n\"actix-http\",\n@@ -562,8 +562,8 @@ dependencies = [\n\"derive_more\",\n\"futures-core\",\n\"futures-util\",\n- \"h2 0.3.9\",\n- \"http 0.2.5\",\n+ \"h2 0.3.10\",\n+ \"http 0.2.6\",\n\"itoa 1.0.1\",\n\"log\",\n\"mime\",\n@@ -571,7 +571,7 @@ dependencies = [\n\"percent-encoding 2.1.0\",\n\"pin-project-lite\",\n\"rand 0.8.4\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_json\",\n\"serde_urlencoded 0.7.0\",\n\"tokio 1.15.0\",\n@@ -582,11 +582,11 @@ name = \"babel_monitor\"\nversion = \"0.1.0\"\ndependencies = [\n\"ascii\",\n- \"env_logger 0.9.0\",\n+ \"env_logger\",\n\"failure\",\n\"ipnetwork 0.14.0\",\n\"log\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_derive\",\n]\n@@ -596,12 +596,12 @@ version = \"0.1.0\"\ndependencies = [\n\"ascii\",\n\"babel_monitor\",\n- \"env_logger 0.9.0\",\n+ \"env_logger\",\n\"failure\",\n\"futures 0.1.31\",\n\"ipnetwork 0.14.0\",\n\"log\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_derive\",\n\"tokio 0.1.22\",\n]\n@@ -663,7 +663,7 @@ version = \"1.3.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad\"\ndependencies = [\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n]\n[[package]]\n@@ -689,29 +689,19 @@ version = \"0.7.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b\"\ndependencies = [\n- \"block-padding 0.1.5\",\n+ \"block-padding\",\n\"byte-tools\",\n\"byteorder\",\n\"generic-array 0.12.4\",\n]\n-[[package]]\n-name = \"block-buffer\"\n-version = \"0.9.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4\"\n-dependencies = [\n- \"block-padding 0.2.1\",\n- \"generic-array 0.14.4\",\n-]\n-\n[[package]]\nname = \"block-buffer\"\nversion = \"0.10.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"f1d36a02058e76b040de25a4464ba1c80935655595b661505c8b39b664828b95\"\ndependencies = [\n- \"generic-array 0.14.4\",\n+ \"generic-array 0.14.5\",\n]\n[[package]]\n@@ -723,12 +713,6 @@ dependencies = [\n\"byte-tools\",\n]\n-[[package]]\n-name = \"block-padding\"\n-version = \"0.2.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae\"\n-\n[[package]]\nname = \"brotli-sys\"\nversion = \"0.3.2\"\n@@ -757,9 +741,9 @@ checksum = \"40e38929add23cdf8a366df9b0e088953150724bcbe5fc330b0d8eb3b328eec8\"\n[[package]]\nname = \"bumpalo\"\n-version = \"3.8.0\"\n+version = \"3.9.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c\"\n+checksum = \"a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899\"\n[[package]]\nname = \"byte-tools\"\n@@ -840,20 +824,20 @@ dependencies = [\n[[package]]\nname = \"clarity\"\n-version = \"0.5.0\"\n+version = \"0.5.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f8b52c587db3d2ad2be8ee522fda467592adfb2ff39d474993e31232f64780c6\"\n+checksum = \"9e043fca6ce2fabc4566fe447d2185a724529a383f3e9938279a53ea75532a02\"\ndependencies = [\n\"lazy_static\",\n\"num-bigint 0.4.3\",\n\"num-traits 0.2.14\",\n\"num256\",\n\"secp256k1\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde-rlp\",\n\"serde_bytes\",\n\"serde_derive\",\n- \"sha3 0.10.0\",\n+ \"sha3\",\n]\n[[package]]\n@@ -872,14 +856,14 @@ dependencies = [\n\"althea_kernel_interface\",\n\"althea_types\",\n\"clarity\",\n- \"env_logger 0.8.4\",\n+ \"env_logger\",\n\"failure\",\n\"ipgen\",\n\"lazy_static\",\n\"log\",\n\"rand 0.8.4\",\n\"regex\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_derive\",\n\"serde_json\",\n\"settings\",\n@@ -900,7 +884,7 @@ dependencies = [\n\"futures 0.3.19\",\n\"lazy_static\",\n\"log\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_derive\",\n\"serde_json\",\n]\n@@ -914,7 +898,7 @@ dependencies = [\n\"lazy_static\",\n\"nom 5.1.2\",\n\"rust-ini\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde-hjson\",\n\"serde_json\",\n\"toml\",\n@@ -993,12 +977,12 @@ dependencies = [\n[[package]]\nname = \"crossbeam-channel\"\n-version = \"0.5.1\"\n+version = \"0.5.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4\"\n+checksum = \"e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa\"\ndependencies = [\n\"cfg-if 1.0.0\",\n- \"crossbeam-utils 0.8.5\",\n+ \"crossbeam-utils 0.8.6\",\n]\n[[package]]\n@@ -1061,9 +1045,9 @@ dependencies = [\n[[package]]\nname = \"crossbeam-utils\"\n-version = \"0.8.5\"\n+version = \"0.8.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db\"\n+checksum = \"cfcae03edb34f947e64acdb1c33ec169824e20657e9ecb61cef6c8c74dcb8120\"\ndependencies = [\n\"cfg-if 1.0.0\",\n\"lazy_static\",\n@@ -1075,7 +1059,7 @@ version = \"0.1.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"683d6b536309245c849479fba3da410962a43ed8e51c26b729208ec0ac2798d0\"\ndependencies = [\n- \"generic-array 0.14.4\",\n+ \"generic-array 0.14.5\",\n]\n[[package]]\n@@ -1084,7 +1068,7 @@ version = \"0.8.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab\"\ndependencies = [\n- \"generic-array 0.14.4\",\n+ \"generic-array 0.14.5\",\n\"subtle\",\n]\n@@ -1108,7 +1092,7 @@ dependencies = [\n\"proc-macro2 1.0.36\",\n\"quote 1.0.14\",\n\"rustc_version 0.4.0\",\n- \"syn 1.0.84\",\n+ \"syn 1.0.85\",\n]\n[[package]]\n@@ -1132,7 +1116,7 @@ checksum = \"45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3\"\ndependencies = [\n\"proc-macro2 1.0.36\",\n\"quote 1.0.14\",\n- \"syn 1.0.84\",\n+ \"syn 1.0.85\",\n]\n[[package]]\n@@ -1150,7 +1134,7 @@ version = \"0.9.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066\"\ndependencies = [\n- \"generic-array 0.14.4\",\n+ \"generic-array 0.14.5\",\n]\n[[package]]\n@@ -1161,7 +1145,7 @@ checksum = \"b697d66081d42af4fba142d56918a3cb21dc8eb63372c6b85d14f44fb9c5979b\"\ndependencies = [\n\"block-buffer 0.10.0\",\n\"crypto-common\",\n- \"generic-array 0.14.4\",\n+ \"generic-array 0.14.5\",\n]\n[[package]]\n@@ -1172,7 +1156,7 @@ checksum = \"7f3f119846c823f9eafcf953a8f6ffb6ed69bf6240883261a7f13b634579a51f\"\ndependencies = [\n\"lazy_static\",\n\"regex\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"strsim\",\n]\n@@ -1291,19 +1275,6 @@ dependencies = [\n\"cfg-if 1.0.0\",\n]\n-[[package]]\n-name = \"env_logger\"\n-version = \"0.8.4\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3\"\n-dependencies = [\n- \"atty\",\n- \"humantime\",\n- \"log\",\n- \"regex\",\n- \"termcolor\",\n-]\n-\n[[package]]\nname = \"env_logger\"\nversion = \"0.9.0\"\n@@ -1344,7 +1315,7 @@ dependencies = [\n\"diesel\",\n\"dotenv\",\n\"failure\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_derive\",\n\"serde_json\",\n]\n@@ -1367,7 +1338,7 @@ checksum = \"aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4\"\ndependencies = [\n\"proc-macro2 1.0.36\",\n\"quote 1.0.14\",\n- \"syn 1.0.84\",\n+ \"syn 1.0.85\",\n\"synstructure\",\n]\n@@ -1386,11 +1357,20 @@ dependencies = [\n\"ascii_utils\",\n]\n+[[package]]\n+name = \"fastrand\"\n+version = \"1.6.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"779d043b6a0b90cc4c0ed7ee380a6504394cee7efd7db050e3774eee387324b2\"\n+dependencies = [\n+ \"instant\",\n+]\n+\n[[package]]\nname = \"firestorm\"\n-version = \"0.4.6\"\n+version = \"0.5.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"31586bda1b136406162e381a3185a506cdfc1631708dd40cba2f6628d8634499\"\n+checksum = \"4d3d6188b8804df28032815ea256b6955c9625c24da7525f387a7af02fbb8f01\"\n[[package]]\nname = \"flate2\"\n@@ -1536,7 +1516,7 @@ checksum = \"6dbd947adfffb0efc70599b3ddcf7b5597bb5fa9e245eb99f62b3a5f7bb8bd3c\"\ndependencies = [\n\"proc-macro2 1.0.36\",\n\"quote 1.0.14\",\n- \"syn 1.0.84\",\n+ \"syn 1.0.85\",\n]\n[[package]]\n@@ -1587,9 +1567,9 @@ dependencies = [\n[[package]]\nname = \"generic-array\"\n-version = \"0.14.4\"\n+version = \"0.14.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817\"\n+checksum = \"fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803\"\ndependencies = [\n\"typenum\",\n\"version_check 0.9.4\",\n@@ -1654,16 +1634,16 @@ dependencies = [\n[[package]]\nname = \"h2\"\n-version = \"0.3.9\"\n+version = \"0.3.10\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8f072413d126e57991455e0a922b31e4c8ba7c2ffbebf6b78b4f8521397d65cd\"\n+checksum = \"0c9de88456263e249e241fcd211d3954e2c9b0ef7ccfc235a444eb367cae3689\"\ndependencies = [\n\"bytes 1.1.0\",\n\"fnv\",\n\"futures-core\",\n\"futures-sink\",\n\"futures-util\",\n- \"http 0.2.5\",\n+ \"http 0.2.6\",\n\"indexmap\",\n\"slab\",\n\"tokio 1.15.0\",\n@@ -1679,15 +1659,15 @@ checksum = \"eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7\"\n[[package]]\nname = \"handlebars\"\n-version = \"4.1.6\"\n+version = \"4.2.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"167fa173496c9eadd8749cca6f8339ac88e248f3ad2442791d0b743318a94fc0\"\n+checksum = \"2483bce82dd3ed52509d0117e4a30a488bd608be250ed7a0185301314239ed31\"\ndependencies = [\n\"log\",\n\"pest\",\n\"pest_derive\",\n\"quick-error 2.0.1\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_json\",\n]\n@@ -1752,13 +1732,13 @@ dependencies = [\n[[package]]\nname = \"http\"\n-version = \"0.2.5\"\n+version = \"0.2.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b\"\n+checksum = \"31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03\"\ndependencies = [\n\"bytes 1.1.0\",\n\"fnv\",\n- \"itoa 0.4.8\",\n+ \"itoa 1.0.1\",\n]\n[[package]]\n@@ -1768,7 +1748,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6\"\ndependencies = [\n\"bytes 1.1.0\",\n- \"http 0.2.5\",\n+ \"http 0.2.6\",\n\"pin-project-lite\",\n]\n@@ -1800,8 +1780,8 @@ dependencies = [\n\"futures-channel\",\n\"futures-core\",\n\"futures-util\",\n- \"h2 0.3.9\",\n- \"http 0.2.5\",\n+ \"h2 0.3.10\",\n+ \"http 0.2.6\",\n\"http-body\",\n\"httparse\",\n\"httpdate\",\n@@ -1851,9 +1831,9 @@ dependencies = [\n[[package]]\nname = \"indexmap\"\n-version = \"1.7.0\"\n+version = \"1.8.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5\"\n+checksum = \"282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223\"\ndependencies = [\n\"autocfg 1.0.1\",\n\"hashbrown\",\n@@ -1912,7 +1892,7 @@ version = \"0.14.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"b3d862c86f7867f19b693ec86765e0252d82e53d4240b9b629815675a0714ad1\"\ndependencies = [\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n]\n[[package]]\n@@ -2043,7 +2023,7 @@ dependencies = [\n\"log\",\n\"native-tls\",\n\"nom 4.2.3\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_derive\",\n\"serde_json\",\n]\n@@ -2434,7 +2414,7 @@ dependencies = [\n\"autocfg 1.0.1\",\n\"num-integer\",\n\"num-traits 0.2.14\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n]\n[[package]]\n@@ -2464,7 +2444,7 @@ checksum = \"876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d\"\ndependencies = [\n\"proc-macro2 1.0.36\",\n\"quote 1.0.14\",\n- \"syn 1.0.84\",\n+ \"syn 1.0.85\",\n]\n[[package]]\n@@ -2540,7 +2520,7 @@ dependencies = [\n\"num 0.4.0\",\n\"num-derive\",\n\"num-traits 0.2.14\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_derive\",\n]\n@@ -2771,7 +2751,7 @@ dependencies = [\n\"pest_meta\",\n\"proc-macro2 1.0.36\",\n\"quote 1.0.14\",\n- \"syn 1.0.84\",\n+ \"syn 1.0.85\",\n]\n[[package]]\n@@ -2800,16 +2780,16 @@ dependencies = [\n\"quick-xml\",\n\"regex\",\n\"regex-cache\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_derive\",\n\"thiserror\",\n]\n[[package]]\nname = \"pin-project-lite\"\n-version = \"0.2.7\"\n+version = \"0.2.8\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443\"\n+checksum = \"e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c\"\n[[package]]\nname = \"pin-utils\"\n@@ -2825,9 +2805,9 @@ checksum = \"58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe\"\n[[package]]\nname = \"ppv-lite86\"\n-version = \"0.2.15\"\n+version = \"0.2.16\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba\"\n+checksum = \"eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872\"\n[[package]]\nname = \"pq-sys\"\n@@ -3142,16 +3122,17 @@ dependencies = [\n[[package]]\nname = \"reqwest\"\n-version = \"0.11.8\"\n+version = \"0.11.9\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7c4e0a76dc12a116108933f6301b95e83634e0c47b0afbed6abbaa0601e99258\"\n+checksum = \"87f242f1488a539a79bac6dbe7c8609ae43b7914b7736210f239a37cccb32525\"\ndependencies = [\n\"base64 0.13.0\",\n\"bytes 1.1.0\",\n\"encoding_rs\",\n\"futures-core\",\n\"futures-util\",\n- \"http 0.2.5\",\n+ \"h2 0.3.10\",\n+ \"http 0.2.6\",\n\"http-body\",\n\"hyper\",\n\"hyper-tls\",\n@@ -3163,7 +3144,7 @@ dependencies = [\n\"native-tls\",\n\"percent-encoding 2.1.0\",\n\"pin-project-lite\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_json\",\n\"serde_urlencoded 0.7.0\",\n\"tokio 1.15.0\",\n@@ -3187,12 +3168,12 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.18.9\"\n+version = \"0.18.10\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n\"actix-web 0.7.19\",\n- \"actix-web 4.0.0-beta.18\",\n+ \"actix-web 4.0.0-beta.19\",\n\"actix-web-httpauth\",\n\"actix_derive 0.6.0\",\n\"althea_kernel_interface\",\n@@ -3203,7 +3184,7 @@ dependencies = [\n\"ctrlc\",\n\"diesel\",\n\"docopt\",\n- \"env_logger 0.9.0\",\n+ \"env_logger\",\n\"flate2\",\n\"hex-literal\",\n\"jemallocator\",\n@@ -3217,14 +3198,14 @@ dependencies = [\n\"rita_client\",\n\"rita_common\",\n\"rita_exit\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_json\",\n\"settings\",\n]\n[[package]]\nname = \"rita_client\"\n-version = \"0.18.9\"\n+version = \"0.18.10\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3251,11 +3232,11 @@ dependencies = [\n\"num256\",\n\"phonenumber\",\n\"rita_common\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_derive\",\n\"serde_json\",\n\"settings\",\n- \"sha3 0.9.1\",\n+ \"sha3\",\n\"sodiumoxide\",\n\"tokio 0.1.22\",\n\"tokio-codec\",\n@@ -3265,7 +3246,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.18.9\"\n+version = \"0.18.10\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3296,7 +3277,7 @@ dependencies = [\n\"num256\",\n\"rand 0.8.4\",\n\"regex\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_cbor\",\n\"serde_derive\",\n\"serde_json\",\n@@ -3307,7 +3288,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.18.9\"\n+version = \"0.18.10\"\ndependencies = [\n\"actix 0.7.11\",\n\"actix-web 0.7.19\",\n@@ -3334,7 +3315,7 @@ dependencies = [\n\"rand 0.8.4\",\n\"reqwest\",\n\"rita_common\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_derive\",\n\"serde_json\",\n\"settings\",\n@@ -3425,18 +3406,18 @@ checksum = \"d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd\"\n[[package]]\nname = \"secp256k1\"\n-version = \"0.20.3\"\n+version = \"0.21.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"97d03ceae636d0fed5bae6a7f4f664354c5f4fcedf6eef053fef17e49f837d0a\"\n+checksum = \"ab7883017d5b21f011ef8040ea9c6c7ac90834c0df26a69e4c0b06276151f125\"\ndependencies = [\n\"secp256k1-sys\",\n]\n[[package]]\nname = \"secp256k1-sys\"\n-version = \"0.4.1\"\n+version = \"0.4.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"827cb7cce42533829c792fc51b82fbf18b125b45a702ef2c8be77fce65463a7b\"\n+checksum = \"957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036\"\ndependencies = [\n\"cc\",\n]\n@@ -3493,9 +3474,9 @@ checksum = \"9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8\"\n[[package]]\nname = \"serde\"\n-version = \"1.0.132\"\n+version = \"1.0.133\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8b9875c23cf305cd1fd7eb77234cbb705f21ea6a72c637a5c6db5fe4b8e7f008\"\n+checksum = \"97565067517b60e2d1ea8b268e59ce036de907ac523ad83a0475da04e818989a\"\ndependencies = [\n\"serde_derive\",\n]\n@@ -3521,7 +3502,7 @@ dependencies = [\n\"byteorder\",\n\"error\",\n\"num 0.2.1\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n]\n[[package]]\n@@ -3530,7 +3511,7 @@ version = \"0.11.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9\"\ndependencies = [\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n]\n[[package]]\n@@ -3540,29 +3521,29 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5\"\ndependencies = [\n\"half\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n]\n[[package]]\nname = \"serde_derive\"\n-version = \"1.0.132\"\n+version = \"1.0.133\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ecc0db5cb2556c0e558887d9bbdcf6ac4471e83ff66cf696e5419024d1606276\"\n+checksum = \"ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537\"\ndependencies = [\n\"proc-macro2 1.0.36\",\n\"quote 1.0.14\",\n- \"syn 1.0.84\",\n+ \"syn 1.0.85\",\n]\n[[package]]\nname = \"serde_json\"\n-version = \"1.0.73\"\n+version = \"1.0.74\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"bcbd0344bc6533bc7ec56df11d42fb70f1b912351c0825ccb7211b59d8af7cf5\"\n+checksum = \"ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142\"\ndependencies = [\n\"itoa 1.0.1\",\n\"ryu\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n]\n[[package]]\n@@ -3573,7 +3554,7 @@ checksum = \"642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a\"\ndependencies = [\n\"dtoa\",\n\"itoa 0.4.8\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"url 1.7.2\",\n]\n@@ -3586,7 +3567,7 @@ dependencies = [\n\"form_urlencoded\",\n\"itoa 0.4.8\",\n\"ryu\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n]\n[[package]]\n@@ -3606,7 +3587,7 @@ dependencies = [\n\"num256\",\n\"owning_ref\",\n\"phonenumber\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_derive\",\n\"serde_json\",\n\"toml\",\n@@ -3641,18 +3622,6 @@ version = \"0.6.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d\"\n-[[package]]\n-name = \"sha3\"\n-version = \"0.9.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809\"\n-dependencies = [\n- \"block-buffer 0.9.0\",\n- \"digest 0.9.0\",\n- \"keccak\",\n- \"opaque-debug 0.3.0\",\n-]\n-\n[[package]]\nname = \"sha3\"\nversion = \"0.10.0\"\n@@ -3674,9 +3643,9 @@ dependencies = [\n[[package]]\nname = \"signature\"\n-version = \"1.4.0\"\n+version = \"1.5.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788\"\n+checksum = \"f054c6c1a6e95179d6f23ed974060dcefb2d9388bb7256900badad682c499de4\"\n[[package]]\nname = \"slab\"\n@@ -3729,7 +3698,7 @@ dependencies = [\n\"ed25519\",\n\"libc\",\n\"libsodium-sys\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n]\n[[package]]\n@@ -3778,9 +3747,9 @@ dependencies = [\n[[package]]\nname = \"syn\"\n-version = \"1.0.84\"\n+version = \"1.0.85\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ecb2e6da8ee5eb9a61068762a32fa9619cc591ceb055b3687f4cd4051ec2e06b\"\n+checksum = \"a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7\"\ndependencies = [\n\"proc-macro2 1.0.36\",\n\"quote 1.0.14\",\n@@ -3795,19 +3764,19 @@ checksum = \"f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f\"\ndependencies = [\n\"proc-macro2 1.0.36\",\n\"quote 1.0.14\",\n- \"syn 1.0.84\",\n+ \"syn 1.0.85\",\n\"unicode-xid 0.2.2\",\n]\n[[package]]\nname = \"tempfile\"\n-version = \"3.2.0\"\n+version = \"3.3.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22\"\n+checksum = \"5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4\"\ndependencies = [\n\"cfg-if 1.0.0\",\n+ \"fastrand\",\n\"libc\",\n- \"rand 0.8.4\",\n\"redox_syscall 0.2.10\",\n\"remove_dir_all\",\n\"winapi 0.3.9\",\n@@ -3839,7 +3808,7 @@ checksum = \"aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b\"\ndependencies = [\n\"proc-macro2 1.0.36\",\n\"quote 1.0.14\",\n- \"syn 1.0.84\",\n+ \"syn 1.0.85\",\n]\n[[package]]\n@@ -3988,7 +3957,7 @@ checksum = \"b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7\"\ndependencies = [\n\"proc-macro2 1.0.36\",\n\"quote 1.0.14\",\n- \"syn 1.0.84\",\n+ \"syn 1.0.85\",\n]\n[[package]]\n@@ -4166,7 +4135,7 @@ version = \"0.5.8\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa\"\ndependencies = [\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n]\n[[package]]\n@@ -4364,7 +4333,7 @@ dependencies = [\n\"nom 4.2.3\",\n\"proc-macro2 1.0.36\",\n\"quote 1.0.14\",\n- \"syn 1.0.84\",\n+ \"syn 1.0.85\",\n]\n[[package]]\n@@ -4443,7 +4412,7 @@ dependencies = [\n\"log\",\n\"proc-macro2 1.0.36\",\n\"quote 1.0.14\",\n- \"syn 1.0.84\",\n+ \"syn 1.0.85\",\n\"wasm-bindgen-shared\",\n]\n@@ -4477,7 +4446,7 @@ checksum = \"7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab\"\ndependencies = [\n\"proc-macro2 1.0.36\",\n\"quote 1.0.14\",\n- \"syn 1.0.84\",\n+ \"syn 1.0.85\",\n\"wasm-bindgen-backend\",\n\"wasm-bindgen-shared\",\n]\n@@ -4500,9 +4469,9 @@ dependencies = [\n[[package]]\nname = \"web30\"\n-version = \"0.18.0\"\n+version = \"0.18.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c569c7b89d91e29ea3d6aa5ff5aa4fe4645b108ae2305b8c4b69946d058cef2f\"\n+checksum = \"72b74b36774b3d736d0d7c897daa35eaa2f16b7b835464b44a31c5605436a788\"\ndependencies = [\n\"awc\",\n\"clarity\",\n@@ -4511,7 +4480,7 @@ dependencies = [\n\"log\",\n\"num 0.4.0\",\n\"num256\",\n- \"serde 1.0.132\",\n+ \"serde 1.0.133\",\n\"serde_derive\",\n\"serde_json\",\n\"tokio 1.15.0\",\n@@ -4614,18 +4583,18 @@ dependencies = [\n[[package]]\nname = \"zstd\"\n-version = \"0.9.1+zstd.1.5.1\"\n+version = \"0.9.2+zstd.1.5.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"538b8347df9257b7fbce37677ef7535c00a3c7bf1f81023cc328ed7fe4b41de8\"\n+checksum = \"2390ea1bf6c038c39674f22d95f0564725fc06034a47129179810b2fc58caa54\"\ndependencies = [\n\"zstd-safe\",\n]\n[[package]]\nname = \"zstd-safe\"\n-version = \"4.1.2+zstd.1.5.1\"\n+version = \"4.1.3+zstd.1.5.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"9fb4cfe2f6e6d35c5d27ecd9d256c4b6f7933c4895654917460ec56c29336cc1\"\n+checksum = \"e99d81b99fb3c2c2c794e3fe56c305c63d5173a16a46b5850b07c935ffc7db79\"\ndependencies = [\n\"libc\",\n\"zstd-sys\",\n" }, { "change_type": "MODIFY", "old_path": "clu/Cargo.toml", "new_path": "clu/Cargo.toml", "diff": "@@ -10,7 +10,7 @@ althea_kernel_interface = { path = \"../althea_kernel_interface\" }\nalthea_types = { path = \"../althea_types\" }\nlazy_static = \"1.4\"\nlog = \"0.4\"\n-env_logger = \"0.8\"\n+env_logger = \"0.9\"\nfailure = \"0.1\"\nipgen = \"1.0.1\"\nrand = \"0.8\"\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.18.9\"\n+version = \"0.18.10\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\nbuild = \"build.rs\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "[package]\nname = \"rita_client\"\n-version = \"0.18.9\"\n+version = \"0.18.10\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n@@ -22,7 +22,7 @@ althea_types = { path = \"../althea_types\" }\nalthea_kernel_interface = { path = \"../althea_kernel_interface\" }\nantenna_forwarding_client = { path = \"../antenna_forwarding_client\" }\nsettings = { path = \"../settings\" }\n-sha3 = \"0.9\"\n+sha3 = \"0.10\"\nlettre = \"0.9\"\nlettre_email = \"0.9\"\nphonenumber = \"0.3\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "[package]\nname = \"rita_common\"\n-version = \"0.18.9\"\n+version = \"0.18.10\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/dashboard/own_info.rs", "new_path": "rita_common/src/dashboard/own_info.rs", "diff": "@@ -5,7 +5,7 @@ use clarity::Address;\nuse failure::Error;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 18 RC9\";\n+pub static READABLE_VERSION: &str = \"Beta 18 RC10\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/Cargo.toml", "new_path": "rita_exit/Cargo.toml", "diff": "[package]\nname = \"rita_exit\"\n-version = \"0.18.9\"\n+version = \"0.18.10\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 18 RC10 and update dependencies
20,244
12.01.2022 17:15:58
18,000
c2d8f02d6c0df54759041666d680548261a582d4
Bump for Beta 18 RC11 also bumps compressed log with a minor change to it's log type.
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -872,9 +872,9 @@ dependencies = [\n[[package]]\nname = \"compressed_log\"\n-version = \"0.4.4\"\n+version = \"0.5.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0d643fdb22b65931d0d2b156aa5347fb8e3fa947b3c6bc764173fc6f087b64a6\"\n+checksum = \"0e8d927ae6eec4ece3a1b6cd1a148c29c8000cc2e973b30c37f2c13f695b2a33\"\ndependencies = [\n\"actix 0.12.0\",\n\"awc\",\n@@ -3168,7 +3168,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.18.10\"\n+version = \"0.18.11\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3205,7 +3205,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.18.10\"\n+version = \"0.18.11\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3246,7 +3246,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.18.10\"\n+version = \"0.18.11\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3288,7 +3288,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.18.10\"\n+version = \"0.18.11\"\ndependencies = [\n\"actix 0.7.11\",\n\"actix-web 0.7.19\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.18.10\"\n+version = \"0.18.11\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\nbuild = \"build.rs\"\n@@ -24,7 +24,7 @@ actix = \"0.7\"\nactix-web = { version = \"0.7\", default_features = false, features= [\"ssl\"] }\nactix_derive = \"0.6\"\ndocopt = \"1.1\"\n-compressed_log = \"0.4\"\n+compressed_log = \"0.5\"\nsettings = { path = \"../settings\" }\ndiesel = { version = \"1.4\", features = [\"postgres\", \"r2d2\"] }\nlog = { version = \"0.4\", features = [\"release_max_level_info\"] }\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "[package]\nname = \"rita_client\"\n-version = \"0.18.10\"\n+version = \"0.18.11\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n[dependencies]\n-compressed_log = \"0.4\"\n+compressed_log = \"0.5\"\nnum-traits=\"0.2\"\nnum256 = \"0.3\"\nserde = \"1.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "[package]\nname = \"rita_common\"\n-version = \"0.18.10\"\n+version = \"0.18.11\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n@@ -13,7 +13,7 @@ hex-literal = \"0.3\"\ndocopt = \"1.1\"\nserde = \"1.0\"\nbytes = \"1.0\"\n-compressed_log = \"0.4\"\n+compressed_log = \"0.5\"\nbyteorder = { version = \"1.4\", features = [\"i128\"] }\narrayvec = {version= \"0.7\", features = [\"serde\"]}\nbabel_monitor = { path = \"../babel_monitor\" }\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/dashboard/own_info.rs", "new_path": "rita_common/src/dashboard/own_info.rs", "diff": "@@ -5,7 +5,7 @@ use clarity::Address;\nuse failure::Error;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 18 RC10\";\n+pub static READABLE_VERSION: &str = \"Beta 18 RC11\";\n#[derive(Serialize)]\npub struct OwnInfo {\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/Cargo.toml", "new_path": "rita_exit/Cargo.toml", "diff": "[package]\nname = \"rita_exit\"\n-version = \"0.18.10\"\n+version = \"0.18.11\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n[dependencies]\n# debug is used here to make sure exit logs remain accessible locally\n-compressed_log = {version=\"0.4\", features = [\"debug\"]}\n+compressed_log = {version=\"0.5\", features = [\"debug\"]}\nsodiumoxide = \"0.2\"\nnum256 = \"0.3\"\nrita_common = { path = \"../rita_common\" }\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 18 RC11 also bumps compressed log with a minor change to it's log type.
20,244
13.01.2022 08:02:12
18,000
7e2afe14654ff0a2dc4480479b869d45c0d752f3
Improve logging around update methods
[ { "change_type": "MODIFY", "old_path": "rita_client/src/operator_update/mod.rs", "new_path": "rita_client/src/operator_update/mod.rs", "diff": "@@ -273,12 +273,15 @@ fn checkin() {\n\"Received an update command from op tools! The instruction is {:?}\",\ninstruction\n);\n- let _res = update_rita(instruction);\n+ let res = update_rita(instruction);\n+ info!(\"Update command result is {:?}\", res);\n}\n// both of these actions have been removed, but need to be kept\n// for backwards compatibility for a while\n- Some(OperatorAction::ChangeReleaseFeedAndUpdate { feed: _ }) => {}\n- Some(OperatorAction::UpdateNow) => {}\n+ Some(OperatorAction::ChangeReleaseFeedAndUpdate { feed: _ }) => {\n+ info!(\"Got outdated command ChangeReleaseFeedAndUpdate\")\n+ }\n+ Some(OperatorAction::UpdateNow) => info!(\"Got outdated command UpdateNow\"),\nNone => {}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Improve logging around update methods
20,253
04.01.2022 13:49:58
28,800
92b03bc2b9729596644b04bb72f689f54ce23201
failure dependency removed from auto-bridge crate
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -518,7 +518,6 @@ version = \"0.1.5\"\ndependencies = [\n\"actix 0.12.0\",\n\"clarity\",\n- \"failure\",\n\"futures 0.3.19\",\n\"log\",\n\"num 0.4.0\",\n" }, { "change_type": "MODIFY", "old_path": "auto_bridge/Cargo.toml", "new_path": "auto_bridge/Cargo.toml", "diff": "@@ -13,7 +13,6 @@ num = \"0.4\"\nlog = \"0.4\"\nserde_derive = \"1.0\"\nserde = \"1.0\"\n-failure = \"0.1\"\ntokio = \"1.0\"\nfutures = {version=\"0.3\", features = [\"thread-pool\"]}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
failure dependency removed from auto-bridge crate
20,253
04.01.2022 16:20:04
28,800
9694f2dd32184ae457f9fe911016a852fab9715a
removing failure crate dependency from antenna_forwarding_client
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -185,7 +185,7 @@ dependencies = [\n\"log\",\n\"mio 0.8.0\",\n\"num_cpus\",\n- \"socket2 0.4.2\",\n+ \"socket2 0.4.3\",\n\"tokio 1.15.0\",\n]\n@@ -317,7 +317,7 @@ dependencies = [\n\"serde_json\",\n\"serde_urlencoded 0.7.1\",\n\"smallvec 1.8.0\",\n- \"socket2 0.4.2\",\n+ \"socket2 0.4.3\",\n\"time 0.3.5\",\n\"url 2.2.2\",\n]\n@@ -447,7 +447,6 @@ dependencies = [\n\"althea_types\",\n\"antenna_forwarding_protocol\",\n\"env_logger\",\n- \"failure\",\n\"get_if_addrs\",\n\"lazy_static\",\n\"log\",\n@@ -1786,7 +1785,7 @@ dependencies = [\n\"httpdate\",\n\"itoa 0.4.8\",\n\"pin-project-lite\",\n- \"socket2 0.4.2\",\n+ \"socket2 0.4.3\",\n\"tokio 1.15.0\",\n\"tower-service 0.3.1\",\n\"tracing\",\n@@ -3689,9 +3688,9 @@ dependencies = [\n[[package]]\nname = \"socket2\"\n-version = \"0.4.2\"\n+version = \"0.4.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516\"\n+checksum = \"0f82496b90c36d70af5fcd482edaa2e0bd16fade569de1330405fecbbdac736b\"\ndependencies = [\n\"libc\",\n\"winapi 0.3.9\",\n" }, { "change_type": "MODIFY", "old_path": "antenna_forwarding_client/Cargo.toml", "new_path": "antenna_forwarding_client/Cargo.toml", "diff": "@@ -14,7 +14,6 @@ althea_kernel_interface = { path = \"../althea_kernel_interface\"}\nantenna_forwarding_protocol = {path = \"../antenna_forwarding_protocol\"}\nserde_json = \"1.0\"\nserde = \"1.0\"\n-failure = \"0.1\"\nget_if_addrs = \"0.5\"\nlazy_static = \"1.4\"\nrand = \"0.8\"\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "antenna_forwarding_client/src/error.rs", "diff": "+use std::{\n+ error::Error,\n+ fmt::{Display, Formatter, Result as FmtResult},\n+};\n+\n+use althea_kernel_interface::KernelInterfaceError;\n+use oping::PingError;\n+\n+#[derive(Debug)]\n+pub enum AntennaForwardingError {\n+ IPSetupError, //(\"IP setup failed\")\n+ AntennaNotFound, // //Err(format_err!(\"Failed to find Antenna!\"))\n+ IPNotSupported, // //IpAddr::V6(_address) => Err(format_err!(\"Not supported!\")),\n+ BlacklistedAddress, ////return Err(format_err!(\"Blacklisted address!\"));\n+ KernelInterfaceError(KernelInterfaceError),\n+ PingError(PingError),\n+\n+\n+}\n+\n+\n+impl From<KernelInterfaceError> for AntennaForwardingError {\n+ fn from(error: KernelInterfaceError) -> Self {\n+ AntennaForwardingError::KernelInterfaceError(error)\n+ }\n+}\n+impl From<PingError> for AntennaForwardingError {\n+ fn from(error: PingError) -> Self {\n+ AntennaForwardingError::PingError(error)\n+ }\n+}\n+\n+impl Display for AntennaForwardingError {\n+ fn fmt(&self, f: &mut Formatter) -> FmtResult {\n+ match self {\n+ AntennaForwardingError::IPSetupError => write!(\n+ f,\n+ \"IP setup failed\",\n+ ),\n+ AntennaForwardingError::AntennaNotFound => write!(\n+ f,\n+ \"Failed to find Antenna!\",\n+ ),\n+ AntennaForwardingError::IPNotSupported => write!(\n+ f,\n+ \"Not supported!\",\n+ ),\n+ AntennaForwardingError::BlacklistedAddress => write!(\n+ f,\n+ \"Blacklisted address!\",\n+ ),\n+ AntennaForwardingError::KernelInterfaceError(e) => write!(f, \"{}\", e),\n+ AntennaForwardingError::PingError(e) => write!(f, \"{}\", e),\n+\n+ }\n+ }\n+}\n+\n+impl Error for AntennaForwardingError {}\n" }, { "change_type": "MODIFY", "old_path": "antenna_forwarding_client/src/lib.rs", "new_path": "antenna_forwarding_client/src/lib.rs", "diff": "#[macro_use]\nextern crate log;\n-#[macro_use]\n-extern crate failure;\n+//#[macro_use]\n+//extern crate failure;\n#[macro_use]\nextern crate lazy_static;\n@@ -19,7 +19,7 @@ use antenna_forwarding_protocol::ExternalStream;\nuse antenna_forwarding_protocol::ForwardingProtocolMessage;\nuse antenna_forwarding_protocol::NET_TIMEOUT;\nuse antenna_forwarding_protocol::SPINLOCK_TIME;\n-use failure::Error;\n+//use failure::Error;\nuse oping::Ping;\nuse rand::Rng;\nuse std::collections::HashMap;\n@@ -34,6 +34,9 @@ use std::thread;\nuse std::time::Duration;\nuse std::time::Instant;\n+mod error;\n+pub use error::AntennaForwardingError;\n+\nlazy_static! {\npub static ref KI: Box<dyn KernelInterface> = Box::new(LinuxCommandRunner {});\n}\n@@ -287,7 +290,7 @@ fn setup_networking<S: ::std::hash::BuildHasher>(\nantenna_ip: IpAddr,\nantenna_port: u16,\ninterfaces: &HashSet<String, S>,\n-) -> Result<SocketAddr, Error> {\n+) -> Result<SocketAddr, AntennaForwardingError> {\nmatch find_antenna(antenna_ip, interfaces) {\nOk(_iface) => {}\nErr(e) => {\n@@ -305,7 +308,7 @@ fn setup_networking<S: ::std::hash::BuildHasher>(\nfn find_antenna<S: ::std::hash::BuildHasher>(\ntarget_ip: IpAddr,\ninterfaces: &HashSet<String, S>,\n-) -> Result<String, Error> {\n+) -> Result<String, AntennaForwardingError> {\ncheck_blacklist(target_ip)?;\nlet our_ip = get_local_ip(target_ip)?;\nfor iface in interfaces {\n@@ -353,7 +356,7 @@ fn find_antenna<S: ::std::hash::BuildHasher>(\nif let Some(code) = r.status.code() {\nif code == 512 {\nerror!(\"Failed to add route\");\n- bail!(\"IP setup failed\");\n+ return Err(AntennaForwardingError::IPSetupError);\n}\n}\ntrace!(\"added route with {:?}\", r);\n@@ -380,12 +383,13 @@ fn find_antenna<S: ::std::hash::BuildHasher>(\n}\n}\n}\n- Err(format_err!(\"Failed to find Antenna!\"))\n+ //Err(format_err!(\"Failed to find Antenna!\"))\n+ Err(AntennaForwardingError::AntennaNotFound)\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) -> Result<IpAddr, Error> {\n+fn get_local_ip(target_ip: IpAddr) -> Result<IpAddr, AntennaForwardingError> {\nmatch target_ip {\nIpAddr::V4(address) => {\nlet mut rng = rand::thread_rng();\n@@ -400,7 +404,8 @@ fn get_local_ip(target_ip: IpAddr) -> Result<IpAddr, Error> {\nbytes[3] = new_ip;\nOk(Ipv4Addr::new(bytes[0], bytes[1], bytes[2], bytes[3]).into())\n}\n- IpAddr::V6(_address) => Err(format_err!(\"Not supported!\")),\n+ //IpAddr::V6(_address) => Err(format_err!(\"Not supported!\")),\n+ IpAddr::V6(_address) => Err(AntennaForwardingError::IPNotSupported),\n}\n}\n@@ -408,12 +413,12 @@ const IP_BLACKLIST: [Ipv4Addr; 2] = [Ipv4Addr::new(192, 168, 10, 0), Ipv4Addr::n\n/// Checks the forwarding ip blacklist, these are ip's that we don't\n/// want the forwarding client working on\n-fn check_blacklist(ip: IpAddr) -> Result<(), Error> {\n+fn check_blacklist(ip: IpAddr) -> Result<(), AntennaForwardingError> {\nmatch ip {\nIpAddr::V4(address) => {\nfor ip in IP_BLACKLIST.iter() {\nif compare_ipv4_octets(*ip, address) {\n- return Err(format_err!(\"Blacklisted address!\"));\n+ return Err(AntennaForwardingError::BlacklistedAddress);\n}\n}\nOk(())\n@@ -435,7 +440,7 @@ fn send_error_message(server_stream: &mut TcpStream, message: String) {\nlet _res = server_stream.shutdown(Shutdown::Both);\n}\n-fn cleanup_interface(iface: &str) -> Result<(), Error> {\n+fn cleanup_interface(iface: &str) -> Result<(), AntennaForwardingError> {\nlet values = KI.get_ip_from_iface(iface)?;\nfor (ip, netmask) in values {\n// we only clean up very specific routes, this doesn't prevent us from causing problems\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
removing failure crate dependency from antenna_forwarding_client
20,253
05.01.2022 14:15:44
28,800
46607751625190d1654c9086dd5086771f1e5ee6
removing failure dependency from antenna_forwarding_protocol
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -463,7 +463,6 @@ version = \"0.1.0\"\ndependencies = [\n\"althea_types\",\n\"clarity\",\n- \"failure\",\n\"lazy_static\",\n\"log\",\n\"rand 0.8.4\",\n" }, { "change_type": "MODIFY", "old_path": "antenna_forwarding_client/src/error.rs", "new_path": "antenna_forwarding_client/src/error.rs", "diff": "@@ -8,10 +8,10 @@ use oping::PingError;\n#[derive(Debug)]\npub enum AntennaForwardingError {\n- IPSetupError, //(\"IP setup failed\")\n- AntennaNotFound, // //Err(format_err!(\"Failed to find Antenna!\"))\n- IPNotSupported, // //IpAddr::V6(_address) => Err(format_err!(\"Not supported!\")),\n- BlacklistedAddress, ////return Err(format_err!(\"Blacklisted address!\"));\n+ IPSetupError,\n+ AntennaNotFound,\n+ IPNotSupported,\n+ BlacklistedAddress,\nKernelInterfaceError(KernelInterfaceError),\nPingError(PingError),\n" }, { "change_type": "MODIFY", "old_path": "antenna_forwarding_client/src/lib.rs", "new_path": "antenna_forwarding_client/src/lib.rs", "diff": "#[macro_use]\nextern crate log;\n-//#[macro_use]\n-//extern crate failure;\n#[macro_use]\nextern crate lazy_static;\n@@ -19,7 +17,6 @@ use antenna_forwarding_protocol::ExternalStream;\nuse antenna_forwarding_protocol::ForwardingProtocolMessage;\nuse antenna_forwarding_protocol::NET_TIMEOUT;\nuse antenna_forwarding_protocol::SPINLOCK_TIME;\n-//use failure::Error;\nuse oping::Ping;\nuse rand::Rng;\nuse std::collections::HashMap;\n@@ -383,7 +380,6 @@ fn find_antenna<S: ::std::hash::BuildHasher>(\n}\n}\n}\n- //Err(format_err!(\"Failed to find Antenna!\"))\nErr(AntennaForwardingError::AntennaNotFound)\n}\n" }, { "change_type": "MODIFY", "old_path": "antenna_forwarding_protocol/Cargo.toml", "new_path": "antenna_forwarding_protocol/Cargo.toml", "diff": "@@ -10,7 +10,6 @@ serde_json = \"1.0\"\nserde_derive = \"1.0\"\nserde = \"1.0\"\nsodiumoxide = \"0.2\"\n-failure = \"0.1\"\nclarity = \"0.5\"\nlog = \"0.4\"\nlazy_static = \"1.4\"\n" }, { "change_type": "ADD", "old_path": null, "new_path": "antenna_forwarding_protocol/src/error.rs", "diff": "+use std::{\n+ error::Error,\n+ fmt::{Display, Formatter, Result as FmtResult},\n+};\n+\n+use crate::{ForwardingProtocolError, ForwardingProtocolMessage};\n+\n+#[derive(Debug)]\n+pub enum AntennaForwardingError {\n+ SpaceAllocationError,\n+ ConnectionDownError,\n+ EndNotFoundError,\n+ DoubleReadFailure {\n+ a: ForwardingProtocolError,\n+ b: ForwardingProtocolError,\n+ },\n+ ImpossibleError,\n+ UnparsedBytesError {\n+ messages: Vec<ForwardingProtocolMessage>,\n+ remaining_bytes: Vec<u8>,\n+ },\n+ MessageWriteError(std::io::Error),\n+}\n+\n+impl From<std::io::Error> for AntennaForwardingError {\n+ fn from(error: std::io::Error) -> Self {\n+ AntennaForwardingError::MessageWriteError(error)\n+ }\n+}\n+\n+\n+impl Display for AntennaForwardingError {\n+ fn fmt(&self, f: &mut Formatter) -> FmtResult {\n+ match self {\n+ AntennaForwardingError::SpaceAllocationError => write!(\n+ f,\n+ \"Operating system won't allocate buffer space\",\n+ ),\n+ AntennaForwardingError::ConnectionDownError => write!(\n+ f,\n+ \"Probably a dead connection\",\n+ ),\n+ AntennaForwardingError::EndNotFoundError => write!(\n+ f,\n+ \"Never found the end of the message\",\n+ ),\n+ AntennaForwardingError::DoubleReadFailure{a,b} => {\n+ write!(f, \"Double read failure {:?} {:?}\", a, b)\n+ }\n+ AntennaForwardingError::ImpossibleError => write!(\n+ f,\n+ \"Impossible error\",\n+ ),\n+ AntennaForwardingError::UnparsedBytesError{messages, remaining_bytes} => {\n+ write!(f, \"Unparsed bytes! Messages {:#X?} Remaining bytes {:#X?}\",\n+ messages, remaining_bytes)\n+ }\n+ AntennaForwardingError::MessageWriteError(e) => write!(f, \"{}\", e),\n+\n+ }\n+ }\n+}\n+\n+impl Error for AntennaForwardingError {}\n" }, { "change_type": "MODIFY", "old_path": "antenna_forwarding_protocol/src/lib.rs", "new_path": "antenna_forwarding_protocol/src/lib.rs", "diff": "#[macro_use]\nextern crate serde_derive;\n#[macro_use]\n-extern crate failure;\n-#[macro_use]\nextern crate log;\n#[cfg(test)]\n#[macro_use]\n@@ -18,7 +16,6 @@ extern crate lazy_static;\nuse althea_types::Identity;\nuse althea_types::WgKey;\n-use failure::Error as FailureError;\nuse sodiumoxide::crypto::box_;\nuse sodiumoxide::crypto::box_::Nonce;\nuse sodiumoxide::crypto::box_::NONCEBYTES;\n@@ -38,6 +35,9 @@ use std::thread;\nuse std::time::Duration;\nuse std::time::Instant;\n+mod error;\n+pub use error::AntennaForwardingError;\n+\n/// The amount of time to sleep a thread that's spinlocking on somthing\npub const SPINLOCK_TIME: Duration = Duration::from_millis(100);\n@@ -101,7 +101,7 @@ fn write_all_spinlock_internal(\nif depth > 100 {\nreturn Err(IoError::new(\nstd::io::ErrorKind::WriteZero,\n- format_err!(\"Operating system won't allocate buffer space\"),\n+ AntennaForwardingError::SpaceAllocationError,\n));\n}\n@@ -115,7 +115,7 @@ fn write_all_spinlock_internal(\n} else if bytes == 0 {\nErr(IoError::new(\nstd::io::ErrorKind::WriteZero,\n- format_err!(\"Probably a dead connection\"),\n+ AntennaForwardingError::ConnectionDownError,\n))\n} else {\ntrace!(\"Did not write all, recursing\",);\n@@ -623,7 +623,7 @@ impl ForwardingProtocolMessage {\ninput: &mut TcpStream,\nserver_publickey: WgKey,\nclient_secretkey: WgKey,\n- ) -> Result<Vec<ForwardingProtocolMessage>, FailureError> {\n+ ) -> Result<Vec<ForwardingProtocolMessage>, AntennaForwardingError> {\ntrace!(\"read messages start\");\nForwardingProtocolMessage::read_messages_start_internal(\ninput,\n@@ -640,7 +640,7 @@ impl ForwardingProtocolMessage {\nclient_secretkey: WgKey,\nbytes: Vec<u8>,\ndepth: u8,\n- ) -> Result<Vec<ForwardingProtocolMessage>, FailureError> {\n+ ) -> Result<Vec<ForwardingProtocolMessage>, AntennaForwardingError> {\n// don't wait the first time in order to speed up execution\n// if we are recursing we want to wait for the message to finish\n// being written as the only reason we recuse is becuase we found\n@@ -650,7 +650,7 @@ impl ForwardingProtocolMessage {\nthread::sleep(SPINLOCK_TIME);\n} else if depth > WAIT_TIME {\nerror!(\"Never found the end of the message\");\n- bail!(\"Never found the end of the message\");\n+ return Err(AntennaForwardingError::EndNotFoundError);\n}\nlet mut bytes = bytes;\n@@ -703,11 +703,11 @@ impl ForwardingProtocolMessage {\n}\n(Err(a), Err(b)) => {\ntrace!(\"Double read failure {:?} {:?}\", a, b);\n- Err(format_err!(\"{:?} {:?}\", a, b))\n+ Err(AntennaForwardingError::DoubleReadFailure{a: a, b: b})\n}\n(_, _) => {\ntrace!(\"Impossible error\");\n- Err(format_err!(\"Impossible\"))\n+ Err(AntennaForwardingError::ImpossibleError)\n}\n}\n}\n@@ -716,7 +716,7 @@ impl ForwardingProtocolMessage {\n/// also block until a currently in flight message is delivered\npub fn read_messages(\ninput: &mut TcpStream,\n- ) -> Result<Vec<ForwardingProtocolMessage>, FailureError> {\n+ ) -> Result<Vec<ForwardingProtocolMessage>, AntennaForwardingError> {\nForwardingProtocolMessage::read_messages_internal(input, Vec::new(), Vec::new(), 0, None)\n}\n@@ -731,7 +731,7 @@ impl ForwardingProtocolMessage {\nmessages: Vec<ForwardingProtocolMessage>,\ndepth: u16,\nlast_read_bytes: Option<u32>,\n- ) -> Result<Vec<ForwardingProtocolMessage>, FailureError> {\n+ ) -> Result<Vec<ForwardingProtocolMessage>, AntennaForwardingError> {\n// don't wait the first time in order to speed up execution\n// if we are recursing we want to wait for the message to finish\n// being written as the only reason we recuse is becuase we found\n@@ -744,7 +744,7 @@ impl ForwardingProtocolMessage {\nthread::sleep(SPINLOCK_TIME);\n} else if depth > WAIT_TIME {\nerror!(\"Never found the end of the message\");\n- bail!(\"Never found the end of the message\");\n+ return Err(AntennaForwardingError::EndNotFoundError);\n}\n// these should match the full list of message types defined above\nlet mut messages = messages;\n@@ -799,12 +799,7 @@ impl ForwardingProtocolMessage {\n}\n_ => {\nif !remaining_bytes.is_empty() {\n- error!(\"Unparsed bytes! {} {:?}\", remaining_bytes.len(), e);\n- error!(\n- \"Messages {:#X?} Remaining bytes {:#X?}\",\n- messages, remaining_bytes\n- );\n- bail!(\"Unparsed bytes!\");\n+ return Err(AntennaForwardingError::UnparsedBytesError{messages: messages, remaining_bytes: remaining_bytes})\n} else {\nOk(messages)\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
removing failure dependency from antenna_forwarding_protocol
20,253
05.01.2022 21:16:23
28,800
e9e77f9e9fc1f4e937d4bee286debd3aad717ce4
removed failure dependency in babel_monitor
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -580,7 +580,6 @@ version = \"0.1.0\"\ndependencies = [\n\"ascii\",\n\"env_logger\",\n- \"failure\",\n\"ipnetwork 0.18.0\",\n\"log\",\n\"serde 1.0.133\",\n" }, { "change_type": "MODIFY", "old_path": "babel_monitor/Cargo.toml", "new_path": "babel_monitor/Cargo.toml", "diff": "@@ -7,7 +7,6 @@ edition = \"2018\"\n[dependencies]\nascii = \"1.0\"\nenv_logger = \"0.9\"\n-failure = \"0.1\"\nipnetwork = \"0.18\"\nlog = \"0.4\"\nserde = \"1.0\"\n" }, { "change_type": "MODIFY", "old_path": "babel_monitor/src/lib.rs", "new_path": "babel_monitor/src/lib.rs", "diff": "#[macro_use]\nextern crate serde_derive;\n#[macro_use]\n-extern crate failure;\n-#[macro_use]\nextern crate log;\n-use failure::Error;\n-use ipnetwork::IpNetwork;\n+use ipnetwork::{IpNetwork, IpNetworkError};\nuse std::error::Error as ErrorTrait;\nuse std::f32;\nuse std::fmt::Debug;\n+use std::fmt::{Display, Formatter, Result as FmtResult};\nuse std::io::ErrorKind;\nuse std::io::Read;\nuse std::io::Write;\nuse std::iter::Iterator;\n-use std::net::IpAddr;\n+use std::net::{IpAddr, AddrParseError};\nuse std::net::SocketAddr;\nuse std::net::TcpStream;\n-use std::str;\n+use std::num::{ParseIntError, ParseFloatError};\n+use std::str::{self, ParseBoolError};\nuse std::str::FromStr;\nuse std::thread;\nuse std::time::Duration;\n@@ -38,24 +37,24 @@ use std::time::Duration;\n/// job\nconst SLEEP_TIME: Duration = Duration::from_millis(10);\n-#[derive(Debug, Fail)]\n+#[derive(Debug)]\npub enum BabelMonitorError {\n- #[fail(display = \"variable '{}' not found in '{}'\", _0, _1)]\nVariableNotFound(String, String),\n- #[fail(display = \"Invalid preamble: {}\", _0)]\nInvalidPreamble(String),\n- #[fail(display = \"Could not find local fee in '{}'\", _0)]\nLocalFeeNotFound(String),\n- #[fail(display = \"Command '{}' failed. {}\", _0, _1)]\nCommandFailed(String, String),\n- #[fail(display = \"Erroneous Babel output:\\n{}\", _0)]\nReadFailed(String),\n- #[fail(display = \"No terminator after Babel output:\\n{}\", _0)]\nNoTerminator(String),\n- #[fail(display = \"No Neighbor was found matching address:\\n{}\", _0)]\nNoNeighbor(String),\n- #[fail(display = \"Tcp connection failure while talking to babel:\\n{}\", _0)]\nTcpError(String),\n+ BabelParseError(String),\n+ ReadFunctionError(std::io::Error),\n+ BoolParseError(ParseBoolError),\n+ ParseAddrError(AddrParseError),\n+ IntParseError(ParseIntError),\n+ FloatParseError(ParseFloatError),\n+ NetworkError(IpNetworkError),\n+ NoRoute(String),\n}\nuse crate::BabelMonitorError::{\n@@ -63,7 +62,83 @@ use crate::BabelMonitorError::{\nTcpError, VariableNotFound,\n};\n-pub fn find_babel_val(val: &str, line: &str) -> Result<String, Error> {\n+impl From<std::io::Error> for BabelMonitorError {\n+ fn from(error: std::io::Error) -> Self {\n+ BabelMonitorError::ReadFunctionError(error)\n+ }\n+}\n+impl From<ParseBoolError> for BabelMonitorError {\n+ fn from(error: ParseBoolError) -> Self {\n+ BabelMonitorError::BoolParseError(error)\n+ }\n+}\n+impl From<AddrParseError> for BabelMonitorError {\n+ fn from(error: AddrParseError) -> Self {\n+ BabelMonitorError::ParseAddrError(error)\n+ }\n+}\n+impl From<ParseIntError> for BabelMonitorError {\n+ fn from(error: ParseIntError) -> Self {\n+ BabelMonitorError::IntParseError(error)\n+ }\n+}\n+impl From<ParseFloatError> for BabelMonitorError {\n+ fn from(error: ParseFloatError) -> Self {\n+ BabelMonitorError::FloatParseError(error)\n+ }\n+}\n+impl From<IpNetworkError> for BabelMonitorError {\n+ fn from(error: IpNetworkError) -> Self {\n+ BabelMonitorError::NetworkError(error)\n+ }\n+}\n+\n+impl Display for BabelMonitorError {\n+ fn fmt(&self, f: &mut Formatter) -> FmtResult {\n+ match self {\n+ BabelMonitorError::VariableNotFound(a, b) => write!(\n+ f, \"variable '{}' not found in '{}'\", a, b,\n+ ),\n+ BabelMonitorError::InvalidPreamble(a) => write!(\n+ f, \"Invalid preamble: {}\", a,\n+ ),\n+ BabelMonitorError::LocalFeeNotFound(a) => write!(\n+ f, \"Could not find local fee in '{}'\", a,\n+ ),\n+ BabelMonitorError::CommandFailed(a, b) => write!(\n+ f, \"Command '{}' failed. {}\", a, b,\n+ ),\n+ BabelMonitorError::ReadFailed(a) => write!(\n+ f, \"Erroneous Babel output:\\n{}\", a,\n+ ),\n+ BabelMonitorError::NoTerminator(a) => write!(\n+ f, \"No terminator after Babel output:\\n{}\", a,\n+ ),\n+ BabelMonitorError::NoNeighbor(a) => write!(\n+ f, \"No Neighbor was found matching address:\\n{}\", a,\n+ ),\n+ BabelMonitorError::TcpError(a) => write!(\n+ f, \"Tcp connection failure while talking to babel:\\n{}\", a,\n+ ),\n+ BabelMonitorError::BabelParseError(a) => write!(\n+ f, \"Babel parsing failed:\\n{}\", a,\n+ ),\n+ BabelMonitorError::ReadFunctionError(e) => write!(f, \"{}\", e),\n+ BabelMonitorError::BoolParseError(e) => write!(f, \"{}\", e),\n+ BabelMonitorError::ParseAddrError(e) => write!(f, \"{}\", e),\n+ BabelMonitorError::IntParseError(e) => write!(f, \"{}\", e),\n+ BabelMonitorError::FloatParseError(e) => write!(f, \"{}\", e),\n+ BabelMonitorError::NetworkError(e) => write!(f, \"{}\", e),\n+ BabelMonitorError::NoRoute(a) => write!(\n+ f, \"Route not found:\\n{}\", a,\n+ ),\n+\n+ }\n+ }\n+}\n+\n+\n+pub fn find_babel_val(val: &str, line: &str) -> Result<String, BabelMonitorError> {\nlet mut iter = line.split(' ');\nwhile let Some(entry) = iter.next() {\nif entry == val {\n@@ -77,9 +152,9 @@ pub fn find_babel_val(val: &str, line: &str) -> Result<String, Error> {\nErr(VariableNotFound(String::from(val), String::from(line)).into())\n}\n-pub fn find_and_parse_babel_val<T: FromStr>(val: &str, line: &str) -> Result<T, Error>\n+pub fn find_and_parse_babel_val<T: FromStr>(val: &str, line: &str) -> Result<T, BabelMonitorError>\nwhere\n- <T as FromStr>::Err: Debug + ErrorTrait + Sync + Send + 'static,\n+ <T as FromStr>::Err: Debug + ErrorTrait + Sync + Send + 'static, BabelMonitorError: From<<T as FromStr>::Err>\n{\nmatch find_babel_val(val, line) {\nOk(string_val) => match string_val.parse() {\n@@ -131,7 +206,7 @@ pub struct Neighbor {\n/// Opens a tcpstream to the babel management socket using a standard timeout\n/// for both the open and read operations\n-pub fn open_babel_stream(babel_port: u16, timeout: Duration) -> Result<TcpStream, Error> {\n+pub fn open_babel_stream(babel_port: u16, timeout: Duration) -> Result<TcpStream, BabelMonitorError> {\nlet socket_string = format!(\"[::1]:{}\", babel_port);\ntrace!(\"About to open Babel socket using {}\", socket_string);\nlet socket: SocketAddr = socket_string.parse().unwrap();\n@@ -161,7 +236,7 @@ fn read_babel(\nstream: &mut TcpStream,\nprevious_contents: String,\ndepth: usize,\n-) -> Result<String, Error> {\n+) -> Result<String, BabelMonitorError> {\ntrace!(\n\"starting read babel with {} and {}\",\nprevious_contents,\n@@ -261,7 +336,7 @@ fn read_babel_sync(output: &str) -> Result<String, BabelMonitorError> {\nErr(NoTerminator(ret))\n}\n-pub fn run_command(stream: &mut TcpStream, cmd: &str) -> Result<String, Error> {\n+pub fn run_command(stream: &mut TcpStream, cmd: &str) -> Result<String, BabelMonitorError> {\ninfo!(\"Running babel command {}\", cmd);\nlet cmd = format!(\"{}\\n\", cmd);\nlet bytes = cmd.as_bytes().to_vec();\n@@ -276,7 +351,7 @@ pub fn run_command(stream: &mut TcpStream, cmd: &str) -> Result<String, Error> {\nread_babel(stream, String::new(), 0)\n}\n-pub fn validate_preamble(preamble: String) -> Result<(), Error> {\n+pub fn validate_preamble(preamble: String) -> Result<(), BabelMonitorError> {\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@@ -286,7 +361,7 @@ pub fn validate_preamble(preamble: String) -> Result<(), Error> {\n}\n}\n-pub fn parse_interfaces(stream: &mut TcpStream) -> Result<Vec<Interface>, Error> {\n+pub fn parse_interfaces(stream: &mut TcpStream) -> Result<Vec<Interface>, BabelMonitorError> {\nlet output = run_command(stream, \"dump\");\nif let Err(e) = output {\n@@ -296,7 +371,7 @@ pub fn parse_interfaces(stream: &mut TcpStream) -> Result<Vec<Interface>, Error>\nparse_interfaces_sync(babel_output)\n}\n-pub fn parse_interfaces_sync(output: String) -> Result<Vec<Interface>, Error> {\n+pub fn parse_interfaces_sync(output: String) -> Result<Vec<Interface>, BabelMonitorError> {\nlet mut vector: Vec<Interface> = Vec::new();\nlet mut found_interface = false;\nfor entry in output.split('\\n') {\n@@ -324,12 +399,12 @@ pub fn parse_interfaces_sync(output: String) -> Result<Vec<Interface>, Error> {\n}\n}\nif vector.is_empty() && found_interface {\n- bail!(\"All Babel Interface parsing failed!\")\n+ return Err(BabelMonitorError::BabelParseError(\"All Babel Interface parsing failed!\".to_string()))\n}\nOk(vector)\n}\n-pub fn get_local_fee(stream: &mut TcpStream) -> Result<u32, Error> {\n+pub fn get_local_fee(stream: &mut TcpStream) -> Result<u32, BabelMonitorError> {\nlet output = run_command(stream, \"dump\");\nif let Err(e) = output {\n@@ -339,7 +414,7 @@ pub fn get_local_fee(stream: &mut TcpStream) -> Result<u32, Error> {\nget_local_fee_sync(babel_output)\n}\n-pub fn get_local_fee_sync(babel_output: String) -> Result<u32, Error> {\n+pub fn get_local_fee_sync(babel_output: String) -> Result<u32, BabelMonitorError> {\nlet fee_entry = match babel_output.split('\\n').next() {\nSome(entry) => entry,\n// Even an empty string wouldn't yield None\n@@ -355,7 +430,7 @@ pub fn get_local_fee_sync(babel_output: String) -> Result<u32, Error> {\nErr(LocalFeeNotFound(String::from(fee_entry)).into())\n}\n-pub fn set_local_fee(stream: &mut TcpStream, new_fee: u32) -> Result<(), Error> {\n+pub fn set_local_fee(stream: &mut TcpStream, new_fee: u32) -> Result<(), BabelMonitorError> {\nlet result = run_command(stream, &format!(\"fee {}\", new_fee));\nif let Err(e) = result {\n@@ -365,7 +440,7 @@ pub fn set_local_fee(stream: &mut TcpStream, new_fee: u32) -> Result<(), Error>\nOk(())\n}\n-pub fn set_metric_factor(stream: &mut TcpStream, new_factor: u32) -> Result<(), Error> {\n+pub fn set_metric_factor(stream: &mut TcpStream, new_factor: u32) -> Result<(), BabelMonitorError> {\nlet result = run_command(stream, &format!(\"metric-factor {}\", new_factor));\nif let Err(e) = result {\n@@ -375,7 +450,7 @@ pub fn set_metric_factor(stream: &mut TcpStream, new_factor: u32) -> Result<(),\nOk(())\n}\n-pub fn monitor(stream: &mut TcpStream, iface: &str) -> Result<(), Error> {\n+pub fn monitor(stream: &mut TcpStream, iface: &str) -> Result<(), BabelMonitorError> {\nlet command = &format!(\n\"interface {} max-rtt-penalty 500 enable-timestamps true\",\niface\n@@ -391,7 +466,7 @@ pub fn monitor(stream: &mut TcpStream, iface: &str) -> Result<(), Error> {\nOk(())\n}\n-pub fn redistribute_ip(stream: &mut TcpStream, ip: &IpAddr, allow: bool) -> Result<String, Error> {\n+pub fn redistribute_ip(stream: &mut TcpStream, ip: &IpAddr, allow: bool) -> Result<String, BabelMonitorError> {\nlet command = format!(\n\"redistribute ip {}/128 {}\",\nip,\n@@ -406,7 +481,7 @@ pub fn redistribute_ip(stream: &mut TcpStream, ip: &IpAddr, allow: bool) -> Resu\nread_babel(stream, String::new(), 0)\n}\n-pub fn unmonitor(stream: &mut TcpStream, iface: &str) -> Result<(), Error> {\n+pub fn unmonitor(stream: &mut TcpStream, iface: &str) -> Result<(), BabelMonitorError> {\nlet command = format!(\"flush interface {}\", iface);\nlet iface = iface.to_string();\nlet result = run_command(stream, &command);\n@@ -419,7 +494,7 @@ pub fn unmonitor(stream: &mut TcpStream, iface: &str) -> Result<(), Error> {\nOk(())\n}\n-pub fn parse_neighs(stream: &mut TcpStream) -> Result<Vec<Neighbor>, Error> {\n+pub fn parse_neighs(stream: &mut TcpStream) -> Result<Vec<Neighbor>, BabelMonitorError> {\nlet result = run_command(stream, \"dump\");\nif let Err(e) = result {\n@@ -429,7 +504,7 @@ pub fn parse_neighs(stream: &mut TcpStream) -> Result<Vec<Neighbor>, Error> {\nparse_neighs_sync(output)\n}\n-pub fn parse_neighs_sync(output: String) -> Result<Vec<Neighbor>, Error> {\n+pub fn parse_neighs_sync(output: String) -> Result<Vec<Neighbor>, BabelMonitorError> {\nlet mut vector: Vec<Neighbor> = Vec::with_capacity(5);\nlet mut found_neigh = false;\nfor entry in output.split('\\n') {\n@@ -478,12 +553,12 @@ pub fn parse_neighs_sync(output: String) -> Result<Vec<Neighbor>, Error> {\n}\n}\nif vector.is_empty() && found_neigh {\n- bail!(\"All Babel neigh parsing failed!\")\n+ return Err(BabelMonitorError::BabelParseError(\"All Babel neigh parsing failed!\".to_string()))\n}\nOk(vector)\n}\n-pub fn parse_routes(stream: &mut TcpStream) -> Result<Vec<Route>, Error> {\n+pub fn parse_routes(stream: &mut TcpStream) -> Result<Vec<Route>, BabelMonitorError> {\nlet result = run_command(stream, \"dump\");\nif let Err(e) = result {\n@@ -493,7 +568,7 @@ pub fn parse_routes(stream: &mut TcpStream) -> Result<Vec<Route>, Error> {\nparse_routes_sync(babel_out)\n}\n-pub fn parse_routes_sync(babel_out: String) -> Result<Vec<Route>, Error> {\n+pub fn parse_routes_sync(babel_out: String) -> Result<Vec<Route>, BabelMonitorError> {\nlet mut vector: Vec<Route> = Vec::with_capacity(20);\nlet mut found_route = false;\ntrace!(\"Got from babel dump: {}\", babel_out);\n@@ -550,7 +625,7 @@ pub fn parse_routes_sync(babel_out: String) -> Result<Vec<Route>, Error> {\n}\n}\nif vector.is_empty() && found_route {\n- bail!(\"All Babel route parsing failed!\")\n+ return Err(BabelMonitorError::BabelParseError(\"All Babel route parsing failed!\".to_string()))\n}\nOk(vector)\n}\n@@ -563,7 +638,7 @@ pub fn get_route_via_neigh(\nneigh_mesh_ip: IpAddr,\ndest_mesh_ip: IpAddr,\nroutes: &[Route],\n-) -> Result<Route, Error> {\n+) -> Result<Route, BabelMonitorError> {\n// First find the neighbors route to itself to get the local address\nfor neigh_route in routes.iter() {\n// This will fail on v4 babel routes etc\n@@ -595,7 +670,7 @@ pub fn get_neigh_given_route(route: &Route, neighs: &[Neighbor]) -> Option<Neigh\n}\n/// Checks if Babel has an installed route to the given destination\n-pub fn do_we_have_route(mesh_ip: &IpAddr, routes: &[Route]) -> Result<bool, Error> {\n+pub fn do_we_have_route(mesh_ip: &IpAddr, routes: &[Route]) -> Result<bool, BabelMonitorError> {\nfor route in routes.iter() {\nif let IpNetwork::V6(ref ip) = route.prefix {\nif ip.ip() == *mesh_ip && route.installed {\n@@ -606,7 +681,7 @@ pub fn do_we_have_route(mesh_ip: &IpAddr, routes: &[Route]) -> Result<bool, Erro\nOk(false)\n}\n/// Returns the installed route to a given destination\n-pub fn get_installed_route(mesh_ip: &IpAddr, routes: &[Route]) -> Result<Route, Error> {\n+pub fn get_installed_route(mesh_ip: &IpAddr, routes: &[Route]) -> Result<Route, BabelMonitorError> {\nlet mut exit_route = None;\nfor route in routes.iter() {\n// Only ip6\n@@ -619,7 +694,8 @@ pub fn get_installed_route(mesh_ip: &IpAddr, routes: &[Route]) -> Result<Route,\n}\n}\nif exit_route.is_none() {\n- bail!(\"No installed route to that destination!\");\n+ return Err(BabelMonitorError::NoRoute(\"No installed route to that destination!\".to_string()))\n+\n}\nOk(exit_route.unwrap().clone())\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
removed failure dependency in babel_monitor
20,253
05.01.2022 22:24:27
28,800
51f0372252bbc87752da7192425619bd3c8f515e
removed failure dependency in babel_monitor_legacy
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -593,7 +593,6 @@ dependencies = [\n\"ascii\",\n\"babel_monitor\",\n\"env_logger\",\n- \"failure\",\n\"futures 0.1.31\",\n\"ipnetwork 0.18.0\",\n\"log\",\n" }, { "change_type": "MODIFY", "old_path": "babel_monitor_legacy/Cargo.toml", "new_path": "babel_monitor_legacy/Cargo.toml", "diff": "@@ -9,7 +9,6 @@ license = \"Apache-2.0\"\nbabel_monitor = { path = \"../babel_monitor\" }\nascii = \"1.0\"\nenv_logger = \"0.9\"\n-failure = \"0.1\"\nipnetwork = \"0.18\"\nlog = \"0.4\"\nfutures = \"0.1\"\n" }, { "change_type": "MODIFY", "old_path": "babel_monitor_legacy/src/lib.rs", "new_path": "babel_monitor_legacy/src/lib.rs", "diff": "#![allow(clippy::pedantic)]\n#![forbid(unsafe_code)]\n-#[macro_use]\n-extern crate failure;\n#[macro_use]\nextern crate log;\nextern crate futures;\n@@ -20,12 +18,12 @@ use babel_monitor::validate_preamble;\nuse babel_monitor::Interface;\nuse babel_monitor::Neighbor;\nuse babel_monitor::Route;\n-use failure::Error;\nuse futures::future;\nuse futures::future::result as future_result;\nuse futures::future::Either;\nuse futures::future::Future;\nuse std::fmt::Debug;\n+use std::fmt::{Display, Formatter, Result as FmtResult};\nuse std::net::IpAddr;\nuse std::net::SocketAddr;\nuse std::str;\n@@ -44,28 +42,69 @@ use tokio::net::TcpStream;\n/// job\nconst SLEEP_TIME: Duration = Duration::from_millis(10);\n-#[derive(Debug, Fail)]\n+#[derive(Debug)]\npub enum BabelMonitorError {\n- #[fail(display = \"variable '{}' not found in '{}'\", _0, _1)]\nVariableNotFound(String, String),\n- #[fail(display = \"Invalid preamble: {}\", _0)]\nInvalidPreamble(String),\n- #[fail(display = \"Could not find local fee in '{}'\", _0)]\nLocalFeeNotFound(String),\n- #[fail(display = \"Command '{}' failed. {}\", _0, _1)]\nCommandFailed(String, String),\n- #[fail(display = \"Erroneous Babel output:\\n{}\", _0)]\nReadFailed(String),\n- #[fail(display = \"No terminator after Babel output:\\n{}\", _0)]\nNoTerminator(String),\n- #[fail(display = \"No Neighbor was found matching address:\\n{}\", _0)]\nNoNeighbor(String),\n- #[fail(display = \"Tokio had a failure while it was talking to babel:\\n{}\", _0)]\nTokioError(String),\n+ ReadFunctionError(std::io::Error),\n+ NewBabelMonitorError(babel_monitor::BabelMonitorError),\n+\n}\nuse crate::BabelMonitorError::{CommandFailed, NoTerminator, ReadFailed, TokioError};\n+impl From<std::io::Error> for BabelMonitorError {\n+ fn from(error: std::io::Error) -> Self {\n+ BabelMonitorError::ReadFunctionError(error)\n+ }\n+}\n+impl From<babel_monitor::BabelMonitorError> for BabelMonitorError {\n+ fn from(error: babel_monitor::BabelMonitorError) -> Self {\n+ BabelMonitorError::NewBabelMonitorError(error)\n+ }\n+}\n+\n+impl Display for BabelMonitorError {\n+ fn fmt(&self, f: &mut Formatter) -> FmtResult {\n+ match self {\n+ BabelMonitorError::VariableNotFound(a, b) => write!(\n+ f, \"variable '{}' not found in '{}'\", a, b,\n+ ),\n+ BabelMonitorError::InvalidPreamble(a) => write!(\n+ f, \"Invalid preamble: {}\", a,\n+ ),\n+ BabelMonitorError::LocalFeeNotFound(a) => write!(\n+ f, \"Could not find local fee in '{}'\", a,\n+ ),\n+ BabelMonitorError::CommandFailed(a, b) => write!(\n+ f, \"Command '{}' failed. {}\", a, b,\n+ ),\n+ BabelMonitorError::ReadFailed(a) => write!(\n+ f, \"Erroneous Babel output:\\n{}\", a,\n+ ),\n+ BabelMonitorError::NoTerminator(a) => write!(\n+ f, \"No terminator after Babel output:\\n{}\", a,\n+ ),\n+ BabelMonitorError::NoNeighbor(a) => write!(\n+ f, \"No Neighbor was found matching address:\\n{}\", a,\n+ ),\n+ BabelMonitorError::TokioError(a) => write!(\n+ f, \"Tokio had a failure while it was talking to babel:\\n{}\", a,\n+ ),\n+ BabelMonitorError::ReadFunctionError(e) => write!(f, \"{}\", e),\n+ BabelMonitorError::NewBabelMonitorError(e) => write!(f, \"{}\", e),\n+\n+\n+ }\n+ }\n+}\n+\n/// Opens a tcpstream to the babel management socket using a standard timeout\n/// for both the open and read operations\npub fn open_babel_stream_legacy(babel_port: u16) -> ConnectFuture {\n@@ -82,7 +121,7 @@ fn read_babel(\nstream: TcpStream,\nprevious_contents: String,\ndepth: usize,\n-) -> impl Future<Item = (TcpStream, String), Error = Error> {\n+) -> impl Future<Item = (TcpStream, String), Error = BabelMonitorError> {\n// 500kbytes / 0.5mbyte\nconst BUFFER_SIZE: usize = 500_000;\nlet buffer: [u8; BUFFER_SIZE] = [0; BUFFER_SIZE];\n@@ -95,7 +134,7 @@ fn read_babel(\nlet output = String::from_utf8(buffer);\nif let Err(e) = output {\nreturn Box::new(future::err(TokioError(format!(\"{:?}\", e)).into()))\n- as Box<dyn Future<Item = (TcpStream, String), Error = Error>>;\n+ as Box<dyn Future<Item = (TcpStream, String), Error = BabelMonitorError>>;\n}\nlet output = output.unwrap();\nlet output = output.trim_matches(char::from(0));\n@@ -119,7 +158,7 @@ fn read_babel(\nreturn Box::new(future::err(\nReadFailed(\"Babel read timed out!\".to_string()).into(),\n))\n- as Box<dyn Future<Item = (TcpStream, String), Error = Error>>;\n+ as Box<dyn Future<Item = (TcpStream, String), Error = BabelMonitorError>>;\n} else if full_buffer {\n// our buffer is full, we should recurse right away\nwarn!(\"Babel read larger than buffer! Consider increasing it's size\");\n@@ -175,7 +214,7 @@ fn read_babel_sync(output: &str) -> Result<String, BabelMonitorError> {\npub fn run_command(\nstream: TcpStream,\ncmd: &str,\n-) -> impl Future<Item = (TcpStream, String), Error = Error> {\n+) -> impl Future<Item = (TcpStream, String), Error = BabelMonitorError> {\ntrace!(\"Running babel command {}\", cmd);\nlet cmd = format!(\"{}\\n\", cmd);\nlet bytes = cmd.as_bytes().to_vec();\n@@ -194,7 +233,7 @@ pub fn run_command(\n}\n// Consumes the automated Preamble and validates configuration api version\n-pub fn start_connection_legacy(stream: TcpStream) -> impl Future<Item = TcpStream, Error = Error> {\n+pub fn start_connection_legacy(stream: TcpStream) -> impl Future<Item = TcpStream, Error = BabelMonitorError> {\ntrace!(\"Starting babel connection\");\nread_babel(stream, String::new(), 0).then(|result| {\nif let Err(e) = result {\n@@ -208,7 +247,7 @@ pub fn start_connection_legacy(stream: TcpStream) -> impl Future<Item = TcpStrea\npub fn parse_interfaces_legacy(\nstream: TcpStream,\n-) -> impl Future<Item = (TcpStream, Vec<Interface>), Error = Error> {\n+) -> impl Future<Item = (TcpStream, Vec<Interface>), Error = BabelMonitorError> {\nrun_command(stream, \"dump\").then(|output| {\nif let Err(e) = output {\nreturn Err(e);\n@@ -218,7 +257,7 @@ pub fn parse_interfaces_legacy(\n})\n}\n-pub fn get_local_fee(stream: TcpStream) -> impl Future<Item = (TcpStream, u32), Error = Error> {\n+pub fn get_local_fee(stream: TcpStream) -> impl Future<Item = (TcpStream, u32), Error = BabelMonitorError> {\nrun_command(stream, \"dump\").then(|output| {\nif let Err(e) = output {\nreturn Err(e);\n@@ -231,7 +270,7 @@ pub fn get_local_fee(stream: TcpStream) -> impl Future<Item = (TcpStream, u32),\npub fn set_local_fee_legacy(\nstream: TcpStream,\nnew_fee: u32,\n-) -> impl Future<Item = TcpStream, Error = Error> {\n+) -> impl Future<Item = TcpStream, Error = BabelMonitorError> {\nrun_command(stream, &format!(\"fee {}\", new_fee)).then(|result| {\nif let Err(e) = result {\nreturn Err(e);\n@@ -244,7 +283,7 @@ pub fn set_local_fee_legacy(\npub fn set_metric_factor_legacy(\nstream: TcpStream,\nnew_factor: u32,\n-) -> impl Future<Item = TcpStream, Error = Error> {\n+) -> impl Future<Item = TcpStream, Error = BabelMonitorError> {\nrun_command(stream, &format!(\"metric-factor {}\", new_factor)).then(|result| {\nif let Err(e) = result {\nreturn Err(e);\n@@ -257,7 +296,7 @@ pub fn set_metric_factor_legacy(\npub fn monitor_legacy(\nstream: TcpStream,\niface: &str,\n-) -> impl Future<Item = TcpStream, Error = Error> {\n+) -> impl Future<Item = TcpStream, Error = BabelMonitorError> {\nlet command = &format!(\n\"interface {} max-rtt-penalty 500 enable-timestamps true\",\niface\n@@ -277,7 +316,7 @@ pub fn redistribute_ip(\nstream: TcpStream,\nip: &IpAddr,\nallow: bool,\n-) -> impl Future<Item = (TcpStream, String), Error = Error> {\n+) -> impl Future<Item = (TcpStream, String), Error = BabelMonitorError> {\nlet command = format!(\n\"redistribute ip {}/128 {}\",\nip,\n@@ -295,7 +334,7 @@ pub fn redistribute_ip(\npub fn unmonitor_legacy(\nstream: TcpStream,\niface: &str,\n-) -> impl Future<Item = TcpStream, Error = Error> {\n+) -> impl Future<Item = TcpStream, Error = BabelMonitorError> {\nlet command = format!(\"flush interface {}\", iface);\nlet iface = iface.to_string();\nrun_command(stream, &command).then(move |result| {\n@@ -310,7 +349,7 @@ pub fn unmonitor_legacy(\npub fn parse_neighs_legacy(\nstream: TcpStream,\n-) -> impl Future<Item = (TcpStream, Vec<Neighbor>), Error = Error> {\n+) -> impl Future<Item = (TcpStream, Vec<Neighbor>), Error = BabelMonitorError> {\nrun_command(stream, \"dump\").then(|result| {\nif let Err(e) = result {\nreturn Err(e);\n@@ -322,7 +361,7 @@ pub fn parse_neighs_legacy(\npub fn parse_routes_legacy(\nstream: TcpStream,\n-) -> impl Future<Item = (TcpStream, Vec<Route>), Error = Error> {\n+) -> impl Future<Item = (TcpStream, Vec<Route>), Error = BabelMonitorError> {\nrun_command(stream, \"dump\").then(|result| {\nif let Err(e) = result {\nreturn Err(e);\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
removed failure dependency in babel_monitor_legacy
20,253
07.01.2022 00:05:03
28,800
13185f3b6d93b248d1c71fccdb9101a3b98cf24a
removed failure from exit_db
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -1309,7 +1309,6 @@ dependencies = [\n\"althea_types\",\n\"diesel\",\n\"dotenv\",\n- \"failure\",\n\"serde 1.0.133\",\n\"serde_derive\",\n\"serde_json\",\n" }, { "change_type": "MODIFY", "old_path": "exit_db/Cargo.toml", "new_path": "exit_db/Cargo.toml", "diff": "@@ -11,4 +11,3 @@ althea_types = { path = \"../althea_types\"}\nserde = \"1.0\"\nserde_derive = \"1.0\"\nserde_json = \"1.0\"\n\\ No newline at end of file\n-failure = \"0.1\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
removed failure from exit_db
20,253
07.01.2022 10:25:46
28,800
ec003bf0476685c38fd067285a70608c79c22cd7
removed failure dependency from clu crate
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -852,7 +852,6 @@ dependencies = [\n\"althea_types\",\n\"clarity\",\n\"env_logger\",\n- \"failure\",\n\"ipgen\",\n\"lazy_static\",\n\"log\",\n" }, { "change_type": "MODIFY", "old_path": "clu/Cargo.toml", "new_path": "clu/Cargo.toml", "diff": "@@ -10,8 +10,7 @@ althea_kernel_interface = { path = \"../althea_kernel_interface\" }\nalthea_types = { path = \"../althea_types\" }\nlazy_static = \"1.4\"\nlog = \"0.4\"\n-env_logger = \"0.9\"\n-failure = \"0.1\"\n+env_logger = \"0.9.0\"\nipgen = \"1.0.1\"\nrand = \"0.8\"\nserde = \"1.0\"\n" }, { "change_type": "ADD", "old_path": null, "new_path": "clu/src/error.rs", "diff": "+use std::{\n+ fmt::{Display, Formatter, Result as FmtResult},\n+};\n+\n+use althea_kernel_interface::KernelInterfaceError;\n+\n+#[derive(Debug)]\n+pub enum NewCluError {\n+ RuntimeError(String),\n+ MeshError(ipgen::Error),\n+ KernelInterfaceError(KernelInterfaceError),\n+ StandardError(std::io::Error),\n+ NoDeviceName(String),\n+ ClarityError(clarity::Error),\n+\n+}\n+\n+impl From<clarity::Error> for NewCluError {\n+ fn from(error: clarity::Error) -> Self {\n+ NewCluError::ClarityError(error)\n+ }\n+}\n+impl From<ipgen::Error> for NewCluError {\n+ fn from(error: ipgen::Error) -> Self {\n+ NewCluError::MeshError(error)\n+ }\n+}\n+impl From<KernelInterfaceError> for NewCluError {\n+ fn from(error: KernelInterfaceError) -> Self {\n+ NewCluError::KernelInterfaceError(error)\n+ }\n+}\n+impl From<std::io::Error> for NewCluError {\n+ fn from(error: std::io::Error) -> Self {\n+ NewCluError::StandardError(error)\n+ }\n+}\n+\n+\n+impl Display for NewCluError {\n+ fn fmt(&self, f: &mut Formatter) -> FmtResult {\n+ match self {\n+ NewCluError::RuntimeError(a) => write!(\n+ f, \"Runtime Error:\\n{:?}\", a,\n+ ),\n+ NewCluError::MeshError(e) => write!(f, \"{}\", e),\n+ NewCluError::KernelInterfaceError(e) => write!(f, \"{}\", e),\n+ NewCluError::StandardError(e) => write!(f, \"{}\", e),\n+ NewCluError::NoDeviceName(a) => write!(\n+ f, \"Could not obtain device name from line {:?}\", a,\n+ ),\n+ NewCluError::ClarityError(e) => write!(f, \"{}\", e),\n+\n+\n+ }\n+ }\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "clu/src/lib.rs", "new_path": "clu/src/lib.rs", "diff": "-//! Clu is used to handle init tasks, mostly genreating eth and wireguard keys\n-\n#[macro_use]\nextern crate log;\n#[macro_use]\n-extern crate failure;\n-#[macro_use]\nextern crate lazy_static;\n-use althea_kernel_interface::KI;\n+use althea_kernel_interface::{KI};\nuse clarity::PrivateKey;\n-use failure::Error;\nuse rand::distributions::Alphanumeric;\nuse rand::{thread_rng, Rng};\nuse regex::Regex;\n@@ -20,19 +15,33 @@ use std::io::Read;\nuse std::net::IpAddr;\nuse std::path::Path;\nuse std::str;\n+use std::fmt::{Display, Formatter, Result as FmtResult};\n-#[derive(Debug, Fail)]\n+mod error;\n+pub use error::NewCluError;\n+\n+#[derive(Debug)]\npub enum CluError {\n- #[fail(display = \"Runtime Error: {:?}\", _0)]\nRuntimeError(String),\n}\n-pub fn generate_mesh_ip() -> Result<IpAddr, Error> {\n+impl Display for CluError {\n+ fn fmt(&self, f: &mut Formatter) -> FmtResult {\n+ match self {\n+ CluError::RuntimeError(a) => write!(\n+ f, \"Runtime Error:\\n{:?}\", a,\n+ ),\n+\n+ }\n+ }\n+}\n+\n+pub fn generate_mesh_ip() -> Result<IpAddr, NewCluError> {\nlet seed: String =\nString::from_utf8(thread_rng().sample_iter(&Alphanumeric).take(50).collect()).unwrap();\nlet mesh_ip = match ipgen::ip(&seed, \"fd00::/8\".parse().unwrap()) {\nOk(ip) => ip,\n- Err(msg) => bail!(msg), // For some reason, ipgen devs decided to use Strings for all errors\n+ Err(msg) => return Err(NewCluError::MeshError(msg)) // For some reason, ipgen devs decided to use Strings for all errors\n};\ninfo!(\"Generated a new mesh IP address: {}\", mesh_ip);\n@@ -45,7 +54,7 @@ pub fn validate_mesh_ip(ip: &IpAddr) -> bool {\n}\n/// Called before anything is started to delete existing wireguard per hop tunnels\n-pub fn cleanup() -> Result<(), Error> {\n+pub fn cleanup() -> Result<(), NewCluError> {\ndebug!(\"Cleaning up WireGuard tunnels\");\nlazy_static! {\n@@ -67,7 +76,7 @@ pub fn cleanup() -> Result<(), Error> {\nOk(())\n}\n-fn linux_init(settings: RitaClientSettings) -> Result<RitaClientSettings, Error> {\n+fn linux_init(settings: RitaClientSettings) -> Result<RitaClientSettings, NewCluError> {\ncleanup()?;\nlet mut settings = settings;\nlet mut network_settings = settings.network;\n@@ -122,7 +131,8 @@ fn linux_init(settings: RitaClientSettings) -> Result<RitaClientSettings, Error>\nfor line in contents.lines() {\nif line.starts_with(\"device:\") {\nlet device = line.split(' ').nth(1).ok_or_else(|| {\n- format_err!(\"Could not obtain device name from line {:?}\", line)\n+ // format_err!(\"Could not obtain device name from line {:?}\", line)\n+ NewCluError::NoDeviceName(line.to_string())\n})?;\nnetwork_settings.device = Some(device.to_string());\n@@ -192,7 +202,7 @@ fn linux_init(settings: RitaClientSettings) -> Result<RitaClientSettings, Error>\nOk(settings)\n}\n-fn linux_exit_init(settings: RitaExitSettingsStruct) -> Result<RitaExitSettingsStruct, Error> {\n+fn linux_exit_init(settings: RitaExitSettingsStruct) -> Result<RitaExitSettingsStruct, NewCluError> {\ncleanup()?;\nlet mut settings = settings;\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
removed failure dependency from clu crate
20,253
10.01.2022 09:02:52
28,800
0ad88ce09e7ac25ddf51f7611cd7bd3236ab5797
removed failure dependency from settings crate
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -3573,7 +3573,6 @@ dependencies = [\n\"auto-bridge\",\n\"clarity\",\n\"config\",\n- \"failure\",\n\"ipnetwork 0.18.0\",\n\"lazy_static\",\n\"log\",\n" }, { "change_type": "MODIFY", "old_path": "settings/Cargo.toml", "new_path": "settings/Cargo.toml", "diff": "@@ -15,7 +15,6 @@ serde_derive = \"1.0\"\nserde_json = \"1.0\"\ntoml = \"0.5\"\nlog = \"0.4\"\n-failure = \"0.1\"\nowning_ref = \"0.4\"\nlazy_static = \"1.4\"\nclarity = \"0.5\"\n" }, { "change_type": "MODIFY", "old_path": "settings/src/client.rs", "new_path": "settings/src/client.rs", "diff": "@@ -3,12 +3,11 @@ use crate::logging::LoggingSettings;\nuse crate::network::NetworkSettings;\nuse crate::operator::OperatorSettings;\nuse crate::payment::PaymentSettings;\n-use crate::{json_merge, set_rita_client, spawn_watch_thread_client, update_config, SUBNET};\n+use crate::{json_merge, set_rita_client, spawn_watch_thread_client, update_config, SUBNET, SettingsError};\nuse althea_types::wg_key::WgKey;\nuse althea_types::{ContactStorage, ExitState, Identity};\nuse clarity::Address;\nuse config::Config;\n-use failure::Error;\nuse ipnetwork::IpNetwork;\nuse std::collections::{HashMap, HashSet};\nuse std::net::IpAddr;\n@@ -164,7 +163,7 @@ impl ExitClientSettings {\n}\nimpl RitaClientSettings {\n- pub fn new(file_name: &str) -> Result<Self, Error> {\n+ pub fn new(file_name: &str) -> Result<Self, SettingsError> {\nlet mut s = Config::new();\nassert!(Path::new(file_name).exists());\ns.merge(config::File::with_name(file_name).required(false))?;\n@@ -172,7 +171,7 @@ impl RitaClientSettings {\nOk(settings)\n}\n- pub fn new_watched(file_name: &str) -> Result<Self, Error> {\n+ pub fn new_watched(file_name: &str) -> Result<Self, SettingsError> {\nlet mut s = Config::new();\ns.merge(config::File::with_name(file_name).required(false))?;\nlet settings: Self = update_config(s.try_into()?, SUBNET)?;\n@@ -212,7 +211,7 @@ pub struct RitaClientSettings {\n}\nimpl RitaClientSettings {\n- pub fn merge(&mut self, changed_settings: serde_json::Value) -> Result<(), Error> {\n+ pub fn merge(&mut self, changed_settings: serde_json::Value) -> Result<(), SettingsError> {\nlet mut settings_value = serde_json::to_value(self.clone())?;\ninfo!(\"Merge is being called, maybe error here\");\n@@ -228,7 +227,7 @@ impl RitaClientSettings {\n}\n}\n- pub fn get_all(&self) -> Result<serde_json::Value, Error> {\n+ pub fn get_all(&self) -> Result<serde_json::Value, SettingsError> {\nOk(serde_json::to_value(self.clone())?)\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "settings/src/error.rs", "diff": "+use std::{\n+ error::Error,\n+ fmt::{Display, Formatter, Result as FmtResult},\n+};\n+\n+#[derive(Debug)]\n+pub enum SettingsError {\n+ TomlError(toml::ser::Error),\n+ IOError(std::io::Error),\n+ IpNetworkError(ipnetwork::IpNetworkError),\n+ SerdeJsonError(serde_json::Error),\n+ ConfigError(config::ConfigError),\n+}\n+\n+impl From<toml::ser::Error> for SettingsError {\n+ fn from(error: toml::ser::Error) -> Self {\n+ SettingsError::TomlError(error)\n+ }\n+}\n+impl From<std::io::Error> for SettingsError {\n+ fn from(error: std::io::Error) -> Self {\n+ SettingsError::IOError(error)\n+ }\n+}\n+impl From<ipnetwork::IpNetworkError> for SettingsError {\n+ fn from(error: ipnetwork::IpNetworkError) -> Self {\n+ SettingsError::IpNetworkError(error)\n+ }\n+}\n+impl From<serde_json::Error> for SettingsError {\n+ fn from(error: serde_json::Error) -> Self {\n+ SettingsError::SerdeJsonError(error)\n+ }\n+}\n+impl From<config::ConfigError> for SettingsError {\n+ fn from(error: config::ConfigError) -> Self {\n+ SettingsError::ConfigError(error)\n+ }\n+}\n+\n+impl Display for SettingsError {\n+ fn fmt(&self, f: &mut Formatter) -> FmtResult {\n+ match self {\n+ SettingsError::TomlError(e) => write!(f, \"{}\", e),\n+ SettingsError::IOError(e) => write!(f, \"{}\", e),\n+ SettingsError::IpNetworkError(e) => write!(f, \"{}\", e),\n+ SettingsError::SerdeJsonError(e) => write!(f, \"{}\", e),\n+ SettingsError::ConfigError(e) => write!(f, \"{}\", e),\n+\n+\n+ }\n+ }\n+}\n+\n+impl Error for SettingsError {}\n" }, { "change_type": "MODIFY", "old_path": "settings/src/exit.rs", "new_path": "settings/src/exit.rs", "diff": "use crate::localization::LocalizationSettings;\nuse crate::network::NetworkSettings;\nuse crate::payment::PaymentSettings;\n-use crate::{json_merge, set_rita_exit, spawn_watch_thread_exit};\n+use crate::{json_merge, set_rita_exit, spawn_watch_thread_exit, SettingsError};\nuse althea_types::{Identity, WgKey};\nuse config::Config;\nuse core::str::FromStr;\n-use failure::Error;\nuse phonenumber::PhoneNumber;\nuse std::collections::HashSet;\nuse std::net::Ipv4Addr;\n@@ -212,11 +211,11 @@ impl RitaExitSettingsStruct {\n))\n}\n- pub fn get_all(&self) -> Result<serde_json::Value, Error> {\n+ pub fn get_all(&self) -> Result<serde_json::Value, SettingsError> {\nOk(serde_json::to_value(self.clone())?)\n}\n- pub fn merge(&mut self, changed_settings: serde_json::Value) -> Result<(), Error> {\n+ pub fn merge(&mut self, changed_settings: serde_json::Value) -> Result<(), SettingsError> {\nlet mut settings_value = serde_json::to_value(self.clone())?;\njson_merge(&mut settings_value, &changed_settings);\n@@ -230,14 +229,14 @@ impl RitaExitSettingsStruct {\n}\n}\n- pub fn new(file_name: &str) -> Result<Self, Error> {\n+ pub fn new(file_name: &str) -> Result<Self, SettingsError> {\nlet mut s = Config::new();\ns.merge(config::File::with_name(file_name).required(false))?;\nlet settings: Self = s.try_into()?;\nOk(settings)\n}\n- pub fn new_watched(file_name: &str) -> Result<Self, Error> {\n+ pub fn new_watched(file_name: &str) -> Result<Self, SettingsError> {\nlet mut s = Config::new();\ns.merge(config::File::with_name(file_name).required(false))?;\nlet settings: Self = s.try_into()?;\n" }, { "change_type": "MODIFY", "old_path": "settings/src/lib.rs", "new_path": "settings/src/lib.rs", "diff": "@@ -19,7 +19,6 @@ extern crate arrayvec;\nuse crate::client::{ExitClientSettings, ExitServer, SelectedExit};\nuse althea_types::Identity;\n-use failure::Error;\nuse ipnetwork::IpNetwork;\nuse network::NetworkSettings;\nuse payment::PaymentSettings;\n@@ -43,6 +42,9 @@ pub mod operator;\npub mod payment;\n// pub mod tower;\n+mod error;\n+pub use error::SettingsError;\n+\nuse crate::client::RitaClientSettings;\nuse crate::exit::RitaExitSettingsStruct;\n@@ -94,11 +96,11 @@ pub enum SettingsType {\n// The higher layer is responsible for the actual read/write of settings to disk.\n// This adaptor must be thread safe (Send + Sync)\npub trait WrappedSettingsAdaptor {\n- fn get_client(&self) -> Result<RitaClientSettings, Error>;\n- fn set_client(&self, client_settings: RitaClientSettings) -> Result<(), Error>;\n- fn write_config(&self) -> Result<(), Error>;\n- fn merge_client_json(&self, changed_settings: serde_json::Value) -> Result<(), Error>;\n- fn get_config_json(&self) -> Result<serde_json::Value, Error>;\n+ fn get_client(&self) -> Result<RitaClientSettings, SettingsError>;\n+ fn set_client(&self, client_settings: RitaClientSettings) -> Result<(), SettingsError>;\n+ fn write_config(&self) -> Result<(), SettingsError>;\n+ fn merge_client_json(&self, changed_settings: serde_json::Value) -> Result<(), SettingsError>;\n+ fn get_config_json(&self) -> Result<serde_json::Value, SettingsError>;\n}\n// This function can be called from a higher layer (wrapping binary) to set a reference to its adaptor\n@@ -134,7 +136,7 @@ impl RitaSettings {\n}\n/// write the current SETTINGS from memory to file\n-pub fn write_config() -> Result<(), Error> {\n+pub fn write_config() -> Result<(), SettingsError> {\nmatch &*SETTINGS.read().unwrap() {\nSome(Settings::Adaptor(adapt)) => adapt.adaptor.write_config(),\nSome(Settings::Client(settings)) => {\n@@ -160,7 +162,7 @@ pub fn save_settings_on_shutdown() {\n}\n/// get a JSON value of all settings\n-pub fn get_config_json() -> Result<serde_json::Value, Error> {\n+pub fn get_config_json() -> Result<serde_json::Value, SettingsError> {\nmatch &*SETTINGS.read().unwrap() {\nSome(Settings::Adaptor(adapt)) => adapt.adaptor.get_config_json(),\nSome(Settings::Client(settings)) => settings.get_all(),\n@@ -170,7 +172,7 @@ pub fn get_config_json() -> Result<serde_json::Value, Error> {\n}\n/// merge a json of a subset of settings into global settings\n-pub fn merge_config_json(changed_settings: serde_json::Value) -> Result<(), Error> {\n+pub fn merge_config_json(changed_settings: serde_json::Value) -> Result<(), SettingsError> {\nlet settings_ref: &mut Option<Settings> = &mut *SETTINGS.write().unwrap();\nmatch settings_ref {\nSome(Settings::Adaptor(adapt)) => adapt.adaptor.merge_client_json(changed_settings),\n@@ -365,14 +367,14 @@ fn spawn_watch_thread_exit(settings: RitaExitSettingsStruct, file_path: &str) {\n/// Must be called from the context that holds the settings var in memory.\n/// In the case of adaptor settings, must be called in the wrapping binary.\npub trait FileWrite {\n- fn write(&self, file_name: &str) -> Result<(), Error>;\n+ fn write(&self, file_name: &str) -> Result<(), SettingsError>;\n}\nimpl<T> FileWrite for T\nwhere\nT: Serialize,\n{\n- fn write(&self, file_name: &str) -> Result<(), Error> {\n+ fn write(&self, file_name: &str) -> Result<(), SettingsError> {\nlet ser = toml::Value::try_from(self)?;\nlet ser = toml::to_string(&ser)?;\nlet mut file = File::create(file_name)?;\n@@ -388,7 +390,7 @@ where\npub fn update_config(\nold_settings: RitaClientSettings,\nsubnet: u8,\n-) -> Result<RitaClientSettings, Error> {\n+) -> Result<RitaClientSettings, SettingsError> {\nlet mut new_settings = RitaClientSettings {\npayment: old_settings.payment,\nlog: old_settings.log,\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
removed failure dependency from settings crate
20,244
12.01.2022 13:54:01
18,000
b86feba134b198a65dbe91fa19e40356fa5ae147
Fix futures related errors
[ { "change_type": "MODIFY", "old_path": "babel_monitor/src/lib.rs", "new_path": "babel_monitor/src/lib.rs", "diff": "@@ -20,12 +20,12 @@ use std::io::ErrorKind;\nuse std::io::Read;\nuse std::io::Write;\nuse std::iter::Iterator;\n-use std::net::{IpAddr, AddrParseError};\nuse std::net::SocketAddr;\nuse std::net::TcpStream;\n-use std::num::{ParseIntError, ParseFloatError};\n-use std::str::{self, ParseBoolError};\n+use std::net::{AddrParseError, IpAddr};\n+use std::num::{ParseFloatError, ParseIntError};\nuse std::str::FromStr;\n+use std::str::{self, ParseBoolError};\nuse std::thread;\nuse std::time::Duration;\n@@ -54,6 +54,7 @@ pub enum BabelMonitorError {\nIntParseError(ParseIntError),\nFloatParseError(ParseFloatError),\nNetworkError(IpNetworkError),\n+ TokioError(String),\nNoRoute(String),\n}\n@@ -96,47 +97,42 @@ impl From<IpNetworkError> for BabelMonitorError {\nimpl Display for BabelMonitorError {\nfn fmt(&self, f: &mut Formatter) -> FmtResult {\nmatch self {\n- BabelMonitorError::VariableNotFound(a, b) => write!(\n- f, \"variable '{}' not found in '{}'\", a, b,\n- ),\n- BabelMonitorError::InvalidPreamble(a) => write!(\n- f, \"Invalid preamble: {}\", a,\n- ),\n- BabelMonitorError::LocalFeeNotFound(a) => write!(\n- f, \"Could not find local fee in '{}'\", a,\n- ),\n- BabelMonitorError::CommandFailed(a, b) => write!(\n- f, \"Command '{}' failed. {}\", a, b,\n- ),\n- BabelMonitorError::ReadFailed(a) => write!(\n- f, \"Erroneous Babel output:\\n{}\", a,\n- ),\n- BabelMonitorError::NoTerminator(a) => write!(\n- f, \"No terminator after Babel output:\\n{}\", a,\n- ),\n- BabelMonitorError::NoNeighbor(a) => write!(\n- f, \"No Neighbor was found matching address:\\n{}\", a,\n- ),\n- BabelMonitorError::TcpError(a) => write!(\n- f, \"Tcp connection failure while talking to babel:\\n{}\", a,\n- ),\n- BabelMonitorError::BabelParseError(a) => write!(\n- f, \"Babel parsing failed:\\n{}\", a,\n- ),\n+ BabelMonitorError::VariableNotFound(a, b) => {\n+ write!(f, \"variable '{}' not found in '{}'\", a, b,)\n+ }\n+ BabelMonitorError::InvalidPreamble(a) => write!(f, \"Invalid preamble: {}\", a,),\n+ BabelMonitorError::LocalFeeNotFound(a) => {\n+ write!(f, \"Could not find local fee in '{}'\", a,)\n+ }\n+ BabelMonitorError::CommandFailed(a, b) => write!(f, \"Command '{}' failed. {}\", a, b,),\n+ BabelMonitorError::ReadFailed(a) => write!(f, \"Erroneous Babel output:\\n{}\", a,),\n+ BabelMonitorError::NoTerminator(a) => {\n+ write!(f, \"No terminator after Babel output:\\n{}\", a,)\n+ }\n+ BabelMonitorError::NoNeighbor(a) => {\n+ write!(f, \"No Neighbor was found matching address:\\n{}\", a,)\n+ }\n+ BabelMonitorError::TcpError(a) => {\n+ write!(f, \"Tcp connection failure while talking to babel:\\n{}\", a,)\n+ }\n+ BabelMonitorError::BabelParseError(a) => write!(f, \"Babel parsing failed:\\n{}\", a,),\nBabelMonitorError::ReadFunctionError(e) => write!(f, \"{}\", e),\nBabelMonitorError::BoolParseError(e) => write!(f, \"{}\", e),\nBabelMonitorError::ParseAddrError(e) => write!(f, \"{}\", e),\nBabelMonitorError::IntParseError(e) => write!(f, \"{}\", e),\nBabelMonitorError::FloatParseError(e) => write!(f, \"{}\", e),\nBabelMonitorError::NetworkError(e) => write!(f, \"{}\", e),\n- BabelMonitorError::NoRoute(a) => write!(\n- f, \"Route not found:\\n{}\", a,\n+ BabelMonitorError::NoRoute(a) => write!(f, \"Route not found:\\n{}\", a,),\n+ BabelMonitorError::TokioError(a) => write!(\n+ f,\n+ \"Tokio had a failure while it was talking to babel:\\n{}\",\n+ a,\n),\n-\n}\n}\n}\n+impl std::error::Error for BabelMonitorError {}\npub fn find_babel_val(val: &str, line: &str) -> Result<String, BabelMonitorError> {\nlet mut iter = line.split(' ');\n@@ -154,7 +150,8 @@ pub fn find_babel_val(val: &str, line: &str) -> Result<String, BabelMonitorError\npub fn find_and_parse_babel_val<T: FromStr>(val: &str, line: &str) -> Result<T, BabelMonitorError>\nwhere\n- <T as FromStr>::Err: Debug + ErrorTrait + Sync + Send + 'static, BabelMonitorError: From<<T as FromStr>::Err>\n+ <T as FromStr>::Err: Debug + ErrorTrait + Sync + Send + 'static,\n+ BabelMonitorError: From<<T as FromStr>::Err>,\n{\nmatch find_babel_val(val, line) {\nOk(string_val) => match string_val.parse() {\n@@ -206,7 +203,10 @@ pub struct Neighbor {\n/// Opens a tcpstream to the babel management socket using a standard timeout\n/// for both the open and read operations\n-pub fn open_babel_stream(babel_port: u16, timeout: Duration) -> Result<TcpStream, BabelMonitorError> {\n+pub fn open_babel_stream(\n+ babel_port: u16,\n+ timeout: Duration,\n+) -> Result<TcpStream, BabelMonitorError> {\nlet socket_string = format!(\"[::1]:{}\", babel_port);\ntrace!(\"About to open Babel socket using {}\", socket_string);\nlet socket: SocketAddr = socket_string.parse().unwrap();\n@@ -399,7 +399,9 @@ pub fn parse_interfaces_sync(output: String) -> Result<Vec<Interface>, BabelMoni\n}\n}\nif vector.is_empty() && found_interface {\n- return Err(BabelMonitorError::BabelParseError(\"All Babel Interface parsing failed!\".to_string()))\n+ return Err(BabelMonitorError::BabelParseError(\n+ \"All Babel Interface parsing failed!\".to_string(),\n+ ));\n}\nOk(vector)\n}\n@@ -466,7 +468,11 @@ pub fn monitor(stream: &mut TcpStream, iface: &str) -> Result<(), BabelMonitorEr\nOk(())\n}\n-pub fn redistribute_ip(stream: &mut TcpStream, ip: &IpAddr, allow: bool) -> Result<String, BabelMonitorError> {\n+pub fn redistribute_ip(\n+ stream: &mut TcpStream,\n+ ip: &IpAddr,\n+ allow: bool,\n+) -> Result<String, BabelMonitorError> {\nlet command = format!(\n\"redistribute ip {}/128 {}\",\nip,\n@@ -553,7 +559,9 @@ pub fn parse_neighs_sync(output: String) -> Result<Vec<Neighbor>, BabelMonitorEr\n}\n}\nif vector.is_empty() && found_neigh {\n- return Err(BabelMonitorError::BabelParseError(\"All Babel neigh parsing failed!\".to_string()))\n+ return Err(BabelMonitorError::BabelParseError(\n+ \"All Babel neigh parsing failed!\".to_string(),\n+ ));\n}\nOk(vector)\n}\n@@ -625,7 +633,9 @@ pub fn parse_routes_sync(babel_out: String) -> Result<Vec<Route>, BabelMonitorEr\n}\n}\nif vector.is_empty() && found_route {\n- return Err(BabelMonitorError::BabelParseError(\"All Babel route parsing failed!\".to_string()))\n+ return Err(BabelMonitorError::BabelParseError(\n+ \"All Babel route parsing failed!\".to_string(),\n+ ));\n}\nOk(vector)\n}\n@@ -694,8 +704,9 @@ pub fn get_installed_route(mesh_ip: &IpAddr, routes: &[Route]) -> Result<Route,\n}\n}\nif exit_route.is_none() {\n- return Err(BabelMonitorError::NoRoute(\"No installed route to that destination!\".to_string()))\n-\n+ return Err(BabelMonitorError::NoRoute(\n+ \"No installed route to that destination!\".to_string(),\n+ ));\n}\nOk(exit_route.unwrap().clone())\n}\n" }, { "change_type": "MODIFY", "old_path": "babel_monitor_legacy/src/lib.rs", "new_path": "babel_monitor_legacy/src/lib.rs", "diff": "@@ -15,6 +15,7 @@ use babel_monitor::parse_interfaces_sync;\nuse babel_monitor::parse_neighs_sync;\nuse babel_monitor::parse_routes_sync;\nuse babel_monitor::validate_preamble;\n+use babel_monitor::BabelMonitorError;\nuse babel_monitor::Interface;\nuse babel_monitor::Neighbor;\nuse babel_monitor::Route;\n@@ -22,8 +23,6 @@ use futures::future;\nuse futures::future::result as future_result;\nuse futures::future::Either;\nuse futures::future::Future;\n-use std::fmt::Debug;\n-use std::fmt::{Display, Formatter, Result as FmtResult};\nuse std::net::IpAddr;\nuse std::net::SocketAddr;\nuse std::str;\n@@ -42,68 +41,7 @@ use tokio::net::TcpStream;\n/// job\nconst SLEEP_TIME: Duration = Duration::from_millis(10);\n-#[derive(Debug)]\n-pub enum BabelMonitorError {\n- VariableNotFound(String, String),\n- InvalidPreamble(String),\n- LocalFeeNotFound(String),\n- CommandFailed(String, String),\n- ReadFailed(String),\n- NoTerminator(String),\n- NoNeighbor(String),\n- TokioError(String),\n- ReadFunctionError(std::io::Error),\n- NewBabelMonitorError(babel_monitor::BabelMonitorError),\n-\n-}\n-\n-use crate::BabelMonitorError::{CommandFailed, NoTerminator, ReadFailed, TokioError};\n-\n-impl From<std::io::Error> for BabelMonitorError {\n- fn from(error: std::io::Error) -> Self {\n- BabelMonitorError::ReadFunctionError(error)\n- }\n-}\n-impl From<babel_monitor::BabelMonitorError> for BabelMonitorError {\n- fn from(error: babel_monitor::BabelMonitorError) -> Self {\n- BabelMonitorError::NewBabelMonitorError(error)\n- }\n-}\n-\n-impl Display for BabelMonitorError {\n- fn fmt(&self, f: &mut Formatter) -> FmtResult {\n- match self {\n- BabelMonitorError::VariableNotFound(a, b) => write!(\n- f, \"variable '{}' not found in '{}'\", a, b,\n- ),\n- BabelMonitorError::InvalidPreamble(a) => write!(\n- f, \"Invalid preamble: {}\", a,\n- ),\n- BabelMonitorError::LocalFeeNotFound(a) => write!(\n- f, \"Could not find local fee in '{}'\", a,\n- ),\n- BabelMonitorError::CommandFailed(a, b) => write!(\n- f, \"Command '{}' failed. {}\", a, b,\n- ),\n- BabelMonitorError::ReadFailed(a) => write!(\n- f, \"Erroneous Babel output:\\n{}\", a,\n- ),\n- BabelMonitorError::NoTerminator(a) => write!(\n- f, \"No terminator after Babel output:\\n{}\", a,\n- ),\n- BabelMonitorError::NoNeighbor(a) => write!(\n- f, \"No Neighbor was found matching address:\\n{}\", a,\n- ),\n- BabelMonitorError::TokioError(a) => write!(\n- f, \"Tokio had a failure while it was talking to babel:\\n{}\", a,\n- ),\n- BabelMonitorError::ReadFunctionError(e) => write!(f, \"{}\", e),\n- BabelMonitorError::NewBabelMonitorError(e) => write!(f, \"{}\", e),\n-\n-\n- }\n- }\n-}\n+use babel_monitor::BabelMonitorError::{CommandFailed, NoTerminator, ReadFailed, TokioError};\n/// Opens a tcpstream to the babel management socket using a standard timeout\n/// for both the open and read operations\n@@ -155,9 +93,7 @@ fn read_babel(\nif depth > 50 {\n// prevent infinite recursion in error cases\nwarn!(\"Babel read timed out! {}\", output);\n- return Box::new(future::err(\n- ReadFailed(\"Babel read timed out!\".to_string()),\n- ))\n+ return Box::new(future::err(ReadFailed(\"Babel read timed out!\".to_string())))\nas Box<dyn Future<Item = (TcpStream, String), Error = BabelMonitorError>>;\n} else if full_buffer {\n// our buffer is full, we should recurse right away\n@@ -232,7 +168,9 @@ pub fn run_command(\n}\n// Consumes the automated Preamble and validates configuration api version\n-pub fn start_connection_legacy(stream: TcpStream) -> impl Future<Item = TcpStream, Error = BabelMonitorError> {\n+pub fn start_connection_legacy(\n+ stream: TcpStream,\n+) -> impl Future<Item = TcpStream, Error = BabelMonitorError> {\ntrace!(\"Starting babel connection\");\nread_babel(stream, String::new(), 0).then(|result| {\nif let Err(e) = result {\n@@ -256,7 +194,9 @@ pub fn parse_interfaces_legacy(\n})\n}\n-pub fn get_local_fee(stream: TcpStream) -> impl Future<Item = (TcpStream, u32), Error = BabelMonitorError> {\n+pub fn get_local_fee(\n+ stream: TcpStream,\n+) -> impl Future<Item = (TcpStream, u32), Error = BabelMonitorError> {\nrun_command(stream, \"dump\").then(|output| {\nif let Err(e) = output {\nreturn Err(e);\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/dashboard/babel.rs", "new_path": "rita_common/src/dashboard/babel.rs", "diff": "+use crate::RitaCommonError;\nuse actix_web::http::StatusCode;\nuse actix_web::Path;\n-use actix_web::{HttpRequest, HttpResponse, Result};\n+use actix_web::{HttpRequest, HttpResponse};\nuse babel_monitor_legacy::open_babel_stream_legacy;\nuse babel_monitor_legacy::set_local_fee_legacy as babel_set_local_fee_legacy;\nuse babel_monitor_legacy::set_metric_factor_legacy as babel_set_metric_factor_legacy;\nuse babel_monitor_legacy::start_connection_legacy;\n-use failure::Error;\nuse futures01::future::Future;\nuse std::collections::HashMap;\n-pub fn get_local_fee(_req: HttpRequest) -> Result<HttpResponse, Error> {\n+pub fn get_local_fee(_req: HttpRequest) -> HttpResponse {\ndebug!(\"/local_fee GET hit\");\nlet mut ret = HashMap::new();\nret.insert(\"local_fee\", settings::get_rita_common().payment.local_fee);\n- Ok(HttpResponse::Ok().json(ret))\n+ HttpResponse::Ok().json(ret)\n}\n-pub fn get_metric_factor(_req: HttpRequest) -> Result<HttpResponse, Error> {\n+pub fn get_metric_factor(_req: HttpRequest) -> HttpResponse {\ndebug!(\"/local_fee GET hit\");\nlet mut ret = HashMap::new();\nret.insert(\n@@ -25,10 +25,12 @@ pub fn get_metric_factor(_req: HttpRequest) -> Result<HttpResponse, Error> {\nsettings::get_rita_common().network.metric_factor,\n);\n- Ok(HttpResponse::Ok().json(ret))\n+ HttpResponse::Ok().json(ret)\n}\n-pub fn set_local_fee(path: Path<u32>) -> Box<dyn Future<Item = HttpResponse, Error = Error>> {\n+pub fn set_local_fee(\n+ path: Path<u32>,\n+) -> Box<dyn Future<Item = HttpResponse, Error = RitaCommonError>> {\nlet new_fee = path.into_inner();\ndebug!(\"/local_fee/{} POST hit\", new_fee);\nlet babel_port = settings::get_rita_common().network.babel_port;\n@@ -40,7 +42,9 @@ pub fn set_local_fee(path: Path<u32>) -> Box<dyn Future<Item = HttpResponse, Err\nBox::new(open_babel_stream_legacy(babel_port).then(move |stream| {\n// if we can't get to babel here we panic\nlet stream = stream.expect(\"Can't reach Babel!\");\n- start_connection_legacy(stream).and_then(move |stream| {\n+ start_connection_legacy(stream)\n+ .from_err()\n+ .and_then(move |stream| {\nbabel_set_local_fee_legacy(stream, new_fee).then(move |res| {\nif let Err(e) = res {\nerror!(\"Failed to set babel fee with {:?}\", e);\n@@ -54,7 +58,7 @@ pub fn set_local_fee(path: Path<u32>) -> Box<dyn Future<Item = HttpResponse, Err\n// try and save the config and fail if we can't\nif let Err(e) = settings::write_config() {\n- return Err(e);\n+ return Err(e.into());\n}\nOk(HttpResponse::Ok().json(()))\n}\n@@ -65,7 +69,9 @@ pub fn set_local_fee(path: Path<u32>) -> Box<dyn Future<Item = HttpResponse, Err\n/// Sets the metric factor for this node, lower values mean a higher price preference while higher\n/// values mean a higher weight on route quality.\n-pub fn set_metric_factor(path: Path<u32>) -> Box<dyn Future<Item = HttpResponse, Error = Error>> {\n+pub fn set_metric_factor(\n+ path: Path<u32>,\n+) -> Box<dyn Future<Item = HttpResponse, Error = RitaCommonError>> {\nlet new_factor = path.into_inner();\ndebug!(\"/metric_factor/{} POST hit\", new_factor);\nlet babel_port = settings::get_rita_common().network.babel_port;\n@@ -73,7 +79,9 @@ pub fn set_metric_factor(path: Path<u32>) -> Box<dyn Future<Item = HttpResponse,\nBox::new(open_babel_stream_legacy(babel_port).then(move |stream| {\n// if we can't get to babel here we panic\nlet stream = stream.expect(\"Can't reach Babel!\");\n- start_connection_legacy(stream).and_then(move |stream| {\n+ start_connection_legacy(stream)\n+ .from_err()\n+ .and_then(move |stream| {\nbabel_set_metric_factor_legacy(stream, new_factor).then(move |res| {\nif let Err(e) = res {\nerror!(\"Failed to set babel metric factor with {:?}\", e);\n@@ -87,7 +95,7 @@ pub fn set_metric_factor(path: Path<u32>) -> Box<dyn Future<Item = HttpResponse,\n// try and save the config and fail if we can't\nif let Err(e) = settings::write_config() {\n- return Err(e);\n+ return Err(e.into());\n}\nOk(HttpResponse::Ok().json(()))\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/dashboard/own_info.rs", "new_path": "rita_common/src/dashboard/own_info.rs", "diff": "@@ -22,7 +22,7 @@ pub struct OwnInfo {\npub client_can_use_free_tier: bool,\n}\n-pub fn get_own_info(_req: HttpRequest) -> Result<Json<OwnInfo>, RitaCommonError> {\n+pub fn get_own_info(_req: HttpRequest) -> Json<OwnInfo> {\ndebug!(\"Get own info endpoint hit!\");\nlet payment_settings = settings::get_rita_common().payment;\nlet eth_address = payment_settings.eth_address.unwrap();\n@@ -51,5 +51,5 @@ pub fn get_own_info(_req: HttpRequest) -> Result<Json<OwnInfo>, RitaCommonError>\nis_gateway,\nclient_can_use_free_tier,\n};\n- Ok(Json(reply))\n+ Json(reply)\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/error.rs", "new_path": "rita_common/src/error.rs", "diff": "use std::{\nerror::Error,\n- fmt::{Display, Formatter, Result as FmtResult}, time::SystemTimeError,\n+ fmt::{Display, Formatter, Result as FmtResult},\n+ time::SystemTimeError,\n};\nuse actix::MailboxError;\n+use actix_web::ResponseError;\nuse althea_kernel_interface::KernelInterfaceError;\nuse babel_monitor::BabelMonitorError;\nuse compressed_log::builder::LoggerError;\n@@ -12,7 +14,6 @@ use settings::SettingsError;\n#[derive(Debug)]\npub enum RitaCommonError {\n- //format_err!(\"Unable to convert level filter to a level\")\nConversionError(String),\nLoggerError(LoggerError),\nSetLoggerError(SetLoggerError),\n@@ -28,7 +29,6 @@ pub enum RitaCommonError {\nLowest20Error(usize),\nBabelMonitorError(BabelMonitorError),\nSysTimeError(SystemTimeError),\n-\n}\nimpl From<LoggerError> for RitaCommonError {\n@@ -72,6 +72,8 @@ impl From<SystemTimeError> for RitaCommonError {\n}\n}\n+impl ResponseError for RitaCommonError {}\n+\nimpl Display for RitaCommonError {\nfn fmt(&self, f: &mut Formatter) -> FmtResult {\nmatch self {\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/network_endpoints/mod.rs", "new_path": "rita_common/src/network_endpoints/mod.rs", "diff": "//! Network endptoints for common Rita functionality (such as exchanging hello messages)\n-use crate::RitaCommonError;\nuse crate::payment_validator::{validate_later, ToValidate};\nuse crate::peer_listener::Peer;\nuse crate::tunnel_manager::id_callback::IdentityCallback;\nuse crate::tunnel_manager::TunnelManager;\n+use crate::RitaCommonError;\nuse actix::registry::SystemService;\nuse actix_web::http::StatusCode;\n-use actix_web::{AsyncResponder, HttpRequest, HttpResponse, Json, Result};\n+use actix_web::AsyncResponder;\n+use actix_web::{HttpRequest, HttpResponse, Json, Result};\nuse althea_types::{LocalIdentity, PaymentTx};\nuse futures01::{future, Future};\nuse std::boxed::Box;\n@@ -21,7 +22,9 @@ pub struct JsonStatusResponse {\n}\nimpl JsonStatusResponse {\n- pub fn new(ret_val: Result<String, RitaCommonError>) -> Result<Json<JsonStatusResponse>, RitaCommonError> {\n+ pub fn new(\n+ ret_val: Result<String, RitaCommonError>,\n+ ) -> Result<Json<JsonStatusResponse>, RitaCommonError> {\nlet res_string = match ret_val {\nOk(msg) => msg,\nErr(e) => format!(\"{}\", e),\n@@ -77,9 +80,17 @@ pub fn hello_response(\nlet socket = match req.1.connection_info().remote() {\nSome(val) => match val.parse::<SocketAddr>() {\nOk(val) => val,\n- Err(_e) => return Box::new(future::err(RitaCommonError::MiscStringError(err_mesg.to_string())))\n+ Err(_e) => {\n+ return Box::new(future::err(RitaCommonError::MiscStringError(\n+ err_mesg.to_string(),\n+ )))\n+ }\n},\n- None => return Box::new(future::err(RitaCommonError::MiscStringError(err_mesg.to_string())))\n+ None => {\n+ return Box::new(future::err(RitaCommonError::MiscStringError(\n+ err_mesg.to_string(),\n+ )))\n+ }\n};\ntrace!(\"Got Hello from {:?}\", req.1.connection_info().remote());\n@@ -100,18 +111,27 @@ pub fn hello_response(\n.and_then(|tunnel| {\nlet tunnel = match tunnel {\nSome(val) => val,\n- None => return Err(RitaCommonError::MiscStringError(\"tunnel open failure!\".to_string()))\n+ None => {\n+ return Err(RitaCommonError::MiscStringError(\n+ \"tunnel open failure!\".to_string(),\n+ ))\n+ }\n};\nOk(Json(LocalIdentity {\nglobal: match settings::get_rita_common().get_identity() {\nSome(id) => id,\n- None => return Err(RitaCommonError::MiscStringError(\"Identity has no mesh IP ready yet\".to_string()))\n+ None => {\n+ return Err(RitaCommonError::MiscStringError(\n+ \"Identity has no mesh IP ready yet\".to_string(),\n+ ))\n+ }\n},\nwg_port: tunnel.0.listen_port,\nhave_tunnel: Some(tunnel.1),\n}))\n})\n+ .from_err()\n.responder(),\n)\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix futures related errors
20,253
12.01.2022 11:22:16
28,800
3406a369d51d29ef057e0e6293f1e32be29ee1be
removed failures from rita_exit crate
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -3291,10 +3291,10 @@ dependencies = [\n\"arrayvec 0.7.2\",\n\"babel_monitor\",\n\"babel_monitor_legacy\",\n+ \"clarity\",\n\"compressed_log\",\n\"diesel\",\n\"exit_db\",\n- \"failure\",\n\"futures 0.1.31\",\n\"handlebars\",\n\"ipnetwork 0.18.0\",\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/Cargo.toml", "new_path": "rita_exit/Cargo.toml", "diff": "@@ -20,6 +20,7 @@ handlebars = \"4.0\"\nrand = \"0.8.0\"\nlazy_static = \"1.4\"\nipnetwork = \"0.18\"\n+clarity = \"0.5\"\nserde = \"1.0\"\nserde_derive = \"1.0\"\nserde_json = \"1.0\"\n@@ -27,7 +28,6 @@ lettre = \"0.9\"\nlettre_email = \"0.9\"\nr2d2 = \"0.8\"\nphonenumber = \"0.3\"\n-failure = \"0.1\"\narrayvec = {version= \"0.7\", features = [\"serde\"]}\nlog = { version = \"0.4\", features = [\"release_max_level_info\"] }\nreqwest = { version = \"0.11\", features = [\"blocking\", \"json\"] }\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/database/database_tools.rs", "new_path": "rita_exit/src/database/database_tools.rs", "diff": "use crate::database::secs_since_unix_epoch;\nuse crate::database::struct_tools::client_to_new_db_client;\nuse crate::database::ONE_DAY;\n-use failure::bail;\n-use failure::format_err;\nuse rita_common::utils::ip_increment::increment;\n-use crate::DB_POOL;\n+use crate::{DB_POOL, RitaExitError};\nuse actix_web::Result;\nuse althea_kernel_interface::ExitClient;\nuse althea_types::ExitClientIdentity;\n@@ -15,7 +13,6 @@ use diesel::r2d2::ConnectionManager;\nuse diesel::r2d2::PooledConnection;\nuse diesel::select;\nuse exit_db::{models, schema};\n-use failure::Error;\nuse futures01::future;\nuse futures01::future::Future;\nuse std::net::IpAddr;\n@@ -39,7 +36,7 @@ fn get_internal_ips(clients: &[exit_db::models::Client]) -> Vec<Ipv4Addr> {\n/// Gets the next available client ip, takes about O(n) time, we could make it faster by\n/// sorting on the database side but I've left that optimization on the vine for now\n-pub fn get_next_client_ip(conn: &PgConnection) -> Result<IpAddr, Error> {\n+pub fn get_next_client_ip(conn: &PgConnection) -> Result<IpAddr, RitaExitError> {\nuse self::schema::clients::dsl::clients;\nlet rita_exit = settings::get_rita_exit();\nlet exit_settings = rita_exit.exit_network;\n@@ -74,7 +71,7 @@ pub fn update_client(\nclient: &ExitClientIdentity,\ntheir_record: &models::Client,\nconn: &PgConnection,\n-) -> Result<(), Error> {\n+) -> Result<(), RitaExitError> {\nuse self::schema::clients::dsl::{\nclients, email, eth_address, last_seen, mesh_ip, phone, wg_pubkey,\n};\n@@ -126,7 +123,7 @@ pub fn update_client(\npub fn get_client(\nclient: &ExitClientIdentity,\nconn: &PgConnection,\n-) -> Result<Option<models::Client>, Error> {\n+) -> Result<Option<models::Client>, RitaExitError> {\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@@ -155,7 +152,7 @@ pub fn get_client(\n}\nErr(e) => {\nerror!(\"We failed to lookup the client {:?} with{:?}\", mesh_ip, e);\n- bail!(\"We failed to lookup the client!\")\n+ return Err(RitaExitError::MiscStringError(\"We failed to lookup the client!\".to_string()))\n}\n}\n}\n@@ -165,7 +162,7 @@ pub fn verify_client(\nclient: &ExitClientIdentity,\nclient_verified: bool,\nconn: &PgConnection,\n-) -> Result<(), Error> {\n+) -> Result<(), RitaExitError> {\nuse self::schema::clients::dsl::*;\nlet ip = client.global.mesh_ip;\nlet wg = client.global.wg_public_key;\n@@ -187,7 +184,7 @@ pub fn verify_db_client(\nclient: &models::Client,\nclient_verified: bool,\nconn: &PgConnection,\n-) -> Result<(), Error> {\n+) -> Result<(), RitaExitError> {\nuse self::schema::clients::dsl::*;\nlet ip = &client.mesh_ip;\nlet wg = &client.wg_pubkey;\n@@ -205,7 +202,7 @@ pub fn verify_db_client(\n}\n/// Increments the text message sent count in the database\n-pub fn text_sent(client: &ExitClientIdentity, conn: &PgConnection, val: i32) -> Result<(), Error> {\n+pub fn text_sent(client: &ExitClientIdentity, conn: &PgConnection, val: i32) -> Result<(), RitaExitError> {\nuse self::schema::clients::dsl::*;\nlet ip = client.global.mesh_ip;\nlet wg = client.global.wg_public_key;\n@@ -222,7 +219,7 @@ pub fn text_sent(client: &ExitClientIdentity, conn: &PgConnection, val: i32) ->\nOk(())\n}\n-fn client_exists(client: &ExitClientIdentity, conn: &PgConnection) -> Result<bool, Error> {\n+fn client_exists(client: &ExitClientIdentity, conn: &PgConnection) -> Result<bool, RitaExitError> {\nuse self::schema::clients::dsl::*;\ntrace!(\"Checking if client exists\");\nlet ip = client.global.mesh_ip;\n@@ -236,7 +233,7 @@ fn client_exists(client: &ExitClientIdentity, conn: &PgConnection) -> Result<boo\n}\n/// True if there is any client with the same eth address, wg key, or ip address already registered\n-pub fn client_conflict(client: &ExitClientIdentity, conn: &PgConnection) -> Result<bool, Error> {\n+pub fn client_conflict(client: &ExitClientIdentity, conn: &PgConnection) -> Result<bool, RitaExitError> {\nuse self::schema::clients::dsl::*;\n// we can't possibly have a conflict if we have exactly this client already\n// since client exists checks all major details this is safe and will return false\n@@ -261,7 +258,7 @@ pub fn client_conflict(client: &ExitClientIdentity, conn: &PgConnection) -> Resu\nOk(ip_exists || eth_exists || wg_exists)\n}\n-pub fn delete_client(client: ExitClient, connection: &PgConnection) -> Result<(), Error> {\n+pub fn delete_client(client: ExitClient, connection: &PgConnection) -> Result<(), RitaExitError> {\nuse self::schema::clients::dsl::*;\ninfo!(\"Deleting clients {:?} in database\", client);\n@@ -273,7 +270,7 @@ pub fn delete_client(client: ExitClient, connection: &PgConnection) -> Result<()\n// for backwards compatibility with entires that do not have a timestamp\n// new entires will be initialized and updated as part of the normal flow\n-pub fn set_client_timestamp(client: ExitClient, connection: &PgConnection) -> Result<(), Error> {\n+pub fn set_client_timestamp(client: ExitClient, connection: &PgConnection) -> Result<(), RitaExitError> {\nuse self::schema::clients::dsl::*;\ninfo!(\"Setting timestamp for client {:?}\", client);\n@@ -288,11 +285,11 @@ pub fn set_client_timestamp(client: ExitClient, connection: &PgConnection) -> Re\npub fn update_mail_sent_time(\nclient: &ExitClientIdentity,\nconn: &PgConnection,\n-) -> Result<(), Error> {\n+) -> Result<(), RitaExitError> {\nuse self::schema::clients::dsl::{clients, email, email_sent_time};\nlet mail_addr = match client.clone().reg_details.email {\nSome(mail) => mail,\n- None => bail!(\"Cloud not find email for {:?}\", client.clone()),\n+ None => return Err(RitaExitError::EmailNotFound(client.clone()))\n};\ndiesel::update(clients.filter(email.eq(mail_addr)))\n@@ -305,26 +302,24 @@ pub fn update_mail_sent_time(\n/// Gets the Postgres database connection from the threadpool, since there are dedicated\n/// connections for each threadpool member error if non is available right away\npub fn get_database_connection(\n-) -> impl Future<Item = PooledConnection<ConnectionManager<PgConnection>>, Error = Error> {\n+) -> impl Future<Item = PooledConnection<ConnectionManager<PgConnection>>, Error = RitaExitError> {\nmatch DB_POOL.read().unwrap().try_get() {\nSome(connection) => Box::new(future::ok(connection))\nas Box<\n- dyn Future<Item = PooledConnection<ConnectionManager<PgConnection>>, Error = Error>,\n+ dyn Future<Item = PooledConnection<ConnectionManager<PgConnection>>, Error = RitaExitError>,\n>,\nNone => {\nerror!(\"No available db connection!\");\n- Box::new(future::err(format_err!(\n- \"No Database connection available!\"\n- )))\n+ Box::new(future::err(RitaExitError::MiscStringError(\"No Database connection available!\".to_string())))\n}\n}\n}\npub fn get_database_connection_sync(\n-) -> Result<PooledConnection<ConnectionManager<PgConnection>>, Error> {\n+) -> Result<PooledConnection<ConnectionManager<PgConnection>>, RitaExitError> {\nmatch DB_POOL.read().unwrap().try_get() {\nSome(connection) => Ok(connection),\n- None => bail!(\"No connection!\"),\n+ None => return Err(RitaExitError::MiscStringError(\"No connection!\".to_string()))\n}\n}\n@@ -332,7 +327,7 @@ pub fn create_or_update_user_record(\nconn: &PgConnection,\nclient: &ExitClientIdentity,\nuser_country: String,\n-) -> Result<models::Client, Error> {\n+) -> Result<models::Client, RitaExitError> {\nuse self::schema::clients::dsl::clients;\nif let Some(val) = get_client(client, conn)? {\nupdate_client(client, &val, conn)?;\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/database/db_client.rs", "new_path": "rita_exit/src/database/db_client.rs", "diff": "@@ -9,9 +9,9 @@ use actix_web::Result;\nuse diesel::dsl::delete;\nuse diesel::*;\nuse exit_db::schema;\n-use failure::Error;\nuse futures01::future::Future;\n+use crate::RitaExitError;\nuse crate::database::database_tools::get_database_connection;\n#[derive(Default)]\n@@ -30,11 +30,11 @@ impl SystemService for DbClient {\npub struct TruncateTables;\nimpl Message for TruncateTables {\n- type Result = Result<(), Error>;\n+ type Result = Result<(), RitaExitError>;\n}\nimpl Handler<TruncateTables> for DbClient {\n- type Result = Result<(), Error>;\n+ type Result = Result<(), RitaExitError>;\nfn handle(&mut self, _: TruncateTables, _: &mut Self::Context) -> Self::Result {\nuse self::schema::clients::dsl::*;\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/database/email.rs", "new_path": "rita_exit/src/database/email.rs", "diff": "+use crate::RitaExitError;\nuse crate::database::database_tools::update_mail_sent_time;\nuse crate::database::database_tools::verify_client;\nuse crate::database::get_exit_info;\n@@ -7,9 +8,6 @@ use crate::database::struct_tools::verif_done;\nuse althea_types::{ExitClientDetails, ExitClientIdentity, ExitState};\nuse diesel::prelude::PgConnection;\nuse exit_db::models;\n-use failure::bail;\n-use failure::format_err;\n-use failure::Error;\nuse futures01::future;\nuse futures01::future::Future;\nuse handlebars::Handlebars;\n@@ -22,11 +20,11 @@ use lettre_email::EmailBuilder;\nuse serde_json::json;\nuse settings::exit::ExitVerifSettings;\n-pub fn send_mail(client: &models::Client) -> Result<(), Error> {\n+pub fn send_mail(client: &models::Client) -> Result<(), RitaExitError> {\nlet mailer = match settings::get_rita_exit().verif_settings {\nSome(ExitVerifSettings::Email(mailer)) => mailer,\n- Some(_) => bail!(\"Verification mode is not email!\"),\n- None => bail!(\"No verification mode configured!\"),\n+ Some(_) => return Err(RitaExitError::MiscStringError(\"Verification mode is not email!\".to_string())),\n+ None => return Err(RitaExitError::MiscStringError(\"No verification mode configured!\".to_string()))\n};\ninfo!(\"Sending exit signup email for client\");\n@@ -68,7 +66,7 @@ pub fn handle_email_registration(\ntheir_record: &exit_db::models::Client,\nconn: &PgConnection,\ncooldown: i64,\n-) -> impl Future<Item = ExitState, Error = Error> {\n+) -> impl Future<Item = ExitState, Error = RitaExitError> {\nlet mut their_record = their_record.clone();\nif client.reg_details.email_code == Some(their_record.email_code.clone()) {\ninfo!(\"email verification complete for {:?}\", client);\n@@ -85,7 +83,7 @@ pub fn handle_email_registration(\nlet client_internal_ip = match their_record.internal_ip.parse() {\nOk(ip) => ip,\n- Err(e) => return future::err(format_err!(\"{:?}\", e)),\n+ Err(e) => return future::err(RitaExitError::AddrParseError(e)),\n};\nfuture::ok(ExitState::Registered {\nour_details: ExitClientDetails { client_internal_ip },\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/database/geoip.rs", "new_path": "rita_exit/src/database/geoip.rs", "diff": "use babel_monitor_legacy::open_babel_stream_legacy;\nuse babel_monitor_legacy::parse_routes_legacy;\nuse babel_monitor_legacy::start_connection_legacy;\n-use failure::bail;\n-use failure::Error;\nuse futures01::future;\nuse futures01::future::Future;\nuse ipnetwork::IpNetwork;\n@@ -13,13 +11,15 @@ use std::net::IpAddr;\nuse std::sync::{Arc, RwLock};\nuse std::time::Duration;\n+use crate::RitaExitError;\n+\nlazy_static! {\nstatic ref GEOIP_CACHE: Arc<RwLock<HashMap<IpAddr, String>>> =\nArc::new(RwLock::new(HashMap::new()));\n}\n/// gets the gateway ip for a given mesh IP\n-pub fn get_gateway_ip_single(mesh_ip: IpAddr) -> Box<dyn Future<Item = IpAddr, Error = Error>> {\n+pub fn get_gateway_ip_single(mesh_ip: IpAddr) -> Box<dyn Future<Item = IpAddr, Error = RitaExitError>> {\nlet babel_port = settings::get_rita_exit().network.babel_port;\nBox::new(\n@@ -44,7 +44,7 @@ pub fn get_gateway_ip_single(mesh_ip: IpAddr) -> Box<dyn Future<Item = IpAddr, E\nmatch route_to_des {\nSome(route) => Ok(KI.get_wg_remote_ip(&route.iface)?),\n- None => bail!(\"No route found for mesh ip: {:?}\", mesh_ip),\n+ None => return Err(RitaExitError::IpAddrError(mesh_ip))\n}\n})\n})\n@@ -62,7 +62,7 @@ pub struct IpPair {\n/// not appear in the result vec\npub fn get_gateway_ip_bulk(\nmesh_ip_list: Vec<IpAddr>,\n-) -> Box<dyn Future<Item = Vec<IpPair>, Error = Error>> {\n+) -> Box<dyn Future<Item = Vec<IpPair>, Error = RitaExitError>> {\nlet babel_port = settings::get_rita_exit().network.babel_port;\ntrace!(\"getting gateway ip bulk\");\n@@ -128,7 +128,7 @@ struct CountryDetails {\niso_code: String,\n}\n-pub fn get_country_async(ip: IpAddr) -> impl Future<Item = String, Error = Error> {\n+pub fn get_country_async(ip: IpAddr) -> impl Future<Item = String, Error = RitaExitError> {\nmatch get_country(ip) {\nOk(res) => future::ok(res),\nErr(e) => future::err(e),\n@@ -136,7 +136,7 @@ pub fn get_country_async(ip: IpAddr) -> impl Future<Item = String, Error = Error\n}\n/// get ISO country code from ip, consults a in memory cache\n-pub fn get_country(ip: IpAddr) -> Result<String, Error> {\n+pub fn get_country(ip: IpAddr) -> Result<String, RitaExitError> {\ntrace!(\"get GeoIP country for {}\", ip.to_string());\n// if allowed countries is not configured we don't care and will insert\n@@ -207,10 +207,10 @@ pub fn get_country(ip: IpAddr) -> Result<String, Error> {\ntrace!(\"Added to cache, returning\");\nOk(code)\n} else {\n- Err(format_err!(\"Failed to deserialize geoip response\"))\n+ Err(RitaExitError::MiscStringError(\"Failed to deserialize geoip response\".to_string()))\n}\n} else {\n- Err(format_err!(\"request failed\"))\n+ Err(RitaExitError::MiscStringError(\"Request failed\".to_string()))\n}\n}\n}\n@@ -218,7 +218,7 @@ pub fn get_country(ip: IpAddr) -> Result<String, Error> {\n/// Returns true or false if an ip is confirmed to be inside or outside the region and error\n/// if an api error is encountered trying to figure that out.\n-pub fn verify_ip(request_ip: IpAddr) -> impl Future<Item = bool, Error = Error> {\n+pub fn verify_ip(request_ip: IpAddr) -> impl Future<Item = bool, Error = RitaExitError> {\nmatch verify_ip_sync(request_ip) {\nOk(item) => future::ok(item),\nErr(e) => future::err(e),\n@@ -227,7 +227,7 @@ pub fn verify_ip(request_ip: IpAddr) -> impl Future<Item = bool, Error = Error>\n/// Returns true or false if an ip is confirmed to be inside or outside the region and error\n/// if an api error is encountered trying to figure that out.\n-pub fn verify_ip_sync(request_ip: IpAddr) -> Result<bool, Error> {\n+pub fn verify_ip_sync(request_ip: IpAddr) -> Result<bool, RitaExitError> {\n// in this case we have a gateway directly attached to the exit, so our\n// peer address for them will be an fe80 linklocal ip address. When we\n// detect this we know that they are in the allowed countries list because\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/database/mod.rs", "new_path": "rita_exit/src/database/mod.rs", "diff": "//! for the exit, which is most exit logic in general. Keep in mind database connections are remote\n//! and therefore synchronous database requests are quite expensive (on the order of tens of milliseconds)\n+use crate::RitaExitError;\nuse crate::create_or_update_user_record;\nuse crate::database::database_tools::client_conflict;\nuse crate::database::database_tools::delete_client;\n@@ -28,9 +29,6 @@ use althea_kernel_interface::ExitClient;\nuse althea_types::Identity;\nuse althea_types::{ExitClientDetails, ExitClientIdentity, ExitDetails, ExitState, ExitVerifMode};\nuse diesel::prelude::PgConnection;\n-use failure::bail;\n-use failure::format_err;\n-use failure::Error;\nuse futures01::future;\nuse futures01::Future;\nuse ipnetwork::IpNetwork;\n@@ -108,7 +106,7 @@ pub fn secs_since_unix_epoch() -> i64 {\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-pub fn signup_client(client: ExitClientIdentity) -> impl Future<Item = ExitState, Error = Error> {\n+pub fn signup_client(client: ExitClientIdentity) -> impl Future<Item = ExitState, Error = RitaExitError> {\ninfo!(\"got setup request {:?}\", client);\nget_gateway_ip_single(client.global.mesh_ip).and_then(move |gateway_ip| {\ninfo!(\"got gateway ip {:?}\", client);\n@@ -127,7 +125,7 @@ pub fn signup_client(client: ExitClientIdentity) -> impl Future<Item = ExitState\ndisplay_hashset(&*EXIT_ALLOWED_COUNTRIES),\n),\n}))\n- as Box<dyn Future<Item = ExitState, Error = Error>>\n+ as Box<dyn Future<Item = ExitState, Error = RitaExitError>>\n}\nOk(false) => {}\nErr(e) => return Box::new(future::err(e)),\n@@ -159,7 +157,7 @@ pub fn signup_client(client: ExitClientIdentity) -> impl Future<Item = ExitState\n}\nlet client_internal_ip = match their_record.internal_ip.parse() {\nOk(ip) => ip,\n- Err(e) => return Box::new(future::err(format_err!(\"{:?}\", e))),\n+ Err(e) => return Box::new(future::err(RitaExitError::AddrParseError(e))),\n};\nBox::new(future::ok(ExitState::Registered {\n@@ -182,7 +180,7 @@ pub fn signup_client(client: ExitClientIdentity) -> impl Future<Item = ExitState\n}\n/// Gets the status of a client and updates it in the database\n-pub fn client_status(client: ExitClientIdentity, conn: &PgConnection) -> Result<ExitState, Error> {\n+pub fn client_status(client: ExitClientIdentity, conn: &PgConnection) -> Result<ExitState, RitaExitError> {\ntrace!(\"Checking if record exists for {:?}\", client.global.mesh_ip);\nif let Some(their_record) = get_client(&client, conn)? {\n@@ -221,7 +219,7 @@ pub fn client_status(client: ExitClientIdentity, conn: &PgConnection) -> Result<\n})\n} else {\nerror!(\"De-registering client! {:?}\", client);\n- bail!(\"Refusing to de-register clients right now!\");\n+ return Err(RitaExitError::MiscStringError(\"Refusing to de-register clients right now!\".to_string()))\n// TODO restore this functionality once it's confirmed to be safe\n// Ok(ExitState::New)\n}\n@@ -233,7 +231,7 @@ pub fn client_status(client: ExitClientIdentity, conn: &PgConnection) -> Result<\npub fn validate_clients_region(\nclients_list: Vec<exit_db::models::Client>,\nconn: &PgConnection,\n-) -> Result<(), Error> {\n+) -> Result<(), RitaExitError> {\ninfo!(\"Starting exit region validation\");\nlet start = Instant::now();\n@@ -257,7 +255,7 @@ pub fn validate_clients_region(\nlet list = match wait_timeout(get_gateway_ip_bulk(ip_vec), EXIT_LOOP_TIMEOUT) {\nWaitResult::Err(e) => return Err(e),\nWaitResult::Ok(val) => val,\n- WaitResult::TimedOut(_) => return Err(format_err!(\"Timed out!\")),\n+ WaitResult::TimedOut(_) => return Err(RitaExitError::MiscStringError(\"Timed out!\".to_string())),\n};\nfor item in list.iter() {\nlet res = verify_ip_sync(item.gateway_ip);\n@@ -293,7 +291,7 @@ pub fn validate_clients_region(\npub fn cleanup_exit_clients(\nclients_list: &[exit_db::models::Client],\nconn: &PgConnection,\n-) -> Result<(), Error> {\n+) -> Result<(), RitaExitError> {\ntrace!(\"Running exit client cleanup\");\nlet start = Instant::now();\n@@ -352,7 +350,7 @@ pub fn cleanup_exit_clients(\npub fn setup_clients(\nclients_list: &[exit_db::models::Client],\nold_clients: &HashSet<ExitClient>,\n-) -> Result<HashSet<ExitClient>, Error> {\n+) -> Result<HashSet<ExitClient>, RitaExitError> {\nlet start = Instant::now();\n// use hashset to ensure uniqueness and check for duplicate db entries\n@@ -415,7 +413,7 @@ pub fn setup_clients(\npub fn enforce_exit_clients(\nclients_list: Vec<exit_db::models::Client>,\nold_debt_actions: &HashSet<(Identity, DebtAction)>,\n-) -> Result<HashSet<(Identity, DebtAction)>, Error> {\n+) -> Result<HashSet<(Identity, DebtAction)>, RitaExitError> {\nlet start = Instant::now();\nlet mut clients_by_id = HashMap::new();\nlet free_tier_limit = settings::get_rita_exit().payment.free_tier_throughput;\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/database/sms.rs", "new_path": "rita_exit/src/database/sms.rs", "diff": "+use crate::RitaExitError;\nuse crate::database::database_tools::text_sent;\nuse crate::database::database_tools::verify_client;\nuse crate::database::get_database_connection;\n@@ -7,7 +8,6 @@ use crate::database::struct_tools::texts_sent;\nuse actix_web::client as actix_client;\nuse actix_web::client::ClientResponse;\nuse althea_types::{ExitClientDetails, ExitClientIdentity, ExitState};\n-use failure::Error;\nuse futures01::future;\nuse futures01::future::Either;\nuse futures01::future::Future;\n@@ -29,7 +29,7 @@ fn check_text(\nnumber: String,\ncode: String,\napi_key: String,\n-) -> impl Future<Item = bool, Error = Error> {\n+) -> impl Future<Item = bool, Error = RitaExitError> {\ntrace!(\"About to check text message status for {}\", number);\nlet number: PhoneNumber = match number.parse() {\nOk(number) => number,\n@@ -63,7 +63,7 @@ pub struct SmsRequest {\n}\n/// Sends the authy verification text by hitting the api endpoint\n-fn send_text(number: String, api_key: String) -> impl Future<Item = ClientResponse, Error = Error> {\n+fn send_text(number: String, api_key: String) -> impl Future<Item = ClientResponse, Error = RitaExitError> {\ninfo!(\"Sending message for {}\", number);\nlet url = \"https://api.authy.com/protected/json/phones/verification/start\";\nlet number: PhoneNumber = match number.parse() {\n@@ -89,7 +89,7 @@ pub fn handle_sms_registration(\nclient: ExitClientIdentity,\ntheir_record: exit_db::models::Client,\napi_key: String,\n-) -> impl Future<Item = ExitState, Error = Error> {\n+) -> impl Future<Item = ExitState, Error = RitaExitError> {\ninfo!(\n\"Handling phone registration for {}\",\nclient.global.wg_public_key\n@@ -128,7 +128,7 @@ pub fn handle_sms_registration(\n})\n}\n})\n- })) as Box<dyn Future<Item = ExitState, Error = Error>>\n+ })) as Box<dyn Future<Item = ExitState, Error = RitaExitError>>\n}\n// user has exhausted attempts but is still not submitting code\n(Some(_number), None, true) => Box::new(future::ok(ExitState::Pending {\n@@ -149,7 +149,7 @@ pub fn handle_sms_registration(\nphone_code: None,\n})\n})\n- })) as Box<dyn Future<Item = ExitState, Error = Error>>\n+ })) as Box<dyn Future<Item = ExitState, Error = RitaExitError>>\n}\n// user has attempts remaining and is submitting a code\n(Some(number), Some(code), false) => {\n@@ -179,12 +179,12 @@ pub fn handle_sms_registration(\n})\n}\n})\n- })) as Box<dyn Future<Item = ExitState, Error = Error>>\n+ })) as Box<dyn Future<Item = ExitState, Error = RitaExitError>>\n}\n// user did not submit a phonenumber\n(None, _, _) => Box::new(future::ok(ExitState::Denied {\nmessage: \"This exit requires a phone number to register!\".to_string(),\n- })) as Box<dyn Future<Item = ExitState, Error = Error>>,\n+ })) as Box<dyn Future<Item = ExitState, Error = RitaExitError>>,\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/database/struct_tools.rs", "new_path": "rita_exit/src/database/struct_tools.rs", "diff": "@@ -4,12 +4,13 @@ use althea_types::Identity;\nuse arrayvec::ArrayString;\nuse exit_db::models;\nuse exit_db::models::Client;\n-use failure::Error;\nuse rand::Rng;\nuse std::collections::HashSet;\nuse std::net::IpAddr;\n-pub fn to_identity(client: &Client) -> Result<Identity, Error> {\n+use crate::RitaExitError;\n+\n+pub fn to_identity(client: &Client) -> Result<Identity, RitaExitError> {\ntrace!(\"Converting client {:?}\", client);\nOk(Identity {\nmesh_ip: client.mesh_ip.clone().parse()?,\n@@ -19,7 +20,7 @@ pub fn to_identity(client: &Client) -> Result<Identity, Error> {\n})\n}\n-pub fn to_exit_client(client: Client) -> Result<ExitClient, Error> {\n+pub fn to_exit_client(client: Client) -> Result<ExitClient, RitaExitError> {\nOk(ExitClient {\nmesh_ip: client.mesh_ip.parse()?,\ninternal_ip: client.internal_ip.parse()?,\n" }, { "change_type": "ADD", "old_path": null, "new_path": "rita_exit/src/error.rs", "diff": "+use std::{\n+ error::Error,\n+ fmt::{Display, Formatter, Result as FmtResult}, net::{AddrParseError, IpAddr},\n+};\n+use althea_kernel_interface::KernelInterfaceError;\n+use althea_types::{ExitClientIdentity, error::AltheaTypesError};\n+use handlebars::RenderError;\n+use ipnetwork::IpNetworkError;\n+use rita_common::RitaCommonError;\n+\n+#[derive(Debug)]\n+pub enum RitaExitError {\n+ MiscStringError(String),\n+ EmailNotFound(ExitClientIdentity),\n+ AddrParseError(AddrParseError),\n+ IpAddrError(IpAddr),\n+ DieselError(diesel::result::Error),\n+ RitaCommonError(RitaCommonError),\n+ RenderError(RenderError),\n+ EmailError(lettre_email::error::Error),\n+ FileError(lettre::file::error::Error),\n+ SmtpError(lettre::smtp::error::Error),\n+ IpNetworkError(IpNetworkError),\n+ PhoneParseError(phonenumber::ParseError),\n+ ClarityError(clarity::error::Error),\n+ AltheaTypesError(AltheaTypesError),\n+ KernelInterfaceError(KernelInterfaceError),\n+\n+}\n+\n+impl From<diesel::result::Error> for RitaExitError {\n+ fn from(error: diesel::result::Error) -> Self {\n+ RitaExitError::DieselError(error)\n+ }\n+}\n+impl From<AddrParseError> for RitaExitError {\n+ fn from(error: AddrParseError) -> Self {\n+ RitaExitError::AddrParseError(error)\n+ }\n+}\n+impl From<RitaCommonError> for RitaExitError {\n+ fn from(error: RitaCommonError) -> Self {\n+ RitaExitError::RitaCommonError(error)\n+ }\n+}\n+impl From<RenderError> for RitaExitError {\n+ fn from(error: RenderError) -> Self {\n+ RitaExitError::RenderError(error)\n+ }\n+}\n+impl From<lettre_email::error::Error> for RitaExitError {\n+ fn from(error: lettre_email::error::Error) -> Self {\n+ RitaExitError::EmailError(error)\n+ }\n+}\n+impl From<lettre::file::error::Error> for RitaExitError {\n+ fn from(error: lettre::file::error::Error) -> Self {\n+ RitaExitError::FileError(error)\n+ }\n+}\n+impl From<lettre::smtp::error::Error> for RitaExitError {\n+ fn from(error: lettre::smtp::error::Error) -> Self {\n+ RitaExitError::SmtpError(error)\n+ }\n+}\n+impl From<IpNetworkError> for RitaExitError {\n+ fn from(error: IpNetworkError) -> Self {\n+ RitaExitError::IpNetworkError(error)\n+ }\n+}\n+impl From<phonenumber::ParseError> for RitaExitError {\n+ fn from(error: phonenumber::ParseError) -> Self {\n+ RitaExitError::PhoneParseError(error)\n+ }\n+}\n+impl From<clarity::error::Error> for RitaExitError {\n+ fn from(error: clarity::error::Error) -> Self {\n+ RitaExitError::ClarityError(error)\n+ }\n+}\n+impl From<AltheaTypesError> for RitaExitError {\n+ fn from(error: AltheaTypesError) -> Self {\n+ RitaExitError::AltheaTypesError(error)\n+ }\n+}\n+impl From<KernelInterfaceError> for RitaExitError {\n+ fn from(error: KernelInterfaceError) -> Self {\n+ RitaExitError::KernelInterfaceError(error)\n+ }\n+}\n+\n+impl Display for RitaExitError {\n+ fn fmt(&self, f: &mut Formatter) -> FmtResult {\n+ match self {\n+ RitaExitError::MiscStringError(a) => write!(f, \"{}\", a,),\n+ RitaExitError::EmailNotFound(a) => write!(f, \"Could not find email for {:?}\", a),\n+ RitaExitError::AddrParseError(a) => write!(f, \"{:?}\", a,),\n+ RitaExitError::IpAddrError(a) => write!(f, \"No route found for mesh ip: {:?}\", a,),\n+ RitaExitError::DieselError(a) => write!(f, \"{}\", a,),\n+ RitaExitError::RitaCommonError(a) => write!(f, \"{}\", a,),\n+ RitaExitError::RenderError(a) => write!(f, \"{}\", a,),\n+ RitaExitError::EmailError(a) => write!(f, \"{}\", a,),\n+ RitaExitError::FileError(a) => write!(f, \"{}\", a,),\n+ RitaExitError::SmtpError(a) => write!(f, \"{}\", a,),\n+ RitaExitError::IpNetworkError(a) => write!(f, \"{}\", a,),\n+ RitaExitError::PhoneParseError(a) => write!(f, \"{}\", a,),\n+ RitaExitError::ClarityError(a) => write!(f, \"{}\", a,),\n+ RitaExitError::AltheaTypesError(a) => write!(f, \"{}\", a,),\n+ RitaExitError::KernelInterfaceError(a) => write!(f, \"{}\", a,),\n+\n+ }\n+ }\n+}\n+\n+impl Error for RitaExitError {}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/lib.rs", "new_path": "rita_exit/src/lib.rs", "diff": "@@ -4,9 +4,6 @@ extern crate log;\n#[macro_use]\nextern crate lazy_static;\n-#[macro_use]\n-extern crate failure;\n-\n#[macro_use]\nextern crate serde_derive;\n@@ -15,6 +12,9 @@ pub mod network_endpoints;\npub mod rita_loop;\npub mod traffic_watcher;\n+mod error;\n+pub use error::RitaExitError;\n+\npub use crate::database::database_tools::*;\npub use crate::database::database_tools::*;\npub use crate::database::db_client::*;\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/network_endpoints/mod.rs", "new_path": "rita_exit/src/network_endpoints/mod.rs", "diff": "@@ -18,7 +18,6 @@ use althea_types::WgKey;\nuse althea_types::{\nEncryptedExitClientIdentity, EncryptedExitState, ExitClientIdentity, ExitState,\n};\n-use failure::{format_err, Error};\nuse futures01::future;\nuse futures01::Future;\nuse num256::Int256;\n@@ -29,7 +28,7 @@ use sodiumoxide::crypto::box_::curve25519xsalsa20poly1305::PublicKey;\nuse sodiumoxide::crypto::box_::curve25519xsalsa20poly1305::SecretKey;\nuse std::net::SocketAddr;\n-use crate::EXIT_WG_PRIVATE_KEY;\n+use crate::{EXIT_WG_PRIVATE_KEY, RitaExitError};\n/// helper function for returning from secure_setup_request()\nfn secure_setup_return(\n@@ -50,7 +49,7 @@ fn secure_setup_return(\nenum DecryptResult {\nSuccess(ExitClientIdentity),\n- Failure(Box<dyn Future<Item = Json<EncryptedExitState>, Error = Error>>),\n+ Failure(Box<dyn Future<Item = Json<EncryptedExitState>, Error = RitaExitError>>),\n}\nfn decrypt_exit_client_id(\n@@ -122,7 +121,7 @@ fn decrypt_exit_client_id(\npub fn secure_setup_request(\nrequest: (Json<EncryptedExitClientIdentity>, HttpRequest),\n-) -> Box<dyn Future<Item = Json<EncryptedExitState>, Error = Error>> {\n+) -> Box<dyn Future<Item = Json<EncryptedExitState>, Error = RitaExitError>> {\nlet our_secretkey: WgKey = *EXIT_WG_PRIVATE_KEY;\nlet our_secretkey = our_secretkey.into();\n@@ -146,7 +145,7 @@ pub fn secure_setup_request(\n\"Error in exit setup for {} malformed packet header {:?}!\",\ntheir_wg_pubkey, e\n);\n- return Box::new(future::err(format_err!(\"Invalid packet!\")));\n+ return Box::new(future::err(RitaExitError::MiscStringError(\"Invalid packet!\".to_string())));\n}\n},\nNone => {\n@@ -154,7 +153,7 @@ pub fn secure_setup_request(\n\"Error in exit setup for {} invalid remote_mesh_sender!\",\ntheir_wg_pubkey\n);\n- return Box::new(future::err(format_err!(\"Invalid packet!\")));\n+ return Box::new(future::err(RitaExitError::MiscStringError(\"Invalid packet!\".to_string())));\n}\n};\n@@ -171,7 +170,7 @@ pub fn secure_setup_request(\n)),\nErr(e) => {\nerror!(\"Signup client failed with {:?}\", e);\n- Err(format_err!(\"There was an internal server error!\"))\n+ Err(RitaExitError::MiscStringError(\"There was an internal server error!\".to_string()))\n}\n}))\n} else {\n@@ -188,7 +187,7 @@ pub fn secure_setup_request(\npub fn secure_status_request(\nrequest: Json<EncryptedExitClientIdentity>,\n-) -> Box<dyn Future<Item = Json<EncryptedExitState>, Error = Error>> {\n+) -> Box<dyn Future<Item = Json<EncryptedExitState>, Error = RitaExitError>> {\nlet our_secretkey: WgKey = *EXIT_WG_PRIVATE_KEY;\nlet our_secretkey = our_secretkey.into();\n@@ -210,7 +209,7 @@ pub fn secure_status_request(\n\"Internal error in client status for {} with {:?}\",\ntheir_wg_pubkey, e\n);\n- return Err(format_err!(\"There was an internal error!\"));\n+ return Err(RitaExitError::MiscStringError(\"There was an internal error!\".to_string()));\n}\n};\nOk(secure_setup_return(\n@@ -221,7 +220,7 @@ pub fn secure_status_request(\n}))\n}\n-pub fn get_exit_info_http(_req: HttpRequest) -> Result<Json<ExitState>, Error> {\n+pub fn get_exit_info_http(_req: HttpRequest) -> Result<Json<ExitState>, RitaExitError> {\nOk(Json(ExitState::GotInfo {\ngeneral_details: get_exit_info(),\nmessage: \"Got info successfully\".to_string(),\n@@ -246,7 +245,7 @@ pub fn get_client_debt(client: Json<Identity>) -> HttpResponse {\n}\n#[cfg(not(feature = \"development\"))]\n-pub fn nuke_db(_req: HttpRequest) -> Result<HttpResponse, Error> {\n+pub fn nuke_db(_req: HttpRequest) -> Result<HttpResponse, RitaExitError> {\n// This is returned on production builds.\nOk(HttpResponse::NotFound().finish())\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/traffic_watcher/mod.rs", "new_path": "rita_exit/src/traffic_watcher/mod.rs", "diff": "//!\n//! Also handles enforcement of nonpayment, since there's no need for a complicated TunnelManager for exits\n-use failure::bail;\nuse rita_common::debt_keeper::traffic_update;\nuse rita_common::debt_keeper::Traffic;\nuse rita_common::usage_tracker::update_usage_data;\n@@ -22,11 +21,12 @@ use althea_kernel_interface::KI;\nuse althea_types::Identity;\nuse althea_types::WgKey;\nuse babel_monitor::Route as RouteLegacy;\n-use failure::Error;\nuse ipnetwork::IpNetwork;\nuse std::collections::HashMap;\nuse std::net::IpAddr;\n+use crate::RitaExitError;\n+\n#[derive(Default)]\npub struct TrafficWatcher {\nlast_seen_bytes: HashMap<WgKey, WgUsage>,\n@@ -49,11 +49,11 @@ pub struct Watch {\n}\nimpl Message for Watch {\n- type Result = Result<(), Error>;\n+ type Result = Result<(), RitaExitError>;\n}\nimpl Handler<Watch> for TrafficWatcher {\n- type Result = Result<(), Error>;\n+ type Result = Result<(), RitaExitError>;\nfn handle(&mut self, msg: Watch, _: &mut Context<Self>) -> Self::Result {\nwatch(&mut self.last_seen_bytes, &msg.routes, &msg.users)\n@@ -182,13 +182,13 @@ pub fn watch(\nusage_history: &mut HashMap<WgKey, WgUsage>,\nroutes: &[RouteLegacy],\nclients: &[Identity],\n-) -> Result<(), Error> {\n+) -> Result<(), RitaExitError> {\nlet our_price = settings::get_rita_exit().exit_network.exit_price;\nlet our_id = match settings::get_rita_exit().get_identity() {\nSome(id) => id,\nNone => {\nwarn!(\"Our identity is not ready!\");\n- bail!(\"Identity is not ready\");\n+ return Err(RitaExitError::MiscStringError(\"Identity is not ready\".to_string()))\n}\n};\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
removed failures from rita_exit crate
20,247
25.01.2022 12:19:53
28,800
6e11418ca0fb28ca03d29ac72ad2d7950d1b78b0
Fix add_iptables_rule usage add_iptables_rule expects that a rule with -I will also have an insertion location included. Leaving it out will only impact if the rule is run multiple times, in which case the check to see if it already exists will fail resulting in an additional rule being added.
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/exit_client_tunnel.rs", "new_path": "althea_kernel_interface/src/exit_client_tunnel.rs", "diff": "@@ -73,6 +73,7 @@ impl dyn KernelInterface {\n&[\n\"-I\",\n\"OUTPUT\",\n+ \"1\",\n\"-o\",\n\"wg_exit\",\n\"-p\",\n@@ -204,6 +205,7 @@ impl dyn KernelInterface {\n&[\n\"-I\",\n\"FORWARD\",\n+ \"1\",\n\"-p\",\n\"tcp\",\n\"--tcp-flags\",\n@@ -222,7 +224,7 @@ impl dyn KernelInterface {\n/// blocks the client nat by inserting a blocker in the start of the special lan forwarding\n/// table created by openwrt.\npub fn block_client_nat(&self) -> Result<(), Error> {\n- self.add_iptables_rule(\"iptables\", &[\"-I\", \"zone_lan_forward\", \"-j\", \"REJECT\"])?;\n+ self.add_iptables_rule(\"iptables\", &[\"-I\", \"zone_lan_forward\", \"1\", \"-j\", \"REJECT\"])?;\nOk(())\n}\n" }, { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/iptables.rs", "new_path": "althea_kernel_interface/src/iptables.rs", "diff": "@@ -2,6 +2,10 @@ use crate::KernelInterface;\nuse crate::KernelInterfaceError;\nimpl dyn KernelInterface {\n+ /// -I and -A will be checked to see if they already exist before adding.\n+ /// Expects that a rule with -I will also have an insertion location included.\n+ /// Leaving it out will only impact if the rule is run multiple times,\n+ /// in which case the check to see if it already exists will fail resulting in an additional rule being added.\npub fn add_iptables_rule(\n&self,\ncommand: &str,\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/light_client_manager/mod.rs", "new_path": "rita_client/src/light_client_manager/mod.rs", "diff": "@@ -55,6 +55,7 @@ fn setup_light_client_forwarding(client_addr: Ipv4Addr, nic: &str) -> Result<(),\n&[\n\"-I\",\n\"FORWARD\",\n+ \"1\",\n\"-i\",\nnic,\n\"--src\",\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix add_iptables_rule usage add_iptables_rule expects that a rule with -I will also have an insertion location included. Leaving it out will only impact if the rule is run multiple times, in which case the check to see if it already exists will fail resulting in an additional rule being added.
20,247
27.01.2022 10:27:31
28,800
e55a0d732d389698ea05c915121904cb4e06bb48
Fix add_iptables_rule to support optional insertion index iptables -I can optionally take an index after the chain name. This fix adds support for this when checking the existence of the rule. undo previous changes to iptables commands
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/exit_client_tunnel.rs", "new_path": "althea_kernel_interface/src/exit_client_tunnel.rs", "diff": "@@ -73,7 +73,6 @@ impl dyn KernelInterface {\n&[\n\"-I\",\n\"OUTPUT\",\n- \"1\",\n\"-o\",\n\"wg_exit\",\n\"-p\",\n@@ -205,7 +204,6 @@ impl dyn KernelInterface {\n&[\n\"-I\",\n\"FORWARD\",\n- \"1\",\n\"-p\",\n\"tcp\",\n\"--tcp-flags\",\n@@ -224,7 +222,7 @@ impl dyn KernelInterface {\n/// blocks the client nat by inserting a blocker in the start of the special lan forwarding\n/// table created by openwrt.\npub fn block_client_nat(&self) -> Result<(), Error> {\n- self.add_iptables_rule(\"iptables\", &[\"-I\", \"zone_lan_forward\", \"1\", \"-j\", \"REJECT\"])?;\n+ self.add_iptables_rule(\"iptables\", &[\"-I\", \"zone_lan_forward\", \"-j\", \"REJECT\"])?;\nOk(())\n}\n" }, { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/iptables.rs", "new_path": "althea_kernel_interface/src/iptables.rs", "diff": "@@ -3,9 +3,6 @@ use crate::KernelInterfaceError;\nimpl dyn KernelInterface {\n/// -I and -A will be checked to see if they already exist before adding.\n- /// Expects that a rule with -I will also have an insertion location included.\n- /// Leaving it out will only impact if the rule is run multiple times,\n- /// in which case the check to see if it already exists will fail resulting in an additional rule being added.\npub fn add_iptables_rule(\n&self,\ncommand: &str,\n@@ -13,21 +10,25 @@ impl dyn KernelInterface {\n) -> Result<(), KernelInterfaceError> {\nassert!(rule.contains(&\"-A\") || rule.contains(&\"-I\") || rule.contains(&\"-D\"));\n- // we replace the add or delete commands with a check command so that we can see if the rule is actually present\n+ // we replace the add or append commands with a check command so that we can see if the rule is actually present\n// if it is then we don't need to do anything\nlet mut new_command = Vec::new();\nlet mut i_pos_skip = None;\n- for (i, rule) in rule.iter().enumerate() {\n+\n+ for (i, rul) in rule.iter().enumerate() {\nif i_pos_skip.is_some() && i == i_pos_skip.unwrap() {\ncontinue;\n}\n- if *rule == \"-I\" {\n- new_command.push(\"-C\");\n+ if *rul == \"-I\" {\n+ // if there's an insertion index, then skip it for the check statement\n+ if rule[i + 2].parse::<u32>().is_ok() {\ni_pos_skip = Some(i + 2);\n- } else if *rule == \"-A\" {\n+ }\n+ new_command.push(\"-C\");\n+ } else if *rul == \"-A\" {\nnew_command.push(\"-C\");\n} else {\n- new_command.push(rule);\n+ new_command.push(rul);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/light_client_manager/mod.rs", "new_path": "rita_client/src/light_client_manager/mod.rs", "diff": "@@ -55,7 +55,6 @@ fn setup_light_client_forwarding(client_addr: Ipv4Addr, nic: &str) -> Result<(),\n&[\n\"-I\",\n\"FORWARD\",\n- \"1\",\n\"-i\",\nnic,\n\"--src\",\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix add_iptables_rule to support optional insertion index iptables -I can optionally take an index after the chain name. This fix adds support for this when checking the existence of the rule. undo previous changes to iptables commands
20,255
27.01.2022 15:06:46
28,800
272cb34f5505400bff19a67d3362439d70ee8aa7
Added better logging for Rita update logic
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/upgrade.rs", "new_path": "althea_kernel_interface/src/upgrade.rs", "diff": "@@ -7,6 +7,7 @@ impl dyn KernelInterface {\npub fn perform_sysupgrade(&self, command: SysupgradeCommand) -> Result<Output, Error> {\n//If empty url, return error\nif command.url.is_empty() {\n+ info!(\"Empty url given to sysupgrade\");\nreturn Err(Error::RuntimeError(\n\"Empty url given to sysupgrade\".to_string(),\n));\n@@ -20,6 +21,10 @@ impl dyn KernelInterface {\n};\nargs.push(command.url);\nlet args_ref: Vec<&str> = args.iter().map(std::ops::Deref::deref).collect();\n+ info!(\n+ \"Running the command /sbin/sysupgrade with args: {:?}\",\n+ args_ref\n+ );\nself.run_command(\"/sbin/sysupgrade\", &args_ref)\n}\n@@ -32,6 +37,7 @@ impl dyn KernelInterface {\nlet mut args = command.arguments.unwrap();\nargs.insert(0, \"update\".to_string());\nlet args_ref: Vec<&str> = args.iter().map(std::ops::Deref::deref).collect();\n+ info!(\"Running command opkg with args: {:?}\", args_ref);\nself.run_command(\"opkg\", &args_ref)\n} else {\nlet mut res = Err(Error::RuntimeError(\n@@ -42,6 +48,7 @@ impl dyn KernelInterface {\nargs.insert(0, packet);\nargs.insert(0, \"update\".to_string());\nlet args_ref: Vec<&str> = args.iter().map(std::ops::Deref::deref).collect();\n+ info!(\"Running command opkg with args: {:?}\", args_ref);\nres = self.run_command(\"opkg\", &args_ref);\nres.clone()?;\n}\n@@ -53,6 +60,7 @@ impl dyn KernelInterface {\n\"No packages given to install\".to_string(),\n));\nif command.packages.is_none() {\n+ error!(\"No packages given to opkg install\");\nreturn res;\n}\nfor packet in command.packages.clone().unwrap() {\n@@ -60,6 +68,7 @@ impl dyn KernelInterface {\nargs.insert(0, packet);\nargs.insert(0, \"install\".to_string());\nlet args_ref: Vec<&str> = args.iter().map(std::ops::Deref::deref).collect();\n+ info!(\"Running command opkg with args: {:?}\", args_ref);\nres = self.run_command(\"opkg\", &args_ref);\nres.clone()?;\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/operator_update/updater.rs", "new_path": "rita_client/src/operator_update/updater.rs", "diff": "@@ -12,6 +12,7 @@ pub fn update_rita(instruction: UpdateType) -> Result<Output, KernelInterfaceErr\nUpdateType::Opkg(commands) => {\n//update the feed\nhandle_release_feed_update(Some(commands.feed));\n+ info!(\"Set new release feed for opkg\");\n//opkg commands\nlet res = Err(KernelInterfaceError::RuntimeError(\n@@ -19,12 +20,16 @@ pub fn update_rita(instruction: UpdateType) -> Result<Output, KernelInterfaceErr\n));\nfor cmd in commands.command_list {\nlet res = KI.perform_opkg(cmd);\n- res.clone()?;\n+ if res.is_err() {\n+ error!(\"Unable to perform opkg with error: {:?}\", res);\n+ return res;\n+ }\n}\nres\n}\n}\n} else {\n+ error!(\"Recieved update command for device not openWRT\");\nErr(KernelInterfaceError::RuntimeError(\n\"Not an openwrt device, not updating\".to_string(),\n))\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Added better logging for Rita update logic
20,253
19.01.2022 15:49:00
28,800
06031bbc02d41452229d998d7c8a0a07a4bf4f15
migrating network_monitor to async/await
[ { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/neighbors.rs", "new_path": "rita_client/src/dashboard/neighbors.rs", "diff": "@@ -10,7 +10,7 @@ use babel_monitor_legacy::start_connection_legacy;\nuse futures01::Future;\nuse num256::{Int256, Uint256};\nuse rita_common::debt_keeper::{dump, NodeDebtData};\n-use rita_common::network_monitor::{GetStats, IfaceStats, NetworkMonitor, Stats};\n+use rita_common::network_monitor::{get_stats, IfaceStats, Stats};\nuse rita_common::tunnel_manager::{GetNeighbors, Neighbor, TunnelManager};\nuse std::collections::HashMap;\n@@ -82,21 +82,14 @@ pub fn get_neighbor_info(\n.from_err()\n.and_then(|(_stream, routes)| {\nlet route_table_sample = routes;\n-\n- NetworkMonitor::from_registry()\n- .send(GetStats {})\n- .from_err()\n- .and_then(|stats| {\n- let stats = stats.unwrap();\n+ let stats = get_stats();\nlet output = generate_neighbors_list(\nstats,\nroute_table_sample,\ncombined_list,\n);\n-\nOk(Json(output))\n})\n- })\n.responder()\n})\n})\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/heartbeat/mod.rs", "new_path": "rita_client/src/heartbeat/mod.rs", "diff": "@@ -22,8 +22,8 @@ use babel_monitor::BabelMonitorError;\nuse dummy::dummy_selected_exit_details;\n+use rita_common::network_monitor::get_network_info;\nuse rita_common::network_monitor::GetNetworkInfo;\n-use rita_common::network_monitor::NetworkMonitor;\nuse rita_common::tunnel_manager::Neighbor as RitaNeighbor;\nuse actix::actors::resolver;\n@@ -95,9 +95,6 @@ pub fn send_udp_heartbeat() {\nlet dns_request = Resolver::from_registry()\n.send(resolver::Resolve::host(heartbeat_url.to_string()))\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#[allow(unused_assignments, unused_mut)]\n@@ -130,12 +127,20 @@ pub fn send_udp_heartbeat() {\ntrace!(\"we have heartbeat basic info\");\n- let res = dns_request.join(network_info).then(move |res| {\n+ let network_info = match get_network_info(GetNetworkInfo) {\n+ Ok(network_info_val) => network_info_val,\n+ Err(e) => {\n+ warn!(\"Could not get network info with {:?}\", e);\n+ return;\n+ }\n+ };\n+\n+ let res = dns_request.then(move |res| {\n// In this block we handle gathering all the info and the many ways gathering it could fail\n// once we have succeeded even if only once we have a cached value that is updated regularly\n// if for some reason the cache update fails, we can still progress with the heartbeat\nmatch res {\n- Ok((Ok(dnsresult), Ok(network_info))) => {\n+ Ok(Ok(dnsresult)) => {\n#[cfg(not(feature = \"operator_debug\"))]\nlet selected_exit_route = get_selected_exit_route(&network_info.babel_routes);\n#[cfg(feature = \"operator_debug\")]\n@@ -187,12 +192,9 @@ pub fn send_udp_heartbeat() {\nErr(e) => {\nwarn!(\"Failed to resolve domain and get network info! {:?}\", e);\n}\n- Ok((Err(e), _)) => {\n+ Ok(Err(e)) => {\nwarn!(\"DNS resolution failed with {:?}\", e);\n}\n- Ok((_, Err(e))) => {\n- warn!(\"Could not get network info with {:?}\", e);\n- }\n}\n// Now we actually send the heartbeat, using the cached data if it is\n// available. We should only ever see it not be available for short periods\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/network_monitor/mod.rs", "new_path": "rita_common/src/network_monitor/mod.rs", "diff": "//! on traffic over every interface and base our action off of spikes in throughput as well as spikes in latency.\nuse crate::rita_loop::fast_loop::FAST_LOOP_SPEED;\n-use crate::tunnel_manager::shaping::ShapeMany;\n+use crate::set_to_shape;\nuse crate::tunnel_manager::shaping::ShapingAdjust;\nuse crate::tunnel_manager::shaping::ShapingAdjustAction;\nuse crate::tunnel_manager::Neighbor as RitaNeighbor;\n-use crate::tunnel_manager::TunnelManager;\nuse crate::RitaCommonError;\n-use actix::Actor;\n-use actix::Context;\n-use actix::Handler;\n-use actix::Message;\n-use actix::Supervised;\n-use actix::SystemService;\n+\nuse althea_types::monitoring::has_packet_loss;\nuse althea_types::monitoring::SAMPLE_PERIOD;\nuse althea_types::RunningLatencyStats;\n@@ -29,10 +23,15 @@ use althea_types::WgKey;\nuse babel_monitor::Neighbor as BabelNeighborLegacy;\nuse babel_monitor::Route as BabelRouteLegacy;\nuse std::collections::HashMap;\n+use std::sync::Arc;\n+use std::sync::RwLock;\nuse std::time::Duration;\nuse std::time::Instant;\n-use super::tunnel_manager::neighbor_status::UpdateNeighborStatus;\n+lazy_static! {\n+ static ref NETWORK_MONITOR: Arc<RwLock<NetworkMonitor>> =\n+ Arc::new(RwLock::new(NetworkMonitor::default()));\n+}\n/// 10 minutes in seconds, the amount of time we wait for an interface to be\n/// 'good' before we start trying to increase it's speed\n@@ -48,24 +47,6 @@ pub struct NetworkMonitor {\nlast_babel_dump: Option<NetworkInfo>,\n}\n-impl Actor for NetworkMonitor {\n- type Context = Context<Self>;\n-}\n-\n-impl Supervised for NetworkMonitor {}\n-impl SystemService for NetworkMonitor {\n- fn service_started(&mut self, _ctx: &mut Context<Self>) {\n- info!(\"NetworkMonitor started\");\n-\n- // if this assertion is failing you're running this slowly enough\n- // that all the sample period logic is not relevent, go disable it\n- assert_eq!(SAMPLE_PERIOD as u64, FAST_LOOP_SPEED.as_secs());\n- if !SAMPLE_PERIOD <= 16 {\n- panic!(\"NetworkMonitor is running too slowly! Please adjust constants\");\n- }\n- }\n-}\n-\nimpl NetworkMonitor {\npub fn new() -> Self {\nNetworkMonitor {\n@@ -102,20 +83,14 @@ pub struct IfaceStats {\npacket_loss: PacketLossStats,\n}\n-impl Message for GetStats {\n- type Result = Result<Stats, RitaCommonError>;\n-}\n-\npub type Stats = HashMap<String, IfaceStats>;\n-impl Handler<GetStats> for NetworkMonitor {\n- type Result = Result<Stats, RitaCommonError>;\n-\n- fn handle(&mut self, _msg: GetStats, _ctx: &mut Context<Self>) -> Self::Result {\n+pub fn get_stats() -> Stats {\nlet mut stats = Stats::new();\n+ let network_monitor = &*(NETWORK_MONITOR.write().unwrap());\n- for (iface, latency_stats) in self.latency_history.iter() {\n- if let Some(packet_loss_stats) = self.packet_loss_history.get(iface) {\n+ for (iface, latency_stats) in network_monitor.latency_history.iter() {\n+ if let Some(packet_loss_stats) = network_monitor.packet_loss_history.get(iface) {\nstats.insert(\niface.clone(),\nIfaceStats {\n@@ -133,53 +108,41 @@ impl Handler<GetStats> for NetworkMonitor {\nerror!(\"Found entry in one that's not in the other \")\n}\n}\n-\n- Ok(stats)\n- }\n+ stats\n}\npub struct GetNetworkInfo;\n-impl Message for GetNetworkInfo {\n- type Result = Result<NetworkInfo, RitaCommonError>;\n-}\n-\n-impl Handler<GetNetworkInfo> for NetworkMonitor {\n- type Result = Result<NetworkInfo, RitaCommonError>;\n-\n- fn handle(&mut self, _msg: GetNetworkInfo, _ctx: &mut Context<Self>) -> Self::Result {\n- match self.last_babel_dump.clone() {\n+pub fn get_network_info(_msg: GetNetworkInfo) -> Result<NetworkInfo, RitaCommonError> {\n+ match (*(NETWORK_MONITOR.read().unwrap())).last_babel_dump.clone() {\nSome(dump) => Ok(dump),\nNone => Err(RitaCommonError::MiscStringError(\n\"No babel info ready!\".to_string(),\n)),\n}\n}\n-}\n-#[derive(Message, Clone)]\n+#[derive(Clone)]\npub struct NetworkInfo {\npub babel_neighbors: Vec<BabelNeighborLegacy>,\npub babel_routes: Vec<BabelRouteLegacy>,\npub rita_neighbors: Vec<RitaNeighbor>,\n}\n-impl Handler<NetworkInfo> for NetworkMonitor {\n- type Result = ();\n-\n- fn handle(&mut self, msg: NetworkInfo, _ctx: &mut Context<Self>) -> Self::Result {\n+/// updates babel neighbors, babel routes, and rita neighbors for a NetworkInfo\n+pub fn update_network_info(msg: NetworkInfo) {\n+ let mut network_monitor = &mut *(NETWORK_MONITOR.write().unwrap());\nlet babel_neighbors = &msg.babel_neighbors;\nlet babel_routes = &msg.babel_routes;\nlet rita_neighbors = &msg.rita_neighbors;\nobserve_network(\nbabel_neighbors,\nrita_neighbors,\n- &mut self.latency_history,\n- &mut self.packet_loss_history,\n+ &mut network_monitor.latency_history,\n+ &mut network_monitor.packet_loss_history,\n);\nnetwork_stats(babel_routes, babel_neighbors);\n- self.last_babel_dump = Some(msg);\n- }\n+ network_monitor.last_babel_dump = Some(msg);\n}\n/// Attempts to detect bufferbloat by looking at neighbor latency over time\n@@ -189,6 +152,12 @@ fn observe_network(\nlatency_history: &mut HashMap<String, RunningLatencyStats>,\npacket_loss_history: &mut HashMap<String, RunningPacketLossStats>,\n) {\n+ // if this assertion is failing you're running this slowly enough\n+ // that all the sample period logic is not relevent, go disable it\n+ assert_eq!(SAMPLE_PERIOD as u64, FAST_LOOP_SPEED.as_secs());\n+ if !SAMPLE_PERIOD <= 16 {\n+ panic!(\"NetworkMonitor is running too slowly! Please adjust constants\");\n+ }\nlet mut to_shape = Vec::new();\nfor neigh in babel_neighbors.iter() {\nlet iface = &neigh.iface;\n@@ -287,10 +256,7 @@ fn observe_network(\n// shape the misbehaving tunnels, we do this all at once for the sake\n// of efficiency as lots of do_sends have a high chance of getting lost\n// also there's nontrivial overhead\n- TunnelManager::from_registry().do_send(ShapeMany { to_shape });\n-\n- // update NeighborStatus info for operator tools\n- TunnelManager::from_registry().do_send(UpdateNeighborStatus);\n+ set_to_shape(to_shape);\n}\nfn get_wg_key_by_ifname(\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/rita_loop/fast_loop.rs", "new_path": "rita_common/src/rita_loop/fast_loop.rs", "diff": "use crate::blockchain_oracle::update as BlockchainOracleUpdate;\nuse crate::debt_keeper::send_debt_update;\nuse crate::eth_compatible_withdraw;\n+use crate::network_monitor::update_network_info;\nuse crate::network_monitor::NetworkInfo as NetworkMonitorTick;\n-use crate::network_monitor::NetworkMonitor;\nuse crate::payment_controller::tick_payment_controller;\nuse crate::payment_validator::validate;\nuse crate::peer_listener::get_peers;\n@@ -155,13 +155,11 @@ impl Handler<Tick> for RitaFastLoop {\nparse_interfaces_legacy(stream).and_then(\nmove |(_stream, babel_interfaces)| {\ntrace!(\"Sending network monitor tick\");\n- NetworkMonitor::from_registry().do_send(\n- NetworkMonitorTick {\n+ update_network_info(NetworkMonitorTick {\nbabel_neighbors,\nbabel_routes,\nrita_neighbors,\n- },\n- );\n+ });\ntrace!(\"Sending tunnel GC\");\nTunnelManager::from_registry().do_send(TriggerGc {\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/tunnel_manager/mod.rs", "new_path": "rita_common/src/tunnel_manager/mod.rs", "diff": "@@ -9,12 +9,14 @@ pub mod id_callback;\npub mod neighbor_status;\npub mod shaping;\n+use crate::handle_shaping;\nuse crate::hello_handler::Hello;\nuse crate::peer_listener::Hello as NewHello;\nuse crate::peer_listener::PeerListener;\nuse crate::peer_listener::PEER_LISTENER;\nuse crate::peer_listener::{send_hello, Peer};\nuse crate::rita_loop::is_gateway;\n+use crate::update_neighbor_status;\nuse crate::RitaCommonError;\nuse crate::FAST_LOOP_TIMEOUT;\nuse crate::KI;\n@@ -37,8 +39,20 @@ use std::fmt::Display;\nuse std::fmt::{Formatter, Result as FmtResult};\nuse std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket};\nuse std::path::Path;\n+use std::sync::Arc;\n+use std::sync::RwLock;\nuse std::time::{Duration, Instant};\n+/// Holds messages from NetworkMonitor that need to be processed by TunnelManager\n+#[derive(Debug, Default)]\n+struct NetworkMonitorQueue {}\n+\n+lazy_static! {\n+ /// Partial storage for tunnel manager data, Tunnel Manager is not fully migrated to async/await so this stores\n+ /// data that other modules need to send to tunnel manager for it to dequeue later.\n+ static ref TUNNEL_MANAGER: Arc<RwLock<NetworkMonitorQueue>> = Arc::new(RwLock::new(NetworkMonitorQueue::default()));\n+}\n+\n#[cfg(test)]\ntype HelloHandler = Mocker<crate::hello_handler::HelloHandler>;\n#[cfg(not(test))]\n@@ -370,6 +384,11 @@ impl Message for PeersToContact {\nimpl Handler<PeersToContact> for TunnelManager {\ntype Result = ();\nfn handle(&mut self, msg: PeersToContact, _ctx: &mut Context<Self>) -> Self::Result {\n+ // TODO remove these in TunnelManager async/await migration and move to its own function\n+ // these are put here so that they are run, not for any logical reason\n+ update_neighbor_status(self);\n+ handle_shaping(self);\n+\nlet network_settings = settings::get_rita_common().network;\nlet manual_peers = network_settings.manual_peers.clone();\nlet is_gateway = is_gateway();\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/tunnel_manager/neighbor_status.rs", "new_path": "rita_common/src/tunnel_manager/neighbor_status.rs", "diff": "use super::{PaymentState, TunnelManager};\n-use actix::{Context, Handler, Message};\nuse althea_types::Identity;\nuse althea_types::NeighborStatus;\nuse std::collections::HashMap;\n@@ -18,18 +17,10 @@ pub fn get_neighbor_status() -> HashMap<Identity, NeighborStatus> {\nNEIGHBOR_STATUS.read().unwrap().clone()\n}\n-pub struct UpdateNeighborStatus;\n-\n-impl Message for UpdateNeighborStatus {\n- type Result = ();\n-}\n-\n-impl Handler<UpdateNeighborStatus> for TunnelManager {\n- type Result = ();\n-\n- fn handle(&mut self, _: UpdateNeighborStatus, _: &mut Context<Self>) -> Self::Result {\n+/// Handles updates to neighbor status with lazy static lock\n+pub fn update_neighbor_status(tunnel_manager: &mut TunnelManager) {\nlet mut external_list = NEIGHBOR_STATUS.write().unwrap();\n- for (id, tunnel_list) in self.tunnels.iter() {\n+ for (id, tunnel_list) in tunnel_manager.tunnels.iter() {\n// we may have many tunnels with this same peer, we want to get\n// the lowest shaper value of any of the recently active tunnels\nlet mut lowest_shaper_speed = None;\n@@ -60,4 +51,3 @@ impl Handler<UpdateNeighborStatus> for TunnelManager {\n);\n}\n}\n-}\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/tunnel_manager/shaping.rs", "new_path": "rita_common/src/tunnel_manager/shaping.rs", "diff": "use super::TunnelManager;\nuse crate::KI;\n-use actix::{Context, Handler, Message};\n-use std::sync::atomic::AtomicBool;\n-use std::sync::atomic::Ordering;\n+use std::sync::Arc;\n+use std::sync::RwLock;\n+\n+/// contains the state for the shaper\n+#[derive(Debug, Default)]\n+struct Shaper {\n+ reset_flag: bool,\n+ to_shape: Vec<ShapingAdjust>,\n+}\nlazy_static! {\n- static ref RESET_FLAG: AtomicBool = AtomicBool::new(false);\n+ static ref SHAPER: Arc<RwLock<Shaper>> = Arc::new(RwLock::new(Shaper::default()));\n}\n-#[allow(dead_code)]\npub fn flag_reset_shaper() {\n- RESET_FLAG.store(true, Ordering::Relaxed)\n+ SHAPER.write().unwrap().reset_flag = true;\n+}\n+\n+pub fn set_to_shape(input: Vec<ShapingAdjust>) {\n+ SHAPER.write().unwrap().to_shape = input;\n}\npub struct ShapeMany {\n@@ -18,34 +27,30 @@ pub struct ShapeMany {\n}\n/// Message sent by network monitor when it determines that an iface is bloated\n+#[derive(Debug)]\npub struct ShapingAdjust {\npub iface: String,\npub action: ShapingAdjustAction,\n}\n-#[derive(Clone, Copy, Eq, PartialEq)]\n+#[derive(Clone, Copy, Eq, PartialEq, Debug)]\npub enum ShapingAdjustAction {\nIncreaseSpeed,\nReduceSpeed,\n}\n-impl Message for ShapeMany {\n- type Result = ();\n-}\n-\n-impl Handler<ShapeMany> for TunnelManager {\n- type Result = ();\n-\n- fn handle(&mut self, msg: ShapeMany, _: &mut Context<Self>) -> Self::Result {\n+pub fn handle_shaping(tunnel_manager: &mut TunnelManager) {\nlet network_settings = settings::get_rita_common().network;\nlet minimum_bandwidth_limit = network_settings.shaper_settings.min_speed;\nlet starting_bandwidth_limit = network_settings.shaper_settings.max_speed;\nlet bandwidth_limit_enabled = network_settings.shaper_settings.enabled;\n+ let mut shaper = SHAPER.write().unwrap();\n+\n// removes shaping without requiring a restart if the flag is set or\n// if it's set in the settings\n- if !bandwidth_limit_enabled || RESET_FLAG.load(Ordering::Relaxed) {\n- for (_id, tunnel_list) in self.tunnels.iter_mut() {\n+ if !bandwidth_limit_enabled || shaper.reset_flag {\n+ for (_id, tunnel_list) in tunnel_manager.tunnels.iter_mut() {\nfor tunnel in tunnel_list {\nif tunnel.speed_limit != None {\nset_shaping_or_error(&tunnel.iface_name, None);\n@@ -53,23 +58,23 @@ impl Handler<ShapeMany> for TunnelManager {\n}\n}\n}\n- RESET_FLAG.store(false, Ordering::Relaxed);\n+ shaper.reset_flag = false;\nreturn;\n}\n- for shaping_command in msg.to_shape {\n+ for shaping_command in &shaper.to_shape {\nlet action = shaping_command.action;\n- let iface = shaping_command.iface;\n- for (id, tunnel_list) in self.tunnels.iter_mut() {\n+ let iface = &shaping_command.iface;\n+ for (id, tunnel_list) in tunnel_manager.tunnels.iter_mut() {\nfor tunnel in tunnel_list {\n- if tunnel.iface_name == iface {\n+ if &tunnel.iface_name == iface {\nmatch (tunnel.speed_limit, action) {\n// nothing to do in this case\n(None, ShapingAdjustAction::IncreaseSpeed) => {}\n// start at the starting limit\n(None, ShapingAdjustAction::ReduceSpeed) => {\ntunnel.speed_limit = Some(starting_bandwidth_limit);\n- set_shaping_or_error(&iface, Some(starting_bandwidth_limit))\n+ set_shaping_or_error(iface, Some(starting_bandwidth_limit))\n}\n// after that cut the value by 20% each time\n(Some(val), ShapingAdjustAction::ReduceSpeed) => {\n@@ -81,7 +86,7 @@ impl Handler<ShapeMany> for TunnelManager {\n\"Interface {} for peer {} is showing bloat new speed value {}\",\niface, id.wg_public_key, new_val\n);\n- set_shaping_or_error(&iface, Some(new_val));\n+ set_shaping_or_error(iface, Some(new_val));\ntunnel.speed_limit = Some(new_val);\n}\n}\n@@ -93,7 +98,7 @@ impl Handler<ShapeMany> for TunnelManager {\n\"Interface {} for peer {} has not shown bloat new speed value {}\",\niface, id.wg_public_key, new_val\n);\n- set_shaping_or_error(&iface, Some(new_val));\n+ set_shaping_or_error(iface, Some(new_val));\ntunnel.speed_limit = Some(new_val);\n} else {\ninfo!(\n@@ -108,7 +113,6 @@ impl Handler<ShapeMany> for TunnelManager {\n}\n}\n}\n-}\n/// tiny little helper function for GotBloat() limit is in mbps\nfn set_shaping_or_error(iface: &str, limit: Option<usize>) {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
migrating network_monitor to async/await
20,255
31.01.2022 09:29:44
28,800
4a17022a6ba123c39b004b2c3cbc0e54a30a6986
Fixed Bug in Opkg Updates. Unwrap was being called without a proper check on an option
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/upgrade.rs", "new_path": "althea_kernel_interface/src/upgrade.rs", "diff": "@@ -34,7 +34,7 @@ impl dyn KernelInterface {\nmatch command.opkg_command {\nOpkgCommandType::Update => {\nif command.packages.is_none() {\n- let mut args = command.arguments.unwrap();\n+ let mut args = command.arguments.unwrap_or_default();\nargs.insert(0, \"update\".to_string());\nlet args_ref: Vec<&str> = args.iter().map(std::ops::Deref::deref).collect();\ninfo!(\"Running command opkg with args: {:?}\", args_ref);\n@@ -44,7 +44,7 @@ impl dyn KernelInterface {\n\"No packages given to update\".to_string(),\n));\nfor packet in command.packages.clone().unwrap() {\n- let mut args = command.arguments.clone().unwrap();\n+ let mut args = command.arguments.clone().unwrap_or_default();\nargs.insert(0, packet);\nargs.insert(0, \"update\".to_string());\nlet args_ref: Vec<&str> = args.iter().map(std::ops::Deref::deref).collect();\n@@ -64,7 +64,7 @@ impl dyn KernelInterface {\nreturn res;\n}\nfor packet in command.packages.clone().unwrap() {\n- let mut args = command.arguments.clone().unwrap();\n+ let mut args = command.arguments.clone().unwrap_or_default();\nargs.insert(0, packet);\nargs.insert(0, \"install\".to_string());\nlet args_ref: Vec<&str> = args.iter().map(std::ops::Deref::deref).collect();\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fixed Bug in Opkg Updates. Unwrap was being called without a proper check on an option
20,255
03.02.2022 10:49:26
28,800
a03245d213b0c0fd6205eb7d4f4c88d2f993b905
Migrated Operator Update to async/await
[ { "change_type": "MODIFY", "old_path": "rita_client/src/operator_update/mod.rs", "new_path": "rita_client/src/operator_update/mod.rs", "diff": "@@ -13,9 +13,6 @@ use rita_common::tunnel_manager::shaping::flag_reset_shaper;\nuse rita_common::utils::option_convert;\nuse updater::update_rita;\n-use actix::{Actor, Arbiter, Context, Handler, Message, Supervised, SystemService};\n-use actix_web::Error;\n-use actix_web::{client, HttpMessage};\nuse althea_kernel_interface::hardware_info::get_hardware_info;\nuse althea_kernel_interface::opkg_feeds::get_release_feed;\nuse althea_kernel_interface::opkg_feeds::set_release_feed;\n@@ -23,7 +20,6 @@ use althea_kernel_interface::opkg_feeds::set_release_feed;\nuse althea_types::OperatorAction;\nuse althea_types::OperatorCheckinMessage;\nuse althea_types::OperatorUpdateMessage;\n-use futures01::Future;\nuse num256::Uint256;\nuse rita_common::KI;\nuse serde_json::Map;\n@@ -72,6 +68,8 @@ lazy_static! {\npub static ref RITA_UPTIME: Instant = Instant::now();\npub static ref TIME_PASSED: Arc<RwLock<UptimeStruct>> =\nArc::new(RwLock::new(UptimeStruct::new()));\n+ static ref OPERATOR_UPDATE: Arc<RwLock<OperatorUpdate>> =\n+ Arc::new(RwLock::new(OperatorUpdate::default()));\n}\n/// Perform operator updates every UPDATE_FREQUENCY seconds,\n@@ -82,17 +80,6 @@ pub struct OperatorUpdate {\nlast_update: Instant,\n}\n-impl Actor for OperatorUpdate {\n- type Context = Context<Self>;\n-}\n-\n-impl Supervised for OperatorUpdate {}\n-impl SystemService for OperatorUpdate {\n- fn service_started(&mut self, _ctx: &mut Context<Self>) {\n- info!(\"OperatorUpdate started\");\n- }\n-}\n-\nimpl OperatorUpdate {\npub fn new() -> Self {\nOperatorUpdate {\n@@ -112,23 +99,19 @@ impl Default for OperatorUpdate {\n/// in the rita_client loop\npub const OPERATOR_UPDATE_TIMEOUT: Duration = CLIENT_LOOP_TIMEOUT;\n-#[derive(Message)]\npub struct Update;\n-impl Handler<Update> for OperatorUpdate {\n- type Result = ();\n-\n- fn handle(&mut self, _msg: Update, _ctx: &mut Context<Self>) -> Self::Result {\n- let time_elapsed = Instant::now().checked_duration_since(self.last_update);\n+pub async fn operator_update() {\n+ let operator_update = &mut *OPERATOR_UPDATE.write().unwrap();\n+ let time_elapsed = Instant::now().checked_duration_since(operator_update.last_update);\nif time_elapsed.is_some() && time_elapsed.unwrap() > UPDATE_FREQUENCY {\n- checkin();\n- self.last_update = Instant::now();\n- }\n+ checkin().await;\n+ operator_update.last_update = Instant::now();\n}\n}\n/// Checks in with the operator server\n-fn checkin() {\n+async fn checkin() {\nlet url: &str;\nif cfg!(feature = \"dev_env\") {\nurl = \"http://0.0.0.0:8080/checkin\";\n@@ -186,9 +169,11 @@ fn checkin() {\n}\n};\n- let res = client::post(url)\n- .header(\"User-Agent\", \"Actix-web\")\n- .json(OperatorCheckinMessage {\n+ let client = awc::Client::default();\n+ let response = client\n+ .post(url)\n+ .timeout(OPERATOR_UPDATE_TIMEOUT)\n+ .send_json(&OperatorCheckinMessage {\nid,\noperator_address,\nsystem_chain,\n@@ -200,23 +185,33 @@ fn checkin() {\nuser_bandwidth_limit,\nrita_uptime: TIME_PASSED.write().unwrap().time_elapsed(&RITA_UPTIME),\n})\n- .unwrap()\n- .send()\n- .timeout(OPERATOR_UPDATE_TIMEOUT)\n- .from_err()\n- .and_then(move |response| {\n+ .await;\n+\n+ let response = match response {\n+ Ok(mut response) => {\ntrace!(\"Response is {:?}\", response.status());\ntrace!(\"Response is {:?}\", response.headers());\n- response\n- .json()\n- .from_err()\n- .and_then(move |new_settings: OperatorUpdateMessage| {\n+ response.json().await\n+ }\n+ Err(e) => {\n+ error!(\"Failed to perform operator checkin with {:?}\", e);\n+ return;\n+ }\n+ };\n+\n+ let new_settings: OperatorUpdateMessage = match response {\n+ Ok(a) => a,\n+ Err(e) => {\n+ error!(\"Failed to perform operator checkin with {:?}\", e);\n+ return;\n+ }\n+ };\n+\nlet mut rita_client = settings::get_rita_client();\nlet mut network = rita_client.network;\ntrace!(\"Updating from operator settings\");\nlet mut payment = rita_client.payment;\n-\nif use_operator_price {\n// This will be true on devices that have integrated switches\n// and a wan port configured. Mostly not a problem since we stopped\n@@ -230,7 +225,6 @@ fn checkin() {\n} else {\ninfo!(\"User has disabled the OperatorUpdate!\");\n}\n-\npayment.max_fee = new_settings.max;\npayment.balance_warning_level = new_settings.warning.into();\nif let Some(new_chain) = new_settings.system_chain {\n@@ -243,17 +237,13 @@ fn checkin() {\n}\nrita_client.payment = payment;\ntrace!(\"Done with payment\");\n-\nlet mut operator = rita_client.operator;\nlet new_operator_fee = Uint256::from(new_settings.operator_fee);\noperator.operator_fee = new_operator_fee;\nrita_client.operator = operator;\n-\nmerge_settings_safely(new_settings.merge_json);\n-\n//Every tick, update the local router update instructions\nset_router_update_instruction(new_settings.local_update_instruction);\n-\nmatch new_settings.operator_action {\nSome(OperatorAction::ResetShaper) => flag_reset_shaper(),\nSome(OperatorAction::Reboot) => {\n@@ -284,23 +274,10 @@ fn checkin() {\nSome(OperatorAction::UpdateNow) => info!(\"Got outdated command UpdateNow\"),\nNone => {}\n}\n-\nnetwork.shaper_settings = new_settings.shaper_settings;\nrita_client.network = network;\n-\nsettings::set_rita_client(rita_client);\ntrace!(\"Successfully completed OperatorUpdate\");\n- Ok(())\n- })\n- })\n- .then(|res: Result<(), Error>| {\n- if let Err(e) = res {\n- error!(\"Failed to perform operator checkin with {:?}\", e);\n- }\n- Ok(())\n- });\n-\n- Arbiter::spawn(res);\n}\n/// Allows for online updating of the release feed, note that this not run\n@@ -399,6 +376,7 @@ mod tests {\n}\n}\n}\n+\n#[test]\nfn test_rita_uptime() {\n// exact key match should fail\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/rita_loop/mod.rs", "new_path": "rita_client/src/rita_loop/mod.rs", "diff": "@@ -11,7 +11,7 @@ use crate::light_client_manager::light_client_hello_response;\nuse crate::light_client_manager::LightClientManager;\nuse crate::light_client_manager::Watch;\nuse crate::operator_fee_manager::tick_operator_payments;\n-use crate::operator_update::{OperatorUpdate, Update};\n+use crate::operator_update::operator_update;\nuse crate::traffic_watcher::get_exit_dest_price;\nuse crate::RitaClientError;\nuse actix::{\n@@ -135,9 +135,6 @@ impl Handler<Tick> for RitaLoop {\nsend_udp_heartbeat();\n}\n- // Check in with Operator\n- OperatorUpdate::from_registry().do_send(Update);\n-\ninfo!(\n\"Rita Client loop completed in {}s {}ms\",\nstart.elapsed().as_secs(),\n@@ -172,7 +169,9 @@ pub fn start_rita_loop() {\n// updates to the local ip and description from the exit side\nexit_manager_tick().await;\n// sends an operator payment if enough time has elapsed\n- tick_operator_payments().await\n+ tick_operator_payments().await;\n+ // Check in with Operator\n+ operator_update().await;\n});\n// sleep until it has been CLIENT_LOOP_SPEED seconds from start, whenever that may be\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Migrated Operator Update to async/await
20,247
02.02.2022 20:45:04
28,800
8de416557d60cd8f518bc1d4d0ac9462fb56e653
Add the LTE port type and network interface This adds a new LTE port and lte network interface that is basically a DHCP WAN port, but does not have the gateway characteristics, and therefore no static routes to exits nor gateway pricing
[ { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/interfaces.rs", "new_path": "rita_client/src/dashboard/interfaces.rs", "diff": "@@ -39,6 +39,8 @@ pub enum InterfaceMode {\nipaddr: Ipv4Addr,\ngateway: Ipv4Addr,\n},\n+ /// Similar to WAN, but not a gateway, so no static DNS routes and only IP peers (10.45.0.1)\n+ LTE,\n/// This represents a port dedicated to phone network extending antennas. This is an extension of the\n/// AltheaMobile SSID and can be boiled down to attaching the port to br-pbs over which devices will\n/// then be assigned phone network DHCP and IPs\n@@ -57,6 +59,7 @@ impl ToString for InterfaceMode {\nInterfaceMode::StaticWan { .. } => \"StaticWAN\".to_owned(),\nInterfaceMode::Phone => \"Phone\".to_owned(),\nInterfaceMode::Unknown => \"unknown\".to_owned(),\n+ InterfaceMode::LTE => \"LTE\".to_owned(),\n}\n}\n}\n@@ -105,6 +108,7 @@ pub fn ethernet2mode(ifname: &str, setting_name: &str) -> Result<InterfaceMode,\ns if s.contains(\"rita_\") => InterfaceMode::Mesh,\ns if s.contains(\"lan\") => InterfaceMode::Lan,\ns if s.contains(\"pbs\") => InterfaceMode::Phone,\n+ s if s.contains(\"lte\") => InterfaceMode::LTE,\ns if s.contains(\"backhaul\") => {\nlet prefix = \"network.backhaul\";\nlet backhaul = KI.uci_show(Some(prefix))?;\n@@ -152,7 +156,7 @@ pub fn ethernet2mode(ifname: &str, setting_name: &str) -> Result<InterfaceMode,\n}\nfn set_interface_mode(iface_name: &str, mode: InterfaceMode) -> Result<(), RitaClientError> {\n- trace!(\"InterfaceToSet recieved\");\n+ trace!(\"InterfaceToSet received\");\nlet iface_name = iface_name;\nlet target_mode = mode;\nlet interfaces = get_interfaces()?;\n@@ -161,13 +165,14 @@ fn set_interface_mode(iface_name: &str, mode: InterfaceMode) -> Result<(), RitaC\nreturn Err(RitaClientError::InterfaceModeError(\n\"Attempted to configure non-existant or unavailable interface!\".to_string(),\n));\n- } else if target_mode == InterfaceMode::Wan {\n+ } else if target_mode == InterfaceMode::Wan || target_mode == InterfaceMode::LTE {\n// we can only have one WAN interface, check for others\n- // StaticWAN entires are not identified seperately but if they ever are\n+ // StaticWAN entries are not identified seperately but if they ever are\n// you'll have to handle them here\nfor entry in interfaces {\n+ let iface = entry.0;\nlet mode = entry.1;\n- if mode == InterfaceMode::Wan {\n+ if iface != iface_name && (mode == InterfaceMode::Wan || mode == InterfaceMode::LTE) {\nreturn Err(RitaClientError::InterfaceModeError(\n\"There can only be one WAN interface!\".to_string(),\n));\n@@ -216,6 +221,11 @@ pub fn ethernet_transform_mode(\nlet ret = KI.del_uci_var(\"network.backhaul\");\nreturn_codes.push(ret);\n}\n+ // LTE is even simpler\n+ InterfaceMode::LTE => {\n+ let ret = KI.del_uci_var(\"network.lte\");\n+ return_codes.push(ret);\n+ }\n// LAN is a bridge and the lan bridge must always remain because things\n// like WiFi interfaces are attached to it. So we just remove the interface\n// from the list\n@@ -278,6 +288,14 @@ pub fn ethernet_transform_mode(\nlet ret = KI.set_uci_var(\"network.backhaul.gateway\", &format!(\"{}\", gateway));\nreturn_codes.push(ret);\n}\n+ InterfaceMode::LTE => {\n+ let ret = KI.set_uci_var(\"network.lte\", \"interface\");\n+ return_codes.push(ret);\n+ let ret = KI.set_uci_var(\"network.lte.ifname\", ifname);\n+ return_codes.push(ret);\n+ let ret = KI.set_uci_var(\"network.lte.proto\", \"dhcp\");\n+ return_codes.push(ret);\n+ }\n// since we left lan mostly unmodified we just pop in the ifname\nInterfaceMode::Lan => {\ntrace!(\"Converting interface to lan with ifname {:?}\", ifname);\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add the LTE port type and network interface This adds a new LTE port and lte network interface that is basically a DHCP WAN port, but does not have the gateway characteristics, and therefore no static routes to exits nor gateway pricing
20,247
04.02.2022 08:40:32
28,800
be903f5a8077f6bde4c488f05b9e6de8f8f9d6da
Remove exclusion check between LTE and WAN ports
[ { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/interfaces.rs", "new_path": "rita_client/src/dashboard/interfaces.rs", "diff": "@@ -165,14 +165,13 @@ fn set_interface_mode(iface_name: &str, mode: InterfaceMode) -> Result<(), RitaC\nreturn Err(RitaClientError::InterfaceModeError(\n\"Attempted to configure non-existant or unavailable interface!\".to_string(),\n));\n- } else if target_mode == InterfaceMode::Wan || target_mode == InterfaceMode::LTE {\n+ } else if target_mode == InterfaceMode::Wan {\n// we can only have one WAN interface, check for others\n// StaticWAN entries are not identified seperately but if they ever are\n// you'll have to handle them here\nfor entry in interfaces {\n- let iface = entry.0;\nlet mode = entry.1;\n- if iface != iface_name && (mode == InterfaceMode::Wan || mode == InterfaceMode::LTE) {\n+ if mode == InterfaceMode::Wan {\nreturn Err(RitaClientError::InterfaceModeError(\n\"There can only be one WAN interface!\".to_string(),\n));\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove exclusion check between LTE and WAN ports
20,247
04.02.2022 08:55:18
28,800
d70c58ad26a1e5f45c60ba1d11a34f4de8ae21e8
Bump to Beta 19 RC 1
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -3161,7 +3161,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.18.11\"\n+version = \"0.19.1\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3198,7 +3198,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.18.11\"\n+version = \"0.19.1\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3238,7 +3238,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.18.11\"\n+version = \"0.19.1\"\ndependencies = [\n\"actix 0.12.0\",\n\"actix 0.7.11\",\n@@ -3279,7 +3279,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.18.11\"\n+version = \"0.19.1\"\ndependencies = [\n\"actix 0.7.11\",\n\"actix-web 0.7.19\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.18.11\"\n+version = \"0.19.1\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\nbuild = \"build.rs\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "[package]\nname = \"rita_client\"\n-version = \"0.18.11\"\n+version = \"0.19.1\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "[package]\nname = \"rita_common\"\n-version = \"0.18.11\"\n+version = \"0.19.1\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/Cargo.toml", "new_path": "rita_exit/Cargo.toml", "diff": "[package]\nname = \"rita_exit\"\n-version = \"0.18.11\"\n+version = \"0.19.1\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump to Beta 19 RC 1