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,255
20.07.2022 12:22:10
25,200
18342bee44c6ae766e2cea262873b3f6c7f3ab67
Fix CI test after update to lettre AFter updating lettre, FileTransport saved emails as an .eml rather than a .json The CI have been chaged to account for this
[ { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/utils.py", "new_path": "integration-tests/integration-test-script/utils.py", "diff": "+import email\nfrom pprint import pprint\nfrom termcolor import colored\n@@ -93,9 +94,11 @@ def read_email(node):\n# TODO: this is O(n^2)\nfor mail in os.listdir(\"mail\"):\nwith open(os.path.join(\"mail\", mail)) as mail_file_handle:\n- mail = json.load(mail_file_handle)\n- if mail[\"envelope\"][\"forward_path\"][0] == \"{}@example.com\".format(id):\n- message = ''.join(chr(i) for i in mail[\"message\"])\n+\n+ mail = email.message_from_file(mail_file_handle)\n+ to_value = mail.get(\"To\")\n+ if to_value == \"{}@example.com\".format(id):\n+ message = mail.get_payload()\nif \"low balance\" in message:\ncontinue\nreturn message\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix CI test after update to lettre AFter updating lettre, FileTransport saved emails as an .eml rather than a .json The CI have been chaged to account for this
20,255
21.07.2022 10:54:30
25,200
db0f0fddea16cedacd9e5e24cedb05f8d6a5a0e7
Remove the Config crate from rita It looks like all this crate is used for is to load a toml file
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -116,7 +116,7 @@ dependencies = [\n\"http\",\n\"log\",\n\"regex\",\n- \"serde 1.0.140\",\n+ \"serde\",\n]\n[[package]]\n@@ -216,7 +216,7 @@ dependencies = [\n\"once_cell\",\n\"pin-project-lite\",\n\"regex\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_json\",\n\"serde_urlencoded\",\n\"smallvec\",\n@@ -303,7 +303,7 @@ dependencies = [\n\"log\",\n\"oping\",\n\"regex\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_derive\",\n]\n@@ -325,7 +325,7 @@ dependencies = [\n\"num256\",\n\"phonenumber\",\n\"rand\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_derive\",\n\"serde_json\",\n\"sodiumoxide\",\n@@ -344,7 +344,7 @@ dependencies = [\n\"log\",\n\"oping\",\n\"rand\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_json\",\n\"sodiumoxide\",\n]\n@@ -358,7 +358,7 @@ dependencies = [\n\"lazy_static\",\n\"log\",\n\"rand\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_derive\",\n\"serde_json\",\n\"sodiumoxide\",\n@@ -376,7 +376,7 @@ version = \"0.7.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6\"\ndependencies = [\n- \"serde 1.0.140\",\n+ \"serde\",\n]\n[[package]]\n@@ -407,7 +407,7 @@ dependencies = [\n\"num 0.4.0\",\n\"num256\",\n\"rand\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_derive\",\n\"tokio\",\n\"web30\",\n@@ -448,7 +448,7 @@ dependencies = [\n\"percent-encoding\",\n\"pin-project-lite\",\n\"rand\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_json\",\n\"serde_urlencoded\",\n\"tokio\",\n@@ -462,7 +462,7 @@ dependencies = [\n\"env_logger\",\n\"ipnetwork 0.20.0\",\n\"log\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_derive\",\n]\n@@ -489,7 +489,7 @@ version = \"1.3.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad\"\ndependencies = [\n- \"serde 1.0.140\",\n+ \"serde\",\n]\n[[package]]\n@@ -622,10 +622,10 @@ checksum = \"9e043fca6ce2fabc4566fe447d2185a724529a383f3e9938279a53ea75532a02\"\ndependencies = [\n\"lazy_static\",\n\"num-bigint 0.4.3\",\n- \"num-traits 0.2.15\",\n+ \"num-traits\",\n\"num256\",\n\"secp256k1\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde-rlp\",\n\"serde_bytes\",\n\"serde_derive\",\n@@ -645,7 +645,7 @@ dependencies = [\n\"log\",\n\"rand\",\n\"regex\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_derive\",\n\"serde_json\",\n\"settings\",\n@@ -665,28 +665,12 @@ dependencies = [\n\"futures 0.3.21\",\n\"lazy_static\",\n\"log\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_derive\",\n\"serde_json\",\n\"time\",\n]\n-[[package]]\n-name = \"config\"\n-version = \"0.11.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"1b1b9d958c2b1368a663f05538fc1b5975adce1e19f435acceae987aceeeb369\"\n-dependencies = [\n- \"lazy_static\",\n- \"nom 5.1.2\",\n- \"rust-ini\",\n- \"serde 1.0.140\",\n- \"serde-hjson\",\n- \"serde_json\",\n- \"toml\",\n- \"yaml-rust\",\n-]\n-\n[[package]]\nname = \"convert_case\"\nversion = \"0.4.0\"\n@@ -861,7 +845,7 @@ checksum = \"7f3f119846c823f9eafcf953a8f6ffb6ed69bf6240883261a7f13b634579a51f\"\ndependencies = [\n\"lazy_static\",\n\"regex\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"strsim\",\n]\n@@ -941,7 +925,7 @@ dependencies = [\n\"althea_types\",\n\"diesel\",\n\"dotenv\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_derive\",\n\"serde_json\",\n]\n@@ -1203,7 +1187,7 @@ dependencies = [\n\"log\",\n\"pest\",\n\"pest_derive\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_json\",\n\"thiserror\",\n]\n@@ -1381,7 +1365,7 @@ version = \"0.20.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"bf466541e9d546596ee94f9f69590f89473455f88372423e0008fc1a7daf100e\"\ndependencies = [\n- \"serde 1.0.140\",\n+ \"serde\",\n]\n[[package]]\n@@ -1484,7 +1468,7 @@ dependencies = [\n\"nom 7.1.1\",\n\"once_cell\",\n\"quoted_printable\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"socket2\",\n\"uuid\",\n]\n@@ -1690,7 +1674,7 @@ dependencies = [\n\"num-integer\",\n\"num-iter\",\n\"num-rational 0.2.4\",\n- \"num-traits 0.2.15\",\n+ \"num-traits\",\n]\n[[package]]\n@@ -1704,7 +1688,7 @@ dependencies = [\n\"num-integer\",\n\"num-iter\",\n\"num-rational 0.4.1\",\n- \"num-traits 0.2.15\",\n+ \"num-traits\",\n]\n[[package]]\n@@ -1715,7 +1699,7 @@ checksum = \"090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304\"\ndependencies = [\n\"autocfg\",\n\"num-integer\",\n- \"num-traits 0.2.15\",\n+ \"num-traits\",\n]\n[[package]]\n@@ -1726,8 +1710,8 @@ checksum = \"f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f\"\ndependencies = [\n\"autocfg\",\n\"num-integer\",\n- \"num-traits 0.2.15\",\n- \"serde 1.0.140\",\n+ \"num-traits\",\n+ \"serde\",\n]\n[[package]]\n@@ -1737,7 +1721,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95\"\ndependencies = [\n\"autocfg\",\n- \"num-traits 0.2.15\",\n+ \"num-traits\",\n]\n[[package]]\n@@ -1746,7 +1730,7 @@ version = \"0.4.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19\"\ndependencies = [\n- \"num-traits 0.2.15\",\n+ \"num-traits\",\n]\n[[package]]\n@@ -1767,7 +1751,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9\"\ndependencies = [\n\"autocfg\",\n- \"num-traits 0.2.15\",\n+ \"num-traits\",\n]\n[[package]]\n@@ -1778,7 +1762,7 @@ checksum = \"7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252\"\ndependencies = [\n\"autocfg\",\n\"num-integer\",\n- \"num-traits 0.2.15\",\n+ \"num-traits\",\n]\n[[package]]\n@@ -1790,7 +1774,7 @@ dependencies = [\n\"autocfg\",\n\"num-bigint 0.2.6\",\n\"num-integer\",\n- \"num-traits 0.2.15\",\n+ \"num-traits\",\n]\n[[package]]\n@@ -1802,16 +1786,7 @@ dependencies = [\n\"autocfg\",\n\"num-bigint 0.4.3\",\n\"num-integer\",\n- \"num-traits 0.2.15\",\n-]\n-\n-[[package]]\n-name = \"num-traits\"\n-version = \"0.1.43\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31\"\n-dependencies = [\n- \"num-traits 0.2.15\",\n+ \"num-traits\",\n]\n[[package]]\n@@ -1832,8 +1807,8 @@ dependencies = [\n\"lazy_static\",\n\"num 0.4.0\",\n\"num-derive\",\n- \"num-traits 0.2.15\",\n- \"serde 1.0.140\",\n+ \"num-traits\",\n+ \"serde\",\n\"serde_derive\",\n]\n@@ -2073,7 +2048,7 @@ dependencies = [\n\"quick-xml\",\n\"regex\",\n\"regex-cache\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_derive\",\n\"thiserror\",\n]\n@@ -2256,7 +2231,7 @@ dependencies = [\n\"native-tls\",\n\"percent-encoding\",\n\"pin-project-lite\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_json\",\n\"serde_urlencoded\",\n\"tokio\",\n@@ -2297,7 +2272,7 @@ dependencies = [\n\"rita_client\",\n\"rita_common\",\n\"rita_exit\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_json\",\n\"settings\",\n]\n@@ -2323,11 +2298,11 @@ dependencies = [\n\"lazy_static\",\n\"lettre\",\n\"log\",\n- \"num-traits 0.2.15\",\n+ \"num-traits\",\n\"num256\",\n\"phonenumber\",\n\"rita_common\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_derive\",\n\"serde_json\",\n\"settings\",\n@@ -2363,11 +2338,11 @@ dependencies = [\n\"ipnetwork 0.20.0\",\n\"lazy_static\",\n\"log\",\n- \"num-traits 0.2.15\",\n+ \"num-traits\",\n\"num256\",\n\"rand\",\n\"regex\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_cbor\",\n\"serde_derive\",\n\"serde_json\",\n@@ -2401,19 +2376,13 @@ dependencies = [\n\"rand\",\n\"reqwest\",\n\"rita_common\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_derive\",\n\"serde_json\",\n\"settings\",\n\"sodiumoxide\",\n]\n-[[package]]\n-name = \"rust-ini\"\n-version = \"0.13.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2\"\n-\n[[package]]\nname = \"rustc_version\"\nversion = \"0.4.0\"\n@@ -2510,12 +2479,6 @@ version = \"1.0.12\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1\"\n-[[package]]\n-name = \"serde\"\n-version = \"0.8.23\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8\"\n-\n[[package]]\nname = \"serde\"\nversion = \"1.0.140\"\n@@ -2525,18 +2488,6 @@ dependencies = [\n\"serde_derive\",\n]\n-[[package]]\n-name = \"serde-hjson\"\n-version = \"0.9.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6a3a4e0ea8a88553209f6cc6cfe8724ecad22e1acf372793c27d995290fe74f8\"\n-dependencies = [\n- \"lazy_static\",\n- \"num-traits 0.1.43\",\n- \"regex\",\n- \"serde 0.8.23\",\n-]\n-\n[[package]]\nname = \"serde-rlp\"\nversion = \"0.1.4\"\n@@ -2546,7 +2497,7 @@ dependencies = [\n\"byteorder\",\n\"error\",\n\"num 0.2.1\",\n- \"serde 1.0.140\",\n+ \"serde\",\n]\n[[package]]\n@@ -2555,7 +2506,7 @@ version = \"0.11.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54\"\ndependencies = [\n- \"serde 1.0.140\",\n+ \"serde\",\n]\n[[package]]\n@@ -2565,7 +2516,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5\"\ndependencies = [\n\"half\",\n- \"serde 1.0.140\",\n+ \"serde\",\n]\n[[package]]\n@@ -2587,7 +2538,7 @@ checksum = \"82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7\"\ndependencies = [\n\"itoa\",\n\"ryu\",\n- \"serde 1.0.140\",\n+ \"serde\",\n]\n[[package]]\n@@ -2599,7 +2550,7 @@ dependencies = [\n\"form_urlencoded\",\n\"itoa\",\n\"ryu\",\n- \"serde 1.0.140\",\n+ \"serde\",\n]\n[[package]]\n@@ -2611,14 +2562,13 @@ dependencies = [\n\"arrayvec 0.7.2\",\n\"auto-bridge\",\n\"clarity\",\n- \"config\",\n\"ipnetwork 0.20.0\",\n\"lazy_static\",\n\"log\",\n\"num256\",\n\"owning_ref\",\n\"phonenumber\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_derive\",\n\"serde_json\",\n\"toml\",\n@@ -2706,7 +2656,7 @@ dependencies = [\n\"ed25519\",\n\"libc\",\n\"libsodium-sys\",\n- \"serde 1.0.140\",\n+ \"serde\",\n]\n[[package]]\n@@ -2908,7 +2858,7 @@ version = \"0.5.9\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7\"\ndependencies = [\n- \"serde 1.0.140\",\n+ \"serde\",\n]\n[[package]]\n@@ -3138,7 +3088,7 @@ dependencies = [\n\"log\",\n\"num 0.4.0\",\n\"num256\",\n- \"serde 1.0.140\",\n+ \"serde\",\n\"serde_derive\",\n\"serde_json\",\n\"tokio\",\n@@ -3233,15 +3183,6 @@ dependencies = [\n\"winapi 0.3.9\",\n]\n-[[package]]\n-name = \"yaml-rust\"\n-version = \"0.4.5\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85\"\n-dependencies = [\n- \"linked-hash-map\",\n-]\n-\n[[package]]\nname = \"zstd\"\nversion = \"0.11.2+zstd.1.5.2\"\n" }, { "change_type": "MODIFY", "old_path": "settings/Cargo.toml", "new_path": "settings/Cargo.toml", "diff": "@@ -5,7 +5,6 @@ authors = [\"Ben <wangben3@gmail.com>\"]\nedition = \"2018\"\n[dependencies]\n-config = \"0.11\"\nalthea_types = { path = \"../althea_types\"}\nalthea_kernel_interface = { path = \"../althea_kernel_interface\" }\nauto-bridge = { path = \"../auto_bridge\" }\n" }, { "change_type": "MODIFY", "old_path": "settings/src/client.rs", "new_path": "settings/src/client.rs", "diff": "@@ -7,7 +7,6 @@ use crate::{json_merge, set_rita_client, SettingsError};\nuse althea_types::wg_key::WgKey;\nuse althea_types::{ContactStorage, ExitState, Identity};\nuse clarity::Address;\n-use config::Config;\nuse ipnetwork::IpNetwork;\nuse std::collections::{HashMap, HashSet};\nuse std::net::IpAddr;\n@@ -153,20 +152,22 @@ impl ExitClientSettings {\nimpl RitaClientSettings {\npub fn new(file_name: &str) -> Result<Self, SettingsError> {\n- let mut s = Config::new();\nassert!(Path::new(file_name).exists());\n- s.merge(config::File::with_name(file_name).required(false))?;\n- Ok(s.try_into()?)\n+\n+ let config_toml = std::fs::read_to_string(file_name)?;\n+ let ret: Self = toml::from_str(&config_toml)?;\n+ Ok(ret)\n}\npub fn new_watched(file_name: &str) -> Result<Self, SettingsError> {\n- let mut s = Config::new();\n- s.merge(config::File::with_name(file_name).required(false))?;\n- let settings: RitaClientSettings = s.try_into()?;\n+ assert!(Path::new(file_name).exists());\n+\n+ let config_toml = std::fs::read_to_string(file_name)?;\n+ let ret: Self = toml::from_str(&config_toml)?;\n- set_rita_client(settings.clone());\n+ set_rita_client(ret.clone());\n- Ok(settings)\n+ Ok(ret)\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "settings/src/error.rs", "new_path": "settings/src/error.rs", "diff": "@@ -5,16 +5,21 @@ use std::{\n#[derive(Debug)]\npub enum SettingsError {\n- TomlError(toml::ser::Error),\n+ TomlSeError(toml::ser::Error),\n+ TomlDeError(toml::de::Error),\nIOError(std::io::Error),\nIpNetworkError(ipnetwork::IpNetworkError),\nSerdeJsonError(serde_json::Error),\n- ConfigError(config::ConfigError),\n}\nimpl From<toml::ser::Error> for SettingsError {\nfn from(error: toml::ser::Error) -> Self {\n- SettingsError::TomlError(error)\n+ SettingsError::TomlSeError(error)\n+ }\n+}\n+impl From<toml::de::Error> for SettingsError {\n+ fn from(error: toml::de::Error) -> Self {\n+ SettingsError::TomlDeError(error)\n}\n}\nimpl From<std::io::Error> for SettingsError {\n@@ -32,20 +37,15 @@ impl From<serde_json::Error> for SettingsError {\nSettingsError::SerdeJsonError(error)\n}\n}\n-impl From<config::ConfigError> for SettingsError {\n- fn from(error: config::ConfigError) -> Self {\n- SettingsError::ConfigError(error)\n- }\n-}\nimpl Display for SettingsError {\nfn fmt(&self, f: &mut Formatter) -> FmtResult {\nmatch self {\n- SettingsError::TomlError(e) => write!(f, \"{}\", e),\n+ SettingsError::TomlSeError(e) => write!(f, \"{}\", e),\n+ SettingsError::TomlDeError(e) => write!(f, \"{}\", e),\nSettingsError::IOError(e) => write!(f, \"{}\", e),\nSettingsError::IpNetworkError(e) => write!(f, \"{}\", e),\nSettingsError::SerdeJsonError(e) => write!(f, \"{}\", e),\n- SettingsError::ConfigError(e) => write!(f, \"{}\", e),\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "settings/src/exit.rs", "new_path": "settings/src/exit.rs", "diff": "@@ -3,12 +3,12 @@ use crate::network::NetworkSettings;\nuse crate::payment::PaymentSettings;\nuse crate::{json_merge, set_rita_exit, SettingsError};\nuse althea_types::{Identity, WgKey};\n-use config::Config;\nuse core::str::FromStr;\nuse ipnetwork::IpNetwork;\nuse phonenumber::PhoneNumber;\nuse std::collections::HashSet;\nuse std::net::Ipv4Addr;\n+use std::path::Path;\n/// This is the network settings specific to rita_exit\n#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]\n@@ -251,19 +251,21 @@ impl RitaExitSettingsStruct {\n}\npub fn new(file_name: &str) -> Result<Self, SettingsError> {\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- Ok(settings)\n+ assert!(Path::new(file_name).exists());\n+\n+ let config_toml = std::fs::read_to_string(file_name)?;\n+ let ret: Self = toml::from_str(&config_toml)?;\n+ Ok(ret)\n}\npub fn new_watched(file_name: &str) -> Result<Self, SettingsError> {\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+ assert!(Path::new(file_name).exists());\n+\n+ let config_toml = std::fs::read_to_string(file_name)?;\n+ let ret: Self = toml::from_str(&config_toml)?;\n- set_rita_exit(settings.clone());\n+ set_rita_exit(ret.clone());\n- Ok(settings)\n+ Ok(ret)\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "settings/src/lib.rs", "new_path": "settings/src/lib.rs", "diff": "@@ -363,7 +363,8 @@ mod tests {\n#[test]\nfn test_settings_test() {\n- RitaClientSettings::new(\"test.toml\").unwrap();\n+ let ret = RitaClientSettings::new(\"test.toml\").unwrap();\n+ println!(\"{:?}\", ret);\n}\n#[test]\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove the Config crate from rita It looks like all this crate is used for is to load a toml file
20,244
02.08.2022 08:36:50
14,400
e655b79376e1587eb44a3d070e7b59a21297c6cb
Bump for Beta 20 rc2 Updates dependencies and bumps for the latest release
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -227,16 +227,16 @@ dependencies = [\n[[package]]\nname = \"actix-web-httpauth\"\n-version = \"0.6.0\"\n+version = \"0.8.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"08c25a48b4684f90520183cd1a688e5f4f7e9905835fa75d02c0fe4f60fcdbe6\"\n+checksum = \"6dda62cf04bc3a9ad2ea8f314f721951cfdb4cdacec4e984d20e77c7bb170991\"\ndependencies = [\n- \"actix-service\",\n\"actix-utils\",\n\"actix-web\",\n\"base64\",\n\"futures-core\",\n\"futures-util\",\n+ \"log\",\n\"pin-project-lite\",\n]\n@@ -506,19 +506,7 @@ checksum = \"0a4e37d16930f5459780f5621038b6382b9bb37c19016f39fb6b5808d831f174\"\ndependencies = [\n\"crypto-mac\",\n\"digest 0.9.0\",\n- \"opaque-debug 0.3.0\",\n-]\n-\n-[[package]]\n-name = \"block-buffer\"\n-version = \"0.7.3\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b\"\n-dependencies = [\n- \"block-padding\",\n- \"byte-tools\",\n- \"byteorder\",\n- \"generic-array 0.12.4\",\n+ \"opaque-debug\",\n]\n[[package]]\n@@ -527,16 +515,7 @@ version = \"0.10.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324\"\ndependencies = [\n- \"generic-array 0.14.5\",\n-]\n-\n-[[package]]\n-name = \"block-padding\"\n-version = \"0.1.5\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5\"\n-dependencies = [\n- \"byte-tools\",\n+ \"generic-array\",\n]\n[[package]]\n@@ -566,12 +545,6 @@ version = \"3.10.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3\"\n-[[package]]\n-name = \"byte-tools\"\n-version = \"0.3.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7\"\n-\n[[package]]\nname = \"byteorder\"\nversion = \"1.4.3\"\n@@ -580,9 +553,9 @@ checksum = \"14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610\"\n[[package]]\nname = \"bytes\"\n-version = \"1.2.0\"\n+version = \"1.2.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f0b3de4a0c5e67e16066a0715723abd91edc2f9001d09c46e1dca929351e130e\"\n+checksum = \"ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db\"\n[[package]]\nname = \"bytestring\"\n@@ -724,9 +697,9 @@ dependencies = [\n[[package]]\nname = \"crossbeam-channel\"\n-version = \"0.5.5\"\n+version = \"0.5.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c\"\n+checksum = \"c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521\"\ndependencies = [\n\"cfg-if\",\n\"crossbeam-utils\",\n@@ -734,9 +707,9 @@ dependencies = [\n[[package]]\nname = \"crossbeam-utils\"\n-version = \"0.8.10\"\n+version = \"0.8.11\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7d82ee10ce34d7bc12c2122495e7593a9c41347ecdd64185af4ecf72cb1a7f83\"\n+checksum = \"51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc\"\ndependencies = [\n\"cfg-if\",\n\"once_cell\",\n@@ -748,7 +721,7 @@ version = \"0.1.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3\"\ndependencies = [\n- \"generic-array 0.14.5\",\n+ \"generic-array\",\n\"typenum\",\n]\n@@ -758,7 +731,7 @@ version = \"0.8.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab\"\ndependencies = [\n- \"generic-array 0.14.5\",\n+ \"generic-array\",\n\"subtle\",\n]\n@@ -809,22 +782,13 @@ dependencies = [\n\"syn\",\n]\n-[[package]]\n-name = \"digest\"\n-version = \"0.8.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5\"\n-dependencies = [\n- \"generic-array 0.12.4\",\n-]\n-\n[[package]]\nname = \"digest\"\nversion = \"0.9.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066\"\ndependencies = [\n- \"generic-array 0.14.5\",\n+ \"generic-array\",\n]\n[[package]]\n@@ -833,7 +797,7 @@ version = \"0.10.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506\"\ndependencies = [\n- \"block-buffer 0.10.2\",\n+ \"block-buffer\",\n\"crypto-common\",\n]\n@@ -930,17 +894,11 @@ dependencies = [\n\"serde_json\",\n]\n-[[package]]\n-name = \"fake-simd\"\n-version = \"0.1.2\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed\"\n-\n[[package]]\nname = \"fastrand\"\n-version = \"1.7.0\"\n+version = \"1.8.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf\"\n+checksum = \"a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499\"\ndependencies = [\n\"instant\",\n]\n@@ -1101,15 +1059,6 @@ version = \"0.3.55\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2\"\n-[[package]]\n-name = \"generic-array\"\n-version = \"0.12.4\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd\"\n-dependencies = [\n- \"typenum\",\n-]\n-\n[[package]]\nname = \"generic-array\"\nversion = \"0.14.5\"\n@@ -1424,9 +1373,9 @@ dependencies = [\n[[package]]\nname = \"js-sys\"\n-version = \"0.3.58\"\n+version = \"0.3.59\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27\"\n+checksum = \"258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2\"\ndependencies = [\n\"wasm-bindgen\",\n]\n@@ -1556,12 +1505,6 @@ dependencies = [\n\"linked-hash-map\",\n]\n-[[package]]\n-name = \"maplit\"\n-version = \"1.0.2\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d\"\n-\n[[package]]\nname = \"match_cfg\"\nversion = \"0.1.0\"\n@@ -1843,12 +1786,6 @@ version = \"0.1.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"44d11de466f4a3006fe8a5e7ec84e93b79c70cb992ae0aa0eb631ad2df8abfe2\"\n-[[package]]\n-name = \"opaque-debug\"\n-version = \"0.2.3\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c\"\n-\n[[package]]\nname = \"opaque-debug\"\nversion = \"0.3.0\"\n@@ -1992,18 +1929,19 @@ checksum = \"d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e\"\n[[package]]\nname = \"pest\"\n-version = \"2.1.3\"\n+version = \"2.2.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53\"\n+checksum = \"69486e2b8c2d2aeb9762db7b4e00b0331156393555cff467f4163ff06821eef8\"\ndependencies = [\n+ \"thiserror\",\n\"ucd-trie\",\n]\n[[package]]\nname = \"pest_derive\"\n-version = \"2.1.0\"\n+version = \"2.2.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0\"\n+checksum = \"b13570633aff33c6d22ce47dd566b10a3b9122c2fe9d8e7501895905be532b91\"\ndependencies = [\n\"pest\",\n\"pest_generator\",\n@@ -2011,9 +1949,9 @@ dependencies = [\n[[package]]\nname = \"pest_generator\"\n-version = \"2.1.3\"\n+version = \"2.2.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55\"\n+checksum = \"b3c567e5702efdc79fb18859ea74c3eb36e14c43da7b8c1f098a4ed6514ec7a0\"\ndependencies = [\n\"pest\",\n\"pest_meta\",\n@@ -2024,11 +1962,11 @@ dependencies = [\n[[package]]\nname = \"pest_meta\"\n-version = \"2.1.3\"\n+version = \"2.2.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d\"\n+checksum = \"5eb32be5ee3bbdafa8c7a18b0a8a8d962b66cfa2ceee4037f49267a50ee821fe\"\ndependencies = [\n- \"maplit\",\n+ \"once_cell\",\n\"pest\",\n\"sha-1\",\n]\n@@ -2088,9 +2026,9 @@ dependencies = [\n[[package]]\nname = \"proc-macro2\"\n-version = \"1.0.40\"\n+version = \"1.0.42\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7\"\n+checksum = \"c278e965f1d8cf32d6e0e96de3d3e79712178ae67986d9cf9151f51e95aac89b\"\ndependencies = [\n\"unicode-ident\",\n]\n@@ -2162,9 +2100,9 @@ dependencies = [\n[[package]]\nname = \"redox_syscall\"\n-version = \"0.2.13\"\n+version = \"0.2.16\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42\"\n+checksum = \"fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a\"\ndependencies = [\n\"bitflags\",\n]\n@@ -2246,7 +2184,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.20.1\"\n+version = \"0.20.2\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2279,7 +2217,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.20.1\"\n+version = \"0.20.2\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2313,7 +2251,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.20.1\"\n+version = \"0.20.2\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-service\",\n@@ -2352,7 +2290,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.20.1\"\n+version = \"0.20.2\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2481,9 +2419,9 @@ checksum = \"a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1\"\n[[package]]\nname = \"serde\"\n-version = \"1.0.140\"\n+version = \"1.0.141\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03\"\n+checksum = \"7af873f2c95b99fcb0bd0fe622a43e29514658873c8ceba88c4cb88833a22500\"\ndependencies = [\n\"serde_derive\",\n]\n@@ -2521,9 +2459,9 @@ dependencies = [\n[[package]]\nname = \"serde_derive\"\n-version = \"1.0.140\"\n+version = \"1.0.141\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6f2122636b9fe3b81f1cb25099fcf2d3f542cdb1d45940d56c713158884a05da\"\n+checksum = \"75743a150d003dd863b51dc809bcad0d73f2102c53632f1e954e738192a3413f\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -2576,14 +2514,13 @@ dependencies = [\n[[package]]\nname = \"sha-1\"\n-version = \"0.8.2\"\n+version = \"0.10.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df\"\n+checksum = \"028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f\"\ndependencies = [\n- \"block-buffer 0.7.3\",\n- \"digest 0.8.1\",\n- \"fake-simd\",\n- \"opaque-debug 0.2.3\",\n+ \"cfg-if\",\n+ \"cpufeatures\",\n+ \"digest 0.10.3\",\n]\n[[package]]\n@@ -2599,9 +2536,9 @@ dependencies = [\n[[package]]\nname = \"sha3\"\n-version = \"0.10.1\"\n+version = \"0.10.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"881bf8156c87b6301fc5ca6b27f11eeb2761224c7081e69b409d5a1951a70c86\"\n+checksum = \"0a31480366ec990f395a61b7c08122d99bd40544fdb5abcfc1b06bb29994312c\"\ndependencies = [\n\"digest 0.10.3\",\n\"keccak\",\n@@ -2739,11 +2676,12 @@ dependencies = [\n[[package]]\nname = \"time\"\n-version = \"0.3.11\"\n+version = \"0.3.12\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"72c91f41dcb2f096c05f0873d667dceec1087ce5bcf984ec8ffb19acddbb3217\"\n+checksum = \"74b7cc93fc23ba97fde84f7eea56c55d1ba183f495c6715defdfc7b9cb8c870f\"\ndependencies = [\n\"itoa\",\n+ \"js-sys\",\n\"libc\",\n\"num_threads\",\n\"time-macros\",\n@@ -2772,9 +2710,9 @@ checksum = \"cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c\"\n[[package]]\nname = \"tokio\"\n-version = \"1.20.0\"\n+version = \"1.20.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"57aec3cfa4c296db7255446efb4928a6be304b431a806216105542a67b6ca82e\"\n+checksum = \"7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581\"\ndependencies = [\n\"autocfg\",\n\"bytes\",\n@@ -2869,9 +2807,9 @@ checksum = \"b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52\"\n[[package]]\nname = \"tracing\"\n-version = \"0.1.35\"\n+version = \"0.1.36\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160\"\n+checksum = \"2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307\"\ndependencies = [\n\"cfg-if\",\n\"log\",\n@@ -2881,9 +2819,9 @@ dependencies = [\n[[package]]\nname = \"tracing-core\"\n-version = \"0.1.28\"\n+version = \"0.1.29\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7\"\n+checksum = \"5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7\"\ndependencies = [\n\"once_cell\",\n]\n@@ -3001,9 +2939,9 @@ checksum = \"9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423\"\n[[package]]\nname = \"wasm-bindgen\"\n-version = \"0.2.81\"\n+version = \"0.2.82\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994\"\n+checksum = \"fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d\"\ndependencies = [\n\"cfg-if\",\n\"wasm-bindgen-macro\",\n@@ -3011,13 +2949,13 @@ dependencies = [\n[[package]]\nname = \"wasm-bindgen-backend\"\n-version = \"0.2.81\"\n+version = \"0.2.82\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a\"\n+checksum = \"662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f\"\ndependencies = [\n\"bumpalo\",\n- \"lazy_static\",\n\"log\",\n+ \"once_cell\",\n\"proc-macro2\",\n\"quote\",\n\"syn\",\n@@ -3026,9 +2964,9 @@ dependencies = [\n[[package]]\nname = \"wasm-bindgen-futures\"\n-version = \"0.4.31\"\n+version = \"0.4.32\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f\"\n+checksum = \"fa76fb221a1f8acddf5b54ace85912606980ad661ac7a503b4570ffd3a624dad\"\ndependencies = [\n\"cfg-if\",\n\"js-sys\",\n@@ -3038,9 +2976,9 @@ dependencies = [\n[[package]]\nname = \"wasm-bindgen-macro\"\n-version = \"0.2.81\"\n+version = \"0.2.82\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa\"\n+checksum = \"b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602\"\ndependencies = [\n\"quote\",\n\"wasm-bindgen-macro-support\",\n@@ -3048,9 +2986,9 @@ dependencies = [\n[[package]]\nname = \"wasm-bindgen-macro-support\"\n-version = \"0.2.81\"\n+version = \"0.2.82\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048\"\n+checksum = \"5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -3061,15 +2999,15 @@ dependencies = [\n[[package]]\nname = \"wasm-bindgen-shared\"\n-version = \"0.2.81\"\n+version = \"0.2.82\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be\"\n+checksum = \"6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a\"\n[[package]]\nname = \"web-sys\"\n-version = \"0.3.58\"\n+version = \"0.3.59\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90\"\n+checksum = \"ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1\"\ndependencies = [\n\"js-sys\",\n\"wasm-bindgen\",\n@@ -3077,9 +3015,9 @@ dependencies = [\n[[package]]\nname = \"web30\"\n-version = \"0.19.2\"\n+version = \"0.19.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c2a1cd88f65c3315ffda8722ee2de20ae5e9c607ebd009377fbfd2ea68375af3\"\n+checksum = \"41c0c0c928020760cc69884944d54e7fca43ff5d00933d0a63fd85155466fbed\"\ndependencies = [\n\"awc\",\n\"clarity\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.20.1\"\n+version = \"0.20.2\"\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.20.1\"\n+version = \"0.20.2\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n@@ -32,7 +32,7 @@ awc = \"3.0.0\"\nipnetwork = \"0.20\"\nactix-async = {package=\"actix\", version = \"0.13\"}\nactix-web-async = { package=\"actix-web\", version = \"4.0.1\", default_features = false, features= [\"openssl\"]}\n-actix-web-httpauth-async = { package=\"actix-web-httpauth\", version = \"0.6.0\"}\n+actix-web-httpauth-async = { package=\"actix-web-httpauth\", version = \"0.8.0\"}\nclarity = \"0.5\"\n[lib]\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "[package]\nname = \"rita_common\"\n-version = \"0.20.1\"\n+version = \"0.20.2\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n@@ -30,7 +30,7 @@ bincode = \"1.3\"\nserde_cbor = \"0.11\"\nlazy_static = \"1.4\"\nalthea_kernel_interface = { path = \"../althea_kernel_interface\" }\n-actix-web-httpauth-async = { package=\"actix-web-httpauth\", version = \"0.6.0\"}\n+actix-web-httpauth-async = { package=\"actix-web-httpauth\", version = \"0.8.0\"}\nactix-web-async = { package=\"actix-web\", version = \"4.0.1\", default_features = false, features= [\"openssl\"]}\nawc = {version = \"3.0.0-beta.21\", default-features = false, features=[\"openssl\", \"compress-gzip\", \"compress-zstd\"]}\nactix-service = \"2.0.2\"\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/Cargo.toml", "new_path": "rita_exit/Cargo.toml", "diff": "[package]\nname = \"rita_exit\"\n-version = \"0.20.1\"\n+version = \"0.20.2\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 20 rc2 Updates dependencies and bumps for the latest release
20,255
05.08.2022 12:49:17
25,200
30df87c73ecc39eaf78da2c8c304f207a1f15705
Remove bounty ip and port from rita
[ { "change_type": "MODIFY", "old_path": "docs/api/router-dashboard.md", "new_path": "docs/api/router-dashboard.md", "diff": "@@ -453,8 +453,6 @@ application/json\" -d '\\{\"url\": \"https://somewhere.safe\"\\}'\n},\n\"network\": {\n\"babel_port\": 6872,\n- \"bounty_ip\": \"fd96::1337:e1f\",\n- \"bounty_port\": 8888,\n\"default_route\": [],\n\"manual_peers\": [\n\"test.altheamesh.com\",\n" }, { "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": "@@ -256,7 +256,6 @@ level = \"INFO\"\n[network]\nbabel_port = 6872\nbackup_created = false\n-bounty_port = 8888\ndevice = \"ubnt-erx\"\ndiscovery_ip = \"ff02::1:8\"\nlight_client_hello_port = 4878\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": "@@ -123,7 +123,6 @@ level = \"WARN\"\n[network]\nbabel_port = 6872\nbackup_created = false\n-bounty_port = 8888\ndevice = \"ubnt-erx\"\ndiscovery_ip = \"ff02::1:8\"\nlight_client_hello_port = 4878\n" }, { "change_type": "MODIFY", "old_path": "scripts/rita-test.toml", "new_path": "scripts/rita-test.toml", "diff": "@@ -7,12 +7,10 @@ eth_address = \"0x0101010101010101010101010101010101010101\"\n[network]\nown_ip = \"fdb4:5a79:7f9a:8ef8:ec40:5701:5b57:7e3\"\n-bounty_ip = \"fd00::3\"\nbabel_port = 6872\nrita_hello_port = 4876\nrita_contact_port = 4874\nrita_dashboard_port = 4877\n-bounty_port = 8888\nwg_private_key = \"priv\"\nwg_private_key_path = \"/tmp/priv\"\nwg_public_key = \"pub\"\n" }, { "change_type": "MODIFY", "old_path": "settings/example.toml", "new_path": "settings/example.toml", "diff": "@@ -7,13 +7,11 @@ eth_address = \"0x0101010101010101010101010101010101010101\"\n[network]\nmesh_ip = \"fd00::1\"\n-bounty_ip = \"fd00::3\"\nbabel_port = 6872\nrita_hello_port = 4876\nrita_contact_port = 4874\nrita_dashboard_port = 4877\nrita_tick_interval = 5\n-bounty_port = 8888\nwg_private_key_path = \"/tmp/priv\"\nwg_start_port = 60000\ntunnel_timeout_seconds = 900\n" }, { "change_type": "MODIFY", "old_path": "settings/example_exit.toml", "new_path": "settings/example_exit.toml", "diff": "@@ -11,13 +11,11 @@ eth_address = \"0x0101010101010101010101010101010101010101\"\n[network]\nmesh_ip = \"fd00::1\"\n-bounty_ip = \"fd00::3\"\nbabel_port = 6872\nrita_hello_port = 4876\nrita_contact_port = 4874\nrita_dashboard_port = 4877\nrita_tick_interval = 5\n-bounty_port = 8888\nwg_public_key = \"bvM10HW73yePrxdtCQQ4U20W5ogogdiZtUihrPc/oGY=\"\nwg_private_key = \"OGzbcm6czrjOEAViK7ZzlWM8mtjCxp7UPbuLS/dATV4=\"\nwg_private_key_path = \"/tmp/priv\"\n" }, { "change_type": "MODIFY", "old_path": "settings/old_example.toml", "new_path": "settings/old_example.toml", "diff": "@@ -7,13 +7,11 @@ eth_address = \"0x0101010101010101010101010101010101010101\"\n[network]\nmesh_ip = \"fd00::1\"\n-bounty_ip = \"fd00::3\"\nbabel_port = 6872\nrita_hello_port = 4876\nrita_contact_port = 4874\nrita_dashboard_port = 4877\nrita_tick_interval = 5\n-bounty_port = 8888\nwg_private_key_path = \"/tmp/priv\"\nwg_start_port = 60000\ntunnel_timeout_seconds = 900\n" }, { "change_type": "MODIFY", "old_path": "settings/src/network.rs", "new_path": "settings/src/network.rs", "diff": "@@ -63,8 +63,6 @@ pub struct NetworkSettings {\npub rita_dashboard_port: u16,\n/// The password for dashboard authentication\npub rita_dashboard_password: Option<String>,\n- /// Port over which the bounty hunter will be contacted\n- pub bounty_port: u16,\n/// The tick interval in seconds between rita hellos, traffic watcher measurements and payments\npub rita_tick_interval: u64,\n/// Our private key, encoded with Base64 (what the `wg` command outputs and takes by default)\n@@ -131,7 +129,6 @@ impl Default for NetworkSettings {\nlight_client_router_ip: None,\nrita_dashboard_port: 4877,\nrita_dashboard_password: None,\n- bounty_port: 8888,\nrita_tick_interval: 5,\nwg_private_key: None,\nwg_private_key_path: \"/tmp/priv\".to_string(),\n" }, { "change_type": "MODIFY", "old_path": "settings/test.toml", "new_path": "settings/test.toml", "diff": "@@ -7,14 +7,12 @@ eth_address = \"0x0101010101010101010101010101010101010101\"\n[network]\nmesh_ip = \"fd00::1\"\n-bounty_ip = \"fd00::3\"\ndiscovery_ip = \"ff02::1:8\"\nbabel_port = 6872\nrita_hello_port = 4876\nrita_contact_port = 4874\nrita_dashboard_port = 4877\nrita_tick_interval = 5\n-bounty_port = 8888\nwg_private_key_path = \"/tmp/priv\"\nwg_start_port = 60000\ntunnel_timeout_seconds = 900\n" }, { "change_type": "MODIFY", "old_path": "settings/test_exit.toml", "new_path": "settings/test_exit.toml", "diff": "@@ -12,14 +12,12 @@ eth_private_key = \"0x05d97734fc8d75ecae60e1be43f57322365b9b73614a7cf5ec7bc98d123\n[network]\nmesh_ip = \"fd00::1\"\n-bounty_ip = \"fd00::3\"\ndiscovery_ip = \"ff02::1:8\"\nbabel_port = 6872\nrita_hello_port = 4876\nrita_contact_port = 4874\nrita_dashboard_port = 4877\nrita_tick_interval = 5\n-bounty_port = 8888\nwg_public_key = \"bvM10HW73yePrxdtCQQ4U20W5ogogdiZtUihrPc/oGY=\"\nwg_private_key = \"OGzbcm6czrjOEAViK7ZzlWM8mtjCxp7UPbuLS/dATV4=\"\nwg_private_key_path = \"/tmp/priv\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove bounty ip and port from rita
20,255
08.08.2022 10:12:33
25,200
10534842a4d602f4bf1157a28de83bf22a645c56
Cargo audit: removing owning_ref dep
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -1061,9 +1061,9 @@ checksum = \"8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2\"\n[[package]]\nname = \"generic-array\"\n-version = \"0.14.5\"\n+version = \"0.14.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803\"\n+checksum = \"bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9\"\ndependencies = [\n\"typenum\",\n\"version_check\",\n@@ -1337,9 +1337,9 @@ dependencies = [\n[[package]]\nname = \"itoa\"\n-version = \"1.0.2\"\n+version = \"1.0.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d\"\n+checksum = \"6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754\"\n[[package]]\nname = \"jemalloc-sys\"\n@@ -1437,9 +1437,9 @@ dependencies = [\n[[package]]\nname = \"libc\"\n-version = \"0.2.126\"\n+version = \"0.2.127\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836\"\n+checksum = \"505e71a4706fa491e9b1b55f51b95d4037d0821ee40131190475f692b35b009b\"\n[[package]]\nname = \"libsodium-sys\"\n@@ -1858,15 +1858,6 @@ dependencies = [\n\"pkg-config\",\n]\n-[[package]]\n-name = \"owning_ref\"\n-version = \"0.4.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce\"\n-dependencies = [\n- \"stable_deref_trait\",\n-]\n-\n[[package]]\nname = \"parking_lot\"\nversion = \"0.11.2\"\n@@ -1917,9 +1908,9 @@ dependencies = [\n[[package]]\nname = \"paste\"\n-version = \"1.0.7\"\n+version = \"1.0.8\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc\"\n+checksum = \"9423e2b32f7a043629287a536f21951e8c6a82482d0acb1eeebfc90bc2225b22\"\n[[package]]\nname = \"percent-encoding\"\n@@ -2026,9 +2017,9 @@ dependencies = [\n[[package]]\nname = \"proc-macro2\"\n-version = \"1.0.42\"\n+version = \"1.0.43\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c278e965f1d8cf32d6e0e96de3d3e79712178ae67986d9cf9151f51e95aac89b\"\n+checksum = \"0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab\"\ndependencies = [\n\"unicode-ident\",\n]\n@@ -2044,9 +2035,9 @@ dependencies = [\n[[package]]\nname = \"quote\"\n-version = \"1.0.20\"\n+version = \"1.0.21\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804\"\n+checksum = \"bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179\"\ndependencies = [\n\"proc-macro2\",\n]\n@@ -2332,9 +2323,9 @@ dependencies = [\n[[package]]\nname = \"ryu\"\n-version = \"1.0.10\"\n+version = \"1.0.11\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695\"\n+checksum = \"4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09\"\n[[package]]\nname = \"same-file\"\n@@ -2413,15 +2404,15 @@ dependencies = [\n[[package]]\nname = \"semver\"\n-version = \"1.0.12\"\n+version = \"1.0.13\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1\"\n+checksum = \"93f6841e709003d68bb2deee8c343572bf446003ec20a583e76f7b15cebf3711\"\n[[package]]\nname = \"serde\"\n-version = \"1.0.141\"\n+version = \"1.0.142\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7af873f2c95b99fcb0bd0fe622a43e29514658873c8ceba88c4cb88833a22500\"\n+checksum = \"e590c437916fb6b221e1d00df6e3294f3fccd70ca7e92541c475d6ed6ef5fee2\"\ndependencies = [\n\"serde_derive\",\n]\n@@ -2440,9 +2431,9 @@ dependencies = [\n[[package]]\nname = \"serde_bytes\"\n-version = \"0.11.6\"\n+version = \"0.11.7\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54\"\n+checksum = \"cfc50e8183eeeb6178dcb167ae34a8051d63535023ae38b5d8d12beae193d37b\"\ndependencies = [\n\"serde\",\n]\n@@ -2459,9 +2450,9 @@ dependencies = [\n[[package]]\nname = \"serde_derive\"\n-version = \"1.0.141\"\n+version = \"1.0.142\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"75743a150d003dd863b51dc809bcad0d73f2102c53632f1e954e738192a3413f\"\n+checksum = \"34b5b8d809babe02f538c2cfec6f2c1ed10804c0e5a6a041a049a4f5588ccc2e\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -2470,9 +2461,9 @@ dependencies = [\n[[package]]\nname = \"serde_json\"\n-version = \"1.0.82\"\n+version = \"1.0.83\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7\"\n+checksum = \"38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7\"\ndependencies = [\n\"itoa\",\n\"ryu\",\n@@ -2504,7 +2495,6 @@ dependencies = [\n\"lazy_static\",\n\"log\",\n\"num256\",\n- \"owning_ref\",\n\"phonenumber\",\n\"serde\",\n\"serde_derive\",\n@@ -2596,12 +2586,6 @@ dependencies = [\n\"serde\",\n]\n-[[package]]\n-name = \"stable_deref_trait\"\n-version = \"1.2.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3\"\n-\n[[package]]\nname = \"static_assertions\"\nversion = \"1.1.0\"\n@@ -2622,9 +2606,9 @@ checksum = \"6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601\"\n[[package]]\nname = \"syn\"\n-version = \"1.0.98\"\n+version = \"1.0.99\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd\"\n+checksum = \"58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -2656,18 +2640,18 @@ dependencies = [\n[[package]]\nname = \"thiserror\"\n-version = \"1.0.31\"\n+version = \"1.0.32\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a\"\n+checksum = \"f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994\"\ndependencies = [\n\"thiserror-impl\",\n]\n[[package]]\nname = \"thiserror-impl\"\n-version = \"1.0.31\"\n+version = \"1.0.32\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a\"\n+checksum = \"12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -2864,9 +2848,9 @@ checksum = \"099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992\"\n[[package]]\nname = \"unicode-ident\"\n-version = \"1.0.2\"\n+version = \"1.0.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7\"\n+checksum = \"c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf\"\n[[package]]\nname = \"unicode-normalization\"\n" }, { "change_type": "MODIFY", "old_path": "settings/Cargo.toml", "new_path": "settings/Cargo.toml", "diff": "@@ -14,7 +14,6 @@ serde_derive = \"1.0\"\nserde_json = \"1.0\"\ntoml = \"0.5\"\nlog = \"0.4\"\n-owning_ref = \"0.4\"\nlazy_static = \"1.4\"\nclarity = \"0.5\"\narrayvec = {version= \"0.7\", features = [\"serde\"]}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Cargo audit: removing owning_ref dep
20,243
12.08.2022 10:23:19
25,200
65bdf56300edd5d62043b6cefd1a4f883ab20ba5
Changed serialization for OperatorUpdateMessage Changed serialization for OperatorUpdateMessage to serialize as a string to prevent the bincode serialization error. Also, wrote a unit test to validate that there was no issue with serde.
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -318,6 +318,7 @@ dependencies = [\n\"arrayvec 0.7.2\",\n\"babel_monitor\",\n\"base64\",\n+ \"bincode\",\n\"clarity\",\n\"hex\",\n\"ipnetwork 0.20.0\",\n" }, { "change_type": "MODIFY", "old_path": "althea_types/Cargo.toml", "new_path": "althea_types/Cargo.toml", "diff": "@@ -20,6 +20,7 @@ arrayvec = {version= \"0.7\", features = [\"serde\"]}\nphonenumber = \"0.3\"\nlettre = {version = \"0.10\", features = [\"serde\"]}\nipnetwork = \"0.20\"\n+bincode = \"1.3\"\n[dev-dependencies]\nrand = \"0.8\"\n" }, { "change_type": "MODIFY", "old_path": "althea_types/src/interop.rs", "new_path": "althea_types/src/interop.rs", "diff": "@@ -6,6 +6,8 @@ use babel_monitor::Route as RouteLegacy;\nuse clarity::Address;\nuse ipnetwork::IpNetwork;\nuse num256::Uint256;\n+use serde::de::Error;\n+use serde::{Deserialize, Deserializer, Serializer};\nuse std::collections::hash_map::DefaultHasher;\nuse std::fmt;\nuse std::fmt::Display;\n@@ -512,14 +514,41 @@ pub struct OperatorUpdateMessage {\npub local_update_instruction: Option<UpdateTypeLegacy>,\n/// String that holds the download link to the latest firmware release\n/// When a user hits 'update router', it updates to this version\n+ /// #[serde(default = \"default_shaper_settings\")]\npub local_update_instruction_v2: Option<UpdateType>,\n/// settings for the device bandwidth shaper\n#[serde(default = \"default_shaper_settings\")]\npub shaper_settings: ShaperSettings,\n- /// Updated contact info from ops tools\n+ // Updated contact info from ops tools\n+ #[serde(\n+ serialize_with = \"data_serialize\",\n+ deserialize_with = \"data_deserialize\"\n+ )]\npub contact_info: Option<ContactType>,\n}\n+/// Serializes a ContactType as a string\n+pub fn data_serialize<S>(value: &Option<ContactType>, serializer: S) -> Result<S::Ok, S::Error>\n+where\n+ S: Serializer,\n+{\n+ let string_value = serde_json::to_string(&value).unwrap_or_default();\n+ serializer.serialize_str(&string_value)\n+}\n+\n+/// Deserializes a string as a ContactType\n+pub fn data_deserialize<'de, D>(deserializer: D) -> Result<Option<ContactType>, D::Error>\n+where\n+ D: Deserializer<'de>,\n+{\n+ let s = String::deserialize(deserializer).unwrap_or_default();\n+ let value: Option<ContactType> = match serde_json::from_str(&s) {\n+ Ok(value) => value,\n+ Err(e) => return Err(e).map_err(D::Error::custom),\n+ };\n+ Ok(value)\n+}\n+\n/// Settings for the bandwidth shaper\n#[derive(Debug, Clone, Copy, Serialize, Deserialize, Hash, Eq, PartialEq)]\npub struct ShaperSettings {\n@@ -744,3 +773,29 @@ pub struct HeartbeatMessage {\npub struct ExitSystemTime {\npub system_time: SystemTime,\n}\n+#[cfg(test)]\n+mod test {\n+\n+ #[derive(Debug, Clone, Serialize, Deserialize)]\n+ pub struct DummyStruct {\n+ #[serde(\n+ serialize_with = \"data_serialize\",\n+ deserialize_with = \"data_deserialize\"\n+ )]\n+ contact: Option<ContactType>,\n+ }\n+ use lettre::Address;\n+\n+ use crate::{data_deserialize, data_serialize, ContactType};\n+ #[test]\n+ fn test_operator_update_serialize() {\n+ let entry: DummyStruct = DummyStruct {\n+ contact: Some(ContactType::Email {\n+ email: Address::new(\"something\", \"1.1.1.1\").unwrap(),\n+ sequence_number: Some(0),\n+ }),\n+ };\n+ let data = bincode::serialize(&entry).unwrap();\n+ let _try_bincode: DummyStruct = bincode::deserialize(&data).unwrap();\n+ }\n+}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Changed serialization for OperatorUpdateMessage Changed serialization for OperatorUpdateMessage to serialize as a string to prevent the bincode serialization error. Also, wrote a unit test to validate that there was no issue with serde.
20,244
12.08.2022 10:10:41
14,400
4d031d2e8018036c2421fcb08c06966ebd6fe693
Always save exit registration Specific dashboard actions where not saving instantly, like exit registration. This patch adds saving logic for these endpoints and removes some redundant saving functions which where only used in one location. There is also a potential logic fix in the saving loop logic never updating the settings on disk.
[ { "change_type": "MODIFY", "old_path": "rita_bin/src/client.rs", "new_path": "rita_bin/src/client.rs", "diff": "@@ -144,10 +144,9 @@ fn main() {\nstart_rita_common_loops();\nstart_rita_client_loops();\n- save_to_disk_loop(\n- SettingsOnDisk::RitaClientSettings(settings::get_rita_client()),\n- &args.flag_config,\n- );\n+ save_to_disk_loop(SettingsOnDisk::RitaClientSettings(\n+ settings::get_rita_client(),\n+ ));\nstart_core_rita_endpoints(4);\nstart_rita_client_endpoints(1);\nstart_client_dashboard(settings.network.rita_dashboard_port);\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/src/exit.rs", "new_path": "rita_bin/src/exit.rs", "diff": "@@ -70,7 +70,7 @@ fn main() {\n// load the settings file, setup a thread to save it out every so often\n// and populate the memory cache of settings used throughout the program\nlet settings = {\n- let settings_file = args.flag_config.clone();\n+ let settings_file = args.flag_config;\nlet settings = RitaExitSettingsStruct::new_watched(&settings_file).unwrap();\nsettings::set_git_hash(env!(\"GIT_HASH\").to_string());\n@@ -132,10 +132,9 @@ fn main() {\nstart_rita_common_loops();\nstart_rita_exit_loop();\n- save_to_disk_loop(\n- SettingsOnDisk::RitaExitSettingsStruct(settings::get_rita_exit()),\n- &args.flag_config,\n- );\n+ save_to_disk_loop(SettingsOnDisk::RitaExitSettingsStruct(\n+ settings::get_rita_exit(),\n+ ));\nlet workers = settings.workers;\nstart_core_rita_endpoints(workers as usize);\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/exits.rs", "new_path": "rita_client/src/dashboard/exits.rs", "diff": "@@ -12,6 +12,7 @@ use babel_monitor::parse_routes;\nuse rita_common::RitaCommonError;\nuse rita_common::KI;\nuse settings::client::ExitServer;\n+use settings::write_config;\nuse std::collections::HashMap;\nuse std::time::Duration;\n@@ -149,6 +150,10 @@ pub async fn reset_exit(path: Path<String>) -> HttpResponse {\n};\nrita_client.exit_client.exits = exits;\nsettings::set_rita_client(rita_client);\n+ let res = write_config();\n+ if let Err(e) = res {\n+ error!(\"Failed to save exit reset! {:?}\", e);\n+ }\nHttpResponse::Ok().json(ret)\n} else {\nerror!(\"Requested a reset on unknown exit {:?}\", exit_name);\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/operator.rs", "new_path": "rita_client/src/dashboard/operator.rs", "diff": "@@ -3,6 +3,7 @@ use actix_web_async::web::Path;\nuse actix_web_async::{HttpRequest, HttpResponse};\nuse clarity::Address;\nuse num256::Uint256;\n+use settings::write_config;\nuse std::collections::HashMap;\n/// TODO remove after beta 12, provided for backwards compat\n@@ -28,6 +29,10 @@ pub async fn add_to_dao_list(path: Path<Address>) -> HttpResponse {\nrita_client.operator = operator;\nsettings::set_rita_client(rita_client);\n+ let res = write_config();\n+ if let Err(e) = res {\n+ error!(\"Failed to save operator address! {:?}\", e);\n+ }\nHttpResponse::Ok().finish()\n}\n@@ -41,6 +46,10 @@ pub async fn remove_from_dao_list(_path: Path<Address>) -> HttpResponse {\nrita_client.operator = operator;\nsettings::set_rita_client(rita_client);\n+ let res = write_config();\n+ if let Err(e) = res {\n+ error!(\"Failed to save operator remove! {:?}\", e);\n+ }\nHttpResponse::Ok().finish()\n}\n@@ -65,6 +74,10 @@ pub async fn set_dao_fee(path: Path<Uint256>) -> HttpResponse {\nrita_client.operator = operator;\nsettings::set_rita_client(rita_client);\n+ let res = write_config();\n+ if let Err(e) = res {\n+ error!(\"Failed to save operator fee! {:?}\", e);\n+ }\nHttpResponse::Ok().finish()\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/rita_loop/write_to_disk.rs", "new_path": "rita_common/src/rita_loop/write_to_disk.rs", "diff": "use crate::{debt_keeper::save_debt_to_disk, usage_tracker::save_usage_to_disk};\nuse settings::{\ncheck_if_exit, client::RitaClientSettings, exit::RitaExitSettingsStruct, get_rita_client,\n- get_rita_exit, save_client_settings, save_exit_settings,\n+ get_rita_exit, write_config,\n};\nuse std::{\nthread,\n@@ -26,8 +26,7 @@ pub enum SettingsOnDisk {\n/// is. There is also a consideration for the amount of storage the device\n/// has on disk since we don't want to save too often if the disk doesn't\n/// contain a lot of storage.\n-pub fn save_to_disk_loop(mut old_settings: SettingsOnDisk, file_path: &str) {\n- let file_path = file_path.to_string();\n+pub fn save_to_disk_loop(mut old_settings: SettingsOnDisk) {\nlet router_storage_small;\nlet saving_to_disk_frequency: Duration;\n@@ -67,7 +66,10 @@ pub fn save_to_disk_loop(mut old_settings: SettingsOnDisk, file_path: &str) {\nlet new_settings = get_rita_client();\nif old_settings_client != new_settings {\n- save_client_settings(old_settings_client, file_path.clone());\n+ let res = write_config();\n+ if let Err(e) = res {\n+ error!(\"Error saving client settings! {:?}\", e);\n+ }\n}\nold_settings = SettingsOnDisk::RitaClientSettings(new_settings);\n@@ -76,7 +78,10 @@ pub fn save_to_disk_loop(mut old_settings: SettingsOnDisk, file_path: &str) {\nlet new_settings = get_rita_exit();\nif old_settings_exit != new_settings {\n- save_exit_settings(new_settings.clone(), file_path.clone());\n+ let res = write_config();\n+ if let Err(e) = res {\n+ error!(\"Error saving exit settings! {:?}\", e);\n+ }\n}\nold_settings = SettingsOnDisk::RitaExitSettingsStruct(new_settings);\n" }, { "change_type": "MODIFY", "old_path": "settings/src/lib.rs", "new_path": "settings/src/lib.rs", "diff": "@@ -156,20 +156,6 @@ pub fn save_settings_on_shutdown() {\ninfo!(\"Shutdown: saving settings\");\n}\n-pub fn save_exit_settings(new_settings: RitaExitSettingsStruct, file_path: String) {\n- if let Err(e) = new_settings.write(&file_path) {\n- warn!(\"writing updated exit config failed {:?}\", e);\n- }\n- log::info!(\"Exit Config/settings is being saved to\");\n-}\n-\n-pub fn save_client_settings(new_settings: RitaClientSettings, file_path: String) {\n- if let Err(e) = new_settings.write(&file_path) {\n- warn!(\"writing updated client config failed {:?}\", e);\n- }\n- log::info!(\"Client Config/settings is being saved to\");\n-}\n-\n/// get a JSON value of all settings\npub fn get_config_json() -> Result<serde_json::Value, SettingsError> {\nmatch &*SETTINGS.read().unwrap() {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Always save exit registration Specific dashboard actions where not saving instantly, like exit registration. This patch adds saving logic for these endpoints and removes some redundant saving functions which where only used in one location. There is also a potential logic fix in the saving loop logic never updating the settings on disk.
20,255
28.08.2022 22:28:47
25,200
de9e8cb85e137dbe15e2669ba9f48c96529fade4
Log every step of peer listener and remove explicit panics in tunnel manager in hopes of finding a peerlistener panic bug
[ { "change_type": "MODIFY", "old_path": "rita_common/src/network_endpoints/mod.rs", "new_path": "rita_common/src/network_endpoints/mod.rs", "diff": "@@ -46,6 +46,7 @@ pub async fn make_payments(item: Json<PaymentTx>) -> HttpResponse {\n}\npub async fn hello_response(item: Json<LocalIdentity>, req: HttpRequest) -> HttpResponse {\n+ info!(\"In Hello response handler!!\");\nlet their_id = item.into_inner();\nlet err_mesg = \"Malformed hello tcp packet!\";\n@@ -54,7 +55,7 @@ pub async fn hello_response(item: Json<LocalIdentity>, req: HttpRequest) -> Http\nNone => return HttpResponse::build(StatusCode::from_u16(400u16).unwrap()).json(err_mesg),\n};\n- trace!(\"Got Hello from {:?}\", req.peer_addr());\n+ info!(\"Got Hello from {:?}\", req.peer_addr());\ntrace!(\"opening tunnel in hello_response for {:?}\", their_id);\nlet peer = Peer {\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/peer_listener/mod.rs", "new_path": "rita_common/src/peer_listener/mod.rs", "diff": "@@ -211,10 +211,9 @@ fn send_im_here(interfaces: &mut HashMap<String, ListenInterface>) {\ntrace!(\"About to send ImHere\");\nfor obj in interfaces.iter_mut() {\nlet listen_interface = obj.1;\n- trace!(\n+ info!(\n\"Sending ImHere to {:?}, with ip {:?}\",\n- listen_interface.ifname,\n- listen_interface.linklocal_ip\n+ listen_interface.ifname, listen_interface.linklocal_ip\n);\nlet message = PeerMessage::ImHere(listen_interface.linklocal_ip);\nlet result = listen_interface\n@@ -231,7 +230,7 @@ fn send_im_here(interfaces: &mut HashMap<String, ListenInterface>) {\nfn receive_im_here(\ninterfaces: &mut HashMap<String, ListenInterface>,\n) -> (HashMap<IpAddr, Peer>, HashMap<SocketAddr, String>) {\n- trace!(\"About to dequeue ImHere\");\n+ info!(\"About to dequeue ImHere\");\nlet mut output = HashMap::<IpAddr, Peer>::new();\nlet mut interface_map = HashMap::<SocketAddr, String>::new();\nfor obj in interfaces.iter_mut() {\n@@ -244,16 +243,15 @@ fn receive_im_here(\nmatch listen_interface.multicast_socket.recv_from(&mut datagram) {\nOk(b) => b,\nErr(e) => {\n- trace!(\"Could not recv ImHere: {:?}\", e);\n+ error!(\"Could not recv ImHere: {:?}\", e);\n// TODO Consider we might want to remove interfaces that produce specific types\n// of errors from the active list\nbreak;\n}\n};\n- trace!(\n+ info!(\n\"Received {} bytes on multicast socket from {:?}\",\n- bytes_read,\n- sock_addr\n+ bytes_read, sock_addr\n);\nlet ipaddr = match PeerMessage::decode(datagram.as_ref()) {\n@@ -269,12 +267,12 @@ fn receive_im_here(\n};\nif ipaddr == listen_interface.linklocal_ip {\n- trace!(\"Got ImHere from myself\");\n+ error!(\"Got ImHere from myself\");\ncontinue;\n}\nif output.contains_key(&ipaddr.into()) {\n- trace!(\n+ info!(\n\"Discarding ImHere We already have a peer with {:?} for this cycle\",\nipaddr\n);\n@@ -307,7 +305,7 @@ pub fn send_hello(msg: &Hello, socket: &UdpSocket, send_addr: SocketAddr, sender\n/// receive UDP hello messages over IPV6 link local ports\npub fn receive_hello(writer: &mut PeerListener) {\n- trace!(\"Dequeing Hello\");\n+ info!(\"Dequeing Hello\");\nfor obj in writer.interfaces.iter_mut() {\nlet listen_interface = obj.1;\n@@ -330,10 +328,9 @@ pub fn receive_hello(writer: &mut PeerListener) {\n);\ncontinue;\n}\n- trace!(\n+ info!(\n\"Received {} bytes on linklocal socket from {:?}\",\n- bytes_read,\n- sock_addr\n+ bytes_read, sock_addr\n);\nlet peer_to_send = Peer {\ncontact_socket: sock_addr,\n@@ -357,11 +354,9 @@ pub fn receive_hello(writer: &mut PeerListener) {\n}) => {\n//We received an initial hello contact message\nif !response {\n- trace!(\n+ info!(\n\"Received a PeerMessage with fields: {:?}, {:?}, {:?}\",\n- my_id,\n- response,\n- sender_wgport\n+ my_id, response, sender_wgport\n);\nlet their_id = my_id;\n@@ -402,7 +397,7 @@ pub fn receive_hello(writer: &mut PeerListener) {\n//we received a hello response message\n} else {\n- trace!(\n+ info!(\n\"Received a hello response with id wgport and peer: {:?}\",\nmy_id.wg_port\n);\n@@ -416,7 +411,7 @@ pub fn receive_hello(writer: &mut PeerListener) {\n}\n}\nErr(e) => {\n- warn!(\"Hello decode failed: {:?}\", e);\n+ error!(\"Hello decode failed: {:?}\", e);\ncontinue;\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": "@@ -165,13 +165,12 @@ pub fn peer_discovery_loop() {\nthread::spawn(move || loop {\nlet start = Instant::now();\ntrace!(\"Common peer discovery tick!\");\n-\nlet runner = AsyncSystem::new();\nrunner.block_on(async move {\ntrace!(\"Getting Peers from PeerListener to pass to TunnelManager\");\nlet start = Instant::now();\n- trace!(\"Starting PeerListener tick\");\n+ info!(\"Starting PeerListener tick\");\npeerlistener_tick();\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/tunnel_manager/contact_peers.rs", "new_path": "rita_common/src/tunnel_manager/contact_peers.rs", "diff": "@@ -98,6 +98,7 @@ pub async fn tm_neighbor_inquiry(peer: &Peer, is_manual_peer: bool) -> Result<()\n/// This sets a lock on th Peer Listener lazy static to prevent the peer listner tick from overwriting\n/// hashmap data (which contact_peers uses) with new data until the peer contacting process has been complete\nfn set_contacting_neighbors(set: bool) {\n+ info!(\"Set contacting neighbors to {:?}\", set);\nPEER_LISTENER.write().unwrap().contacting_neighbors = set;\n}\n@@ -119,7 +120,7 @@ pub async fn tm_contact_peers(peers: HashMap<IpAddr, Peer>) {\ninfo!(\"contacting peer found by UDP {:?}\", peer);\nlet res = tm_neighbor_inquiry(peer, false).await;\nif res.is_err() {\n- warn!(\"Neighbor inqury for {:?} failed! with {:?}\", peer, res);\n+ error!(\"Neighbor inqury for {:?} failed! with {:?}\", peer, res);\n}\n}\nfor manual_peer in manual_peers.iter() {\n@@ -135,7 +136,7 @@ pub async fn tm_contact_peers(peers: HashMap<IpAddr, Peer>) {\n};\nlet res = tm_neighbor_inquiry(&man_peer, true).await;\nif res.is_err() {\n- warn!(\n+ error!(\n\"Neighbor inqury for {:?} failed with: {:?}\",\nmanual_peer, res\n);\n@@ -149,7 +150,7 @@ pub async fn tm_contact_peers(peers: HashMap<IpAddr, Peer>) {\nif is_gateway {\nlet res = tm_neighbor_inquiry_hostname(manual_peer.to_string()).await;\nif res.is_err() {\n- warn!(\n+ error!(\n\"Neighbor inqury for {:?} failed with: {:?}\",\nmanual_peer, res\n);\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/tunnel_manager/id_callback.rs", "new_path": "rita_common/src/tunnel_manager/id_callback.rs", "diff": "@@ -5,6 +5,7 @@ use std::net::Ipv4Addr;\nuse super::{tm_get_port, TUNNEL_MANAGER};\n+#[derive(Clone, Debug)]\npub struct IdentityCallback {\npub local_identity: LocalIdentity,\npub peer: Peer,\n@@ -35,6 +36,7 @@ impl IdentityCallback {\n/// we now must attach to their tunnel entry. If we also return a bool for if the tunnel already\n/// exists\npub fn tm_identity_callback(msg: IdentityCallback) -> Option<(Tunnel, bool)> {\n+ info!(\"Tm identity callback with msg: {:?}\", msg);\nlet our_port = match msg.our_port {\nSome(port) => port,\n_ => tm_get_port(),\n@@ -50,7 +52,7 @@ pub fn tm_identity_callback(msg: IdentityCallback) -> Option<(Tunnel, bool)> {\nmatch res {\nOk(res) => Some(res),\nErr(e) => {\n- warn!(\"Open Tunnel failed with {:?}\", e);\n+ error!(\"Open Tunnel failed with {:?}\", e);\nNone\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/tunnel_manager/mod.rs", "new_path": "rita_common/src/tunnel_manager/mod.rs", "diff": "@@ -338,7 +338,10 @@ fn tm_get_port() -> u16 {\nloop {\nlet port = match tunnel_manager.free_ports.pop_front() {\nSome(a) => a,\n- None => panic!(\"No elements present in the ports vecdeque\"),\n+ None => {\n+ error!(\"No elements present in the ports vecdeque\");\n+ panic!(\"No elements present in the ports vecdeque\")\n+ }\n};\ntunnel_manager.free_ports.push_back(port);\nmatch (port, &udp_table) {\n@@ -352,6 +355,8 @@ fn tm_get_port() -> u16 {\n(_p, Err(e)) => {\n// better not to open an individual tunnel than it is to\n// risk having a failed one\n+ error!(\"Failed to check if port was in use! UdpTable from get_port returned error {:?}\", e);\n+\npanic!(\"Failed to check if port was in use! UdpTable from get_port returned error {:?}\", e);\n}\n}\n@@ -412,7 +417,7 @@ impl TunnelManager {\nour_port: u16,\nlight_client_details: Option<Ipv4Addr>,\n) -> Result<(Tunnel, bool), RitaCommonError> {\n- trace!(\"getting existing tunnel or opening a new one\");\n+ info!(\"getting existing tunnel or opening a new one\");\n// ifidx must be a part of the key so that we can open multiple tunnels\n// if we have more than one physical connection to the same peer\nlet key = their_localid.global;\n@@ -432,10 +437,16 @@ impl TunnelManager {\nif we_have_tunnel {\n// Scope the last_contact bump to let go of self.tunnels before next use\n{\n- let tunnels = self.tunnels.get_mut(&key).unwrap();\n+ let tunnels = match self.tunnels.get_mut(&key) {\n+ Some(a) => a,\n+ None => {\n+ error!(\"Logic Error: Identity {:?} doesnt exist\", key.clone());\n+ panic!(\"Identity not in hashmap\");\n+ }\n+ };\nfor tunnel in tunnels.iter_mut() {\nif tunnel.listen_ifidx == peer.ifidx && tunnel.ip == peer.contact_socket.ip() {\n- trace!(\"We already have a tunnel for {}\", tunnel);\n+ info!(\"We already have a tunnel for {}\", tunnel);\ntrace!(\n\"Bumping timestamp after {}s for tunnel: {}\",\ntunnel.last_contact.elapsed().as_secs(),\n@@ -453,14 +464,17 @@ impl TunnelManager {\n// Unwrap is safe because we confirm membership\nlet tunnels = &self.tunnels[&key];\n// Filter by Tunnel::ifidx\n- trace!(\n+ info!(\n\"Got tunnels by key {:?}: {:?}. Ifidx is {}\",\n- key,\n- tunnels,\n- peer.ifidx\n+ key, tunnels, peer.ifidx\n);\n- let tunnel = get_tunnel_by_ifidx(peer.ifidx, tunnels)\n- .expect(\"Unable to find tunnel by ifidx how did this happen?\");\n+ let tunnel = match get_tunnel_by_ifidx(peer.ifidx, tunnels) {\n+ Some(a) => a,\n+ _ => {\n+ error!(\"Unable to find tunnel by ifidx how did this happen?\");\n+ panic!(\"Unable to find tunnel by ifidx how did this happen?\");\n+ }\n+ };\nreturn Ok((tunnel.clone(), true));\n} else {\n@@ -474,9 +488,21 @@ impl TunnelManager {\n// in a separate scope to limit surface of borrow checker.\nlet (tunnel, size) = {\n// Find tunnels by identity\n- let tunnels = self.tunnels.get_mut(&key).unwrap();\n+ let tunnels = match self.tunnels.get_mut(&key) {\n+ Some(a) => a,\n+ None => {\n+ error!(\"LOGIC ERROR: Unable to find a tunnel that should exist, we already confirmed membership\");\n+ panic!(\"Unable to find tunnel\");\n+ }\n+ };\n// Find tunnel by interface index\n- let value = get_tunnel_by_ifidx(peer.ifidx, tunnels).unwrap().clone();\n+ let value = match get_tunnel_by_ifidx(peer.ifidx, tunnels) {\n+ Some(a) => a.clone(),\n+ None => {\n+ error!(\"LOGIC ERROR: Unable to find a tunnel with ifidx when membership is already confirmed\");\n+ panic!(\"Uanble to find tunnel\");\n+ }\n+ };\ndel_tunnel(&value, tunnels);\n// Outer HashMap (self.tunnels) can contain empty HashMaps,\n// so the resulting tuple will consist of the tunnel itself, and\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Log every step of peer listener and remove explicit panics in tunnel manager in hopes of finding a peerlistener panic bug
20,255
30.08.2022 06:31:06
25,200
36f1b7aeade105be9f7ad0c1ad5c38dc1312de5b
Fixed bug and updated docs for manaul exit addition
[ { "change_type": "MODIFY", "old_path": "docs/api/router-dashboard.md", "new_path": "docs/api/router-dashboard.md", "diff": "@@ -116,7 +116,7 @@ This file documents the dashboard API found in Rita client.\n- URL: `<rita ip>:<rita_dashboard_port>/exits'\n- Comment: Merges a supplied exit list with the existing list; existing entries\n- are overwritten\n+ are overwritten. Once client side subnet is removed, replace 'subnet' with 'root_ip'\n- Method: `POST`\n- URL Params: `None`\n- Data Params: A JSON object containing the exits we want to add, e.g.:\n@@ -124,7 +124,6 @@ This file documents the dashboard API found in Rita client.\n```json\n{\n\"exit_other\": {\n- \"auto_register\": false,\n\"description\": \"\",\n\"general_details\": {\n\"description\": \"EDITEDITjust a normal althea exit\",\n@@ -132,21 +131,16 @@ This file documents the dashboard API found in Rita client.\n\"netmask\": 24,\n\"server_internal_ip\": \"172.168.1.254\",\n\"wg_exit_port\": 59999\n-\n},\n- \"id\": {\n+ \"wg_public_key\": \"KaTbsJ0Hur4D7Tcb+nc8ofs7n8tKL+wWG3H38KFCwlE=\",\n\"eth_address\": \"0x0101010101010101010101010101010101010101\",\n- \"mesh_ip\": \"fd00::5\",\n- \"wg_public_key\": \"KaTbsJ0Hur4D7Tcb+nc8ofs7n8tKL+wWG3H38KFCwlE=\"\n-\n- },\n+ \"subnet\": \"fd00::5/120\",\n\"message\": \"Got info successfully\",\n\"registration_port\": 4875,\n\"state\": \"GotInfo\"\n},\n\"exit_yet_another\": {\n- \"auto_register\": false,\n\"description\": \"\",\n\"general_details\": {\n\"description\": \"EDITEDITjust a normal althea exit\",\n@@ -155,14 +149,10 @@ This file documents the dashboard API found in Rita client.\n\"verif_mode\": \"Email\"\n\"server_internal_ip\": \"172.168.1.254\",\n\"wg_exit_port\": 59999\n-\n},\n- \"id\": {\n+ \"wg_public_key\": \"KaTbsJ0Hur4D7Tcb+nc8ofs7n8tKL+wWG3H38KFCwlE=\",\n\"eth_address\": \"0x0101010101010101010101010101010101010101\",\n- \"mesh_ip\": \"fd00::5\",\n- \"wg_public_key\": \"KaTbsJ0Hur4D7Tcb+nc8ofs7n8tKL+wWG3H38KFCwlE=\"\n-\n- },\n+ \"subnet\": \"fd00::5/120\",\n\"message\": \"Got info successfully\",\n\"registration_port\": 4875,\n\"state\": \"GotInfo\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/exits.rs", "new_path": "rita_client/src/dashboard/exits.rs", "diff": "//! The Exit info endpoint gathers infromation about exit status and presents it to the dashbaord.\n-use crate::exit_manager::{exit_setup_request, get_selected_exit};\n+use crate::exit_manager::{exit_setup_request, get_selected_exit, set_selected_exit};\nuse crate::RitaClientError;\nuse actix_web_async::http::StatusCode;\nuse actix_web_async::{web::Json, web::Path, HttpRequest, HttpResponse};\n@@ -11,7 +11,7 @@ use babel_monitor::parse_routes;\nuse rita_common::RitaCommonError;\nuse rita_common::KI;\n-use settings::client::ExitServer;\n+use settings::client::{ExitServer, SelectedExit};\nuse settings::write_config;\nuse std::collections::HashMap;\nuse std::time::Duration;\n@@ -112,12 +112,27 @@ pub async fn add_exits(new_exits: Json<HashMap<String, ExitServer>>) -> HttpResp\ndebug!(\"/exits POST hit with {:?}\", new_exits);\nlet mut rita_client = settings::get_rita_client();\nlet mut exits = rita_client.exit_client.exits;\n+ let new_copy = new_exits.clone();\nexits.extend(new_exits.into_inner());\nlet copy = exits.clone();\nrita_client.exit_client.exits = exits;\n+ trace!(\"Rita settings looks like : {:?}\", rita_client);\nsettings::set_rita_client(rita_client);\n+ if let Err(e) = write_config() {\n+ error!(\"Failed to save new exits! {:?}\", e);\n+ }\n+\n+ // initialze all new exits for Exit manager to use\n+ for exit in new_copy {\n+ let new_exit_ip = exit.1.subnet.ip();\n+ let new_selected_exit = SelectedExit {\n+ selected_id: Some(new_exit_ip),\n+ ..Default::default()\n+ };\n+ set_selected_exit(exit.0.clone(), new_selected_exit);\n+ }\nHttpResponse::Ok().json(copy)\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fixed bug and updated docs for manaul exit addition
20,255
01.09.2022 10:10:13
25,200
74d2ed6be678d2b6a429767ae27342ddfe9705cc
Restructure Peer listener by cloning a UDP socket to send a hello in tunnel manager This change removes the need for calling the peer listener lock in Tunnel Manager. If this was where a panic/deadlock took place, this change fixes it
[ { "change_type": "MODIFY", "old_path": "rita_common/src/peer_listener/mod.rs", "new_path": "rita_common/src/peer_listener/mod.rs", "diff": "@@ -26,7 +26,6 @@ lazy_static! {\n#[derive(Debug)]\npub struct PeerListener {\n- pub contacting_neighbors: bool,\npub interfaces: HashMap<String, ListenInterface>,\npub peers: HashMap<IpAddr, Peer>,\n@@ -83,7 +82,6 @@ impl Default for PeerListener {\nimpl PeerListener {\npub fn new() -> Result<PeerListener, RitaCommonError> {\nOk(PeerListener {\n- contacting_neighbors: false,\ninterfaces: HashMap::new(),\npeers: HashMap::new(),\ninterface_map: HashMap::new(),\n@@ -91,6 +89,50 @@ impl PeerListener {\n}\n}\n+impl Clone for PeerListener {\n+ fn clone(&self) -> PeerListener {\n+ let interfaces = &self.interfaces;\n+ let mut clone_interfaces = HashMap::new();\n+\n+ for (name, inter) in interfaces {\n+ let multi_udp = match inter.multicast_socket.try_clone() {\n+ Ok(a) => a,\n+ Err(e) => {\n+ error!(\n+ \"PEER DISCOVERY ERROR: Unable to clone multicast udp, please fix: {:?}\",\n+ e\n+ );\n+ continue;\n+ }\n+ };\n+ let local_udp = match inter.linklocal_socket.try_clone() {\n+ Ok(a) => a,\n+ Err(e) => {\n+ error!(\n+ \"PEER DISCOVERY ERROR: Unable to clone local udp, please fix: {:?}\",\n+ e\n+ );\n+ continue;\n+ }\n+ };\n+ let new_lis = ListenInterface {\n+ ifname: inter.ifname.clone(),\n+ ifidx: inter.ifidx,\n+ multicast_socketaddr: inter.multicast_socketaddr,\n+ multicast_socket: multi_udp,\n+ linklocal_socket: local_udp,\n+ linklocal_ip: inter.linklocal_ip,\n+ };\n+ clone_interfaces.insert(name.clone(), new_lis);\n+ }\n+ PeerListener {\n+ interfaces: clone_interfaces,\n+ peers: self.peers.clone(),\n+ interface_map: self.interface_map.clone(),\n+ }\n+ }\n+}\n+\n/// Creates a listen interface on all interfaces in the peer_interfaces hashmap.\nfn listen_to_available_ifaces(peer_listener: &mut PeerListener) {\nlet interfaces = settings::get_rita_common().network.peer_interfaces;\n@@ -103,36 +145,46 @@ fn listen_to_available_ifaces(peer_listener: &mut PeerListener) {\n.interfaces\n.insert(new_listen_interface.ifname.clone(), new_listen_interface);\n}\n- Err(_e) => {}\n+ Err(e) => {\n+ error!(\"Received an error while listening to interfaces: {:?}\", e)\n+ }\n}\n}\n}\n}\n+/// Returns a copy of PL lazy static var\n+fn get_pl_copy() -> PeerListener {\n+ PEER_LISTENER.read().unwrap().clone()\n+}\n+\n+/// Sets the PeerListener lazy static to the given value\n+fn set_pl(pl: PeerListener) {\n+ *PEER_LISTENER.write().unwrap() = pl;\n+}\n+\n/// Ticks the peer listener module sending ImHere messages and receiving Hello messages from all\n/// peers over UDP\n-pub fn peerlistener_tick() {\n+pub fn peerlistener_tick() -> PeerListener {\ntrace!(\"Starting PeerListener tick!\");\n- let mut writer = PEER_LISTENER.write().unwrap();\n- if !writer.contacting_neighbors {\n- send_im_here(&mut writer.interfaces);\n-\n- let (a, b) = receive_im_here(&mut writer.interfaces);\n+ let mut pl = get_pl_copy();\n+ send_im_here(&mut pl.interfaces);\n+ let (a, b) = receive_im_here(&mut pl.interfaces);\n{\n- // Reset hashmaps only when not contacting peers\n- (*writer).peers = a;\n- (*writer).interface_map = b;\n+ pl.peers = a;\n+ pl.interface_map = b;\n}\n- receive_hello(&mut writer);\n+ receive_hello(&mut pl);\n+ listen_to_available_ifaces(&mut pl);\n- listen_to_available_ifaces(&mut writer);\n- }\n+ set_pl(pl.clone());\n+ pl\n}\n#[allow(dead_code)]\npub fn unlisten_interface(interface: String) {\n- trace!(\"Peerlistener unlisten on {:?}\", interface);\n+ info!(\"Peerlistener unlisten on {:?}\", interface);\nlet ifname_to_delete = interface;\nlet mut writer = PEER_LISTENER.write().unwrap();\nif writer.interfaces.contains_key(&ifname_to_delete) {\n@@ -147,10 +199,6 @@ pub fn unlisten_interface(interface: String) {\n}\n}\n-pub fn get_peers() -> HashMap<IpAddr, Peer> {\n- PEER_LISTENER.read().unwrap().peers.clone()\n-}\n-\n#[derive(Debug)]\npub struct ListenInterface {\nifname: String,\n@@ -177,8 +225,7 @@ impl ListenInterface {\n// try_link_ip should guard from non-existant interfaces and the network stack not being ready\n// so in theory we should never hit this expect or the panic below either.\n- let multicast_socket = UdpSocket::bind(multicast_socketaddr)\n- .expect(\"Failed to bind to peer discovery address!\");\n+ let multicast_socket = UdpSocket::bind(multicast_socketaddr)?;\nlet res = multicast_socket.join_multicast_v6(&disc_ip, iface_index);\ntrace!(\"ListenInterface init set multicast v6 with {:?}\", res);\nlet res = multicast_socket.set_nonblocking(true);\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": "@@ -6,7 +6,6 @@ use crate::network_monitor::update_network_info;\nuse crate::network_monitor::NetworkInfo as NetworkMonitorTick;\nuse crate::payment_controller::tick_payment_controller;\nuse crate::payment_validator::validate;\n-use crate::peer_listener::get_peers;\nuse crate::peer_listener::peerlistener_tick;\nuse crate::tm_trigger_gc;\nuse crate::traffic_watcher::watch;\n@@ -172,7 +171,7 @@ pub fn peer_discovery_loop() {\nlet start = Instant::now();\ninfo!(\"Starting PeerListener tick\");\n- peerlistener_tick();\n+ let pl_copy = peerlistener_tick();\ninfo!(\n\"PeerListener tick completed in {}s {}ms\",\n@@ -181,7 +180,7 @@ pub fn peer_discovery_loop() {\n);\n// Contact manual peers\n- tm_contact_peers(get_peers()).await;\n+ tm_contact_peers(pl_copy).await;\n});\n// sleep until it has been FAST_LOOP_SPEED seconds from start, whenever that may be\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/tunnel_manager/contact_peers.rs", "new_path": "rita_common/src/tunnel_manager/contact_peers.rs", "diff": "use crate::hello_handler::handle_hello;\nuse crate::hello_handler::Hello;\nuse crate::peer_listener::Hello as NewHello;\n-use crate::peer_listener::PEER_LISTENER;\n+use crate::peer_listener::PeerListener;\nuse crate::peer_listener::{send_hello, Peer};\nuse crate::rita_loop::is_gateway;\nuse crate::tunnel_manager::tm_get_port;\nuse crate::RitaCommonError;\nuse crate::KI;\nuse althea_types::LocalIdentity;\n-use std::collections::HashMap;\nuse std::net::ToSocketAddrs;\nuse std::net::{IpAddr, SocketAddr, UdpSocket};\n@@ -66,14 +65,18 @@ pub async fn tm_neighbor_inquiry_hostname(their_hostname: String) -> Result<(),\n/// Contacts one neighbor with our LocalIdentity to get their LocalIdentity and wireguard tunnel\n/// interface name. Sends a Hello over udp, or http if its a manual peer\n-pub async fn tm_neighbor_inquiry(peer: &Peer, is_manual_peer: bool) -> Result<(), RitaCommonError> {\n+pub async fn tm_neighbor_inquiry(\n+ peer: &Peer,\n+ is_manual_peer: bool,\n+ pl: &PeerListener,\n+) -> Result<(), RitaCommonError> {\ntrace!(\"TunnelManager neigh inquiry for {:?}\", peer);\nlet our_port = tm_get_port();\nif is_manual_peer {\ncontact_manual_peer(peer, our_port).await\n} else {\n- let peer_listener = &mut *PEER_LISTENER.write().unwrap();\n+ let peer_listener = pl;\nlet iface_name = match peer_listener.interface_map.get(&peer.contact_socket) {\nSome(a) => a,\nNone => {\n@@ -95,17 +98,10 @@ pub async fn tm_neighbor_inquiry(peer: &Peer, is_manual_peer: bool) -> Result<()\n}\n}\n-/// This sets a lock on th Peer Listener lazy static to prevent the peer listner tick from overwriting\n-/// hashmap data (which contact_peers uses) with new data until the peer contacting process has been complete\n-fn set_contacting_neighbors(set: bool) {\n- info!(\"Set contacting neighbors to {:?}\", set);\n- PEER_LISTENER.write().unwrap().contacting_neighbors = set;\n-}\n-\n/// takes a list of peers to contact and dispatches UDP hello messages to peers discovered via IPv6 link local\n/// multicast peer discovery, also sends http hello messages to manual peers, only resolves manual peers with\n/// hostnames if the devices is detected to be a gateway.\n-pub async fn tm_contact_peers(peers: HashMap<IpAddr, Peer>) {\n+pub async fn tm_contact_peers(pl: PeerListener) {\nlet network_settings = settings::get_rita_common().network;\nlet manual_peers = network_settings.manual_peers.clone();\nlet is_gateway = is_gateway();\n@@ -113,12 +109,10 @@ pub async fn tm_contact_peers(peers: HashMap<IpAddr, Peer>) {\ndrop(network_settings);\ninfo!(\"TunnelManager contacting peers\");\n- // Hashmaps will not get overwritten while this bool is set\n- set_contacting_neighbors(true);\n- for (_, peer) in peers.iter() {\n+ for (_, peer) in pl.peers.iter() {\ninfo!(\"contacting peer found by UDP {:?}\", peer);\n- let res = tm_neighbor_inquiry(peer, false).await;\n+ let res = tm_neighbor_inquiry(peer, false, &pl).await;\nif res.is_err() {\nerror!(\"Neighbor inqury for {:?} failed! with {:?}\", peer, res);\n}\n@@ -134,7 +128,7 @@ pub async fn tm_contact_peers(peers: HashMap<IpAddr, Peer>) {\nifidx: 0,\ncontact_socket: socket,\n};\n- let res = tm_neighbor_inquiry(&man_peer, true).await;\n+ let res = tm_neighbor_inquiry(&man_peer, true, &pl).await;\nif res.is_err() {\nerror!(\n\"Neighbor inqury for {:?} failed with: {:?}\",\n@@ -159,9 +153,6 @@ pub async fn tm_contact_peers(peers: HashMap<IpAddr, Peer>) {\n}\n}\n}\n-\n- // Hashmaps can now get overwritten\n- set_contacting_neighbors(false);\n}\n/// Sets out to contacts a local mesh neighbor, takes a speculative port (only assigned if the neighbor\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Restructure Peer listener by cloning a UDP socket to send a hello in tunnel manager This change removes the need for calling the peer listener lock in Tunnel Manager. If this was where a panic/deadlock took place, this change fixes it
20,253
30.08.2022 15:15:52
25,200
78eac056a9f13cbfa0100edb451656bf126545c5
Make billing details editable from ops tools Billing details now includes a sequence number which keeps track of updates sent by ops, which now sends back billing details as part of the router checkin process.
[ { "change_type": "MODIFY", "old_path": "althea_types/src/interop.rs", "new_path": "althea_types/src/interop.rs", "diff": "@@ -525,6 +525,8 @@ pub struct OperatorUpdateMessage {\ndeserialize_with = \"data_deserialize\"\n)]\npub contact_info: Option<ContactType>,\n+ /// Billing details from ops tools, so that we may sync changes\n+ pub billing_details: Option<BillingDetails>,\n}\n/// Serializes a ContactType as a string\n" }, { "change_type": "MODIFY", "old_path": "althea_types/src/user_info.rs", "new_path": "althea_types/src/user_info.rs", "diff": "@@ -30,6 +30,8 @@ pub struct BillingDetails {\n/// format the local nation has for addresses. Optional as this install\n/// may not have a formal mailing address\npub mailing_address: MailingAddress,\n+ #[serde(default)]\n+ pub sequence_number: u32,\n}\n/// Struct for storing details about this user installation. This particular\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/installation_details.rs", "new_path": "rita_client/src/dashboard/installation_details.rs", "diff": "@@ -117,6 +117,8 @@ pub async fn set_installation_details(req: Json<InstallationDetailsPost>) -> Htt\ncity: input.city,\nstreet: input.street,\n},\n+ // initialize sequence with 1\n+ sequence_number: 1,\n};\nlet mut rita_client = settings::get_rita_client();\n" }, { "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": "@@ -314,7 +314,7 @@ light_client_fee = 10000000\nlocal_fee = 30000000\nmax_fee = 1000000000\nmax_gas = 1000000000\n-min_gas = 1000000000\n+min_gas = \"1000000000\"\nnet_version = 100\nnode_list = [\"https://dai.althea.org:443\"]\nnonce = \"88\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/operator_update/mod.rs", "new_path": "rita_client/src/operator_update/mod.rs", "diff": "@@ -8,6 +8,7 @@ use crate::rita_loop::CLIENT_LOOP_TIMEOUT;\nuse crate::set_router_update_instruction;\nuse althea_kernel_interface::hardware_info::get_hardware_info;\nuse althea_types::get_sequence_num;\n+use althea_types::BillingDetails;\nuse althea_types::ContactStorage;\nuse althea_types::ContactType;\nuse althea_types::HardwareInfo;\n@@ -228,7 +229,13 @@ async fn checkin() {\nrita_client.payment = payment;\ntrace!(\"Done with payment\");\n- let mut operator = rita_client.operator;\n+ let mut operator = rita_client.operator.clone();\n+ if check_billing_update(\n+ rita_client.operator.billing_details.clone(),\n+ new_settings.billing_details.clone(),\n+ ) {\n+ operator.billing_details = new_settings.billing_details.clone();\n+ }\nlet new_operator_fee = Uint256::from(new_settings.operator_fee);\noperator.operator_fee = new_operator_fee;\noperator.installation_details = None;\n@@ -400,6 +407,22 @@ fn check_contacts_update(current: Option<ContactStorage>, incoming: Option<Conta\nfalse\n}\n+fn check_billing_update(current: Option<BillingDetails>, incoming: Option<BillingDetails>) -> bool {\n+ let current_sequence = match current {\n+ Some(details) => details.sequence_number,\n+ None => 0,\n+ };\n+ if let Some(details) = incoming {\n+ let seq = details.sequence_number;\n+ if seq > current_sequence {\n+ return true;\n+ }\n+ // else the existing config is more recent, so do not update\n+ return false;\n+ }\n+ false\n+}\n+\n/// Merges an arbitrary settings string, after first filtering for several\n/// forbidden values\nfn merge_settings_safely(new_settings: Value) {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Make billing details editable from ops tools Billing details now includes a sequence number which keeps track of updates sent by ops, which now sends back billing details as part of the router checkin process.
20,243
07.09.2022 10:00:38
25,200
c9ef9e0c8420f3937b2eba0f09c521891c8a095e
Removing deprecated daos endpoint Removing daos endpoints/routes since they were no longer useful for the althea dash. They were no longer used as operators became the more useful endpoint.
[ { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/mod.rs", "new_path": "rita_client/src/dashboard/mod.rs", "diff": "@@ -76,14 +76,6 @@ pub fn start_client_dashboard(rita_dashboard_port: u16) {\n\"/backup_created/{status}\",\nweb::post().to(set_backup_created),\n)\n- .route(\"/dao_list\", web::get().to(get_dao_list))\n- .route(\"/dao_list/add/{address}\", web::post().to(add_to_dao_list))\n- .route(\n- \"/dao_list/remove/{address}\",\n- web::post().to(remove_from_dao_list),\n- )\n- .route(\"/dao_fee\", web::get().to(get_dao_fee))\n- .route(\"/dao_fee/{fee}\", web::post().to(set_dao_fee))\n.route(\"/operator\", web::get().to(get_operator))\n.route(\"/operator/{address}\", web::post().to(change_operator))\n.route(\"/operator/remove\", web::post().to(remove_operator))\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/operator.rs", "new_path": "rita_client/src/dashboard/operator.rs", "diff": "@@ -2,85 +2,6 @@ use crate::operator_fee_manager::get_operator_fee_debt;\nuse actix_web_async::web::Path;\nuse actix_web_async::{HttpRequest, HttpResponse};\nuse clarity::Address;\n-use num256::Uint256;\n-use settings::write_config;\n-use std::collections::HashMap;\n-\n-/// TODO remove after beta 12, provided for backwards compat\n-pub async fn get_dao_list(_req: HttpRequest) -> HttpResponse {\n- trace!(\"get dao list: Hit\");\n- let rita_client = settings::get_rita_client();\n- match rita_client.operator.operator_address {\n- Some(address) => HttpResponse::Ok().json(vec![address]),\n- None => {\n- let emp_vec: Vec<Address> = Vec::new();\n- HttpResponse::Ok().json(emp_vec)\n- }\n- }\n-}\n-\n-/// TODO remove after beta 12, provided for backwards compat\n-pub async fn add_to_dao_list(path: Path<Address>) -> HttpResponse {\n- trace!(\"Add to dao list: Hit\");\n- let provided_address = path.into_inner();\n- let mut rita_client = settings::get_rita_client();\n- let mut operator = rita_client.operator;\n- operator.operator_address = Some(provided_address);\n-\n- rita_client.operator = operator;\n- settings::set_rita_client(rita_client);\n- let res = write_config();\n- if let Err(e) = res {\n- error!(\"Failed to save operator address! {:?}\", e);\n- }\n-\n- HttpResponse::Ok().finish()\n-}\n-\n-/// TODO remove after beta 12, provided for backwards compat\n-pub async fn remove_from_dao_list(_path: Path<Address>) -> HttpResponse {\n- let mut rita_client = settings::get_rita_client();\n- let mut operator = rita_client.operator;\n-\n- operator.operator_address = None;\n-\n- rita_client.operator = operator;\n- settings::set_rita_client(rita_client);\n- let res = write_config();\n- if let Err(e) = res {\n- error!(\"Failed to save operator remove! {:?}\", e);\n- }\n-\n- HttpResponse::Ok().finish()\n-}\n-\n-/// TODO remove after beta 12, provided for backwards compat\n-pub async fn get_dao_fee(_req: HttpRequest) -> HttpResponse {\n- debug!(\"/dao_fee GET hit\");\n- let mut ret = HashMap::new();\n- let rita_client = settings::get_rita_client();\n- ret.insert(\"dao_fee\", rita_client.operator.operator_fee);\n-\n- HttpResponse::Ok().json(ret)\n-}\n-\n-/// TODO remove after beta 12, provided for backwards compat\n-pub async fn set_dao_fee(path: Path<Uint256>) -> HttpResponse {\n- let new_fee = path.into_inner();\n- debug!(\"/dao_fee/{} POST hit\", new_fee);\n- let mut rita_client = settings::get_rita_client();\n- let mut operator = rita_client.operator;\n- operator.operator_fee = new_fee;\n-\n- rita_client.operator = operator;\n- settings::set_rita_client(rita_client);\n- let res = write_config();\n- if let Err(e) = res {\n- error!(\"Failed to save operator fee! {:?}\", e);\n- }\n-\n- HttpResponse::Ok().finish()\n-}\npub async fn get_operator(_req: HttpRequest) -> HttpResponse {\ntrace!(\"get operator address: Hit\");\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Removing deprecated daos endpoint Removing daos endpoints/routes since they were no longer useful for the althea dash. They were no longer used as operators became the more useful endpoint.
20,255
08.09.2022 08:22:44
25,200
d844fb343850334ac8a76fbb4d35b9af8a613bf4
Added Conntrack info to hardware details
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/hardware_info.rs", "new_path": "althea_kernel_interface/src/hardware_info.rs", "diff": "@@ -2,6 +2,7 @@ use crate::file_io::get_lines;\nuse crate::KernelInterfaceError as Error;\nuse althea_types::extract_wifi_station_data;\nuse althea_types::extract_wifi_survey_data;\n+use althea_types::ConntrackInfo;\nuse althea_types::EthOperationMode;\nuse althea_types::EthernetStats;\nuse althea_types::HardwareInfo;\n@@ -10,6 +11,9 @@ use althea_types::WifiDevice;\nuse althea_types::WifiStationData;\nuse althea_types::WifiSurveyData;\nuse std::fs;\n+use std::fs::File;\n+use std::io::BufRead;\n+use std::io::BufReader;\nuse std::process::Command;\nuse std::process::Stdio;\nuse std::time::Duration;\n@@ -48,6 +52,8 @@ pub fn get_hardware_info(device_name: Option<String>) -> Result<HardwareInfo, Er\nlet wifi_devices = get_wifi_devices();\n+ let conntrack_info = get_conntrack_info();\n+\nOk(HardwareInfo {\nlogical_processors: num_cpus,\nload_avg_one_minute: one_minute_load_avg,\n@@ -62,6 +68,7 @@ pub fn get_hardware_info(device_name: Option<String>) -> Result<HardwareInfo, Er\nentire_system_kernel_version,\nethernet_stats,\nwifi_devices,\n+ conntrack: conntrack_info,\n})\n}\n@@ -345,6 +352,47 @@ fn get_wifi_devices() -> Vec<WifiDevice> {\nret\n}\n+/// This function parses files in /proc that contain conntrack info to send to ops\n+/// MAX_PATH: /proc/sys/net/netfilter/nf_conntrack_max this file contains the max number of conns possible in the kernel\n+/// CURR_CONNS_PATH: /proc/net/nf_conntrack This file lists all the current connections in the kernel, we use this file to parse\n+/// number of lines, this gives us total number of connections\n+fn get_conntrack_info() -> Option<ConntrackInfo> {\n+ const MAX_PATH: &str = \"/proc/sys/net/netfilter/nf_conntrack_max\";\n+ const CURR_CONNS_PATH: &str = \"/proc/net/nf_conntrack\";\n+\n+ let curr_conn_file = match File::open(CURR_CONNS_PATH) {\n+ Ok(a) => a,\n+ Err(e) => {\n+ error!(\"Unable to parse current connection conntrack file: {:?}\", e);\n+ return None;\n+ }\n+ };\n+\n+ let curr_conn: u32 = BufReader::new(curr_conn_file).lines().count() as u32;\n+\n+ let max_conns = match get_lines(MAX_PATH) {\n+ Ok(a) => a,\n+ Err(e) => {\n+ error!(\"Unable to get max conntrack connections! {:?}\", e);\n+ return None;\n+ }\n+ };\n+ let max_conns: u32 = match max_conns[0].parse() {\n+ Ok(a) => a,\n+ Err(e) => {\n+ error!(\"Cant parse max conntrack conns! {:?}\", e);\n+ return None;\n+ }\n+ };\n+\n+ let ret = ConntrackInfo {\n+ max_conns,\n+ current_conns: curr_conn,\n+ };\n+ info!(\"Sending the Conntrack struct: {:?}\", ret);\n+ Some(ret)\n+}\n+\nfn parse_wifi_device_names() -> Result<Vec<String>, Error> {\nlet mut ret = Vec::new();\nlet path = \"/proc/net/wireless\";\n@@ -494,4 +542,71 @@ mod test {\nstr1, str2\n);\n}\n+\n+ #[test]\n+ fn get_conntrack_info_test() {\n+ const MAX_PATH: &str = \"/proc/sys/net/netfilter/nf_conntrack_max\";\n+ const TABLE_COUNT_PATH: &str = \"/proc/sys/net/netfilter/nf_conntrack_count\";\n+ //const CURR_CONNS_PATH: &str = \"/proc/net/nf_conntrack\";\n+\n+ // Cannot parse /proc/net/nf_conntrack due to permission errors on local machine\n+\n+ // let curr_conn = Command::new(\"wc\")\n+ // .args(&[\"-l\", CURR_CONNS_PATH])\n+ // .stdout(Stdio::piped())\n+ // .output();\n+\n+ // if curr_conn.is_err() {\n+ // panic!(\"Unable to parse current conntrack info: {:?}\", curr_conn);\n+ // }\n+ // let curr_conn = String::from_utf8(curr_conn.unwrap().stdout).unwrap();\n+ // let curr_conn = curr_conn.split(' ').collect::<Vec<&str>>();\n+ // let curr_conn = curr_conn[0];\n+ // let curr_conn: u32 = match curr_conn.parse() {\n+ // Ok(a) => a,\n+ // Err(e) => {\n+ // panic!(\"Unable to parse conntrack info! {:?}\", e);\n+ // }\n+ // };\n+\n+ // println!(\"Curr connections: {:?}\", curr_conn);\n+\n+ let table_count = match get_lines(TABLE_COUNT_PATH) {\n+ Ok(a) => a,\n+ Err(e) => {\n+ panic!(\"Unable to get table count for conntrack info!: {:?}\", e);\n+ }\n+ };\n+ let table_count: u32 = match table_count[0].parse() {\n+ Ok(a) => a,\n+ Err(e) => {\n+ panic!(\"Cant parse table count conntrack! {:?}\", e);\n+ }\n+ };\n+\n+ println!(\"table count: {:?}\", table_count);\n+\n+ let max_conns = match get_lines(MAX_PATH) {\n+ Ok(a) => a,\n+ Err(e) => {\n+ panic!(\"Unable to get max conntrack connections! {:?}\", e);\n+ }\n+ };\n+ let max_conns: u32 = match max_conns[0].parse() {\n+ Ok(a) => a,\n+ Err(e) => {\n+ panic!(\"Cant parse max conntrack conns! {:?}\", e);\n+ }\n+ };\n+\n+ println!(\"Max conns: {:?}\", max_conns);\n+\n+ // Test read lines\n+ println!(\n+ \"Lines in Max_path file (should be 1): {:?}\",\n+ BufReader::new(File::open(MAX_PATH).unwrap())\n+ .lines()\n+ .count()\n+ );\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "althea_types/src/interop.rs", "new_path": "althea_types/src/interop.rs", "diff": "@@ -671,6 +671,8 @@ pub struct HardwareInfo {\n// Vector of wifi devices on router with staion and survey data for each\n#[serde(default)]\npub wifi_devices: Vec<WifiDevice>,\n+ // Info about the max connections, number of rows in conntrack table and current number of connections made by router\n+ pub conntrack: Option<ConntrackInfo>,\n}\nfn default_kernel_version() -> String {\n@@ -708,6 +710,12 @@ pub struct EthernetStats {\npub rx_errors: u64,\n}\n+#[derive(Debug, Clone, Serialize, Deserialize)]\n+pub struct ConntrackInfo {\n+ pub max_conns: u32,\n+ pub current_conns: u32,\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" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Added Conntrack info to hardware details
20,243
20.09.2022 13:06:14
25,200
d77416acec46d3ce85e25ee37790c1daa691fa31
Serde default tag added to conntrackfield in hardwareinfo struct Without the default serde tag, the conntrack field causes an issue with deserialization which prevents ops tools to load devices correctly.
[ { "change_type": "MODIFY", "old_path": "althea_types/src/interop.rs", "new_path": "althea_types/src/interop.rs", "diff": "@@ -672,6 +672,7 @@ pub struct HardwareInfo {\n#[serde(default)]\npub wifi_devices: Vec<WifiDevice>,\n// Info about the max connections, number of rows in conntrack table and current number of connections made by router\n+ #[serde(default)]\npub conntrack: Option<ConntrackInfo>,\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Serde default tag added to conntrackfield in hardwareinfo struct Without the default serde tag, the conntrack field causes an issue with deserialization which prevents ops tools to load devices correctly.
20,255
21.09.2022 08:48:03
25,200
f3b30dfa40ee36672eb298a948cca87ef7f85411
Peer Listener Logging PR
[ { "change_type": "MODIFY", "old_path": "rita_common/src/peer_listener/mod.rs", "new_path": "rita_common/src/peer_listener/mod.rs", "diff": "@@ -135,12 +135,14 @@ impl Clone for PeerListener {\n/// Creates a listen interface on all interfaces in the peer_interfaces hashmap.\nfn listen_to_available_ifaces(peer_listener: &mut PeerListener) {\n+ info!(\"PEER LISTENER: starting to listen to interfaces\");\nlet interfaces = settings::get_rita_common().network.peer_interfaces;\nlet iface_list = interfaces;\nfor iface in iface_list.iter() {\nif !peer_listener.interfaces.contains_key(iface) {\nmatch ListenInterface::new(iface) {\nOk(new_listen_interface) => {\n+ info!(\"Added interface: {:?} to interfaces list\", iface);\npeer_listener\n.interfaces\n.insert(new_listen_interface.ifname.clone(), new_listen_interface);\n@@ -151,6 +153,11 @@ fn listen_to_available_ifaces(peer_listener: &mut PeerListener) {\n}\n}\n}\n+\n+ info!(\n+ \"PEER LISTENER: Done listening, Our interface list looks like : {:?}\",\n+ peer_listener.interfaces\n+ );\n}\n/// Returns a copy of PL lazy static var\n@@ -169,6 +176,7 @@ pub fn peerlistener_tick() -> PeerListener {\ntrace!(\"Starting PeerListener tick!\");\nlet mut pl = get_pl_copy();\n+ info!(\"Received the PL struct: {:?}\", pl);\nsend_im_here(&mut pl.interfaces);\nlet (a, b) = receive_im_here(&mut pl.interfaces);\n{\n@@ -179,6 +187,7 @@ pub fn peerlistener_tick() -> PeerListener {\nlisten_to_available_ifaces(&mut pl);\nset_pl(pl.clone());\n+ info!(\"We set the PL struct to : {:?}\", pl);\npl\n}\n@@ -255,7 +264,7 @@ impl ListenInterface {\n/// send UDP ImHere messages over IPV6 link local\nfn send_im_here(interfaces: &mut HashMap<String, ListenInterface>) {\n- trace!(\"About to send ImHere\");\n+ info!(\"About to send ImHere messages\");\nfor obj in interfaces.iter_mut() {\nlet listen_interface = obj.1;\ninfo!(\n@@ -268,19 +277,24 @@ fn send_im_here(interfaces: &mut HashMap<String, ListenInterface>) {\n.send_to(&message.encode(), listen_interface.multicast_socketaddr);\ntrace!(\"Sending ImHere to broadcast gets {:?}\", result);\nif result.is_err() {\n- info!(\"Sending ImHere failed with {:?}\", result);\n+ info!(\n+ \"Sending ImHere to {:?} failed with {:?}\",\n+ listen_interface.ifname, result\n+ );\n}\n}\n+ info!(\"Done sending ImHere this tick\");\n}\n/// receive UDP ImHere messages over IPV6 link local\nfn receive_im_here(\ninterfaces: &mut HashMap<String, ListenInterface>,\n) -> (HashMap<IpAddr, Peer>, HashMap<SocketAddr, String>) {\n- info!(\"About to dequeue ImHere\");\n+ info!(\"About to receive ImHere\");\nlet mut output = HashMap::<IpAddr, Peer>::new();\nlet mut interface_map = HashMap::<SocketAddr, String>::new();\nfor obj in interfaces.iter_mut() {\n+ info!(\"PEER LISTENER: Looking at imHere on interface: {:?}\", obj.0);\nlet listen_interface = obj.1;\n// Since the only datagrams we are interested in are very small (22 bytes plus overhead)\n// this buffer is kept intentionally small to discard larger packets earlier rather than later\n@@ -304,12 +318,12 @@ fn receive_im_here(\nlet ipaddr = match PeerMessage::decode(datagram.as_ref()) {\nOk(PeerMessage::ImHere(ipaddr)) => ipaddr,\nErr(e) => {\n- warn!(\"ImHere decode failed: {:?}\", e);\n+ error!(\"ImHere decode failed: {:?}\", e);\ncontinue;\n}\n_ => {\nerror!(\"Received Hello on multicast socket, Error\");\n- panic!(\"Should not receive Hello message on multicast socket\");\n+ continue;\n}\n};\n@@ -331,6 +345,11 @@ fn receive_im_here(\ninterface_map.insert(peer.contact_socket, listen_interface.ifname.clone());\n}\n}\n+ info!(\"Done receiving im here messages\");\n+ info!(\n+ \"Setting Peers and interface map to : {:?}\\n\\n {:?}\",\n+ output, interface_map\n+ );\n(output, interface_map)\n}\n@@ -352,7 +371,7 @@ pub fn send_hello(msg: &Hello, socket: &UdpSocket, send_addr: SocketAddr, sender\n/// receive UDP hello messages over IPV6 link local ports\npub fn receive_hello(writer: &mut PeerListener) {\n- info!(\"Dequeing Hello\");\n+ info!(\"Receiving Hellos\");\nfor obj in writer.interfaces.iter_mut() {\nlet listen_interface = obj.1;\n@@ -392,7 +411,7 @@ pub fn receive_hello(writer: &mut PeerListener) {\nmatch PeerMessage::decode(&encoded_msg) {\nOk(PeerMessage::ImHere(_ipaddr)) => {\nerror!(\"Should not revceive Im Here on linklocal socket, Error\");\n- panic!(\"Received an ImHere message on a linkLocal socket\")\n+ continue;\n}\nOk(PeerMessage::Hello {\nmy_id,\n@@ -464,4 +483,5 @@ pub fn receive_hello(writer: &mut PeerListener) {\n};\n}\n}\n+ info!(\"Done receiving hellos\");\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": "@@ -163,31 +163,37 @@ pub fn peer_discovery_loop() {\nwhile let Err(e) = {\nthread::spawn(move || loop {\nlet start = Instant::now();\n- trace!(\"Common peer discovery tick!\");\n+ info!(\"Common peer discovery tick!\");\nlet runner = AsyncSystem::new();\nrunner.block_on(async move {\n- trace!(\"Getting Peers from PeerListener to pass to TunnelManager\");\n-\n- let start = Instant::now();\n+ let measure_tick = Instant::now();\ninfo!(\"Starting PeerListener tick\");\nlet pl_copy = peerlistener_tick();\ninfo!(\n\"PeerListener tick completed in {}s {}ms\",\n- start.elapsed().as_secs(),\n- start.elapsed().subsec_millis(),\n+ measure_tick.elapsed().as_secs(),\n+ measure_tick.elapsed().subsec_millis(),\n);\n+ info!(\"Starting TM contact peers\");\n// Contact manual peers\ntm_contact_peers(pl_copy).await;\n+ info!(\"Done contacting peers\");\n});\n// sleep until it has been FAST_LOOP_SPEED seconds from start, whenever that may be\n// if it has been more than FAST_LOOP_SPEED seconds from start, go right ahead\n+ info!(\"Peer Listener loop elapsed in = {:?}\", start.elapsed());\nif start.elapsed() < FAST_LOOP_SPEED {\n+ info!(\n+ \"Peer listener sleeping for {:?}\",\n+ FAST_LOOP_SPEED - start.elapsed()\n+ );\nthread::sleep(FAST_LOOP_SPEED - start.elapsed());\n}\n+ info!(\"Peer Listener sleeping Done!\");\n})\n.join()\n} {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Peer Listener Logging PR
20,255
22.09.2022 09:31:21
25,200
eedb144850444b1d91fcebb69568b2b3931fad81
Remove explicit uci panics
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/ip_addr.rs", "new_path": "althea_kernel_interface/src/ip_addr.rs", "diff": "@@ -49,18 +49,31 @@ impl dyn KernelInterface {\n/// to /etc/network/addr. SLAAC takes this ip and assigns a /64 to hosts that connect\n/// to the router\npub fn setup_ipv6_slaac(&self, router_ipv6_str: IpNetwork) {\n- let output = self\n- .run_command(\"uci\", &[\"get\", \"network.lan.ip6addr\"])\n- .unwrap();\n+ let output = match self.run_command(\"uci\", &[\"get\", \"network.lan.ip6addr\"]) {\n+ Ok(a) => a,\n+ Err(e) => {\n+ error!(\"uci get network.lan.ip6addr failed. Unable to setup ipv6 subnet correctly: {:?}\", e);\n+ return;\n+ }\n+ };\nmatch String::from_utf8(output.stdout) {\nOk(a) => {\n- if a.is_empty() || {\n+ if a.is_empty()\n+ || {\nrouter_ipv6_str\n- != a.replace('\\n', \"\")\n- .parse::<IpNetwork>()\n- .expect(\"This should be a valid network\")\n- } {\n+ != {\n+ let val = a.replace('\\n', \"\").parse::<IpNetwork>();\n+ match val {\n+ Ok(a) => a,\n+ Err(e) => {\n+ error!(\"This should be a valid network! Unable to setup ipv6 subnet correctly: {:?}\", e);\n+ return;\n+ }\n+ }\n+ }\n+ }\n+ {\nlet mut append_str = \"network.lan.ip6addr=\".to_owned();\nappend_str.push_str(&router_ipv6_str.to_string());\nlet res1 = self.run_command(\"uci\", &[\"set\", &append_str]);\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove explicit uci panics
20,255
04.10.2022 12:43:07
25,200
50301d8541811a43137685d0246a6f35b35b4828
Added code that checks that tunnels present in rita are being monitored by babel Sometimes due to babel restarting under rita, babel loses all interfaces it monitors leading to communication issues. This commits checks every loop for interfaces that are not being monitored and re-monitors them with babel.
[ { "change_type": "MODIFY", "old_path": "rita_common/src/rita_loop/slow_loop.rs", "new_path": "rita_common/src/rita_loop/slow_loop.rs", "diff": "use crate::simulated_txfee_manager::tick_simulated_tx;\nuse crate::token_bridge::tick_token_bridge;\n+use crate::tunnel_manager::tm_monitor_check;\nuse actix_async::System as AsyncSystem;\nuse babel_monitor::open_babel_stream;\n+use babel_monitor::parse_interfaces;\nuse babel_monitor::set_local_fee;\nuse babel_monitor::set_metric_factor;\nuse std::thread;\n@@ -37,6 +39,13 @@ pub fn start_rita_slow_loop() {\nset_babel_price();\ninfo!(\"Common Slow tick completed!\");\n+ // This checks that all tunnels are attached to babel. This may not be the case when babel restarts\n+ let babel_port = settings::get_rita_common().network.babel_port;\n+ if let Ok(mut stream) = open_babel_stream(babel_port, SLOW_LOOP_TIMEOUT) {\n+ let babel_interfaces = parse_interfaces(&mut stream);\n+ tm_monitor_check(&babel_interfaces);\n+ }\n+\n// sleep until it has been SLOW_LOOP_SPEED seconds from start, whenever that may be\n// if it has been more than SLOW_LOOP_SPEED seconds from start, go right ahead\nif start.elapsed() < SLOW_LOOP_SPEED {\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/tunnel_manager/mod.rs", "new_path": "rita_common/src/tunnel_manager/mod.rs", "diff": "@@ -22,7 +22,9 @@ use babel_monitor::monitor;\nuse babel_monitor::open_babel_stream;\nuse babel_monitor::unmonitor;\nuse babel_monitor::BabelMonitorError;\n+use babel_monitor::Interface;\nuse std::collections::HashMap;\n+use std::collections::HashSet;\nuse std::collections::VecDeque;\nuse std::fmt;\nuse std::fmt::Display;\n@@ -299,6 +301,36 @@ impl Neighbor {\n}\n}\n+/// This function goes through all tunnels preset in rita memory and add them to babel is they are not present already\n+pub fn tm_monitor_check(interface: &Result<Vec<Interface>, BabelMonitorError>) {\n+ let empty = &vec![];\n+ let interface_list: &Vec<Interface> = if interface.is_ok() {\n+ interface.as_ref().unwrap()\n+ } else {\n+ empty\n+ };\n+\n+ // Hashset of all interface names. This allows for an O(n) search instead of O(n^2)\n+ let mut interface_map: HashSet<String> = HashSet::new();\n+ for int in interface_list {\n+ interface_map.insert(int.name.clone());\n+ }\n+\n+ let rita_tunnels = &TUNNEL_MANAGER.read().unwrap().tunnels;\n+ for (_, tunnels) in rita_tunnels.iter() {\n+ for tun in tunnels.iter() {\n+ if !interface_map.contains(&tun.iface_name) {\n+ info!(\n+ \"Babel was not monitored a tunnel, Readding the tunnel: {:?}\",\n+ tun.iface_name\n+ );\n+ let res = tun.monitor();\n+ error!(\"Unable to re-add tunnel to babel with: {:?}\", res);\n+ }\n+ }\n+ }\n+}\n+\npub fn tm_get_neighbors() -> Vec<Neighbor> {\nlet tunnel_manager = get_tunnel_manager();\nlet mut res = Vec::new();\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Added code that checks that tunnels present in rita are being monitored by babel Sometimes due to babel restarting under rita, babel loses all interfaces it monitors leading to communication issues. This commits checks every loop for interfaces that are not being monitored and re-monitors them with babel.
20,255
26.07.2022 12:43:45
25,200
e17b637d64db842dca5bbb114bf7ad387d4f4c13
Add wg_exit_new for backwards compatibility This is the first step to give exits instances unique identities. This allows for older clients to connect to exits normally with a single ip, while newer clients can connect to a newer interfaces which allows for exit switching
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/exit_server_tunnel.rs", "new_path": "althea_kernel_interface/src/exit_server_tunnel.rs", "diff": "@@ -22,12 +22,13 @@ impl dyn KernelInterface {\nclients: &HashSet<ExitClient>,\nlisten_port: u16,\nprivate_key_path: &str,\n+ if_name: &str,\n) -> Result<(), Error> {\nlet command = \"wg\".to_string();\nlet mut args = vec![\n\"set\".into(),\n- \"wg_exit\".into(),\n+ if_name.into(),\n\"listen-port\".into(),\nformat!(\"{}\", listen_port),\n\"private-key\".into(),\n@@ -61,26 +62,23 @@ impl dyn KernelInterface {\nself.run_command(&command, &arg_str[..])?;\n- let wg_peers = self.get_peers(\"wg_exit\")?;\n- info!(\"wg_exit has {} peers\", wg_peers.len());\n+ let wg_peers = self.get_peers(if_name)?;\n+ info!(\"{} has {} peers\", if_name, wg_peers.len());\nfor i in wg_peers {\nif !client_pubkeys.contains(&i) {\nwarn!(\"Removing no longer authorized peer {}\", i);\n- self.run_command(\n- \"wg\",\n- &[\"set\", \"wg_exit\", \"peer\", &format!(\"{}\", i), \"remove\"],\n- )?;\n+ self.run_command(\"wg\", &[\"set\", if_name, \"peer\", &format!(\"{}\", i), \"remove\"])?;\n}\n}\n// setup traffic classes for enforcement with flow id's derived from the ip\n// only get the flows list once\n- let flows = self.get_flows(\"wg_exit\")?;\n+ let flows = self.get_flows(if_name)?;\nfor c in clients.iter() {\nmatch c.internal_ip {\nIpAddr::V4(addr) => {\nif !self.has_flow_bulk(addr, &flows) {\n- self.create_flow_by_ip(\"wg_exit\", addr)?\n+ self.create_flow_by_ip(if_name, addr)?\n}\n}\n_ => panic!(\"Could not derive ipv4 addr for client! Corrupt DB!\"),\n@@ -92,7 +90,12 @@ impl dyn KernelInterface {\n/// This function adds a route for each client subnet to the ipv6 routing table\n/// through wg_exit\n- pub fn setup_client_routes(&self, client_ipv6_list: String, client_mesh: String) {\n+ pub fn setup_client_routes(\n+ &self,\n+ client_ipv6_list: String,\n+ client_mesh: String,\n+ interface: &str,\n+ ) {\nif client_ipv6_list.is_empty() {\nreturn;\n}\n@@ -104,7 +107,7 @@ impl dyn KernelInterface {\nif let Ok(ip_net) = ip.parse::<IpNetwork>() {\nlet _res = self.run_command(\n\"ip\",\n- &[\"-6\", \"route\", \"add\", &ip_net.to_string(), \"dev\", \"wg_exit\"],\n+ &[\"-6\", \"route\", \"add\", &ip_net.to_string(), \"dev\", interface],\n);\n} else {\nerror!(\"IPV6 Error: Invalid client database state. Client with mesh ip: {:?} has invalid database ipv6 list: {:?}\", client_mesh, client_ipv6_list);\n@@ -119,6 +122,7 @@ impl dyn KernelInterface {\nnetmask: u8,\nexit_mesh: IpAddr,\nexternal_nic: String,\n+ interface: &str,\n) -> Result<(), Error> {\nlet _output = self.run_command(\n\"ip\",\n@@ -127,7 +131,7 @@ impl dyn KernelInterface {\n\"add\",\n&format!(\"{}/{}\", local_ip, netmask),\n\"dev\",\n- \"wg_exit\",\n+ interface,\n],\n)?;\n@@ -141,7 +145,7 @@ impl dyn KernelInterface {\n\"add\",\n&format!(\"{}/64\", local_link),\n\"dev\",\n- \"wg_exit\",\n+ interface,\n],\n)?;\n@@ -153,7 +157,7 @@ impl dyn KernelInterface {\n\"-A\",\n\"FORWARD\",\n\"-i\",\n- \"wg_exit\",\n+ interface,\n\"-o\",\n&external_nic,\n\"-j\",\n@@ -162,7 +166,10 @@ impl dyn KernelInterface {\n)\n.is_err()\n{\n- error!(\"IPV6 ERROR: uanble to set ip6table rules: wg_exit to ex_nic\");\n+ error!(\n+ \"IPV6 ERROR: uanble to set ip6table rules: {:?} to ex_nic\",\n+ interface\n+ );\n}\nif self\n@@ -174,17 +181,20 @@ impl dyn KernelInterface {\n\"-i\",\n&external_nic,\n\"-o\",\n- \"wg_exit\",\n+ interface,\n\"-j\",\n\"ACCEPT\",\n],\n)\n.is_err()\n{\n- error!(\"IPV6 ERROR: uanble to set ip6table rules: ex_nic to wg_Exit\");\n+ error!(\n+ \"IPV6 ERROR: uanble to set ip6table rules: ex_nic to {:?}\",\n+ interface\n+ );\n}\n- let output = self.run_command(\"ip\", &[\"link\", \"set\", \"dev\", \"wg_exit\", \"mtu\", \"1340\"])?;\n+ let output = self.run_command(\"ip\", &[\"link\", \"set\", \"dev\", interface, \"mtu\", \"1340\"])?;\nif !output.stderr.is_empty() {\nreturn Err(KernelInterfaceError::RuntimeError(format!(\n\"received error adding wg link: {}\",\n@@ -192,7 +202,7 @@ impl dyn KernelInterface {\n)));\n}\n- let output = self.run_command(\"ip\", &[\"link\", \"set\", \"dev\", \"wg_exit\", \"up\"])?;\n+ let output = self.run_command(\"ip\", &[\"link\", \"set\", \"dev\", interface, \"up\"])?;\nif !output.stderr.is_empty() {\nreturn Err(KernelInterfaceError::RuntimeError(format!(\n\"received error setting wg interface up: {}\",\n@@ -202,16 +212,16 @@ impl dyn KernelInterface {\n// this creates the root classful htb limit for which we will make\n// subclasses to enforce payment\n- if !self.has_limit(\"wg_exit\")? {\n+ if !self.has_limit(interface)? {\ninfo!(\"Setting up root HTB qdisc, this should only run once\");\n- self.create_root_classful_limit(\"wg_exit\")\n+ self.create_root_classful_limit(interface)\n.expect(\"Failed to setup root HTB qdisc!\");\n}\nOk(())\n}\n- pub fn setup_nat(&self, external_interface: &str) -> Result<(), Error> {\n+ pub fn setup_nat(&self, external_interface: &str, interface: &str) -> Result<(), Error> {\nself.add_iptables_rule(\n\"iptables\",\n&[\n@@ -238,7 +248,7 @@ impl dyn KernelInterface {\n\"-o\",\nexternal_interface,\n\"-i\",\n- \"wg_exit\",\n+ interface,\n\"-j\",\n\"ACCEPT\",\n],\n@@ -253,7 +263,7 @@ impl dyn KernelInterface {\n\"-A\",\n\"FORWARD\",\n\"-o\",\n- \"wg_exit\",\n+ interface,\n\"-i\",\nexternal_interface,\n\"-m\",\n" }, { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/setup_wg_if.rs", "new_path": "althea_kernel_interface/src/setup_wg_if.rs", "diff": "@@ -75,8 +75,8 @@ impl dyn KernelInterface {\n}\n/// Returns the number of clients that are active on the wg_exit tunnel\n- pub fn get_wg_exit_clients_online(&self) -> Result<u32, Error> {\n- let output = self.run_command(\"wg\", &[\"show\", \"wg_exit\", \"latest-handshakes\"])?;\n+ pub fn get_wg_exit_clients_online(&self, interface: &str) -> Result<u32, Error> {\n+ let output = self.run_command(\"wg\", &[\"show\", interface, \"latest-handshakes\"])?;\nlet mut num: u32 = 0;\nlet out = String::from_utf8(output.stdout)?;\nfor line in out.lines() {\n@@ -194,7 +194,7 @@ fn test_get_wg_exit_clients_online() {\n}\n}));\n- assert_eq!(KI.get_wg_exit_clients_online().unwrap(), 1);\n+ assert_eq!(KI.get_wg_exit_clients_online(\"wg_exit\").unwrap(), 1);\n}\n#[test]\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/database/mod.rs", "new_path": "rita_exit/src/database/mod.rs", "diff": "@@ -27,6 +27,7 @@ use crate::RitaExitError;\nuse althea_kernel_interface::ExitClient;\nuse althea_types::Identity;\n+use althea_types::WgKey;\nuse althea_types::{ExitClientDetails, ExitClientIdentity, ExitDetails, ExitState, ExitVerifMode};\nuse diesel::prelude::PgConnection;\n@@ -41,6 +42,7 @@ use std::collections::HashSet;\nuse std::net::IpAddr;\nuse std::time::Duration;\nuse std::time::Instant;\n+use std::time::SystemTime;\nuse crate::EXIT_ALLOWED_COUNTRIES;\nuse crate::EXIT_DESCRIPTION;\n@@ -362,9 +364,6 @@ pub fn setup_clients(\n(true, Err(e)) => warn!(\"Error converting {:?} to exit client {:?}\", c, e),\n(false, _) => trace!(\"{:?} is not verified, not adding to wg_exit\", c),\n}\n-\n- // Setup or verify that an ipv6 route exists for each client\n- KI.setup_client_routes(c.internet_ipv6.clone(), c.mesh_ip.clone())\n}\ntrace!(\"converted clients {:?}\", wg_clients);\n@@ -381,8 +380,35 @@ pub fn setup_clients(\n&wg_clients,\nsettings::get_rita_exit().exit_network.wg_tunnel_port,\n&settings::get_rita_exit().exit_network.wg_private_key_path,\n+ \"wg_exit\",\n+ );\n+\n+ // Setup new tunnels\n+ let exit_status_new = KI.set_exit_wg_config(\n+ &wg_clients,\n+ settings::get_rita_exit().exit_network.wg_new_tunnel_port,\n+ &settings::get_rita_exit().network.wg_private_key_path,\n+ \"wg_exit_new\",\n);\n+ // Setup or verify that an ipv6 route exists for each client\n+ let new_wg_exit_clients: HashMap<WgKey, SystemTime> = KI\n+ .get_last_handshake_time(\"wg_exit_new\")\n+ .expect(\"There should be a new wg_exit interface\")\n+ .into_iter()\n+ .collect();\n+ let wg_exit_clients: HashMap<WgKey, SystemTime> = KI\n+ .get_last_handshake_time(\"wg_exit\")\n+ .expect(\"There should be a wg_exit interface\")\n+ .into_iter()\n+ .collect();\n+\n+ for c in clients_list.iter() {\n+ let interface =\n+ get_client_interface(c, new_wg_exit_clients.clone(), wg_exit_clients.clone())?;\n+ KI.setup_client_routes(c.internet_ipv6.clone(), c.mesh_ip.clone(), &interface)\n+ }\n+\nmatch exit_status {\nOk(_) => trace!(\"Successfully setup Exit WG!\"),\nErr(e) => warn!(\n@@ -392,6 +418,15 @@ pub fn setup_clients(\ne\n),\n}\n+ match exit_status_new {\n+ Ok(_) => trace!(\"Successfully setup Exit WG NEW!\"),\n+ Err(e) => warn!(\n+ \"Error in Exit WG NEW setup {:?},\n+ this usually happens when a Rita service is\n+ trying to auto restart in the background\",\n+ e\n+ ),\n+ }\ninfo!(\n\"exit setup loop completed in {}s {}ms with {} clients and {} wg_clients\",\nstart.elapsed().as_secs(),\n@@ -402,6 +437,33 @@ pub fn setup_clients(\nOk(wg_clients)\n}\n+pub fn get_client_interface(\n+ c: &exit_db::models::Client,\n+ new_wg_exit_clients: HashMap<WgKey, SystemTime>,\n+ wg_exit_clients: HashMap<WgKey, SystemTime>,\n+) -> Result<String, RitaExitError> {\n+ match (\n+ new_wg_exit_clients.get(&c.wg_pubkey.parse()?),\n+ wg_exit_clients.get(&c.wg_pubkey.parse()?),\n+ ) {\n+ (Some(_), None) => Ok(\"wg_exit_new\".into()),\n+ (None, Some(_)) => Ok(\"wg_exit\".into()),\n+ (Some(new), Some(old)) => {\n+ if new > old {\n+ Ok(\"wg_exit_new\".into())\n+ } else {\n+ Ok(\"wg_exit\".into())\n+ }\n+ }\n+ _ => {\n+ error!(\"WG EXIT SETUP: Wg Exit not setup correctly. Client {}, does not have handshake with any wg exit interface\", c.wg_pubkey);\n+ Err(RitaExitError::MiscStringError(\n+ \"Unable to find client interface\".to_string(),\n+ ))\n+ }\n+ }\n+}\n+\n/// Performs enforcement actions on clients by requesting a list of clients from debt keeper\n/// if they are also a exit client they are limited to the free tier level of bandwidth by\n/// setting the htb class they are assigned to to a maximum speed of the free tier value.\n@@ -444,6 +506,17 @@ pub fn enforce_exit_clients(\nreturn Ok(new_debt_actions);\n}\n+ let new_wg_exit_clients: HashMap<WgKey, SystemTime> = KI\n+ .get_last_handshake_time(\"wg_exit_new\")\n+ .expect(\"There should be a new wg_exit interface\")\n+ .into_iter()\n+ .collect();\n+ let wg_exit_clients: HashMap<WgKey, SystemTime> = KI\n+ .get_last_handshake_time(\"wg_exit\")\n+ .expect(\"There should be a new wg_exit interface\")\n+ .into_iter()\n+ .collect();\n+\nfor debt_entry in list.iter() {\nmatch clients_by_id.get(&debt_entry.identity) {\nSome(client) => {\n@@ -452,10 +525,20 @@ pub fn enforce_exit_clients(\nlet res = if debt_entry.payment_details.action == DebtAction::SuspendTunnel\n{\ninfo!(\"Exit is enforcing on {} because their debt of {} is greater than the limit of {}\", client.wg_pubkey, debt_entry.payment_details.debt, close_threshold);\n- KI.set_class_limit(\"wg_exit\", free_tier_limit, free_tier_limit, ip)\n+ let interface = get_client_interface(\n+ client,\n+ new_wg_exit_clients.clone(),\n+ wg_exit_clients.clone(),\n+ )?;\n+ KI.set_class_limit(&interface, free_tier_limit, free_tier_limit, ip)\n} else {\n// 10gbit rate and ceil value's we don't want to limit this\n- KI.set_class_limit(\"wg_exit\", 10_000_000, 10_000_000, ip)\n+ let interface = get_client_interface(\n+ client,\n+ new_wg_exit_clients.clone(),\n+ wg_exit_clients.clone(),\n+ )?;\n+ KI.set_class_limit(&interface, 10_000_000, 10_000_000, ip)\n};\nif res.is_err() {\nerror!(\"Failed to limit {} with {:?}\", ip, res);\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/rita_loop/mod.rs", "new_path": "rita_exit/src/rita_loop/mod.rs", "diff": "@@ -220,26 +220,46 @@ fn check_regions(start: Instant, clients_list: Vec<models::Client>, conn: &PgCon\n}\nfn setup_exit_wg_tunnel() {\n+ // Setup legacy wg_exit\nif let Err(e) = KI.setup_wg_if_named(\"wg_exit\") {\nwarn!(\"exit setup returned {}\", e)\n}\n- KI.one_time_exit_setup(\n- &settings::get_rita_exit()\n+ // Setup new wg_exit\n+ if let Err(e) = KI.setup_wg_if_named(\"wg_exit_new\") {\n+ warn!(\"new exit setup returned {}\", e)\n+ }\n+\n+ let local_ip = &settings::get_rita_exit()\n.exit_network\n.own_internal_ip\n- .into(),\n- settings::get_rita_exit().exit_network.netmask,\n- settings::get_rita_exit()\n+ .into();\n+ let netmask = settings::get_rita_exit().exit_network.netmask;\n+ let mesh_ip = settings::get_rita_exit()\n.network\n.mesh_ip\n- .expect(\"Expected a mesh ip for this exit\"),\n- settings::get_rita_exit()\n+ .expect(\"Expected a mesh ip for this exit\");\n+ let ex_nic = settings::get_rita_exit()\n.network\n.external_nic\n- .expect(\"Expected an external nic here\"),\n- )\n+ .expect(\"Expected an external nic here\");\n+\n+ // Setup legacy wg_exit\n+ KI.one_time_exit_setup(local_ip, netmask, mesh_ip, ex_nic.clone(), \"wg_exit\")\n.expect(\"Failed to setup wg_exit!\");\n- KI.setup_nat(&settings::get_rita_exit().network.external_nic.unwrap())\n+\n+ // Setup new wg_exit\n+ KI.one_time_exit_setup(local_ip, netmask, mesh_ip, ex_nic, \"wg_exit_new\")\n+ .expect(\"Failed to setup wg_exit_new!\");\n+\n+ KI.setup_nat(\n+ &settings::get_rita_exit().network.external_nic.unwrap(),\n+ \"wg_exit\",\n+ )\n+ .unwrap();\n+ KI.setup_nat(\n+ &settings::get_rita_exit().network.external_nic.unwrap(),\n+ \"wg_exit_new\",\n+ )\n.unwrap();\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/traffic_watcher/mod.rs", "new_path": "rita_exit/src/traffic_watcher/mod.rs", "diff": "@@ -114,6 +114,7 @@ fn generate_helper_maps(our_id: &Identity, clients: &[Identity]) -> HelperMapRet\nfn counters_logging(\ncounters: &HashMap<WgKey, WgUsage>,\n+ new_counters: &HashMap<WgKey, WgUsage>,\nhistory: &HashMap<WgKey, WgUsage>,\nexit_fee: u32,\n) {\n@@ -130,6 +131,16 @@ fn counters_logging(\n}\n}\n+ for entry in new_counters.iter() {\n+ let key = entry.0;\n+ let val = entry.1;\n+ if let Some(history_val) = history.get(key) {\n+ let moved_bytes = val.download - history_val.download;\n+ trace!(\"Exit accounted {} uploaded {} bytes\", key, moved_bytes,);\n+ total_in += moved_bytes;\n+ }\n+ }\n+\ninfo!(\"Total Exit input of {} bytes this round\", total_in);\nlet mut total_out: u64 = 0;\n@@ -143,6 +154,16 @@ fn counters_logging(\n}\n}\n+ for entry in new_counters.iter() {\n+ let key = entry.0;\n+ let val = entry.1;\n+ if let Some(history_val) = history.get(key) {\n+ let moved_bytes = val.upload - history_val.upload;\n+ trace!(\"Exit accounted {} downloaded {} bytes\", key, moved_bytes);\n+ total_out += moved_bytes;\n+ }\n+ }\n+\nupdate_usage_data(UpdateUsage {\nkind: UsageType::Exit,\nup: total_out,\n@@ -163,8 +184,12 @@ fn debts_logging(debts: &HashMap<Identity, i128>) {\n}\ninfo!(\"Total exit income of {:?} Wei this round\", total_income);\n- match KI.get_wg_exit_clients_online() {\n- Ok(users) => info!(\"Total of {} users online\", users),\n+ match KI.get_wg_exit_clients_online(\"wg_exit\") {\n+ Ok(users) => info!(\"Total of {} wg_exit users online\", users),\n+ Err(e) => warn!(\"Getting clients failed with {:?}\", e),\n+ }\n+ match KI.get_wg_exit_clients_online(\"wg_exit_new\") {\n+ Ok(users) => info!(\"Total of {} wg_exit_new users online\", users),\nErr(e) => warn!(\"Getting clients failed with {:?}\", e),\n}\n}\n@@ -202,10 +227,22 @@ pub fn watch(\n}\n};\n+ let new_counters = match KI.read_wg_counters(\"wg_exit_new\") {\n+ Ok(res) => res,\n+ Err(e) => {\n+ warn!(\n+ \"Error getting input counters {:?} traffic has gone unaccounted!\",\n+ e\n+ );\n+ return Err(e.into());\n+ }\n+ };\n+\n// creates new usage entires does not actualy update the values\nprepare_usage_history(&counters, usage_history);\n+ prepare_usage_history(&new_counters, usage_history);\n- counters_logging(&counters, usage_history, our_price as u32);\n+ counters_logging(&counters, &new_counters, usage_history, our_price as u32);\nlet mut debts = HashMap::new();\n@@ -214,6 +251,8 @@ pub fn watch(\ndebts.insert(ident, 0i128);\n}\n+ let counters: HashMap<WgKey, WgUsage> = merge_counters(&counters, &new_counters);\n+\n// accounting for 'input'\nfor (wg_key, bytes) in counters.clone() {\nlet state = (\n@@ -286,3 +325,38 @@ pub fn watch(\nOk(())\n}\n+\n+/// This function merges two counter maps for wg_exit and wg_exit_new for combined accounting\n+fn merge_counters(\n+ old_counters: &HashMap<WgKey, WgUsage>,\n+ new_counters: &HashMap<WgKey, WgUsage>,\n+) -> HashMap<WgKey, WgUsage> {\n+ let mut ret: HashMap<WgKey, WgUsage> = HashMap::new();\n+ ret.extend(old_counters);\n+ for (k, e) in new_counters {\n+ if ret.contains_key(k) {\n+ let mut usage = *ret.get(k).unwrap();\n+ usage.upload += e.upload;\n+ usage.download += e.download;\n+ ret.insert(*k, usage);\n+ } else {\n+ ret.insert(*k, *e);\n+ }\n+ }\n+ ret\n+}\n+\n+#[test]\n+fn test_merge_counters() {\n+ let mut ret = HashMap::new();\n+ let mut map1: HashMap<&str, &str> = HashMap::new();\n+ map1.insert(\"a\", \"asdf\");\n+\n+ let mut map2: HashMap<&str, &str> = HashMap::new();\n+ map2.insert(\"b\", \"asdfasdf\");\n+\n+ ret.extend(map1);\n+ ret.extend(map2);\n+\n+ println!(\"{:?}\", ret);\n+}\n" }, { "change_type": "MODIFY", "old_path": "settings/example_exit.toml", "new_path": "settings/example_exit.toml", "diff": "@@ -34,6 +34,7 @@ dao_addresses = []\n[exit_network]\nwg_tunnel_port = 59999\n+wg_new_tunnel_port = 59998\nexit_hello_port = 4875\nexit_price = 50\nown_internal_ip = \"172.168.1.254\"\n" }, { "change_type": "MODIFY", "old_path": "settings/src/exit.rs", "new_path": "settings/src/exit.rs", "diff": "@@ -18,6 +18,7 @@ pub struct ExitNetworkSettings {\npub exit_hello_port: u16,\n/// This is the port which the exit tunnel listens on\npub wg_tunnel_port: u16,\n+ pub wg_new_tunnel_port: u16,\n/// Price in wei per byte which is charged to traffic both coming in and out over the internet\npub exit_price: u64,\n/// This is the exit's own ip/gateway ip in the exit wireguard tunnel\n@@ -56,6 +57,7 @@ impl ExitNetworkSettings {\nExitNetworkSettings {\nexit_hello_port: 4875,\nwg_tunnel_port: 59999,\n+ wg_new_tunnel_port: 59998,\nexit_price: 10,\nown_internal_ip: \"172.16.255.254\".parse().unwrap(),\nexit_start_ip: \"172.16.0.0\".parse().unwrap(),\n" }, { "change_type": "MODIFY", "old_path": "settings/test_exit.toml", "new_path": "settings/test_exit.toml", "diff": "@@ -30,6 +30,7 @@ default_route = []\n[exit_network]\nwg_tunnel_port = 59999\n+wg_new_tunnel_port = 59998\nexit_hello_port = 4875\nexit_price = 50\nown_internal_ip = \"172.168.1.254\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add wg_exit_new for backwards compatibility This is the first step to give exits instances unique identities. This allows for older clients to connect to exits normally with a single ip, while newer clients can connect to a newer interfaces which allows for exit switching
20,255
04.08.2022 11:37:38
25,200
f8dec26d92664c3924ed679e488cb36499eb4f28
Configure exit switcher to use a list of exit identities instead of subnetting Now that exits have unique wg keys, we hit and exit endpoint to get a list of exit indentities. We use this list to cycle through exit metrics to choose the best exit to connect to
[ { "change_type": "MODIFY", "old_path": "althea_types/src/interop.rs", "new_path": "althea_types/src/interop.rs", "diff": "@@ -255,9 +255,17 @@ pub struct EncryptedExitState {\n/// Wrapper for secure box containing a list of ips\n#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Hash, Clone)]\n-pub struct EncryptedIpList {\n+pub struct EncryptedExitList {\npub nonce: [u8; 24],\n- pub ip_list: Vec<u8>,\n+ pub exit_list: Vec<u8>,\n+}\n+\n+/// Struct returned when hitting exit_list endpoint\n+#[derive(Default, Debug, Serialize, Deserialize, PartialEq, Eq, Hash, Clone)]\n+pub struct ExitList {\n+ pub exit_list: Vec<Identity>,\n+ // All exits in a cluster listen on same port\n+ pub wg_exit_listen_port: u16,\n}\n#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Hash, Clone, Copy)]\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": "@@ -17,8 +17,8 @@ use crate::exit_manager::{\n};\nuse crate::rita_loop::CLIENT_LOOP_TIMEOUT;\nuse crate::RitaClientError;\n+use althea_types::ExitList;\nuse babel_monitor::{open_babel_stream, parse_routes, Route};\n-use ipnetwork::IpNetwork;\nuse rita_common::FAST_LOOP_SPEED;\nuse settings::client::ExitSwitchingCode;\nuse settings::client::SelectedExit;\n@@ -193,8 +193,8 @@ impl From<ExitMetrics>\n/// Look at the enum 'ExitSwitchingCode' to see all state and function 'update_metric_value' to see when these are triggered.\npub fn set_best_exit(\nexit_name: String,\n- exits: IpNetwork,\nroutes: Vec<Route>,\n+ exit_list: &ExitList,\n) -> Result<IpAddr, RitaClientError> {\nif routes.is_empty() {\nreturn Err(RitaClientError::MiscStringError(\n@@ -216,11 +216,11 @@ pub fn set_best_exit(\n// Parse all babel routes and find useful metrics\nlet exit_metrics = get_exit_metrics(\nroutes,\n- exits,\ncurrent_exit_ip,\ntracking_exit,\ncurrent_exit_ip,\ncurrent_adjusted_metric,\n+ exit_list,\nexit_map,\n);\n@@ -423,11 +423,11 @@ fn set_exit_state(\n/// 7.) Metric of the best exit during this tick\nfn get_exit_metrics(\nroutes: Vec<Route>,\n- exits: IpNetwork,\ncurrent_exit_ip: Option<IpAddr>,\ntracking_exit: Option<IpAddr>,\ninitial_best_exit: Option<IpAddr>,\ninitial_best_metric: u16,\n+ exit_list: &ExitList,\nexit_map: &mut HashMap<IpAddr, ExitTracker>,\n) -> ExitMetrics {\nlet mut best_exit = None;\n@@ -454,7 +454,7 @@ fn get_exit_metrics(\n// All babel routes are advertised as /128, so we check if each 'single' ip is part of exit subnet\nlet ip = route.prefix.ip();\n- if check_ip_in_subnet(ip, exits) && !blacklisted.contains(&ip) {\n+ if check_if_ip_in_exit_list(ip, exit_list) && !blacklisted.contains(&ip) {\n// Not all exits in subnet are blacklisted, so set bool\nall_exits_blacklisted = false;\n@@ -559,16 +559,6 @@ fn set_last_added_to_zero(exit_map: &mut HashMap<IpAddr, ExitTracker>) {\n}\n}\n-/// Helper function that checks if the provided ip address is within the subnet specified by the provided IpNetwork\n-fn check_ip_in_subnet(ip: IpAddr, exits: IpNetwork) -> bool {\n- //check that both are either V4 or V6\n- if ip.is_ipv4() != exits.is_ipv4() {\n- return false;\n- }\n-\n- exits.contains(ip)\n-}\n-\n/// Updates the current metric value during this tick in the global metric tracker. There can be several situations we can be in since there are\n/// 3 exits that we keep track of:\n///\n@@ -750,9 +740,23 @@ pub fn get_babel_routes(babel_port: u16) -> Result<Vec<Route>, RitaClientError>\nOk(routes)\n}\n+fn check_if_ip_in_exit_list(ip: IpAddr, exit_list: &ExitList) -> bool {\n+ for id in exit_list.exit_list.clone() {\n+ if ip == id.mesh_ip {\n+ return true;\n+ }\n+ }\n+\n+ false\n+}\n+\n#[cfg(test)]\nmod tests {\n+ use althea_types::{FromStr, Identity, WgKey};\n+ use clarity::Address;\n+ use ipnetwork::IpNetwork;\n+\nuse super::*;\nuse crate::exit_manager::{reset_blacklist_warnings, ExitBlacklist, MAX_BLACKLIST_STRIKES};\nuse std::net::{IpAddr, Ipv4Addr};\n@@ -955,23 +959,17 @@ mod tests {\nassert_eq!(vec.capacity(), 10);\n}\n- #[test]\n- fn test_ip_in_subnet() {\n- let subnet = IpNetwork::new(IpAddr::V4(Ipv4Addr::new(1, 1, 1, 1)), 20).unwrap();\n- let ip1 = IpAddr::V4(Ipv4Addr::new(1, 2, 1, 1));\n- let ip2 = IpAddr::V4(Ipv4Addr::new(1, 1, 7, 127));\n- let ip3 = IpAddr::V4(Ipv4Addr::new(1, 1, 20, 127));\n- let ip4 = IpAddr::V4(Ipv4Addr::new(1, 1, 1, 12));\n-\n- assert!(!check_ip_in_subnet(ip1, subnet));\n- assert!(check_ip_in_subnet(ip2, subnet));\n- assert!(!check_ip_in_subnet(ip3, subnet));\n- assert!(check_ip_in_subnet(ip4, subnet));\n+ fn test_identity(ip: IpAddr) -> Identity {\n+ Identity {\n+ mesh_ip: ip,\n+ eth_address: Address::from_str(\"0x5CC9aF89B1bf70565d75d0822027694Af38Ca017\").unwrap(),\n+ wg_public_key: WgKey::from_str(\"QkzYfnCeTp1iYKUyMjAVsmwPiemx4Yyqc83G17cebyM=\").unwrap(),\n+ nickname: None,\n+ }\n}\n#[test]\nfn test_get_exit_metrics() {\n- let subnet = IpNetwork::new(IpAddr::V4(Ipv4Addr::new(1, 1, 1, 1)), 20).unwrap();\nlet ip1 = IpAddr::V4(Ipv4Addr::new(1, 1, 1, 1));\nlet ip2 = IpAddr::V4(Ipv4Addr::new(1, 1, 1, 2));\nlet ip3 = IpAddr::V4(Ipv4Addr::new(1, 1, 1, 3));\n@@ -1039,11 +1037,14 @@ mod tests {\n// Nothing is setup yet\nlet (exit_down, _, c_e_met, _, t_e_m, b_exit, b_e_m) = get_exit_metrics(\nroutes.clone(),\n- subnet,\nNone,\nNone,\nNone,\nu16::MAX,\n+ &ExitList {\n+ exit_list: vec![test_identity(ip1), test_identity(ip2), test_identity(ip3)],\n+ wg_exit_listen_port: 0,\n+ },\n&mut exit_map,\n)\n.into();\n@@ -1056,11 +1057,14 @@ mod tests {\n// Only current exit is setup, not tracking yet\nlet (exit_down, _, c_e_met, _, t_e_m, b_exit, b_e_m) = get_exit_metrics(\nroutes.clone(),\n- subnet,\nSome(ip1),\nNone,\nSome(ip1),\n400,\n+ &ExitList {\n+ exit_list: vec![test_identity(ip1), test_identity(ip2), test_identity(ip3)],\n+ wg_exit_listen_port: 0,\n+ },\n&mut exit_map,\n)\n.into();\n@@ -1073,11 +1077,14 @@ mod tests {\n// current and tracking at setup and different from each other and best exit\nlet (exit_down, _, c_e_met, _, t_e_m, b_exit, b_e_m) = get_exit_metrics(\nroutes.clone(),\n- subnet,\nSome(ip1),\nSome(ip2),\nSome(ip1),\n500,\n+ &ExitList {\n+ exit_list: vec![test_identity(ip1), test_identity(ip2), test_identity(ip3)],\n+ wg_exit_listen_port: 0,\n+ },\n&mut exit_map,\n)\n.into();\n@@ -1090,11 +1097,14 @@ mod tests {\n// Current and tracking are same but different from best exit\nlet (exit_down, _, c_e_met, _, t_e_m, b_exit, b_e_m) = get_exit_metrics(\nroutes.clone(),\n- subnet,\nSome(ip2),\nSome(ip2),\nSome(ip2),\n500,\n+ &ExitList {\n+ exit_list: vec![test_identity(ip1), test_identity(ip2), test_identity(ip3)],\n+ wg_exit_listen_port: 0,\n+ },\n&mut exit_map,\n)\n.into();\n@@ -1107,11 +1117,14 @@ mod tests {\n// All three exits are the same\nlet (exit_down, _, c_e_met, _, t_e_m, b_exit, b_e_m) = get_exit_metrics(\nroutes,\n- subnet,\nSome(ip3),\nSome(ip3),\nSome(ip3),\n200,\n+ &ExitList {\n+ exit_list: vec![test_identity(ip1), test_identity(ip2), test_identity(ip3)],\n+ wg_exit_listen_port: 0,\n+ },\n&mut exit_map,\n)\n.into();\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/exit_manager/mod.rs", "new_path": "rita_client/src/exit_manager/mod.rs", "diff": "@@ -29,10 +29,10 @@ use althea_kernel_interface::{\nexit_client_tunnel::ClientExitTunnelConfig, DefaultRoute, KernelInterfaceError,\n};\nuse althea_types::ExitClientDetails;\n-use althea_types::ExitDetails;\nuse althea_types::Identity;\nuse althea_types::WgKey;\nuse althea_types::{EncryptedExitClientIdentity, EncryptedExitState};\n+use althea_types::{EncryptedExitList, ExitDetails, ExitList};\nuse althea_types::{ExitClientIdentity, ExitRegistrationDetails, ExitState, ExitVerifMode};\nuse exit_switcher::{get_babel_routes, set_best_exit};\n@@ -81,6 +81,21 @@ pub struct ExitManager {\n/// It also holds information about metrics and degradation values. Look at doc comment on 'set_best_exit' for more\n/// information on what these mean\npub selected_exit_list: HashMap<String, SelectedExit>,\n+ /// Every tick we query an exit endpoint to get a list of exits in that cluster. We use this list for exit switching\n+ pub exit_list: ExitList,\n+}\n+\n+/// This functions sets the exit list ONLY IF the list arguments provived is not empty. This is need for the following edge case:\n+/// When an exit goes down, the endpoint wont repsond, so we have no exits to switch to. By setting only when we have a length > 1\n+/// we assure that we switch when an exit goes down\n+pub fn set_exit_list(list: ExitList) {\n+ if !list.exit_list.is_empty() {\n+ EXIT_MANAGER.write().unwrap().exit_list = list;\n+ }\n+}\n+\n+pub fn get_exit_list() -> ExitList {\n+ EXIT_MANAGER.read().unwrap().exit_list.clone()\n}\npub fn get_selected_exit(exit: String) -> Option<IpAddr> {\n@@ -129,9 +144,9 @@ pub fn get_em_nat() -> bool {\nfn linux_setup_exit_tunnel(\nexit: String,\n- current_exit: &ExitServer,\ngeneral_details: &ExitDetails,\nour_details: &ExitClientDetails,\n+ exit_list: &ExitList,\n) -> Result<(), RitaClientError> {\nlet mut rita_client = settings::get_rita_client();\nlet mut network = rita_client.network;\n@@ -144,12 +159,10 @@ fn linux_setup_exit_tunnel(\nreturn Err(RitaClientError::MiscStringError(v));\n}\n+ let selected_ip = get_selected_exit(exit).expect(\"There should be an exit ip here\");\nlet args = ClientExitTunnelConfig {\n- endpoint: SocketAddr::new(\n- get_selected_exit(exit).expect(\"There should be an exit ip here\"),\n- general_details.wg_exit_port,\n- ),\n- pubkey: current_exit.wg_public_key,\n+ endpoint: SocketAddr::new(selected_ip, exit_list.wg_exit_listen_port),\n+ pubkey: get_exit_pubkey(selected_ip, exit_list),\nprivate_key_path: network.wg_private_key_path.clone(),\nlisten_port: rita_client.exit_client.wg_listen_port,\nlocal_ip: our_details.client_internal_ip,\n@@ -170,6 +183,18 @@ fn linux_setup_exit_tunnel(\nOk(())\n}\n+/// From a exit list, find the corresponding wg public key of our current connected exit to\n+/// set up wg tunnels\n+fn get_exit_pubkey(ip: IpAddr, exit_list: &ExitList) -> WgKey {\n+ for id in exit_list.exit_list.clone() {\n+ if id.mesh_ip == ip {\n+ return id.wg_public_key;\n+ }\n+ }\n+\n+ panic!(\"Unable to find a valid wg key for current exit, please check that all exit Identities are properly setup on the exit\");\n+}\n+\nfn restore_nat() {\nif let Err(e) = KI.restore_client_nat() {\nerror!(\"Failed to restore client nat! {:?}\", e);\n@@ -570,6 +595,115 @@ async fn exit_status_request(exit: String) -> Result<(), RitaClientError> {\nOk(())\n}\n+async fn get_cluster_ip_list(exit: String) -> Result<ExitList, RitaClientError> {\n+ let current_exit_cluster = match settings::get_rita_client().exit_client.exits.get(&exit) {\n+ Some(current_exit) => current_exit.clone(),\n+ None => {\n+ return Err(RitaClientError::NoExitError(exit));\n+ }\n+ };\n+\n+ let exit_pubkey = current_exit_cluster.wg_public_key;\n+ let reg_details = match settings::get_rita_client().exit_client.contact_info {\n+ Some(val) => val.into(),\n+ None => {\n+ return Err(RitaClientError::MiscStringError(\n+ \"No valid details\".to_string(),\n+ ))\n+ }\n+ };\n+ let ident = ExitClientIdentity {\n+ global: match settings::get_rita_client().get_identity() {\n+ Some(id) => id,\n+ None => {\n+ return Err(RitaClientError::MiscStringError(\n+ \"Identity has no mesh IP ready yet\".to_string(),\n+ ));\n+ }\n+ },\n+ wg_port: settings::get_rita_client().exit_client.wg_listen_port,\n+ reg_details,\n+ };\n+\n+ let current_exit_ip = get_selected_exit(exit.clone());\n+ let exit_server = current_exit_ip.expect(\"There should be an exit ip here\");\n+\n+ let endpoint = format!(\n+ \"http://[{}]:{}/exit_list\",\n+ exit_server, current_exit_cluster.registration_port\n+ );\n+ let ident = encrypt_exit_client_id(&exit_pubkey.into(), ident);\n+\n+ let client = awc::Client::default();\n+ let response = client\n+ .post(&endpoint)\n+ .timeout(CLIENT_LOOP_TIMEOUT)\n+ .send_json(&ident)\n+ .await;\n+ let mut response = match response {\n+ Ok(a) => {\n+ reset_blacklist_warnings(exit_server);\n+ a\n+ }\n+ Err(awc::error::SendRequestError::Timeout) => {\n+ // Did not get a response, is it a rogue exit or some netork error?\n+ blacklist_strike_ip(exit_server, WarningType::SoftWarning);\n+ return Err(RitaClientError::SendRequestError(\n+ awc::error::SendRequestError::Timeout.to_string(),\n+ ));\n+ }\n+ Err(e) => return Err(RitaClientError::SendRequestError(e.to_string())),\n+ };\n+\n+ let value = response.json().await?;\n+\n+ match decrypt_exit_list(value, exit_pubkey.into()) {\n+ Err(e) => {\n+ blacklist_strike_ip(exit_server, WarningType::HardWarning);\n+ Err(e)\n+ }\n+ Ok(a) => {\n+ reset_blacklist_warnings(exit_server);\n+ Ok(a)\n+ }\n+ }\n+}\n+\n+fn decrypt_exit_list(\n+ exit_list: EncryptedExitList,\n+ exit_pubkey: PublicKey,\n+) -> Result<ExitList, RitaClientError> {\n+ let rita_client = settings::get_rita_client();\n+ let network_settings = rita_client.network;\n+ let our_secretkey = network_settings\n+ .wg_private_key\n+ .expect(\"No private key?\")\n+ .into();\n+ let ciphertext = exit_list.exit_list;\n+ let nonce = Nonce(exit_list.nonce);\n+ let ret: ExitList = match box_::open(&ciphertext, &nonce, &exit_pubkey, &our_secretkey) {\n+ Ok(decrypted_bytes) => match String::from_utf8(decrypted_bytes) {\n+ Ok(json_string) => match serde_json::from_str(&json_string) {\n+ Ok(ip_list) => ip_list,\n+ Err(e) => {\n+ return Err(e.into());\n+ }\n+ },\n+ Err(e) => {\n+ error!(\"Could not deserialize exit state with {:?}\", e);\n+ return Err(e.into());\n+ }\n+ },\n+ Err(_) => {\n+ error!(\"Could not decrypt exit state\");\n+ return Err(RitaClientError::MiscStringError(\n+ \"Could not decrypt exit state\".to_string(),\n+ ));\n+ }\n+ };\n+ Ok(ret)\n+}\n+\nfn correct_default_route(input: Option<DefaultRoute>) -> bool {\nmatch input {\nSome(v) => v.is_althea_default_route(),\n@@ -606,6 +740,7 @@ pub async fn exit_manager_tick() {\nSome(a) => a,\nNone => \"\".to_string(),\n};\n+\nlet last_exit = get_selected_exit(current_exit.clone());\nlet mut exits = rita_client.exit_client.exits;\n@@ -625,7 +760,6 @@ pub async fn exit_manager_tick() {\n// Logic to determnine what the best exit is and if we should switch\nlet babel_port = settings::get_rita_client().network.babel_port;\n- let exit_subnet = exit.subnet;\nlet routes = match get_babel_routes(babel_port) {\nOk(a) => a,\n@@ -635,8 +769,31 @@ pub async fn exit_manager_tick() {\n}\n};\n+ // Get cluster exit list. This is saved locally and updated every tick depending on what exit we connect to.\n+ // When it is empty, it means an exit we connected to went down, and we use the list from memory to connect to a new instance\n+ let exit_list = match get_cluster_ip_list(current_exit.clone()).await {\n+ Ok(a) => a,\n+ Err(e) => {\n+ error!(\"Exit_Switcher: Unable to get exit list: {:?}\", e);\n+ ExitList {\n+ exit_list: Vec::new(),\n+ wg_exit_listen_port: 0,\n+ }\n+ }\n+ };\n+ info!(\n+ \"Received a cluster exit list from the exit: {:?}\",\n+ exit_list\n+ );\n+ if exit_list.exit_list.is_empty() {\n+ error!(\"Exit_Switcher: Exit_list Error, it should not be empty\");\n+ }\n+ set_exit_list(exit_list);\n+\n+ // Calling set best exit function, this looks though a list of exit in a cluster, does some math, and determines what exit we should connect to\n+ let exit_list = get_exit_list();\ninfo!(\"Exit_Switcher: Calling set best exit\");\n- let selected_exit = match set_best_exit(current_exit.clone(), exit_subnet, routes) {\n+ let selected_exit = match set_best_exit(current_exit.clone(), routes, &exit_list) {\nOk(a) => Some(a),\nErr(e) => {\nwarn!(\"Found no exit yet : {}\", e);\n@@ -662,9 +819,9 @@ pub async fn exit_manager_tick() {\ntrace!(\"Exit change, setting up exit tunnel\");\nlinux_setup_exit_tunnel(\ncurrent_exit,\n- exit,\n&general_details.clone(),\nexit.info.our_details().unwrap(),\n+ &exit_list,\n)\n.expect(\"failure setting up exit tunnel\");\nset_em_nat(true);\n@@ -673,9 +830,9 @@ pub async fn exit_manager_tick() {\ntrace!(\"DHCP overwrite setup exit tunnel again\");\nlinux_setup_exit_tunnel(\ncurrent_exit,\n- exit,\n&general_details.clone(),\nexit.info.our_details().unwrap(),\n+ &exit_list,\n)\n.expect(\"failure setting up exit tunnel\");\nset_em_nat(true);\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/network_endpoints/mod.rs", "new_path": "rita_exit/src/network_endpoints/mod.rs", "diff": "@@ -13,11 +13,11 @@ use actix::SystemService;\n#[cfg(feature = \"development\")]\nuse actix_web::AsyncResponder;\nuse actix_web_async::{http::StatusCode, web::Json, HttpRequest, HttpResponse, Result};\n-use althea_types::WgKey;\nuse althea_types::{\nEncryptedExitClientIdentity, EncryptedExitState, ExitClientIdentity, ExitState, ExitSystemTime,\n};\n-use althea_types::{EncryptedIpList, Identity};\n+use althea_types::{EncryptedExitList, Identity};\n+use althea_types::{ExitList, WgKey};\nuse num256::Int256;\nuse rita_common::blockchain_oracle::potential_payment_issues_detected;\nuse rita_common::debt_keeper::get_debts_list;\n@@ -246,16 +246,19 @@ pub async fn get_exit_list(request: Json<EncryptedExitClientIdentity>) -> HttpRe\nlet their_nacl_pubkey = request.pubkey.into();\n- let ret = settings::get_rita_exit().exit_network.cluster_ips;\n+ let ret: ExitList = ExitList {\n+ exit_list: settings::get_rita_exit().exit_network.cluster_exits,\n+ wg_exit_listen_port: settings::get_rita_exit().exit_network.wg_new_tunnel_port,\n+ };\nlet plaintext = serde_json::to_string(&ret)\n.expect(\"Failed to serialize Vec of ips!\")\n.into_bytes();\nlet nonce = box_::gen_nonce();\nlet ciphertext = box_::seal(&plaintext, &nonce, &their_nacl_pubkey, &our_secretkey);\n- HttpResponse::Ok().json(Json(EncryptedIpList {\n+ HttpResponse::Ok().json(Json(EncryptedExitList {\nnonce: nonce.0,\n- ip_list: ciphertext,\n+ exit_list: ciphertext,\n}))\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/rita_loop/mod.rs", "new_path": "rita_exit/src/rita_loop/mod.rs", "diff": "@@ -275,7 +275,7 @@ pub fn start_rita_exit_endpoints(workers: usize) {\n.route(\"/exit_info\", web::get().to(get_exit_info_http))\n.route(\"/client_debt\", web::post().to(get_client_debt))\n.route(\"/time\", web::get().to(get_exit_timestamp_http))\n- .route(\"/exit_list\", web::get().to(get_exit_list))\n+ .route(\"/exit_list\", web::post().to(get_exit_list))\n})\n.workers(workers)\n.bind(format!(\n" }, { "change_type": "MODIFY", "old_path": "settings/example_exit.toml", "new_path": "settings/example_exit.toml", "diff": "@@ -46,6 +46,11 @@ wg_public_key = \"H/ABwzXk834OwGYU8CZGfFxNZOd+BAJEaVDHiEiWWhU=\"\nwg_private_key = \"ALxcZm2r58gY0sB4vIfnjShc86qBoVK3f32H9VrwqWU=\"\nwg_private_key_path = \"/tmp/exit-priv\"\n+[[exit_network.cluster_exits]]\n+mesh_ip = \"fd00::1\"\n+eth_address = \"0x5AeE3Dff733F56cFe7E5390B9cC3A46a90cA1CfA\"\n+wg_public_key = \"nGR9XhJMDNmOOzAVvZYny0SHvHyBovzod4CBUwEjajY=\"\n+\n[verif_settings]\ntype = \"Email\"\n" }, { "change_type": "MODIFY", "old_path": "settings/src/exit.rs", "new_path": "settings/src/exit.rs", "diff": "@@ -7,7 +7,7 @@ use core::str::FromStr;\nuse ipnetwork::IpNetwork;\nuse phonenumber::PhoneNumber;\nuse std::collections::HashSet;\n-use std::net::{IpAddr, Ipv4Addr};\n+use std::net::Ipv4Addr;\nuse std::path::Path;\n/// This is the network settings specific to rita_exit\n@@ -48,7 +48,7 @@ pub struct ExitNetworkSettings {\n/// Magic phone number operators enter in order to register to exit without auth\npub magic_phone_number: Option<String>,\n/// Lists of exit ip addrs in this cluster\n- pub cluster_ips: Vec<IpAddr>,\n+ pub cluster_exits: Vec<Identity>,\n}\nimpl ExitNetworkSettings {\n@@ -74,7 +74,7 @@ impl ExitNetworkSettings {\n.unwrap(),\nwg_private_key_path: String::new(),\nmagic_phone_number: None,\n- cluster_ips: Vec::new(),\n+ cluster_exits: Vec::new(),\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "settings/test_exit.toml", "new_path": "settings/test_exit.toml", "diff": "@@ -42,6 +42,11 @@ wg_public_key = \"H/ABwzXk834OwGYU8CZGfFxNZOd+BAJEaVDHiEiWWhU=\"\nwg_private_key = \"ALxcZm2r58gY0sB4vIfnjShc86qBoVK3f32H9VrwqWU=\"\nwg_private_key_path = \"/tmp/exit-priv\"\n+[[exit_network.cluster_exits]]\n+mesh_ip = \"fd00::1\"\n+eth_address = \"0x5AeE3Dff733F56cFe7E5390B9cC3A46a90cA1CfA\"\n+wg_public_key = \"nGR9XhJMDNmOOzAVvZYny0SHvHyBovzod4CBUwEjajY=\"\n+\n[dao]\ndao_enforcement = false\ncache_timeout_seconds = 600\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Configure exit switcher to use a list of exit identities instead of subnetting Now that exits have unique wg keys, we hit and exit endpoint to get a list of exit indentities. We use this list to cycle through exit metrics to choose the best exit to connect to
20,255
05.08.2022 10:46:42
25,200
329cc2b423bd44be3350e71351c3a739189d378a
Remove subnetting functionality from client side Now that the exits send a list of exit identites, subnetting is no longer needed to know the exit ip addrs. We now simply iterative through the list we receive from the exit
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -847,9 +847,9 @@ dependencies = [\n[[package]]\nname = \"email_address\"\n-version = \"0.2.1\"\n+version = \"0.2.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"8684b7c9cb4857dfa1e5b9629ef584ba618c9b93bae60f58cb23f4f271d0468e\"\n+checksum = \"b1b32a7a2580c4473f10f66b512c34bdd7d33c5e3473227ca833abdb5afe4809\"\n[[package]]\nname = \"encoding_rs\"\n@@ -1438,9 +1438,9 @@ dependencies = [\n[[package]]\nname = \"libc\"\n-version = \"0.2.127\"\n+version = \"0.2.131\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"505e71a4706fa491e9b1b55f51b95d4037d0821ee40131190475f692b35b009b\"\n+checksum = \"04c3b4822ccebfa39c02fc03d1534441b22ead323fa0f48bb7ddd8e6ba076a40\"\n[[package]]\nname = \"libsodium-sys\"\n@@ -2411,9 +2411,9 @@ checksum = \"93f6841e709003d68bb2deee8c343572bf446003ec20a583e76f7b15cebf3711\"\n[[package]]\nname = \"serde\"\n-version = \"1.0.142\"\n+version = \"1.0.143\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e590c437916fb6b221e1d00df6e3294f3fccd70ca7e92541c475d6ed6ef5fee2\"\n+checksum = \"53e8e5d5b70924f74ff5c6d64d9a5acd91422117c60f48c4e07855238a254553\"\ndependencies = [\n\"serde_derive\",\n]\n@@ -2451,9 +2451,9 @@ dependencies = [\n[[package]]\nname = \"serde_derive\"\n-version = \"1.0.142\"\n+version = \"1.0.143\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"34b5b8d809babe02f538c2cfec6f2c1ed10804c0e5a6a041a049a4f5588ccc2e\"\n+checksum = \"d3d8e8de557aee63c26b85b947f5e59b690d0454c753f3adeb5cd7835ab88391\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -2661,12 +2661,11 @@ dependencies = [\n[[package]]\nname = \"time\"\n-version = \"0.3.12\"\n+version = \"0.3.13\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"74b7cc93fc23ba97fde84f7eea56c55d1ba183f495c6715defdfc7b9cb8c870f\"\n+checksum = \"db76ff9fa4b1458b3c7f077f3ff9887394058460d21e634355b273aaf11eea45\"\ndependencies = [\n\"itoa\",\n- \"js-sys\",\n\"libc\",\n\"num_threads\",\n\"time-macros\",\n" }, { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/exit_client_tunnel.rs", "new_path": "althea_kernel_interface/src/exit_client_tunnel.rs", "diff": "@@ -3,6 +3,7 @@ use crate::{open_tunnel::to_wg_local, KernelInterfaceError as Error};\nuse althea_types::WgKey;\nuse std::net::{IpAddr, Ipv4Addr, SocketAddr};\n+#[derive(Debug)]\npub struct ClientExitTunnelConfig {\n/// The mesh ip of the exit server and it's port\npub endpoint: SocketAddr,\n" }, { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/exit_server_tunnel.rs", "new_path": "althea_kernel_interface/src/exit_server_tunnel.rs", "diff": "@@ -100,8 +100,15 @@ impl dyn KernelInterface {\nreturn;\n}\n- // Delete an older routes that exists if the router has recently switched\n- //let old_router; // TODO\n+ // Get all routes on our interface\n+ let output = self.run_command(\"ip\", &vec![\"-6\", \"route\", \"show\", \"dev\", interface]).expect(\"Fix command\");\n+ let existing_routes = String::from_utf8(output.stdout).unwrap();\n+\n+ // Turn into a vector of Vec<IpRoute>\n+ //let routes = parse_iproute_string(existing_routes);\n+\n+\n+\nlet ipv6_list: Vec<&str> = client_ipv6_list.split(',').collect();\n" }, { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/setup_wg_if.rs", "new_path": "althea_kernel_interface/src/setup_wg_if.rs", "diff": "@@ -60,6 +60,7 @@ impl dyn KernelInterface {\n/// calls iproute2 to set up a new interface with a given name.\npub fn setup_wg_if_named(&self, name: &str) -> Result<(), KernelInterfaceError> {\nlet output = self.run_command(\"ip\", &[\"link\", \"add\", name, \"type\", \"wireguard\"])?;\n+ info!(\"Added the wg_exit interface\");\nlet stderr = String::from_utf8(output.stderr)?;\nif !stderr.is_empty() {\nif stderr.contains(\"exists\") {\n@@ -71,6 +72,7 @@ impl dyn KernelInterface {\n)));\n}\n}\n+ info!(\"wg_exit should be successfully setup\");\nOk(())\n}\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/rita.py", "new_path": "integration-tests/integration-test-script/rita.py", "diff": "@@ -88,18 +88,14 @@ TEST_PASSES = True\nEXIT_SETTINGS = {\n\"new_exits\": {\n\"exit_a\": {\n- \"subnet\": \"fd00::5/128\",\n+ \"root_ip\": \"fd00::5\",\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+ \"wg_public_key\": \"H/ABwzXk834OwGYU8CZGfFxNZOd+BAJEaVDHiEiWWhU=\",\n},\n\"eth_address\": \"0xbe398dc24de37c73cec974d688018e58f94d6e0a\",\n- \"wg_public_key\": \"fd00::5\",\n+ \"wg_public_key\": \"H/ABwzXk834OwGYU8CZGfFxNZOd+BAJEaVDHiEiWWhU=\",\n\"registration_port\": 4875,\n\"state\": \"New\",\n}\n" }, { "change_type": "MODIFY", "old_path": "integration-tests/integration-test-script/world.py", "new_path": "integration-tests/integration-test-script/world.py", "diff": "@@ -209,6 +209,7 @@ class World:\nverbose=verbose, global_fail=global_fail):\nret = False\nif global_fail and not ret:\n+ time.sleep(400)\nexit(1)\nreturn ret\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/exits.rs", "new_path": "rita_client/src/dashboard/exits.rs", "diff": "@@ -126,7 +126,7 @@ pub async fn add_exits(new_exits: Json<HashMap<String, ExitServer>>) -> HttpResp\n// initialze all new exits for Exit manager to use\nfor exit in new_copy {\n- let new_exit_ip = exit.1.subnet.ip();\n+ let new_exit_ip = exit.1.root_ip;\nlet new_selected_exit = SelectedExit {\nselected_id: Some(new_exit_ip),\n..Default::default()\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": "@@ -193,10 +193,10 @@ impl From<ExitMetrics>\n/// Look at the enum 'ExitSwitchingCode' to see all state and function 'update_metric_value' to see when these are triggered.\npub fn set_best_exit(\nexit_name: String,\n- routes: Vec<Route>,\nexit_list: &ExitList,\n+ route_hashmap: HashMap<IpAddr, Route>,\n) -> Result<IpAddr, RitaClientError> {\n- if routes.is_empty() {\n+ if route_hashmap.is_empty() {\nreturn Err(RitaClientError::MiscStringError(\n\"No routes are found\".to_string(),\n));\n@@ -215,7 +215,7 @@ pub fn set_best_exit(\n// Parse all babel routes and find useful metrics\nlet exit_metrics = get_exit_metrics(\n- routes,\n+ route_hashmap,\ncurrent_exit_ip,\ntracking_exit,\ncurrent_exit_ip,\n@@ -422,7 +422,7 @@ fn set_exit_state(\n///\n/// 7.) Metric of the best exit during this tick\nfn get_exit_metrics(\n- routes: Vec<Route>,\n+ route_hashmap: HashMap<IpAddr, Route>,\ncurrent_exit_ip: Option<IpAddr>,\ntracking_exit: Option<IpAddr>,\ninitial_best_exit: Option<IpAddr>,\n@@ -450,11 +450,15 @@ fn get_exit_metrics(\n.blacklisted_exits\n.clone();\n- for route in routes {\n+ for ip in exit_list.exit_list.clone() {\n// All babel routes are advertised as /128, so we check if each 'single' ip is part of exit subnet\n+ info!(\"Route hashmap: {:?}\\n, ip mesh: {:?}\\n\", route_hashmap, ip.mesh_ip);\n+ let route = route_hashmap\n+ .get(&ip.mesh_ip)\n+ .expect(\"There should be an ip address for every route\");\nlet ip = route.prefix.ip();\n- if check_if_ip_in_exit_list(ip, exit_list) && !blacklisted.contains(&ip) {\n+ if !blacklisted.contains(&ip) {\n// Not all exits in subnet are blacklisted, so set bool\nall_exits_blacklisted = false;\n@@ -740,16 +744,6 @@ pub fn get_babel_routes(babel_port: u16) -> Result<Vec<Route>, RitaClientError>\nOk(routes)\n}\n-fn check_if_ip_in_exit_list(ip: IpAddr, exit_list: &ExitList) -> bool {\n- for id in exit_list.exit_list.clone() {\n- if ip == id.mesh_ip {\n- return true;\n- }\n- }\n-\n- false\n-}\n-\n#[cfg(test)]\nmod tests {\n@@ -1031,12 +1025,18 @@ mod tests {\nfee: 10,\n};\n- let routes = vec![exit1, exit2, exit3, not_exit];\n+ //let routes = vec![exit1, exit2, exit3, not_exit];\n+ let mut route_hashmap = HashMap::new();\n+ route_hashmap.insert(exit1.prefix.ip(), exit1);\n+ route_hashmap.insert(exit2.prefix.ip(), exit2);\n+ route_hashmap.insert(exit3.prefix.ip(), exit3);\n+ route_hashmap.insert(not_exit.prefix.ip(), not_exit);\n+\nlet mut exit_map: HashMap<IpAddr, ExitTracker> = HashMap::new();\n// Nothing is setup yet\nlet (exit_down, _, c_e_met, _, t_e_m, b_exit, b_e_m) = get_exit_metrics(\n- routes.clone(),\n+ route_hashmap.clone(),\nNone,\nNone,\nNone,\n@@ -1056,7 +1056,7 @@ mod tests {\n// Only current exit is setup, not tracking yet\nlet (exit_down, _, c_e_met, _, t_e_m, b_exit, b_e_m) = get_exit_metrics(\n- routes.clone(),\n+ route_hashmap.clone(),\nSome(ip1),\nNone,\nSome(ip1),\n@@ -1076,7 +1076,7 @@ mod tests {\n// current and tracking at setup and different from each other and best exit\nlet (exit_down, _, c_e_met, _, t_e_m, b_exit, b_e_m) = get_exit_metrics(\n- routes.clone(),\n+ route_hashmap.clone(),\nSome(ip1),\nSome(ip2),\nSome(ip1),\n@@ -1096,7 +1096,7 @@ mod tests {\n// Current and tracking are same but different from best exit\nlet (exit_down, _, c_e_met, _, t_e_m, b_exit, b_e_m) = get_exit_metrics(\n- routes.clone(),\n+ route_hashmap.clone(),\nSome(ip2),\nSome(ip2),\nSome(ip2),\n@@ -1116,7 +1116,7 @@ mod tests {\n// All three exits are the same\nlet (exit_down, _, c_e_met, _, t_e_m, b_exit, b_e_m) = get_exit_metrics(\n- routes,\n+ route_hashmap,\nSome(ip3),\nSome(ip3),\nSome(ip3),\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/exit_manager/mod.rs", "new_path": "rita_client/src/exit_manager/mod.rs", "diff": "@@ -34,6 +34,7 @@ use althea_types::WgKey;\nuse althea_types::{EncryptedExitClientIdentity, EncryptedExitState};\nuse althea_types::{EncryptedExitList, ExitDetails, ExitList};\nuse althea_types::{ExitClientIdentity, ExitRegistrationDetails, ExitState, ExitVerifMode};\n+use babel_monitor::Route;\nuse exit_switcher::{get_babel_routes, set_best_exit};\nuse rita_common::blockchain_oracle::low_balance;\n@@ -154,6 +155,7 @@ fn linux_setup_exit_tunnel(\n// TODO this should be refactored to return a value\nKI.update_settings_route(&mut network.last_default_route);\n+ info!(\"Updated settings route\");\nif let Err(KernelInterfaceError::RuntimeError(v)) = KI.setup_wg_if_named(\"wg_exit\") {\nreturn Err(RitaClientError::MiscStringError(v));\n@@ -171,6 +173,8 @@ fn linux_setup_exit_tunnel(\nuser_specified_speed: network.user_bandwidth_limit,\n};\n+ info!(\"Args while setting up wg_exit on client are: {:?}\", args);\n+\nrita_client.network = network;\nsettings::set_rita_client(rita_client);\n@@ -217,6 +221,7 @@ pub async fn get_exit_info(to: &SocketAddr) -> Result<ExitState, RitaClientError\n};\nlet response_json = response.json().await?;\n+ info!(\"Received {:?} from endpoint {:?}\", response_json, endpoint);\nOk(response_json)\n}\n@@ -462,7 +467,7 @@ pub async fn exit_setup_request(exit: String, code: Option<String>) -> Result<()\nNone => {\n// set this ip in the lazy static\ninitialize_selected_exit_list(exit.clone(), current_exit.clone());\n- current_exit.subnet.ip()\n+ current_exit.root_ip\n}\n};\nlet exit_pubkey = current_exit.wg_public_key;\n@@ -719,17 +724,28 @@ fn initialize_selected_exit_list(exit: String, server: ExitServer) {\ninfo!(\n\"Setting initialized IP for exit {} with ip: {}\",\n- exit,\n- server.subnet.ip()\n+ exit, server.root_ip\n);\nlist.entry(exit).or_insert_with(|| SelectedExit {\n- selected_id: Some(server.subnet.ip()),\n+ selected_id: Some(server.root_ip),\nselected_id_degradation: None,\ntracking_exit: None,\nselected_id_metric: None,\n});\n}\n+/// This function takes a list of babel routes and uses this to insert ip -> route\n+/// instances in the hashmap. This is an optimization that allows us to reduce route lookups from O(n * m ) to O(m + n)\n+/// when trying to find exit ips in our cluster\n+fn get_routes_hashmap(routes: Vec<Route>) -> HashMap<IpAddr, Route> {\n+ let mut ret = HashMap::new();\n+ for r in routes {\n+ ret.insert(r.prefix.ip(), r);\n+ }\n+\n+ ret\n+}\n+\npub async fn exit_manager_tick() {\ninfo!(\"Exit_Switcher: exit manager tick\");\nlet client_can_use_free_tier = { settings::get_rita_client().payment.client_can_use_free_tier };\n@@ -765,7 +781,7 @@ pub async fn exit_manager_tick() {\nOk(a) => a,\nErr(_) => {\nwarn!(\"No babel routes present to setup an exit\");\n- return;\n+ Vec::new()\n}\n};\n@@ -790,10 +806,15 @@ pub async fn exit_manager_tick() {\n}\nset_exit_list(exit_list);\n+ // Set all babel routes in a hashmap that we use to instantly get the route object of the exit we are trying to\n+ // connect to\n+ let ip_route_hashmap = get_routes_hashmap(routes);\n+\n// Calling set best exit function, this looks though a list of exit in a cluster, does some math, and determines what exit we should connect to\nlet exit_list = get_exit_list();\ninfo!(\"Exit_Switcher: Calling set best exit\");\n- let selected_exit = match set_best_exit(current_exit.clone(), routes, &exit_list) {\n+ let selected_exit =\n+ match set_best_exit(current_exit.clone(), &exit_list, ip_route_hashmap) {\nOk(a) => Some(a),\nErr(e) => {\nwarn!(\"Found no exit yet : {}\", e);\n@@ -804,7 +825,7 @@ pub async fn exit_manager_tick() {\ninfo!(\"Exit_Switcher: After selecting best exit this tick, we have selected_id: {:?}, selected_metric: {:?}, tracking_ip: {:?}\", get_selected_exit(current_exit.clone()), get_selected_exit_metric(current_exit.clone()), get_selected_exit_tracking(current_exit.clone()));\n// check the exit's time and update locally if it's very different\n- maybe_set_local_to_exit_time(exit.clone()).await;\n+ maybe_set_local_to_exit_time(exit.clone(), current_exit.clone()).await;\n// Determine states to setup tunnels\nlet signed_up_for_exit = exit.info.our_details().is_some();\n@@ -814,6 +835,7 @@ pub async fn exit_manager_tick() {\nlet correct_default_route = correct_default_route(KI.get_default_route());\nlet current_exit_id = selected_exit;\n+ info!(\"Reaches this part of the code: signed_up: {:?}, exit_has_changed: {:?}, correct_default_route {:?}\", signed_up_for_exit, exit_has_changed, correct_default_route);\nmatch (signed_up_for_exit, exit_has_changed, correct_default_route) {\n(true, true, _) => {\ntrace!(\"Exit change, setting up exit tunnel\");\n@@ -911,18 +933,20 @@ pub async fn exit_manager_tick() {\n// code that manages requesting details to exits\nlet servers = { settings::get_rita_client().exit_client.exits };\n-\n+ info!(\"Reaches the end of tick\");\nfor (k, s) in servers {\n+ info!(\"looking at {:?} with s.info {:?}\", k, s.info);\nmatch s.info {\nExitState::Denied { .. } | ExitState::Disabled | ExitState::GotInfo { .. } => {}\nExitState::New { .. } => {\n+ info!(\"Looks at new for exit: {:?} with server {:?}\", k, s);\nmatch exit_general_details_request(k.clone()).await {\nOk(_) => {\n- trace!(\"exit details request to {} was successful\", k);\n+ info!(\"exit details request to {} was successful\", k);\n}\nErr(e) => {\n- trace!(\"exit details request to {} failed with {:?}\", k, e);\n+ info!(\"exit details request to {} failed with {:?}\", k, e);\n}\n};\n}\n@@ -930,10 +954,10 @@ pub async fn exit_manager_tick() {\nExitState::Registered { .. } => {\nmatch exit_status_request(k.clone()).await {\nOk(_) => {\n- trace!(\"exit status request to {} was successful\", k);\n+ info!(\"exit status request to {} was successful\", k);\n}\nErr(e) => {\n- trace!(\"exit status request to {} failed with {:?}\", k, e);\n+ info!(\"exit status request to {} failed with {:?}\", k, e);\n}\n};\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/exit_manager/time_sync.rs", "new_path": "rita_client/src/exit_manager/time_sync.rs", "diff": "@@ -3,6 +3,8 @@ use althea_types::ExitSystemTime;\nuse settings::client::ExitServer;\nuse std::time::{Duration, SystemTime, UNIX_EPOCH};\n+use crate::exit_manager::get_selected_exit;\n+\n/// The max time difference between the local router's time and the exit's before resetting the local time to the exit's\nconst MAX_DIFF_LOCAL_EXIT_TIME: Duration = Duration::from_secs(60);\n@@ -11,9 +13,9 @@ const MAX_DIFF_LOCAL_EXIT_TIME: Duration = Duration::from_secs(60);\nconst MAX_EXIT_TUNNEL_HANDSHAKE: Duration = Duration::from_secs(60 * 3);\n/// Retrieve a unix timestamp from the exit's mesh IPv6\n-pub async fn get_exit_time(exit: ExitServer) -> Option<SystemTime> {\n+pub async fn get_exit_time(exit: ExitServer, exit_name: String) -> Option<SystemTime> {\ninfo!(\"Getting the exit time\");\n- let exit_ip = exit.subnet.ip();\n+ let exit_ip = get_selected_exit(exit_name).expect(\"There should be an exit ip here\");\nlet exit_port = exit.registration_port;\nlet url = format!(\"http://[{}]:{}/time\", exit_ip, exit_port);\n@@ -55,7 +57,7 @@ pub fn get_latest_exit_handshake() -> Option<SystemTime> {\n/// Check for a handshake time for wg_exit. We might not get one if there's no tunnel\n/// if there's no handshake or the handshake is more than 10 mins old, then try to get the exit time\n/// if we do get the exit time and it's more than 60 secs different than local time, then set the local time to it\n-pub async fn maybe_set_local_to_exit_time(exit: ExitServer) {\n+pub async fn maybe_set_local_to_exit_time(exit: ExitServer, cluster_name: String) {\nlet now = SystemTime::now();\nif let Some(last_handshake) = get_latest_exit_handshake() {\n@@ -86,7 +88,7 @@ pub async fn maybe_set_local_to_exit_time(exit: ExitServer) {\n}\n// if we're here, then it means we didn't get a reasonable handshake\n- if let Some(exit_time) = get_exit_time(exit).await {\n+ if let Some(exit_time) = get_exit_time(exit, cluster_name).await {\n// if exit time is more than 60 secs later than our time, set ours to its\nif let Ok(diff) = exit_time.duration_since(now) {\nif diff > MAX_DIFF_LOCAL_EXIT_TIME {\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/database/mod.rs", "new_path": "rita_exit/src/database/mod.rs", "diff": "@@ -398,6 +398,7 @@ pub fn setup_clients(\nreturn Ok(wg_clients);\n}\n+ info!(\"Setting up configs for wg_exit and wg_exit_new\");\n// setup all the tunnels\nlet exit_status = KI.set_exit_wg_config(\n&wg_clients,\n" }, { "change_type": "MODIFY", "old_path": "settings/example_exit.toml", "new_path": "settings/example_exit.toml", "diff": "@@ -47,9 +47,9 @@ wg_private_key = \"ALxcZm2r58gY0sB4vIfnjShc86qBoVK3f32H9VrwqWU=\"\nwg_private_key_path = \"/tmp/exit-priv\"\n[[exit_network.cluster_exits]]\n-mesh_ip = \"fd00::1\"\n+mesh_ip = \"fd00::5\"\neth_address = \"0x5AeE3Dff733F56cFe7E5390B9cC3A46a90cA1CfA\"\n-wg_public_key = \"nGR9XhJMDNmOOzAVvZYny0SHvHyBovzod4CBUwEjajY=\"\n+wg_public_key = \"bvM10HW73yePrxdtCQQ4U20W5ogogdiZtUihrPc/oGY=\"\n[verif_settings]\ntype = \"Email\"\n" }, { "change_type": "MODIFY", "old_path": "settings/src/client.rs", "new_path": "settings/src/client.rs", "diff": "@@ -7,7 +7,6 @@ use crate::{json_merge, set_rita_client, SettingsError};\nuse althea_types::wg_key::WgKey;\nuse althea_types::{ContactStorage, ExitState, Identity};\nuse clarity::Address;\n-use ipnetwork::IpNetwork;\nuse std::collections::{HashMap, HashSet};\nuse std::net::IpAddr;\nuse std::path::Path;\n@@ -33,8 +32,8 @@ pub fn default_config_path() -> String {\n/// ip's within the provided subnet.\n#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]\npub struct ExitServer {\n- /// Subnet of exits in cluster\n- pub subnet: IpNetwork,\n+ /// Ip of exit we first connect to when connected to this cluster\n+ pub root_ip: IpAddr,\n/// eth address of this exit cluster\npub eth_address: Address,\n" }, { "change_type": "MODIFY", "old_path": "settings/test_exit.toml", "new_path": "settings/test_exit.toml", "diff": "@@ -43,9 +43,9 @@ wg_private_key = \"ALxcZm2r58gY0sB4vIfnjShc86qBoVK3f32H9VrwqWU=\"\nwg_private_key_path = \"/tmp/exit-priv\"\n[[exit_network.cluster_exits]]\n-mesh_ip = \"fd00::1\"\n-eth_address = \"0x5AeE3Dff733F56cFe7E5390B9cC3A46a90cA1CfA\"\n-wg_public_key = \"nGR9XhJMDNmOOzAVvZYny0SHvHyBovzod4CBUwEjajY=\"\n+mesh_ip = \"fd00::5\"\n+eth_address = \"0xbe398dc24de37c73cec974d688018e58f94d6e0a\"\n+wg_public_key = \"bvM10HW73yePrxdtCQQ4U20W5ogogdiZtUihrPc/oGY=\"\n[dao]\ndao_enforcement = false\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove subnetting functionality from client side Now that the exits send a list of exit identites, subnetting is no longer needed to know the exit ip addrs. We now simply iterative through the list we receive from the exit
20,255
15.08.2022 20:04:58
25,200
4cde0d8408130e5cbfc8bc40fc8f9a5babb1b773
Set up ipv4 and ipv6 routes correctly for rita exit
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/exit_server_tunnel.rs", "new_path": "althea_kernel_interface/src/exit_server_tunnel.rs", "diff": "@@ -94,31 +94,61 @@ impl dyn KernelInterface {\n&self,\nclient_ipv6_list: String,\nclient_mesh: String,\n+ client_internal_ip: String,\ninterface: &str,\n) {\n- if client_ipv6_list.is_empty() {\n- return;\n+ // Setup ipv4 route\n+ // 1.) Select all ipv4 routes with 'client_internal_ip'. This gives us all routes with wg_exit and wg_exit_new for the ip\n+ // THere should be only one route\n+ // 2.) Does the route contain 'interface'? Yes? we continue\n+ // 3.) No? That means either no route exists or there is a route with the other interface name\n+ // 4.) Delete route, add new route with the correct interface\n+ let output = self\n+ .run_command(\"ip\", &[\"route\", \"show\", &client_internal_ip])\n+ .expect(\"Fix command\");\n+ let route = String::from_utf8(output.stdout).unwrap();\n+ if !route.contains(&interface) {\n+ self.run_command(\"ip\", &[\"route\", \"del\", &client_internal_ip])\n+ .expect(\"Fix command\");\n+\n+ self.run_command(\n+ \"ip\",\n+ &[\"route\", \"add\", &client_internal_ip, \"dev\", interface],\n+ )\n+ .expect(\"Fix command\");\n}\n- // Get all routes on our interface\n- let output = self.run_command(\"ip\", &vec![\"-6\", \"route\", \"show\", \"dev\", interface]).expect(\"Fix command\");\n- let existing_routes = String::from_utf8(output.stdout).unwrap();\n-\n- // Turn into a vector of Vec<IpRoute>\n- //let routes = parse_iproute_string(existing_routes);\n-\n-\n+ // Setup ipv6 routes\n+ // 1.) Find all v6 routes with ip. There should be at most one, either on wg_exit or wg_exit_new\n+ // 2.) Check if that route contains 'interface' Yes? route is already setup, we continue\n+ // 3.) No? It means no route exists or route exists on wrong interface.\n+ // 4.) We delete route and add the new route on correct interface\n+ // 5.) Continue this for each ip in the database for the client\n+ if client_ipv6_list.is_empty() {\n+ return;\n+ }\nlet ipv6_list: Vec<&str> = client_ipv6_list.split(',').collect();\nfor ip in ipv6_list {\n// Verfiy its a valid subnet\nif let Ok(ip_net) = ip.parse::<IpNetwork>() {\n- let _res = self.run_command(\n+ // Look for existing routes\n+ let output = self\n+ .run_command(\"ip\", &[\"-6\", \"route\", \"show\", &ip_net.to_string()])\n+ .expect(\"Fix command\");\n+ let existing_routes = String::from_utf8(output.stdout).unwrap();\n+ if !existing_routes.contains(interface) {\n+ self.run_command(\"ip\", &[\"-6\", \"route\", \"del\", &ip_net.to_string()])\n+ .expect(\"Fix command\");\n+\n+ self.run_command(\n\"ip\",\n&[\"-6\", \"route\", \"add\", &ip_net.to_string(), \"dev\", interface],\n- );\n+ )\n+ .expect(\"Fix command\");\n+ }\n} else {\nerror!(\"IPV6 Error: Invalid client database state. Client with mesh ip: {:?} has invalid database ipv6 list: {:?}\", client_mesh, client_ipv6_list);\n}\n" }, { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/setup_wg_if.rs", "new_path": "althea_kernel_interface/src/setup_wg_if.rs", "diff": "@@ -128,6 +128,14 @@ impl dyn KernelInterface {\n}\n}\n+#[test]\n+fn test_durations() {\n+ let d = UNIX_EPOCH + Duration::from_secs(5);\n+ let d2 = UNIX_EPOCH + Duration::from_secs(10);\n+\n+ println!(\"d: {:?}, d2: {:?}\", d, d2);\n+}\n+\n#[test]\nfn test_setup_wg_if_linux() {\nuse crate::KI;\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": "@@ -452,7 +452,10 @@ fn get_exit_metrics(\nfor ip in exit_list.exit_list.clone() {\n// All babel routes are advertised as /128, so we check if each 'single' ip is part of exit subnet\n- info!(\"Route hashmap: {:?}\\n, ip mesh: {:?}\\n\", route_hashmap, ip.mesh_ip);\n+ info!(\n+ \"Route hashmap: {:?}\\n, ip mesh: {:?}\\n\",\n+ route_hashmap, ip.mesh_ip\n+ );\nlet route = route_hashmap\n.get(&ip.mesh_ip)\n.expect(\"There should be an ip address for every route\");\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/database/mod.rs", "new_path": "rita_exit/src/database/mod.rs", "diff": "@@ -386,7 +386,12 @@ pub fn setup_clients(\ncontinue;\n}\n};\n- KI.setup_client_routes(c.internet_ipv6.clone(), c.mesh_ip.clone(), &interface)\n+ KI.setup_client_routes(\n+ c.internet_ipv6.clone(),\n+ c.mesh_ip.clone(),\n+ c.internal_ip.clone(),\n+ &interface,\n+ )\n}\ntrace!(\"converted clients {:?}\", wg_clients);\n@@ -448,6 +453,7 @@ pub fn get_client_interface(\nnew_wg_exit_clients: HashMap<WgKey, SystemTime>,\nwg_exit_clients: HashMap<WgKey, SystemTime>,\n) -> Result<String, RitaExitError> {\n+ info!(\"New list is {:?} \\n Old list is {:?}\", new_wg_exit_clients, wg_exit_clients);\nmatch (\nnew_wg_exit_clients.get(&c.wg_pubkey.parse()?),\nwg_exit_clients.get(&c.wg_pubkey.parse()?),\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Set up ipv4 and ipv6 routes correctly for rita exit
20,255
23.09.2022 09:12:41
25,200
cff557bd04adc8b9fa63db2ce3efd101d564ee30
Replaced wg_exit_new with wg_exit_V2
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/exit_server_tunnel.rs", "new_path": "althea_kernel_interface/src/exit_server_tunnel.rs", "diff": "@@ -98,7 +98,7 @@ impl dyn KernelInterface {\ninterface: &str,\n) {\n// Setup ipv4 route\n- // 1.) Select all ipv4 routes with 'client_internal_ip'. This gives us all routes with wg_exit and wg_exit_new for the ip\n+ // 1.) Select all ipv4 routes with 'client_internal_ip'. This gives us all routes with wg_exit and wg_exit_v2 for the ip\n// THere should be only one route\n// 2.) Does the route contain 'interface'? Yes? we continue\n// 3.) No? That means either no route exists or there is a route with the other interface name\n@@ -119,7 +119,7 @@ impl dyn KernelInterface {\n}\n// Setup ipv6 routes\n- // 1.) Find all v6 routes with ip. There should be at most one, either on wg_exit or wg_exit_new\n+ // 1.) Find all v6 routes with ip. There should be at most one, either on wg_exit or wg_exit_v2\n// 2.) Check if that route contains 'interface' Yes? route is already setup, we continue\n// 3.) No? It means no route exists or route exists on wrong interface.\n// 4.) We delete route and add the new route on correct interface\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/database/mod.rs", "new_path": "rita_exit/src/database/mod.rs", "diff": "@@ -356,7 +356,7 @@ pub fn setup_clients(\n// Setup or verify that an ipv6 route exists for each client\nlet new_wg_exit_clients: HashMap<WgKey, SystemTime> = KI\n- .get_last_handshake_time(\"wg_exit_new\")\n+ .get_last_handshake_time(\"wg_exit_v2\")\n.expect(\"There should be a new wg_exit interface\")\n.into_iter()\n.collect();\n@@ -381,7 +381,7 @@ pub fn setup_clients(\nmatch get_client_interface(c, new_wg_exit_clients.clone(), wg_exit_clients.clone()) {\nOk(a) => a,\nErr(_) => {\n- // There is no handshake on either wg_exit or wg_exit_new, which can happen during a restart\n+ // There is no handshake on either wg_exit or wg_exit_v2, which can happen during a restart\n// in this case the client will not have an ipv6 route until they initiate a handshake again\ncontinue;\n}\n@@ -403,7 +403,7 @@ pub fn setup_clients(\nreturn Ok(wg_clients);\n}\n- info!(\"Setting up configs for wg_exit and wg_exit_new\");\n+ info!(\"Setting up configs for wg_exit and wg_exit_v2\");\n// setup all the tunnels\nlet exit_status = KI.set_exit_wg_config(\n&wg_clients,\n@@ -415,9 +415,9 @@ pub fn setup_clients(\n// Setup new tunnels\nlet exit_status_new = KI.set_exit_wg_config(\n&wg_clients,\n- settings::get_rita_exit().exit_network.wg_new_tunnel_port,\n+ settings::get_rita_exit().exit_network.wg_v2_tunnel_port,\n&settings::get_rita_exit().network.wg_private_key_path,\n- \"wg_exit_new\",\n+ \"wg_exit_v2\",\n);\nmatch exit_status {\n@@ -461,11 +461,11 @@ pub fn get_client_interface(\nnew_wg_exit_clients.get(&c.wg_pubkey.parse()?),\nwg_exit_clients.get(&c.wg_pubkey.parse()?),\n) {\n- (Some(_), None) => Ok(\"wg_exit_new\".into()),\n+ (Some(_), None) => Ok(\"wg_exit_v2\".into()),\n(None, Some(_)) => Ok(\"wg_exit\".into()),\n(Some(new), Some(old)) => {\nif new > old {\n- Ok(\"wg_exit_new\".into())\n+ Ok(\"wg_exit_v2\".into())\n} else {\nOk(\"wg_exit\".into())\n}\n@@ -523,7 +523,7 @@ pub fn enforce_exit_clients(\n}\nlet new_wg_exit_clients: HashMap<WgKey, SystemTime> = KI\n- .get_last_handshake_time(\"wg_exit_new\")\n+ .get_last_handshake_time(\"wg_exit_v2\")\n.expect(\"There should be a new wg_exit interface\")\n.into_iter()\n.collect();\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/network_endpoints/mod.rs", "new_path": "rita_exit/src/network_endpoints/mod.rs", "diff": "@@ -248,7 +248,7 @@ pub async fn get_exit_list(request: Json<EncryptedExitClientIdentity>) -> HttpRe\nlet ret: ExitList = ExitList {\nexit_list: settings::get_rita_exit().exit_network.cluster_exits,\n- wg_exit_listen_port: settings::get_rita_exit().exit_network.wg_new_tunnel_port,\n+ wg_exit_listen_port: settings::get_rita_exit().exit_network.wg_v2_tunnel_port,\n};\nlet plaintext = serde_json::to_string(&ret)\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/rita_loop/mod.rs", "new_path": "rita_exit/src/rita_loop/mod.rs", "diff": "@@ -225,7 +225,7 @@ fn setup_exit_wg_tunnel() {\nwarn!(\"exit setup returned {}\", e)\n}\n// Setup new wg_exit\n- if let Err(e) = KI.setup_wg_if_named(\"wg_exit_new\") {\n+ if let Err(e) = KI.setup_wg_if_named(\"wg_exit_v2\") {\nwarn!(\"new exit setup returned {}\", e)\n}\n@@ -248,8 +248,8 @@ fn setup_exit_wg_tunnel() {\n.expect(\"Failed to setup wg_exit!\");\n// Setup new wg_exit\n- KI.one_time_exit_setup(local_ip, netmask, mesh_ip, ex_nic, \"wg_exit_new\")\n- .expect(\"Failed to setup wg_exit_new!\");\n+ KI.one_time_exit_setup(local_ip, netmask, mesh_ip, ex_nic, \"wg_exit_v2\")\n+ .expect(\"Failed to setup wg_exit_v2!\");\nKI.setup_nat(\n&settings::get_rita_exit().network.external_nic.unwrap(),\n@@ -258,7 +258,7 @@ fn setup_exit_wg_tunnel() {\n.unwrap();\nKI.setup_nat(\n&settings::get_rita_exit().network.external_nic.unwrap(),\n- \"wg_exit_new\",\n+ \"wg_exit_v2\",\n)\n.unwrap();\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/traffic_watcher/mod.rs", "new_path": "rita_exit/src/traffic_watcher/mod.rs", "diff": "@@ -188,8 +188,8 @@ fn debts_logging(debts: &HashMap<Identity, i128>) {\nOk(users) => info!(\"Total of {} wg_exit users online\", users),\nErr(e) => warn!(\"Getting clients failed with {:?}\", e),\n}\n- match KI.get_wg_exit_clients_online(\"wg_exit_new\") {\n- Ok(users) => info!(\"Total of {} wg_exit_new users online\", users),\n+ match KI.get_wg_exit_clients_online(\"wg_exit_v2\") {\n+ Ok(users) => info!(\"Total of {} wg_exit_v2 users online\", users),\nErr(e) => warn!(\"Getting clients failed with {:?}\", e),\n}\n}\n@@ -227,7 +227,7 @@ pub fn watch(\n}\n};\n- let new_counters = match KI.read_wg_counters(\"wg_exit_new\") {\n+ let new_counters = match KI.read_wg_counters(\"wg_exit_v2\") {\nOk(res) => res,\nErr(e) => {\nwarn!(\n@@ -326,7 +326,7 @@ pub fn watch(\nOk(())\n}\n-/// This function merges two counter maps for wg_exit and wg_exit_new for combined accounting\n+/// This function merges two counter maps for wg_exit and wg_exit_v2 for combined accounting\nfn merge_counters(\nold_counters: &HashMap<WgKey, WgUsage>,\nnew_counters: &HashMap<WgKey, WgUsage>,\n" }, { "change_type": "MODIFY", "old_path": "settings/example_exit.toml", "new_path": "settings/example_exit.toml", "diff": "@@ -34,7 +34,7 @@ dao_addresses = []\n[exit_network]\nwg_tunnel_port = 59999\n-wg_new_tunnel_port = 59998\n+wg_v2_tunnel_port = 59998\nexit_hello_port = 4875\nexit_price = 50\nown_internal_ip = \"172.168.1.254\"\n" }, { "change_type": "MODIFY", "old_path": "settings/src/exit.rs", "new_path": "settings/src/exit.rs", "diff": "@@ -18,7 +18,7 @@ pub struct ExitNetworkSettings {\npub exit_hello_port: u16,\n/// This is the port which the exit tunnel listens on\npub wg_tunnel_port: u16,\n- pub wg_new_tunnel_port: u16,\n+ pub wg_v2_tunnel_port: u16,\n/// Price in wei per byte which is charged to traffic both coming in and out over the internet\npub exit_price: u64,\n/// This is the exit's own ip/gateway ip in the exit wireguard tunnel\n@@ -59,7 +59,7 @@ impl ExitNetworkSettings {\nExitNetworkSettings {\nexit_hello_port: 4875,\nwg_tunnel_port: 59999,\n- wg_new_tunnel_port: 59998,\n+ wg_v2_tunnel_port: 59998,\nexit_price: 10,\nown_internal_ip: \"172.16.255.254\".parse().unwrap(),\nexit_start_ip: \"172.16.0.0\".parse().unwrap(),\n" }, { "change_type": "MODIFY", "old_path": "settings/test_exit.toml", "new_path": "settings/test_exit.toml", "diff": "@@ -30,7 +30,7 @@ default_route = []\n[exit_network]\nwg_tunnel_port = 59999\n-wg_new_tunnel_port = 59998\n+wg_v2_tunnel_port = 59998\nexit_hello_port = 4875\nexit_price = 50\nown_internal_ip = \"172.168.1.254\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Replaced wg_exit_new with wg_exit_V2
20,255
29.09.2022 10:26:41
25,200
300650096a51014c833f90267f5055dfbb4dd71d
Fix manual exit addition docs
[ { "change_type": "MODIFY", "old_path": "docs/api/router-dashboard.md", "new_path": "docs/api/router-dashboard.md", "diff": "@@ -116,7 +116,7 @@ This file documents the dashboard API found in Rita client.\n- URL: `<rita ip>:<rita_dashboard_port>/exits'\n- Comment: Merges a supplied exit list with the existing list; existing entries\n- are overwritten. Once client side subnet is removed, replace 'subnet' with 'root_ip'\n+ are overwritten.\n- Method: `POST`\n- URL Params: `None`\n- Data Params: A JSON object containing the exits we want to add, e.g.:\n@@ -134,7 +134,7 @@ This file documents the dashboard API found in Rita client.\n},\n\"wg_public_key\": \"KaTbsJ0Hur4D7Tcb+nc8ofs7n8tKL+wWG3H38KFCwlE=\",\n\"eth_address\": \"0x0101010101010101010101010101010101010101\",\n- \"subnet\": \"fd00::5/120\",\n+ \"root_ip\": \"fd00::5\",\n\"message\": \"Got info successfully\",\n\"registration_port\": 4875,\n\"state\": \"GotInfo\"\n@@ -152,7 +152,7 @@ This file documents the dashboard API found in Rita client.\n},\n\"wg_public_key\": \"KaTbsJ0Hur4D7Tcb+nc8ofs7n8tKL+wWG3H38KFCwlE=\",\n\"eth_address\": \"0x0101010101010101010101010101010101010101\",\n- \"subnet\": \"fd00::5/120\",\n+ \"root_ip\": \"fd00::5\",\n\"message\": \"Got info successfully\",\n\"registration_port\": 4875,\n\"state\": \"GotInfo\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix manual exit addition docs
20,255
29.09.2022 13:53:26
25,200
df5d5d4174b2aef760e152eaaa2b254a6d4811a2
Fix route setup bug.
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/exit_server_tunnel.rs", "new_path": "althea_kernel_interface/src/exit_server_tunnel.rs", "diff": "@@ -195,6 +195,8 @@ impl dyn KernelInterface {\nclient_internal_ip: String,\ninterface: &str,\n) {\n+ let mut interface_cloned = interface.to_string();\n+ interface_cloned.push(' ');\n// Setup ipv4 route\n// 1.) Select all ipv4 routes with 'client_internal_ip'. This gives us all routes with wg_exit and wg_exit_v2 for the ip\n// THere should be only one route\n@@ -205,7 +207,7 @@ impl dyn KernelInterface {\n.run_command(\"ip\", &[\"route\", \"show\", &client_internal_ip])\n.expect(\"Fix command\");\nlet route = String::from_utf8(output.stdout).unwrap();\n- if !route.contains(&interface) {\n+ if !route.contains(&interface_cloned) {\nself.run_command(\"ip\", &[\"route\", \"del\", &client_internal_ip])\n.expect(\"Fix command\");\n@@ -237,7 +239,7 @@ impl dyn KernelInterface {\n.run_command(\"ip\", &[\"-6\", \"route\", \"show\", &ip_net.to_string()])\n.expect(\"Fix command\");\nlet existing_routes = String::from_utf8(output.stdout).unwrap();\n- if !existing_routes.contains(interface) {\n+ if !existing_routes.contains(&interface_cloned) {\nself.run_command(\"ip\", &[\"-6\", \"route\", \"del\", &ip_net.to_string()])\n.expect(\"Fix command\");\n" }, { "change_type": "MODIFY", "old_path": "scripts/openwrt_build_ipq40xx.sh", "new_path": "scripts/openwrt_build_ipq40xx.sh", "diff": "@@ -5,6 +5,6 @@ DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\n# Parse command line arguments\nsource $DIR/build_common.sh\n-cargo install cross\n+# cargo install cross\ncross build --target armv7-unknown-linux-musleabihf ${PROFILE} ${FEATURES} -p rita_bin --bin rita\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix route setup bug.
20,259
06.10.2022 16:21:27
14,400
252262c240a08b631d159ae471bef445cbeded3c
Update authorized keys Network Operator or managed keys can be cycled out
[ { "change_type": "MODIFY", "old_path": "althea_types/src/interop.rs", "new_path": "althea_types/src/interop.rs", "diff": "@@ -470,6 +470,11 @@ pub enum OperatorAction {\n/// Sets the min gas value to the provided value, primarily intended for use on xDai where\n/// the validators set a minimum gas price as a group without warning\nSetMinGas { new_min_gas: Uint256 },\n+ /// Modifies the authorized keys used for access to routers\n+ UpdateAuthorizedKeys {\n+ add_list: Vec<String>,\n+ drop_list: Vec<String>,\n+ },\n}\n/// Operator update that we get from the operator server during our checkin\n@@ -799,6 +804,17 @@ pub struct HeartbeatMessage {\npub struct ExitSystemTime {\npub system_time: SystemTime,\n}\n+\n+#[derive(Hash, Eq, PartialEq, Debug)]\n+pub struct AuthorizedKeys {\n+ // public ssh key\n+ pub key: String,\n+ // if the key is managed by ops-tools or network operator\n+ pub managed: bool,\n+ // set flush to remove key from configuratio\n+ pub flush: bool,\n+}\n+\n#[cfg(test)]\nmod test {\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "@@ -34,6 +34,7 @@ actix-async = {package=\"actix\", version = \"0.13\"}\nactix-web-async = { package=\"actix-web\", version = \"4.0.1\", default_features = false, features= [\"openssl\"]}\nactix-web-httpauth-async = { package=\"actix-web-httpauth\", version = \"0.8.0\"}\nclarity = \"0.5\"\n+openssh-keys = \"0.5\"\n[lib]\nname = \"rita_client\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/remote_access.rs", "new_path": "rita_client/src/dashboard/remote_access.rs", "diff": "@@ -8,8 +8,7 @@ use rita_common::RitaCommonError;\nuse rita_common::KI;\nuse crate::RitaClientError;\n-\n-static DROPBEAR_CONFIG: &str = \"/etc/config/dropbear\";\n+use rita_common::DROPBEAR_CONFIG;\nstatic FIREWALL_CONFIG: &str = \"/etc/config/firewall\";\npub async fn get_remote_access_status(_req: HttpRequest) -> HttpResponse {\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/operator_update/mod.rs", "new_path": "rita_client/src/operator_update/mod.rs", "diff": "//! This module is responsible for checking in with the operator server and getting updated local settings\npub mod updater;\n-\n+extern crate openssh_keys;\nuse crate::dashboard::system_chain::set_system_blockchain;\nuse crate::dashboard::wifi::reset_wifi_pass;\nuse crate::rita_loop::is_gateway_client;\n@@ -8,6 +8,7 @@ use crate::rita_loop::CLIENT_LOOP_TIMEOUT;\nuse crate::set_router_update_instruction;\nuse althea_kernel_interface::hardware_info::get_hardware_info;\nuse althea_types::get_sequence_num;\n+use althea_types::AuthorizedKeys;\nuse althea_types::BillingDetails;\nuse althea_types::ContactStorage;\nuse althea_types::ContactType;\n@@ -20,16 +21,21 @@ use rita_common::rita_loop::is_gateway;\nuse rita_common::tunnel_manager::neighbor_status::get_neighbor_status;\nuse rita_common::tunnel_manager::shaping::flag_reset_shaper;\nuse rita_common::utils::option_convert;\n+use rita_common::DROPBEAR_CONFIG;\nuse rita_common::KI;\nuse serde_json::Map;\nuse serde_json::Value;\nuse settings::client::RitaClientSettings;\nuse settings::network::NetworkSettings;\nuse settings::payment::PaymentSettings;\n+use std::collections::HashSet;\n+use std::fs::{remove_file, rename, File};\n+use std::io::BufRead;\n+use std::io::BufReader;\n+use std::io::Write;\nuse std::sync::{Arc, RwLock};\nuse std::time::{Duration, Instant};\nuse updater::update_system;\n-\n/// Things that you are not allowed to put into the merge json field of the OperatorUpdate,\n/// this mostly includes dangerous local things like eth private keys (erase money)\n/// ports (destory all networking) etc etc\n@@ -327,6 +333,15 @@ fn perform_operator_update(\n);\nrita_client.payment.min_gas = new_min_gas;\n}\n+ Some(OperatorAction::UpdateAuthorizedKeys {\n+ add_list,\n+ drop_list,\n+ }) => {\n+ let key_file = DROPBEAR_CONFIG;\n+ info!(\"Updating {}\", key_file);\n+ let res = update_authorized_keys(add_list, drop_list, key_file);\n+ info!(\"Update auth_keys result is {:?}\", res);\n+ }\nNone => {}\n}\nnetwork.shaper_settings = new_settings.shaper_settings;\n@@ -335,6 +350,102 @@ fn perform_operator_update(\ntrace!(\"Successfully completed OperatorUpdate\");\n}\n+// cycles in/out ssh pubkeys for recovery access\n+fn update_authorized_keys(\n+ add_list: Vec<String>,\n+ drop_list: Vec<String>,\n+ keys_file: &str,\n+) -> Result<(), std::io::Error> {\n+ info!(\"Authorized keys update starting\");\n+\n+ let mut existing = HashSet::new();\n+ let auth_keys_file = File::open(keys_file);\n+ let mut write_data: Vec<String> = vec![];\n+ let temp_key_file = String::from(\"key_backup\");\n+\n+ info!(\n+ \"Authorized keys updates add {} remove {} pubkeys\",\n+ add_list.len(),\n+ drop_list.len()\n+ );\n+ // collect any keys managed by dropbear already on the router\n+ match auth_keys_file {\n+ Ok(key_file_open) => {\n+ let buf_reader = BufReader::new(key_file_open);\n+\n+ for line in buf_reader.lines() {\n+ match line {\n+ Ok(line) => {\n+ if let Ok(pubkey) = openssh_keys::PublicKey::parse(&line) {\n+ info!(\"Authorized keys parse keys\");\n+ existing.insert(AuthorizedKeys {\n+ key: pubkey.to_string(),\n+ managed: true,\n+ flush: false,\n+ });\n+ }\n+ }\n+ Err(e) => {\n+ info!(\n+ \"Authorized keys unable to read lines from file {:?}, {:?}\",\n+ &keys_file, e\n+ )\n+ }\n+ }\n+ }\n+ }\n+ Err(e) => return Err(e),\n+ };\n+ // parse/validate keys before being added\n+ for pubkey in add_list {\n+ if let Ok(pubkey) = openssh_keys::PublicKey::parse(&pubkey) {\n+ existing.insert(AuthorizedKeys {\n+ key: pubkey.to_string(),\n+ managed: true,\n+ flush: false,\n+ });\n+ }\n+ }\n+ // parse list for keys to remove, setting flush = true\n+ for pubkey in drop_list {\n+ existing.remove(&AuthorizedKeys {\n+ key: pubkey,\n+ managed: false,\n+ flush: true,\n+ });\n+ }\n+\n+ // create and write to temporary file. temp file to protect from a partial writes to _keys_file_\n+ let updated_key_file = std::fs::OpenOptions::new()\n+ .create(true)\n+ .write(true)\n+ .truncate(true)\n+ .open(&temp_key_file)?;\n+\n+ for key in &existing {\n+ if !key.flush {\n+ write_data.push(key.key.to_string());\n+ }\n+ }\n+ // create string block to use a single write to temp file\n+ match write!(&updated_key_file, \"{}\", write_data.join(\"\\n\")) {\n+ Ok(()) => info!(\"Authorized keys write success\"),\n+ Err(e) => info!(\"Authorized keys write failed with {:?}\", e),\n+ };\n+\n+ // rename temp file\n+ match rename(&temp_key_file, keys_file) {\n+ Ok(()) => {\n+ info!(\"Authorized keys rename success\")\n+ }\n+ Err(e) => {\n+ info!(\"Authorized keys rename failed with {:?}\", e);\n+ remove_file(&temp_key_file)?\n+ }\n+ };\n+\n+ Ok(())\n+}\n/// Creates a payment settings from OperatorUpdateMessage to be returned and applied\nfn update_payment_settings(\nmut payment: PaymentSettings,\n@@ -474,6 +585,8 @@ fn contains_forbidden_key(map: Map<String, Value>, forbidden_values: &[&str]) ->\n#[cfg(test)]\nmod tests {\n+ use std::{fs, io::Error};\n+\nuse serde_json::json;\nuse super::*;\n@@ -498,4 +611,95 @@ mod tests {\npanic!(\"Not a json map!\");\n}\n}\n+ fn touch_temp_file(file_name: &str) -> &str {\n+ let test_file = std::fs::OpenOptions::new()\n+ .create(true)\n+ .write(true)\n+ .truncate(true)\n+ .open(file_name);\n+ let operator_key = \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+UBakquB9rJ7tA2H+U43H/xNmpJiHpOkHGpVfFUXgP OPERATOR\";\n+ writeln!(test_file.unwrap(), \"{}\", operator_key).expect(\"setup failed to create temp file\");\n+ operator_key\n+ }\n+ fn remove_temp_file(file_name: &str) -> Result<(), Error> {\n+ fs::remove_file(file_name)\n+ }\n+ fn parse_keys(file_name: &str) -> Vec<String> {\n+ let mut temp = Vec::new();\n+ let expected = File::open(file_name).unwrap();\n+ let reader = BufReader::new(expected);\n+ for key in reader.lines() {\n+ temp.push(key.unwrap());\n+ }\n+ temp\n+ }\n+\n+ #[test]\n+ fn test_update_auth_keys() {\n+ let added_keys = vec![String::from(\"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHFgFrnSm9MFS1zpHHvwtfLohjqtsK13NyL41g/zyIhK test@hawk-net\")];\n+ let removed_keys = vec![];\n+ let key_file: &str = \"authorized_keys\";\n+ let _operator_key = touch_temp_file(key_file);\n+\n+ let _update = update_authorized_keys(added_keys.clone(), removed_keys, key_file);\n+ let result = parse_keys(key_file);\n+ assert_eq!(result.len(), 2);\n+ assert!(result.contains(&added_keys[0]));\n+ remove_temp_file(key_file).unwrap();\n+ }\n+\n+ #[test]\n+ fn test_update_auth_multiple_keys() {\n+ let added_keys = vec![String::from(\"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHFgFrnSm9MFS1zpHHvwtfLohjqtsK13NyL41g/zyIhK test@hawk-net\"),\n+ String::from(\"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDVF1POOko4/fTE/SowsURSmd+kAUFDX6VPNqICJjn8eQk8FZ15WsZKfBdrGXLhl2+pxM66VWMUVRQOq84iSRVSVPA3abz0H7JYIGzO8psTweSZfK1jwHfKDGQA1h1aPuspnPrX7dyS1qLZf3YeVUUi+BFsW2gSiMadbS4zal2c2F1AG5Ezr3zcRVA8y3D0bZxScPAEX74AeTFcimHpHFyzDtUsRpf0uSEXZcMFqX5j4ETKlIs28k1v8LlhHo91IQYHEtbyi/I1M0axbF4VCz5JlcbAs9LUEJg8Kx8LxzJSeSJbxVwyk5WiEDwVsCL2MAtaOcJ+/FhxLb0ZEELAHnXFNSqmY8QoHeSdHrGP7FmVCBjRb/AhVUHYvsG94rO3Ij4H5XsbsQbP3AHVKbvf387WB53Wga7VrBXvRC9aDisetdP9+4/seVIBbOIePotaiHoTyS1cJ+Jg0PkKy96enqwMt9T1Wt8jURB+s/A/bDGHkjB3dxomuGxux8dD6UNX54M= test-rsa@hawk-net\"),\n+ ];\n+ let removed_keys = vec![];\n+ let key_file: &str = \"add_keys\";\n+\n+ let operator_key = touch_temp_file(key_file);\n+\n+ let _update = update_authorized_keys(added_keys.clone(), removed_keys, key_file);\n+ let result = parse_keys(key_file);\n+ assert!(result.contains(&added_keys[0]));\n+ assert!(result.contains(&added_keys[1]));\n+ assert!(result.contains(&operator_key.to_string()));\n+ assert_eq!(result.len(), 3);\n+ remove_temp_file(key_file).unwrap();\n+ }\n+\n+ #[test]\n+ fn test_update_auth_remove_keys() {\n+ let added_keys = vec![];\n+ let removed_keys = vec![\n+ String::from(\"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHFgFrnSm9MFS1zpHHvwtfLohjqtsK13NyL41g/zyIhK test@hawk-net\"),\n+ String::from(\"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDVF1POOko4/fTE/SowsURSmd+kAUFDX6VPNqICJjn8eQk8FZ15WsZKfBdrGXLhl2+pxM66VWMUVRQOq84iSRVSVPA3abz0H7JYIGzO8psTweSZfK1jwHfKDGQA1h1aPuspnPrX7dyS1qLZf3YeVUUi+BFsW2gSiMadbS4zal2c2F1AG5Ezr3zcRVA8y3D0bZxScPAEX74AeTFcimHpHFyzDtUsRpf0uSEXZcMFqX5j4ETKlIs28k1v8LlhHo91IQYHEtbyi/I1M0axbF4VCz5JlcbAs9LUEJg8Kx8LxzJSeSJbxVwyk5WiEDwVsCL2MAtaOcJ+/FhxLb0ZEELAHnXFNSqmY8QoHeSdHrGP7FmVCBjRb/AhVUHYvsG94rO3Ij4H5XsbsQbP3AHVKbvf387WB53Wga7VrBXvRC9aDisetdP9+4/seVIBbOIePotaiHoTyS1cJ+Jg0PkKy96enqwMt9T1Wt8jURB+s/A/bDGHkjB3dxomuGxux8dD6UNX54M= test-rsa@hawk-net\"),\n+ ];\n+ let key_file: &str = \"auth_remove_keys\";\n+\n+ let operator_key = touch_temp_file(key_file);\n+\n+ let _update = update_authorized_keys(added_keys, removed_keys, key_file);\n+ let result = parse_keys(key_file);\n+ assert!(result.contains(&operator_key.to_string()));\n+\n+ assert_eq!(result.len(), 1);\n+\n+ remove_temp_file(key_file).unwrap();\n+ }\n+ #[test]\n+ fn test_removing_existing_key() {\n+ let added_keys = vec![];\n+ let key_file: &str = \"remove_keys\";\n+\n+ let operator_key = touch_temp_file(key_file);\n+ let removed_keys = vec![String::from(operator_key)];\n+ let _update = update_authorized_keys(added_keys, removed_keys.clone(), key_file);\n+\n+ let result = parse_keys(key_file);\n+ for item in result {\n+ assert_eq!(item, removed_keys[0].to_string());\n+ }\n+\n+ remove_temp_file(key_file).unwrap();\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/lib.rs", "new_path": "rita_common/src/lib.rs", "diff": "@@ -15,6 +15,7 @@ use althea_kernel_interface::LinuxCommandRunner;\nlazy_static! {\npub static ref KI: Box<dyn KernelInterface> = Box::new(LinuxCommandRunner {});\n}\n+pub static DROPBEAR_CONFIG: &str = \"/etc/config/dropbear\";\npub mod blockchain_oracle;\npub mod dashboard;\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Update authorized keys Network Operator or managed keys can be cycled out
20,244
07.10.2022 08:19:26
14,400
a5d49dc8cac417d5efa896bf34a746cd3a89c8ec
Bump for Beta 20 RC3
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -47,7 +47,7 @@ dependencies = [\n\"pin-project-lite\",\n\"smallvec\",\n\"tokio\",\n- \"tokio-util 0.7.3\",\n+ \"tokio-util 0.7.4\",\n]\n[[package]]\n@@ -64,14 +64,14 @@ dependencies = [\n\"memchr\",\n\"pin-project-lite\",\n\"tokio\",\n- \"tokio-util 0.7.3\",\n+ \"tokio-util 0.7.4\",\n]\n[[package]]\nname = \"actix-http\"\n-version = \"3.2.1\"\n+version = \"3.2.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6f9ffb6db08c1c3a1f4aef540f1a63193adc73c4fbd40b75a95fc8c5258f6e51\"\n+checksum = \"0c83abf9903e1f0ad9973cc4f7b9767fd5a03a583f51a5b7a339e07987cd2724\"\ndependencies = [\n\"actix-codec\",\n\"actix-rt\",\n@@ -107,16 +107,15 @@ dependencies = [\n[[package]]\nname = \"actix-router\"\n-version = \"0.5.0\"\n+version = \"0.5.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"eb60846b52c118f2f04a56cc90880a274271c489b2498623d58176f8ca21fa80\"\n+checksum = \"d66ff4d247d2b160861fa2866457e85706833527840e4133f8f49aa423a38799\"\ndependencies = [\n\"bytestring\",\n- \"firestorm\",\n\"http\",\n- \"log\",\n\"regex\",\n\"serde\",\n+ \"tracing\",\n]\n[[package]]\n@@ -174,7 +173,7 @@ dependencies = [\n\"openssl\",\n\"pin-project-lite\",\n\"tokio-openssl\",\n- \"tokio-util 0.7.3\",\n+ \"tokio-util 0.7.4\",\n]\n[[package]]\n@@ -189,9 +188,9 @@ dependencies = [\n[[package]]\nname = \"actix-web\"\n-version = \"4.1.0\"\n+version = \"4.2.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a27e8fe9ba4ae613c21f677c2cfaf0696c3744030c6f485b34634e502d6bb379\"\n+checksum = \"d48f7b6534e06c7bfc72ee91db7917d4af6afe23e7d223b51e68fffbb21e96b9\"\ndependencies = [\n\"actix-codec\",\n\"actix-http\",\n@@ -209,6 +208,7 @@ dependencies = [\n\"encoding_rs\",\n\"futures-core\",\n\"futures-util\",\n+ \"http\",\n\"itoa\",\n\"language-tags\",\n\"log\",\n@@ -270,24 +270,24 @@ dependencies = [\n[[package]]\nname = \"aho-corasick\"\n-version = \"0.7.18\"\n+version = \"0.7.19\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f\"\n+checksum = \"b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e\"\ndependencies = [\n\"memchr\",\n]\n[[package]]\nname = \"alloc-no-stdlib\"\n-version = \"2.0.3\"\n+version = \"2.0.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"35ef4730490ad1c4eae5c4325b2a95f521d023e5c885853ff7aca0a6a1631db3\"\n+checksum = \"cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3\"\n[[package]]\nname = \"alloc-stdlib\"\n-version = \"0.2.1\"\n+version = \"0.2.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"697ed7edc0f1711de49ce108c541623a0af97c6c60b2f6e2b65229847ac843c2\"\n+checksum = \"94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece\"\ndependencies = [\n\"alloc-no-stdlib\",\n]\n@@ -297,8 +297,8 @@ name = \"althea_kernel_interface\"\nversion = \"0.1.0\"\ndependencies = [\n\"althea_types\",\n- \"ipnetwork 0.20.0\",\n- \"itertools 0.10.3\",\n+ \"ipnetwork\",\n+ \"itertools 0.10.5\",\n\"lazy_static\",\n\"log\",\n\"oping\",\n@@ -321,7 +321,7 @@ dependencies = [\n\"bincode\",\n\"clarity\",\n\"hex\",\n- \"ipnetwork 0.20.0\",\n+ \"ipnetwork\",\n\"lettre\",\n\"num256\",\n\"phonenumber\",\n@@ -382,9 +382,9 @@ dependencies = [\n[[package]]\nname = \"ascii\"\n-version = \"1.0.0\"\n+version = \"1.1.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"bbf56136a5198c7b01a49e3afcbef6cf84597273d298f54432926024107b0109\"\n+checksum = \"d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16\"\n[[package]]\nname = \"atty\"\n@@ -403,7 +403,7 @@ version = \"0.1.5\"\ndependencies = [\n\"actix 0.13.0\",\n\"clarity\",\n- \"futures 0.3.21\",\n+ \"futures 0.3.24\",\n\"log\",\n\"num 0.4.0\",\n\"num256\",\n@@ -422,9 +422,9 @@ checksum = \"d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa\"\n[[package]]\nname = \"awc\"\n-version = \"3.0.0\"\n+version = \"3.0.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"65c60c44fbf3c8cee365e86b97d706e513b733c4eeb16437b45b88d2fffe889a\"\n+checksum = \"80ca7ff88063086d2e2c70b9f3b29b2fcd999bac68ac21731e66781970d68519\"\ndependencies = [\n\"actix-codec\",\n\"actix-http\",\n@@ -461,7 +461,7 @@ version = \"0.1.0\"\ndependencies = [\n\"ascii\",\n\"env_logger\",\n- \"ipnetwork 0.20.0\",\n+ \"ipnetwork\",\n\"log\",\n\"serde\",\n\"serde_derive\",\n@@ -501,20 +501,27 @@ checksum = \"bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a\"\n[[package]]\nname = \"blake2\"\n-version = \"0.9.2\"\n+version = \"0.10.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0a4e37d16930f5459780f5621038b6382b9bb37c19016f39fb6b5808d831f174\"\n+checksum = \"b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388\"\ndependencies = [\n- \"crypto-mac\",\n- \"digest 0.9.0\",\n- \"opaque-debug\",\n+ \"digest 0.10.5\",\n]\n[[package]]\nname = \"block-buffer\"\n-version = \"0.10.2\"\n+version = \"0.9.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324\"\n+checksum = \"4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4\"\n+dependencies = [\n+ \"generic-array\",\n+]\n+\n+[[package]]\n+name = \"block-buffer\"\n+version = \"0.10.3\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e\"\ndependencies = [\n\"generic-array\",\n]\n@@ -542,9 +549,9 @@ dependencies = [\n[[package]]\nname = \"bumpalo\"\n-version = \"3.10.0\"\n+version = \"3.11.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3\"\n+checksum = \"c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d\"\n[[package]]\nname = \"byteorder\"\n@@ -590,9 +597,9 @@ checksum = \"baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd\"\n[[package]]\nname = \"clarity\"\n-version = \"0.5.1\"\n+version = \"0.5.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"9e043fca6ce2fabc4566fe447d2185a724529a383f3e9938279a53ea75532a02\"\n+checksum = \"880114aafee14fa3a183582a82407474d53f4950b1695658e95bbb5d049bb253\"\ndependencies = [\n\"lazy_static\",\n\"num-bigint 0.4.3\",\n@@ -636,7 +643,7 @@ dependencies = [\n\"awc\",\n\"backoff\",\n\"flate2\",\n- \"futures 0.3.21\",\n+ \"futures 0.3.24\",\n\"lazy_static\",\n\"log\",\n\"serde\",\n@@ -653,9 +660,9 @@ checksum = \"6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e\"\n[[package]]\nname = \"cookie\"\n-version = \"0.16.0\"\n+version = \"0.16.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"94d4706de1b0fa5b132270cddffa8585166037822e260a944fe161acd137ca05\"\n+checksum = \"344adc371239ef32293cb1c4fe519592fcf21206c79c02854320afcdf3ab4917\"\ndependencies = [\n\"percent-encoding\",\n\"time\",\n@@ -680,9 +687,9 @@ checksum = \"5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc\"\n[[package]]\nname = \"cpufeatures\"\n-version = \"0.2.2\"\n+version = \"0.2.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b\"\n+checksum = \"28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320\"\ndependencies = [\n\"libc\",\n]\n@@ -708,12 +715,11 @@ dependencies = [\n[[package]]\nname = \"crossbeam-utils\"\n-version = \"0.8.11\"\n+version = \"0.8.12\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc\"\n+checksum = \"edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac\"\ndependencies = [\n\"cfg-if\",\n- \"once_cell\",\n]\n[[package]]\n@@ -726,21 +732,11 @@ dependencies = [\n\"typenum\",\n]\n-[[package]]\n-name = \"crypto-mac\"\n-version = \"0.8.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab\"\n-dependencies = [\n- \"generic-array\",\n- \"subtle\",\n-]\n-\n[[package]]\nname = \"ctrlc\"\n-version = \"3.2.2\"\n+version = \"3.2.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b37feaa84e6861e00a1f5e5aa8da3ee56d605c9992d33e082786754828e20865\"\n+checksum = \"1d91974fbbe88ec1df0c24a4f00f99583667a7e2e6272b2b92d294d81e462173\"\ndependencies = [\n\"nix\",\n\"winapi 0.3.9\",\n@@ -794,12 +790,13 @@ dependencies = [\n[[package]]\nname = \"digest\"\n-version = \"0.10.3\"\n+version = \"0.10.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506\"\n+checksum = \"adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c\"\ndependencies = [\n- \"block-buffer\",\n+ \"block-buffer 0.10.3\",\n\"crypto-common\",\n+ \"subtle\",\n]\n[[package]]\n@@ -831,9 +828,9 @@ dependencies = [\n[[package]]\nname = \"either\"\n-version = \"1.7.0\"\n+version = \"1.8.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be\"\n+checksum = \"90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797\"\n[[package]]\nname = \"email-encoding\"\n@@ -862,9 +859,9 @@ dependencies = [\n[[package]]\nname = \"env_logger\"\n-version = \"0.9.0\"\n+version = \"0.9.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3\"\n+checksum = \"c90bf5f19754d10198ccb95b70664fc925bd1fc090a0fd9a6ebc54acc8cd6272\"\ndependencies = [\n\"atty\",\n\"humantime\",\n@@ -904,12 +901,6 @@ dependencies = [\n\"instant\",\n]\n-[[package]]\n-name = \"firestorm\"\n-version = \"0.5.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"2c5f6c2c942da57e2aaaa84b8a521489486f14e75e7fa91dab70aba913975f98\"\n-\n[[package]]\nname = \"flate2\"\nversion = \"1.0.24\"\n@@ -943,11 +934,10 @@ checksum = \"00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b\"\n[[package]]\nname = \"form_urlencoded\"\n-version = \"1.0.1\"\n+version = \"1.1.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191\"\n+checksum = \"a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8\"\ndependencies = [\n- \"matches\",\n\"percent-encoding\",\n]\n@@ -965,9 +955,9 @@ checksum = \"3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678\"\n[[package]]\nname = \"futures\"\n-version = \"0.3.21\"\n+version = \"0.3.24\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e\"\n+checksum = \"7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c\"\ndependencies = [\n\"futures-channel\",\n\"futures-core\",\n@@ -980,9 +970,9 @@ dependencies = [\n[[package]]\nname = \"futures-channel\"\n-version = \"0.3.21\"\n+version = \"0.3.24\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010\"\n+checksum = \"30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050\"\ndependencies = [\n\"futures-core\",\n\"futures-sink\",\n@@ -990,15 +980,15 @@ dependencies = [\n[[package]]\nname = \"futures-core\"\n-version = \"0.3.21\"\n+version = \"0.3.24\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3\"\n+checksum = \"4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf\"\n[[package]]\nname = \"futures-executor\"\n-version = \"0.3.21\"\n+version = \"0.3.24\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6\"\n+checksum = \"9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab\"\ndependencies = [\n\"futures-core\",\n\"futures-task\",\n@@ -1008,15 +998,15 @@ dependencies = [\n[[package]]\nname = \"futures-io\"\n-version = \"0.3.21\"\n+version = \"0.3.24\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b\"\n+checksum = \"bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68\"\n[[package]]\nname = \"futures-macro\"\n-version = \"0.3.21\"\n+version = \"0.3.24\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512\"\n+checksum = \"42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -1025,21 +1015,21 @@ dependencies = [\n[[package]]\nname = \"futures-sink\"\n-version = \"0.3.21\"\n+version = \"0.3.24\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868\"\n+checksum = \"21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56\"\n[[package]]\nname = \"futures-task\"\n-version = \"0.3.21\"\n+version = \"0.3.24\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a\"\n+checksum = \"a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1\"\n[[package]]\nname = \"futures-util\"\n-version = \"0.3.21\"\n+version = \"0.3.24\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a\"\n+checksum = \"44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90\"\ndependencies = [\n\"futures 0.1.31\",\n\"futures-channel\",\n@@ -1105,9 +1095,9 @@ dependencies = [\n[[package]]\nname = \"h2\"\n-version = \"0.3.13\"\n+version = \"0.3.14\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57\"\n+checksum = \"5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be\"\ndependencies = [\n\"bytes\",\n\"fnv\",\n@@ -1118,7 +1108,7 @@ dependencies = [\n\"indexmap\",\n\"slab\",\n\"tokio\",\n- \"tokio-util 0.7.3\",\n+ \"tokio-util 0.7.4\",\n\"tracing\",\n]\n@@ -1130,9 +1120,9 @@ checksum = \"eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7\"\n[[package]]\nname = \"handlebars\"\n-version = \"4.3.3\"\n+version = \"4.3.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"360d9740069b2f6cbb63ce2dbaa71a20d3185350cbb990d7bebeb9318415eb17\"\n+checksum = \"433e4ab33f1213cdc25b5fa45c76881240cfe79284cf2b395e8b9e312a30a2fd\"\ndependencies = [\n\"log\",\n\"pest\",\n@@ -1204,9 +1194,9 @@ dependencies = [\n[[package]]\nname = \"httparse\"\n-version = \"1.7.1\"\n+version = \"1.8.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c\"\n+checksum = \"d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904\"\n[[package]]\nname = \"httpdate\"\n@@ -1268,6 +1258,16 @@ dependencies = [\n\"unicode-normalization\",\n]\n+[[package]]\n+name = \"idna\"\n+version = \"0.3.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6\"\n+dependencies = [\n+ \"unicode-bidi\",\n+ \"unicode-normalization\",\n+]\n+\n[[package]]\nname = \"indexmap\"\nversion = \"1.9.1\"\n@@ -1289,12 +1289,12 @@ dependencies = [\n[[package]]\nname = \"ipgen\"\n-version = \"1.0.1\"\n+version = \"1.0.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"3813f6fd14b83ca7f1be253a54b580fd0eb03d2c92d6b4bac7c17f67ef4073a3\"\n+checksum = \"2feff90e2d7307100ba887119bfa8bb9b7703670899b001805ccdd9f2ef187d3\"\ndependencies = [\n\"blake2\",\n- \"ipnetwork 0.17.0\",\n+ \"ipnetwork\",\n]\n[[package]]\n@@ -1303,12 +1303,6 @@ version = \"2.5.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b\"\n-[[package]]\n-name = \"ipnetwork\"\n-version = \"0.17.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"02c3eaab3ac0ede60ffa41add21970a7df7d91772c03383aac6c2c3d53cc716b\"\n-\n[[package]]\nname = \"ipnetwork\"\nversion = \"0.20.0\"\n@@ -1329,24 +1323,24 @@ dependencies = [\n[[package]]\nname = \"itertools\"\n-version = \"0.10.3\"\n+version = \"0.10.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3\"\n+checksum = \"b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473\"\ndependencies = [\n\"either\",\n]\n[[package]]\nname = \"itoa\"\n-version = \"1.0.3\"\n+version = \"1.0.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754\"\n+checksum = \"4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc\"\n[[package]]\nname = \"jemalloc-sys\"\n-version = \"0.5.1+5.3.0-patched\"\n+version = \"0.5.2+5.3.0-patched\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b7c2b313609b95939cb0c5a5c6917fb9b7c9394562aa3ef44eb66ffa51736432\"\n+checksum = \"134163979b6eed9564c98637b710b40979939ba351f59952708234ea11b5f3f8\"\ndependencies = [\n\"cc\",\n\"fs_extra\",\n@@ -1365,18 +1359,18 @@ dependencies = [\n[[package]]\nname = \"jobserver\"\n-version = \"0.1.24\"\n+version = \"0.1.25\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa\"\n+checksum = \"068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b\"\ndependencies = [\n\"libc\",\n]\n[[package]]\nname = \"js-sys\"\n-version = \"0.3.59\"\n+version = \"0.3.60\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2\"\n+checksum = \"49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47\"\ndependencies = [\n\"wasm-bindgen\",\n]\n@@ -1412,7 +1406,7 @@ dependencies = [\n\"futures-util\",\n\"hostname\",\n\"httpdate\",\n- \"idna\",\n+ \"idna 0.2.3\",\n\"mime\",\n\"native-tls\",\n\"nom 7.1.1\",\n@@ -1438,9 +1432,9 @@ dependencies = [\n[[package]]\nname = \"libc\"\n-version = \"0.2.131\"\n+version = \"0.2.134\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"04c3b4822ccebfa39c02fc03d1534441b22ead323fa0f48bb7ddd8e6ba076a40\"\n+checksum = \"329c933548736bc49fd575ee68c89e8be4d260064184389a5b77517cddd99ffb\"\n[[package]]\nname = \"libsodium-sys\"\n@@ -1480,9 +1474,9 @@ checksum = \"e34f76eb3611940e0e7d53a9aaa4e6a3151f69541a282fd0dad5571420c53ff1\"\n[[package]]\nname = \"lock_api\"\n-version = \"0.4.7\"\n+version = \"0.4.9\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53\"\n+checksum = \"435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df\"\ndependencies = [\n\"autocfg\",\n\"scopeguard\",\n@@ -1518,6 +1512,17 @@ version = \"0.1.9\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f\"\n+[[package]]\n+name = \"md-5\"\n+version = \"0.9.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15\"\n+dependencies = [\n+ \"block-buffer 0.9.0\",\n+ \"digest 0.9.0\",\n+ \"opaque-debug\",\n+]\n+\n[[package]]\nname = \"memchr\"\nversion = \"2.5.0\"\n@@ -1538,9 +1543,9 @@ checksum = \"68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a\"\n[[package]]\nname = \"miniz_oxide\"\n-version = \"0.5.3\"\n+version = \"0.5.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc\"\n+checksum = \"96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34\"\ndependencies = [\n\"adler\",\n]\n@@ -1577,10 +1582,11 @@ dependencies = [\n[[package]]\nname = \"nix\"\n-version = \"0.24.2\"\n+version = \"0.25.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc\"\n+checksum = \"e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb\"\ndependencies = [\n+ \"autocfg\",\n\"bitflags\",\n\"cfg-if\",\n\"libc\",\n@@ -1777,9 +1783,9 @@ dependencies = [\n[[package]]\nname = \"once_cell\"\n-version = \"1.13.0\"\n+version = \"1.15.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1\"\n+checksum = \"e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1\"\n[[package]]\nname = \"oncemutex\"\n@@ -1793,11 +1799,24 @@ version = \"0.3.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5\"\n+[[package]]\n+name = \"openssh-keys\"\n+version = \"0.5.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"e7249a699cdeea261ac73f1bf9350777cb867324f44373aafb5a287365bf1771\"\n+dependencies = [\n+ \"base64\",\n+ \"byteorder\",\n+ \"md-5\",\n+ \"sha2\",\n+ \"thiserror\",\n+]\n+\n[[package]]\nname = \"openssl\"\n-version = \"0.10.41\"\n+version = \"0.10.42\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"618febf65336490dfcf20b73f885f5651a0c89c64c2d4a8c3662585a70bf5bd0\"\n+checksum = \"12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13\"\ndependencies = [\n\"bitflags\",\n\"cfg-if\",\n@@ -1836,9 +1855,9 @@ dependencies = [\n[[package]]\nname = \"openssl-sys\"\n-version = \"0.9.75\"\n+version = \"0.9.76\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e5f9bd0c2710541a3cda73d6f9ac4f1b240de4ae261065d309dbe73d9dceb42f\"\n+checksum = \"5230151e44c0f05157effb743e8d517472843121cf9243e8b81393edb5acd9ce\"\ndependencies = [\n\"autocfg\",\n\"cc\",\n@@ -1909,21 +1928,21 @@ dependencies = [\n[[package]]\nname = \"paste\"\n-version = \"1.0.8\"\n+version = \"1.0.9\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"9423e2b32f7a043629287a536f21951e8c6a82482d0acb1eeebfc90bc2225b22\"\n+checksum = \"b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1\"\n[[package]]\nname = \"percent-encoding\"\n-version = \"2.1.0\"\n+version = \"2.2.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e\"\n+checksum = \"478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e\"\n[[package]]\nname = \"pest\"\n-version = \"2.2.1\"\n+version = \"2.4.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"69486e2b8c2d2aeb9762db7b4e00b0331156393555cff467f4163ff06821eef8\"\n+checksum = \"dbc7bc69c062e492337d74d59b120c274fd3d261b6bf6d3207d499b4b379c41a\"\ndependencies = [\n\"thiserror\",\n\"ucd-trie\",\n@@ -1931,9 +1950,9 @@ dependencies = [\n[[package]]\nname = \"pest_derive\"\n-version = \"2.2.1\"\n+version = \"2.4.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b13570633aff33c6d22ce47dd566b10a3b9122c2fe9d8e7501895905be532b91\"\n+checksum = \"60b75706b9642ebcb34dab3bc7750f811609a0eb1dd8b88c2d15bf628c1c65b2\"\ndependencies = [\n\"pest\",\n\"pest_generator\",\n@@ -1941,9 +1960,9 @@ dependencies = [\n[[package]]\nname = \"pest_generator\"\n-version = \"2.2.1\"\n+version = \"2.4.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b3c567e5702efdc79fb18859ea74c3eb36e14c43da7b8c1f098a4ed6514ec7a0\"\n+checksum = \"f4f9272122f5979a6511a749af9db9bfc810393f63119970d7085fed1c4ea0db\"\ndependencies = [\n\"pest\",\n\"pest_meta\",\n@@ -1954,13 +1973,13 @@ dependencies = [\n[[package]]\nname = \"pest_meta\"\n-version = \"2.2.1\"\n+version = \"2.4.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5eb32be5ee3bbdafa8c7a18b0a8a8d962b66cfa2ceee4037f49267a50ee821fe\"\n+checksum = \"4c8717927f9b79515e565a64fe46c38b8cd0427e64c40680b14a7365ab09ac8d\"\ndependencies = [\n\"once_cell\",\n\"pest\",\n- \"sha-1\",\n+ \"sha1\",\n]\n[[package]]\n@@ -2018,9 +2037,9 @@ dependencies = [\n[[package]]\nname = \"proc-macro2\"\n-version = \"1.0.43\"\n+version = \"1.0.46\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab\"\n+checksum = \"94e2ef8dbfc347b10c094890f778ee2e36ca9bb4262e86dc99cd217e35f3470b\"\ndependencies = [\n\"unicode-ident\",\n]\n@@ -2083,9 +2102,9 @@ dependencies = [\n[[package]]\nname = \"rand_core\"\n-version = \"0.6.3\"\n+version = \"0.6.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7\"\n+checksum = \"ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c\"\ndependencies = [\n\"getrandom\",\n]\n@@ -2139,9 +2158,9 @@ dependencies = [\n[[package]]\nname = \"reqwest\"\n-version = \"0.11.11\"\n+version = \"0.11.12\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92\"\n+checksum = \"431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc\"\ndependencies = [\n\"base64\",\n\"bytes\",\n@@ -2155,10 +2174,10 @@ dependencies = [\n\"hyper-tls\",\n\"ipnet\",\n\"js-sys\",\n- \"lazy_static\",\n\"log\",\n\"mime\",\n\"native-tls\",\n+ \"once_cell\",\n\"percent-encoding\",\n\"pin-project-lite\",\n\"serde\",\n@@ -2176,7 +2195,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.20.2\"\n+version = \"0.20.3\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2209,7 +2228,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.20.2\"\n+version = \"0.20.3\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2224,12 +2243,13 @@ dependencies = [\n\"clu\",\n\"compressed_log\",\n\"hex-literal\",\n- \"ipnetwork 0.20.0\",\n+ \"ipnetwork\",\n\"lazy_static\",\n\"lettre\",\n\"log\",\n\"num-traits\",\n\"num256\",\n+ \"openssh-keys\",\n\"phonenumber\",\n\"rita_common\",\n\"serde\",\n@@ -2243,7 +2263,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.20.2\"\n+version = \"0.20.3\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-service\",\n@@ -2263,9 +2283,9 @@ dependencies = [\n\"docopt\",\n\"env_logger\",\n\"flate2\",\n- \"futures 0.3.21\",\n+ \"futures 0.3.24\",\n\"hex-literal\",\n- \"ipnetwork 0.20.0\",\n+ \"ipnetwork\",\n\"lazy_static\",\n\"log\",\n\"num-traits\",\n@@ -2282,7 +2302,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.20.2\"\n+version = \"0.20.3\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2296,7 +2316,7 @@ dependencies = [\n\"diesel\",\n\"exit_db\",\n\"handlebars\",\n- \"ipnetwork 0.20.0\",\n+ \"ipnetwork\",\n\"lazy_static\",\n\"lettre\",\n\"log\",\n@@ -2364,27 +2384,27 @@ checksum = \"d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd\"\n[[package]]\nname = \"secp256k1\"\n-version = \"0.21.3\"\n+version = \"0.24.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"9c42e6f1735c5f00f51e43e28d6634141f2bcad10931b2609ddd74a86d751260\"\n+checksum = \"b7649a0b3ffb32636e60c7ce0d70511eda9c52c658cd0634e194d5a19943aeff\"\ndependencies = [\n\"secp256k1-sys\",\n]\n[[package]]\nname = \"secp256k1-sys\"\n-version = \"0.4.2\"\n+version = \"0.6.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036\"\n+checksum = \"7058dc8eaf3f2810d7828680320acda0b25a288f6d288e19278e249bbf74226b\"\ndependencies = [\n\"cc\",\n]\n[[package]]\nname = \"security-framework\"\n-version = \"2.6.1\"\n+version = \"2.7.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc\"\n+checksum = \"2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c\"\ndependencies = [\n\"bitflags\",\n\"core-foundation\",\n@@ -2405,15 +2425,15 @@ dependencies = [\n[[package]]\nname = \"semver\"\n-version = \"1.0.13\"\n+version = \"1.0.14\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"93f6841e709003d68bb2deee8c343572bf446003ec20a583e76f7b15cebf3711\"\n+checksum = \"e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4\"\n[[package]]\nname = \"serde\"\n-version = \"1.0.143\"\n+version = \"1.0.145\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"53e8e5d5b70924f74ff5c6d64d9a5acd91422117c60f48c4e07855238a254553\"\n+checksum = \"728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b\"\ndependencies = [\n\"serde_derive\",\n]\n@@ -2451,9 +2471,9 @@ dependencies = [\n[[package]]\nname = \"serde_derive\"\n-version = \"1.0.143\"\n+version = \"1.0.145\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d3d8e8de557aee63c26b85b947f5e59b690d0454c753f3adeb5cd7835ab88391\"\n+checksum = \"81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -2462,9 +2482,9 @@ dependencies = [\n[[package]]\nname = \"serde_json\"\n-version = \"1.0.83\"\n+version = \"1.0.85\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7\"\n+checksum = \"e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44\"\ndependencies = [\n\"itoa\",\n\"ryu\",\n@@ -2492,7 +2512,7 @@ dependencies = [\n\"arrayvec 0.7.2\",\n\"auto-bridge\",\n\"clarity\",\n- \"ipnetwork 0.20.0\",\n+ \"ipnetwork\",\n\"lazy_static\",\n\"log\",\n\"num256\",\n@@ -2504,34 +2524,36 @@ dependencies = [\n]\n[[package]]\n-name = \"sha-1\"\n-version = \"0.10.0\"\n+name = \"sha1\"\n+version = \"0.10.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f\"\n+checksum = \"f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3\"\ndependencies = [\n\"cfg-if\",\n\"cpufeatures\",\n- \"digest 0.10.3\",\n+ \"digest 0.10.5\",\n]\n[[package]]\n-name = \"sha1\"\n-version = \"0.10.1\"\n+name = \"sha2\"\n+version = \"0.9.9\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c77f4e7f65455545c2153c1253d25056825e77ee2533f0e41deb65a93a34852f\"\n+checksum = \"4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800\"\ndependencies = [\n+ \"block-buffer 0.9.0\",\n\"cfg-if\",\n\"cpufeatures\",\n- \"digest 0.10.3\",\n+ \"digest 0.9.0\",\n+ \"opaque-debug\",\n]\n[[package]]\nname = \"sha3\"\n-version = \"0.10.2\"\n+version = \"0.10.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0a31480366ec990f395a61b7c08122d99bd40544fdb5abcfc1b06bb29994312c\"\n+checksum = \"e2904bea16a1ae962b483322a1c7b81d976029203aea1f461e51cd7705db7ba9\"\ndependencies = [\n- \"digest 0.10.3\",\n+ \"digest 0.10.5\",\n\"keccak\",\n]\n@@ -2546,9 +2568,9 @@ dependencies = [\n[[package]]\nname = \"signature\"\n-version = \"1.5.0\"\n+version = \"1.6.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f054c6c1a6e95179d6f23ed974060dcefb2d9388bb7256900badad682c499de4\"\n+checksum = \"74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c\"\n[[package]]\nname = \"slab\"\n@@ -2561,15 +2583,15 @@ dependencies = [\n[[package]]\nname = \"smallvec\"\n-version = \"1.9.0\"\n+version = \"1.10.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1\"\n+checksum = \"a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0\"\n[[package]]\nname = \"socket2\"\n-version = \"0.4.4\"\n+version = \"0.4.7\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0\"\n+checksum = \"02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd\"\ndependencies = [\n\"libc\",\n\"winapi 0.3.9\",\n@@ -2607,9 +2629,9 @@ checksum = \"6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601\"\n[[package]]\nname = \"syn\"\n-version = \"1.0.99\"\n+version = \"1.0.102\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13\"\n+checksum = \"3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -2641,18 +2663,18 @@ dependencies = [\n[[package]]\nname = \"thiserror\"\n-version = \"1.0.32\"\n+version = \"1.0.37\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994\"\n+checksum = \"10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e\"\ndependencies = [\n\"thiserror-impl\",\n]\n[[package]]\nname = \"thiserror-impl\"\n-version = \"1.0.32\"\n+version = \"1.0.37\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21\"\n+checksum = \"982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -2661,9 +2683,9 @@ dependencies = [\n[[package]]\nname = \"time\"\n-version = \"0.3.13\"\n+version = \"0.3.15\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"db76ff9fa4b1458b3c7f077f3ff9887394058460d21e634355b273aaf11eea45\"\n+checksum = \"d634a985c4d4238ec39cacaed2e7ae552fbd3c476b552c1deac3021b7d7eaf0c\"\ndependencies = [\n\"itoa\",\n\"libc\",\n@@ -2694,9 +2716,9 @@ checksum = \"cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c\"\n[[package]]\nname = \"tokio\"\n-version = \"1.20.1\"\n+version = \"1.21.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581\"\n+checksum = \"a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099\"\ndependencies = [\n\"autocfg\",\n\"bytes\",\n@@ -2704,7 +2726,6 @@ dependencies = [\n\"memchr\",\n\"mio\",\n\"num_cpus\",\n- \"once_cell\",\n\"parking_lot 0.12.1\",\n\"pin-project-lite\",\n\"signal-hook-registry\",\n@@ -2762,9 +2783,9 @@ dependencies = [\n[[package]]\nname = \"tokio-util\"\n-version = \"0.7.3\"\n+version = \"0.7.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45\"\n+checksum = \"0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740\"\ndependencies = [\n\"bytes\",\n\"futures-core\",\n@@ -2791,9 +2812,9 @@ checksum = \"b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52\"\n[[package]]\nname = \"tracing\"\n-version = \"0.1.36\"\n+version = \"0.1.37\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307\"\n+checksum = \"8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8\"\ndependencies = [\n\"cfg-if\",\n\"log\",\n@@ -2803,9 +2824,9 @@ dependencies = [\n[[package]]\nname = \"tracing-core\"\n-version = \"0.1.29\"\n+version = \"0.1.30\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7\"\n+checksum = \"24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a\"\ndependencies = [\n\"once_cell\",\n]\n@@ -2836,9 +2857,9 @@ checksum = \"dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987\"\n[[package]]\nname = \"ucd-trie\"\n-version = \"0.1.4\"\n+version = \"0.1.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"89570599c4fe5585de2b388aab47e99f7fa4e9238a1399f707a02e356058141c\"\n+checksum = \"9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81\"\n[[package]]\nname = \"unicode-bidi\"\n@@ -2848,28 +2869,27 @@ checksum = \"099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992\"\n[[package]]\nname = \"unicode-ident\"\n-version = \"1.0.3\"\n+version = \"1.0.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf\"\n+checksum = \"dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd\"\n[[package]]\nname = \"unicode-normalization\"\n-version = \"0.1.21\"\n+version = \"0.1.22\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6\"\n+checksum = \"5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921\"\ndependencies = [\n\"tinyvec\",\n]\n[[package]]\nname = \"url\"\n-version = \"2.2.2\"\n+version = \"2.3.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c\"\n+checksum = \"0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643\"\ndependencies = [\n\"form_urlencoded\",\n- \"idna\",\n- \"matches\",\n+ \"idna 0.3.0\",\n\"percent-encoding\",\n]\n@@ -2923,9 +2943,9 @@ checksum = \"9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423\"\n[[package]]\nname = \"wasm-bindgen\"\n-version = \"0.2.82\"\n+version = \"0.2.83\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d\"\n+checksum = \"eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268\"\ndependencies = [\n\"cfg-if\",\n\"wasm-bindgen-macro\",\n@@ -2933,9 +2953,9 @@ dependencies = [\n[[package]]\nname = \"wasm-bindgen-backend\"\n-version = \"0.2.82\"\n+version = \"0.2.83\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f\"\n+checksum = \"4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142\"\ndependencies = [\n\"bumpalo\",\n\"log\",\n@@ -2948,9 +2968,9 @@ dependencies = [\n[[package]]\nname = \"wasm-bindgen-futures\"\n-version = \"0.4.32\"\n+version = \"0.4.33\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"fa76fb221a1f8acddf5b54ace85912606980ad661ac7a503b4570ffd3a624dad\"\n+checksum = \"23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d\"\ndependencies = [\n\"cfg-if\",\n\"js-sys\",\n@@ -2960,9 +2980,9 @@ dependencies = [\n[[package]]\nname = \"wasm-bindgen-macro\"\n-version = \"0.2.82\"\n+version = \"0.2.83\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602\"\n+checksum = \"052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810\"\ndependencies = [\n\"quote\",\n\"wasm-bindgen-macro-support\",\n@@ -2970,9 +2990,9 @@ dependencies = [\n[[package]]\nname = \"wasm-bindgen-macro-support\"\n-version = \"0.2.82\"\n+version = \"0.2.83\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da\"\n+checksum = \"07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -2983,15 +3003,15 @@ dependencies = [\n[[package]]\nname = \"wasm-bindgen-shared\"\n-version = \"0.2.82\"\n+version = \"0.2.83\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a\"\n+checksum = \"1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f\"\n[[package]]\nname = \"web-sys\"\n-version = \"0.3.59\"\n+version = \"0.3.60\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1\"\n+checksum = \"bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f\"\ndependencies = [\n\"js-sys\",\n\"wasm-bindgen\",\n@@ -3005,7 +3025,7 @@ checksum = \"41c0c0c928020760cc69884944d54e7fca43ff5d00933d0a63fd85155466fbed\"\ndependencies = [\n\"awc\",\n\"clarity\",\n- \"futures 0.3.21\",\n+ \"futures 0.3.24\",\n\"lazy_static\",\n\"log\",\n\"num 0.4.0\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.20.2\"\n+version = \"0.20.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.20.2\"\n+version = \"0.20.3\"\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.20.2\"\n+version = \"0.20.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": "@@ -6,7 +6,7 @@ use actix_web_async::HttpResponse;\nuse clarity::Address;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 20 RC1\";\n+pub static READABLE_VERSION: &str = \"Beta 20 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.20.2\"\n+version = \"0.20.3\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 20 RC3
20,255
11.10.2022 10:30:36
25,200
ad0e3395ff573bd82c168cc28b29c1095548da0b
Add a config flag to reset all ipv6 database data
[ { "change_type": "MODIFY", "old_path": "rita_exit/src/rita_loop/mod.rs", "new_path": "rita_exit/src/rita_loop/mod.rs", "diff": "//! Two threads are generated by this, one actual worker thread and a watchdog restarting thread that only\n//! wakes up to restart the inner thread if anything goes wrong.\n-use crate::{get_database_connection, network_endpoints::*};\n+use crate::{get_database_connection, network_endpoints::*, RitaExitError};\nuse crate::database::struct_tools::clients_to_ids;\nuse crate::database::{\n@@ -25,7 +25,9 @@ use babel_monitor::{open_babel_stream, parse_routes};\nuse diesel::{query_dsl::RunQueryDsl, PgConnection};\nuse exit_db::models;\n+use exit_db::schema::clients::internet_ipv6;\nuse rita_common::debt_keeper::DebtAction;\n+use settings::{get_rita_exit, set_rita_exit, write_config};\nuse std::collections::HashSet;\nuse std::thread;\n@@ -99,6 +101,11 @@ fn rita_exit_loop(\nstart.elapsed().as_millis(),\n);\n+ // Resets all ipv6 data in database\n+ if let Err(e) = recompute_ipv6_if_needed(&conn) {\n+ error!(\"IPV6 Error: Unable to reset databases: {:?}\", e);\n+ };\n+\nif let Ok(clients_list) = clients.load::<models::Client>(&conn) {\ntrace!(\"got {:?} clients\", clients_list);\nlet ids = clients_to_ids(clients_list.clone());\n@@ -219,6 +226,39 @@ fn check_regions(start: Instant, clients_list: Vec<models::Client>, conn: &PgCon\n}\n}\n+/// When the ipv6 database gets into an invalid state, we can have unexpected behaviors if rita exit doesnt\n+/// crash. This function checks if a config variable is set; if it is, clear out ipv6 database and let it recompute\n+fn recompute_ipv6_if_needed(conn: &PgConnection) -> Result<(), RitaExitError> {\n+ use diesel::ExpressionMethods;\n+ use exit_db::schema::assigned_ips::dsl::assigned_ips;\n+ use exit_db::schema::clients::dsl::clients;\n+ let mut rita_exit = get_rita_exit();\n+ let recompute = rita_exit.exit_network.recompute_ipv6;\n+ info!(\"About to call recompute with : {:?}\", recompute);\n+ if recompute {\n+ info!(\"Reseting IPV6 databases\");\n+\n+ // Reseting client ipv6 column\n+ let empty_str = \"\";\n+ diesel::update(clients)\n+ .set(internet_ipv6.eq(empty_str))\n+ .execute(conn)?;\n+\n+ // Reseting assigned_ips\n+ diesel::delete(assigned_ips).execute(conn)?;\n+\n+ // Set recompute ipv6 to false\n+ rita_exit.exit_network.recompute_ipv6 = false;\n+ set_rita_exit(rita_exit);\n+\n+ if let Err(e) = write_config() {\n+ error!(\"Unable to write to config with: {:?}\", e);\n+ }\n+ }\n+\n+ Ok(())\n+}\n+\nfn setup_exit_wg_tunnel() {\n// Setup legacy wg_exit\nif let Err(e) = KI.setup_wg_if_named(\"wg_exit\") {\n" }, { "change_type": "MODIFY", "old_path": "settings/src/exit.rs", "new_path": "settings/src/exit.rs", "diff": "@@ -49,6 +49,13 @@ pub struct ExitNetworkSettings {\npub magic_phone_number: Option<String>,\n/// Lists of exit ip addrs in this cluster\npub cluster_exits: Vec<Identity>,\n+ /// when this is set, clear out all ipv6 entries from database\n+ #[serde(default = \"recompute_ipv6_default\")]\n+ pub recompute_ipv6: bool,\n+}\n+\n+fn recompute_ipv6_default() -> bool {\n+ false\n}\nimpl ExitNetworkSettings {\n@@ -75,6 +82,7 @@ impl ExitNetworkSettings {\nwg_private_key_path: String::new(),\nmagic_phone_number: None,\ncluster_exits: Vec::new(),\n+ recompute_ipv6: false,\n}\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add a config flag to reset all ipv6 database data
20,243
13.10.2022 10:00:08
25,200
2b3c18ef0ce27779b79cb76e60aac2842b4469f0
Adjusting wifi names to remove quotes
[ { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/wifi.rs", "new_path": "rita_client/src/dashboard/wifi.rs", "diff": "@@ -692,7 +692,7 @@ fn get_wifi_config_internal() -> Result<Vec<WifiInterface>, RitaClientError> {\nfor (k, v) in items {\nif v[\".type\"] == \"wifi-device\" {\nlet mut device: WifiDevice = serde_json::from_value(v.clone())?;\n- device.section_name = k.clone();\n+ device.section_name = strip_string_quotes(k.clone());\nlet channel: String = serde_json::from_value(v[\"channel\"].clone())?;\nlet channel: u8 = channel.parse()?;\nif channel > 20 {\n@@ -707,7 +707,7 @@ fn get_wifi_config_internal() -> Result<Vec<WifiInterface>, RitaClientError> {\nif v[\".type\"] == \"wifi-iface\" && v[\"mode\"] != \"mesh\" {\nlet mut interface: WifiInterface = serde_json::from_value(v.clone())?;\ninterface.mesh = interface.mode.contains(\"adhoc\");\n- interface.section_name = k.clone();\n+ interface.section_name = strip_string_quotes(k.clone());\nlet device_name: String = serde_json::from_value(v[\"device\"].clone())?;\ninterface.device = devices[&device_name].clone();\ninterfaces.push(interface);\n@@ -715,3 +715,21 @@ fn get_wifi_config_internal() -> Result<Vec<WifiInterface>, RitaClientError> {\n}\nOk(interfaces)\n}\n+/// Function removes quotations and quotes from a string and returns it\n+fn strip_string_quotes(mut name: String) -> String {\n+ name = str::replace(&name, \"'\", \"\");\n+ name = str::replace(&name, \"\\\"\", \"\");\n+ name\n+}\n+\n+#[cfg(test)]\n+mod test {\n+ use crate::dashboard::wifi::strip_string_quotes;\n+\n+ #[test]\n+ pub fn unit_test_wifi_escape_name() {\n+ let name_test = \"hello \\\" ' \\\" world\".to_string();\n+ assert_eq!(None, strip_string_quotes(name_test.clone()).find('\\''));\n+ assert_eq!(None, strip_string_quotes(name_test).find('\\\"'));\n+ }\n+}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Adjusting wifi names to remove quotes
20,255
17.10.2022 13:39:33
25,200
17dfcb816162b0f0b6bd72ffb86da058301a208e
Added checks to ensure cluster exits are set up correctly in the config
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -2210,6 +2210,7 @@ dependencies = [\n\"env_logger\",\n\"flate2\",\n\"hex-literal\",\n+ \"ipnetwork\",\n\"jemallocator\",\n\"lazy_static\",\n\"log\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "@@ -46,6 +46,7 @@ jemallocator = {version = \"0.5\", optional = true}\n# an openssl implementation from the crate and not from the system, simplifying\n# our build process for a lot of cross-compile situations\nopenssl = {version = \"0.10\", features = [\"vendored\"]}\n+ipnetwork = \"0.20\"\n[features]\njemalloc = [\"jemallocator\"]\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/src/exit.rs", "new_path": "rita_bin/src/exit.rs", "diff": "#![allow(clippy::pedantic)]\n#![forbid(unsafe_code)]\n+use std::collections::HashSet;\n+\n#[cfg(feature = \"jemalloc\")]\nuse jemallocator::Jemalloc;\n#[cfg(feature = \"jemalloc\")]\n@@ -23,6 +25,7 @@ static GLOBAL: Jemalloc = Jemalloc;\nextern crate log;\nuse docopt::Docopt;\n+use ipnetwork::IpNetwork;\nuse rita_common::debt_keeper::save_debt_on_shutdown;\nuse rita_common::logging::enable_remote_logging;\nuse rita_common::rita_loop::start_core_rita_endpoints;\n@@ -49,6 +52,31 @@ fn sanity_check_config() {\n{\npanic!(\"GEOIP enforcement configured but not api key provided!\");\n}\n+\n+ // check wg_exit_v2 port is valid\n+ assert!(exit_settings.exit_network.wg_v2_tunnel_port < 59999);\n+\n+ // Check that there is atleast one exit in cluster\n+ assert!(!exit_settings.exit_network.cluster_exits.is_empty());\n+\n+ // Check cluster exits have different ips and wg_keys\n+ let mut ip_sub: Option<IpNetwork> = None;\n+ let mut wg_key_hashset = HashSet::new();\n+ for id in exit_settings.exit_network.cluster_exits.iter() {\n+ if let Some(net) = ip_sub {\n+ if net.contains(id.mesh_ip) {\n+ panic!(\"Ips in cluster exits collide in /116 subnet\");\n+ }\n+ } else {\n+ ip_sub = Some(IpNetwork::new(id.mesh_ip, 116).unwrap())\n+ }\n+\n+ if wg_key_hashset.contains(&id.wg_public_key) {\n+ panic!(\"Conflicting wg keys in cluster exits, please fix\");\n+ } else {\n+ wg_key_hashset.insert(id.wg_public_key);\n+ }\n+ }\n}\nfn main() {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Added checks to ensure cluster exits are set up correctly in the config
20,255
18.10.2022 13:30:56
25,200
6c198b3999ce076de9e57a13c31aadcb478db135
Delete wg_exit_v2 on startup
[ { "change_type": "MODIFY", "old_path": "clu/src/lib.rs", "new_path": "clu/src/lib.rs", "diff": "@@ -70,6 +70,10 @@ pub fn cleanup() -> Result<(), NewCluError> {\ntrace!(\"Failed to delete wg_exit {:?}\", e);\n}\n+ if let Err(e) = KI.del_interface(\"wg_exit_v2\") {\n+ trace!(\"Failed to delete wg_exit_v2 {:?}\", e);\n+ }\n+\nOk(())\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Delete wg_exit_v2 on startup
20,255
19.10.2022 10:03:54
25,200
7cd54923c7d94e664008c8dd52fdbf2e7ed60366
Update rita dockerfile to use posgresql 15
[ { "change_type": "MODIFY", "old_path": "integration-tests/container/Dockerfile", "new_path": "integration-tests/container/Dockerfile", "diff": "@@ -6,8 +6,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/14/bin/postgres\n-ENV INITDB_BIN=/usr/lib/postgresql/14/bin/initdb\n+ENV POSTGRES_BIN=/usr/lib/postgresql/15/bin/postgres\n+ENV INITDB_BIN=/usr/lib/postgresql/15/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
Update rita dockerfile to use posgresql 15
20,255
25.10.2022 12:48:30
25,200
2aab676230c169fd6f368edc4b7c84b657421c5b
Added 'subnet' to 'root_ip' conversion in rita settings to allow older routers to update to new config format
[ { "change_type": "MODIFY", "old_path": "settings/src/client.rs", "new_path": "settings/src/client.rs", "diff": "@@ -7,12 +7,15 @@ use crate::{json_merge, set_rita_client, SettingsError};\nuse althea_types::wg_key::WgKey;\nuse althea_types::{ContactStorage, ExitState, Identity};\nuse clarity::Address;\n+use ipnetwork::IpNetwork;\nuse std::collections::{HashMap, HashSet};\nuse std::net::IpAddr;\nuse std::path::Path;\npub const APP_NAME: &str = \"rita\";\n+pub const DUMMY_ROOT_IP: &str = \"1.1.1.1\";\n+\npub fn default_app_name() -> String {\nAPP_NAME.to_string()\n}\n@@ -33,8 +36,13 @@ pub fn default_config_path() -> String {\n#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]\npub struct ExitServer {\n/// Ip of exit we first connect to when connected to this cluster\n+ #[serde(default = \"dummy_root_ip\")]\npub root_ip: IpAddr,\n+ /// Subnet for backwards compatilibity\n+ #[serde(default)]\n+ pub subnet: Option<IpNetwork>,\n+\n/// eth address of this exit cluster\npub eth_address: Address,\n@@ -57,6 +65,10 @@ pub struct ExitServer {\npub info: ExitState,\n}\n+fn dummy_root_ip() -> IpAddr {\n+ DUMMY_ROOT_IP.parse().unwrap()\n+}\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(Default, Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]\npub struct SelectedExit {\n@@ -164,10 +176,34 @@ impl RitaClientSettings {\nlet config_toml = std::fs::read_to_string(file_name)?;\nlet ret: Self = toml::from_str(&config_toml)?;\n+ let ret = Self::convert_subnet_to_root_ip(&ret);\n+\nset_rita_client(ret.clone());\nOk(ret)\n}\n+\n+ pub fn convert_subnet_to_root_ip(&self) -> Self {\n+ let mut ret = self.clone();\n+ let exit_server = &self.exit_client.exits;\n+ for (hash, ser) in exit_server.iter() {\n+ match (ser.subnet.is_none(), ser.root_ip == dummy_root_ip()) {\n+ (true, true) => panic!(\"Please setup config with correct root_ip value\"),\n+ (false, true) => {\n+ let exit_ser = ret\n+ .exit_client\n+ .exits\n+ .get_mut(hash)\n+ .expect(\"Why did this fail\");\n+ exit_ser.root_ip = ser.subnet.unwrap().ip();\n+ exit_ser.subnet = None;\n+ continue;\n+ }\n+ _ => continue,\n+ }\n+ }\n+ ret\n+ }\n}\n/// This is the main struct for rita\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Added 'subnet' to 'root_ip' conversion in rita settings to allow older routers to update to new config format
20,244
05.11.2022 17:12:07
14,400
018b20b3dbf4c0ea8f1ae898bc6a02e1b4fa8c0f
Don't log clients on every run
[ { "change_type": "MODIFY", "old_path": "rita_exit/src/database/mod.rs", "new_path": "rita_exit/src/database/mod.rs", "diff": "@@ -509,7 +509,7 @@ pub fn get_client_interface(\nnew_wg_exit_clients: HashMap<WgKey, SystemTime>,\nwg_exit_clients: HashMap<WgKey, SystemTime>,\n) -> Result<String, RitaExitError> {\n- info!(\n+ trace!(\n\"New list is {:?} \\n Old list is {:?}\",\nnew_wg_exit_clients, wg_exit_clients\n);\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Don't log clients on every run
20,259
09.11.2022 16:46:28
18,000
705464fdd5298b01c5cdd6af46f068fffbee48f2
Add ssh keys to the correct file The previous ssh key add logic added keys to the wrong file and had a few other minor logical issues fixed in testing here.
[ { "change_type": "MODIFY", "old_path": "rita_client/src/operator_update/mod.rs", "new_path": "rita_client/src/operator_update/mod.rs", "diff": "@@ -21,7 +21,7 @@ use rita_common::rita_loop::is_gateway;\nuse rita_common::tunnel_manager::neighbor_status::get_neighbor_status;\nuse rita_common::tunnel_manager::shaping::flag_reset_shaper;\nuse rita_common::utils::option_convert;\n-use rita_common::DROPBEAR_CONFIG;\n+use rita_common::DROPBEAR_AUTHORIZED_KEYS;\nuse rita_common::KI;\nuse serde_json::Map;\nuse serde_json::Value;\n@@ -258,7 +258,6 @@ async fn checkin() {\n(_, Some(new)) => Some(new),\n};\nset_router_update_instruction(update_instructions);\n-\nperform_operator_update(new_settings, rita_client, network)\n}\n@@ -337,8 +336,8 @@ fn perform_operator_update(\nadd_list,\ndrop_list,\n}) => {\n- let key_file = DROPBEAR_CONFIG;\n- info!(\"Updating {}\", key_file);\n+ let key_file = DROPBEAR_AUTHORIZED_KEYS;\n+ info!(\"Updating auth_keys {:?}\", key_file);\nlet res = update_authorized_keys(add_list, drop_list, key_file);\ninfo!(\"Update auth_keys result is {:?}\", res);\n}\n@@ -361,7 +360,7 @@ fn update_authorized_keys(\nlet mut existing = HashSet::new();\nlet auth_keys_file = File::open(keys_file);\nlet mut write_data: Vec<String> = vec![];\n- let temp_key_file = String::from(\"key_backup\");\n+ let temp_key_file = String::from(\"temp_authorized_keys\");\ninfo!(\n\"Authorized keys updates add {} remove {} pubkeys\",\n@@ -404,6 +403,8 @@ fn update_authorized_keys(\nmanaged: true,\nflush: false,\n});\n+ } else {\n+ info!(\"Authorized keys failed to parse key {:?}\", pubkey);\n}\n}\n// parse list for keys to remove, setting flush = true\n@@ -427,13 +428,16 @@ fn update_authorized_keys(\nwrite_data.push(key.key.to_string());\n}\n}\n+ trace!(\"DEBUG: {:#?}\", &existing);\n+\n// create string block to use a single write to temp file\n- match write!(&updated_key_file, \"{}\", write_data.join(\"\\n\")) {\n- Ok(()) => info!(\"Authorized keys write success\"),\n+ match write!(&updated_key_file, \"{}\", &write_data.join(\"\\n\")) {\n+ Ok(()) => info!(\"Authorized keys write success {:#?}\", write_data),\nErr(e) => info!(\"Authorized keys write failed with {:?}\", e),\n};\n// rename temp file\n+ if updated_key_file.metadata().unwrap().len() != 0 {\nmatch rename(&temp_key_file, keys_file) {\nOk(()) => {\ninfo!(\"Authorized keys rename success\")\n@@ -443,6 +447,7 @@ fn update_authorized_keys(\nremove_file(&temp_key_file)?\n}\n};\n+ }\nOk(())\n}\n@@ -639,12 +644,13 @@ mod tests {\nlet added_keys = vec![String::from(\"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHFgFrnSm9MFS1zpHHvwtfLohjqtsK13NyL41g/zyIhK test@hawk-net\")];\nlet removed_keys = vec![];\nlet key_file: &str = \"authorized_keys\";\n- let _operator_key = touch_temp_file(key_file);\n+ let operator_key = touch_temp_file(key_file);\nlet _update = update_authorized_keys(added_keys.clone(), removed_keys, key_file);\nlet result = parse_keys(key_file);\n- assert_eq!(result.len(), 2);\n+ // assert_eq!(result.len(), 2);\nassert!(result.contains(&added_keys[0]));\n+ assert!(result.contains(&operator_key.to_string()));\nremove_temp_file(key_file).unwrap();\n}\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/lib.rs", "new_path": "rita_common/src/lib.rs", "diff": "@@ -16,6 +16,7 @@ lazy_static! {\npub static ref KI: Box<dyn KernelInterface> = Box::new(LinuxCommandRunner {});\n}\npub static DROPBEAR_CONFIG: &str = \"/etc/config/dropbear\";\n+pub static DROPBEAR_AUTHORIZED_KEYS: &str = \"/etc/dropbear/authorized_keys\";\npub mod blockchain_oracle;\npub mod dashboard;\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add ssh keys to the correct file The previous ssh key add logic added keys to the wrong file and had a few other minor logical issues fixed in testing here.
20,244
10.11.2022 15:08:45
18,000
af175007ff44656595763db0cefbbdfa560b631a
Bump for Beta 20 RC4
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -2186,7 +2186,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.20.3\"\n+version = \"0.20.4\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2220,7 +2220,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.20.3\"\n+version = \"0.20.4\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2255,7 +2255,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.20.3\"\n+version = \"0.20.4\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-service\",\n@@ -2294,7 +2294,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.20.3\"\n+version = \"0.20.4\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.20.3\"\n+version = \"0.20.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.20.3\"\n+version = \"0.20.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.20.3\"\n+version = \"0.20.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": "@@ -6,7 +6,7 @@ use actix_web_async::HttpResponse;\nuse clarity::Address;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 20 RC3\";\n+pub static READABLE_VERSION: &str = \"Beta 20 RC4\";\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.20.3\"\n+version = \"0.20.4\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 20 RC4
20,244
11.11.2022 09:02:44
18,000
91eef112ad8606476acbba4305b144950cd15a75
Fix integration tests Somthing in the unstable packages feed must be breaking dynamic linking, in this case we can just remove the unstable package feed entierly since we only needed iperf3 which is now available in the standard package feeds.
[ { "change_type": "MODIFY", "old_path": "integration-tests/container/Dockerfile", "new_path": "integration-tests/container/Dockerfile", "diff": "FROM postgres\n-RUN echo \"deb http://deb.debian.org/debian/ unstable main\" > /etc/apt/sources.list.d/unstable.list\n-RUN printf 'Package: *\\nPin: release a=unstable\\nPin-Priority: 90\\n' > /etc/apt/preferences.d/limit-unstable\nENV DEBIAN_FRONTEND=noninteractive\n-RUN apt-get update && apt-get install -y sudo iputils-ping iproute2 jq vim netcat default-libmysqlclient-dev libsqlite3-dev postgresql-client-11 postgresql-server-dev-11 libpq-dev python3-pip bridge-utils wireguard linux-source curl git libssl-dev pkg-config build-essential ipset python3-setuptools python3-wheel dh-autoreconf procps\n-RUN apt-get install -y -t unstable iperf3\n+RUN apt-get update && apt-get install -y sudo iputils-ping iproute2 jq vim netcat default-libmysqlclient-dev libsqlite3-dev postgresql-client-11 postgresql-server-dev-11 libpq-dev python3-pip bridge-utils wireguard linux-source curl git libssl-dev pkg-config build-essential ipset python3-setuptools python3-wheel dh-autoreconf procps iperf3\nRUN curl https://sh.rustup.rs -sSf | sh -s -- -y\n+RUN PATH=$PATH:$HOME/.cargo/bin cargo install diesel_cli --force\nENV POSTGRES_USER=postgres\nENV POSTGRES_BIN=/usr/lib/postgresql/15/bin/postgres\nENV INITDB_BIN=/usr/lib/postgresql/15/bin/initdb\n-RUN PATH=$PATH:$HOME/.cargo/bin cargo install diesel_cli --force\nARG NODES\nENV SPEEDTEST_THROUGHPUT=$SPEEDTEST_THROUGHPUT\nENV SPEEDTEST_DURATION=$SPEEDTEST_DURATION\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix integration tests Somthing in the unstable packages feed must be breaking dynamic linking, in this case we can just remove the unstable package feed entierly since we only needed iperf3 which is now available in the standard package feeds.
20,244
30.11.2022 14:55:50
18,000
5ffc017a6b4eb48e93886c1a75512027455513a0
Bump for Beta 20 RC5
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -270,9 +270,9 @@ dependencies = [\n[[package]]\nname = \"aho-corasick\"\n-version = \"0.7.19\"\n+version = \"0.7.20\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e\"\n+checksum = \"cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac\"\ndependencies = [\n\"memchr\",\n]\n@@ -386,17 +386,6 @@ version = \"1.1.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16\"\n-[[package]]\n-name = \"atty\"\n-version = \"0.2.14\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8\"\n-dependencies = [\n- \"hermit-abi\",\n- \"libc\",\n- \"winapi 0.3.9\",\n-]\n-\n[[package]]\nname = \"auto-bridge\"\nversion = \"0.1.5\"\n@@ -501,20 +490,11 @@ checksum = \"bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a\"\n[[package]]\nname = \"blake2\"\n-version = \"0.10.4\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388\"\n-dependencies = [\n- \"digest 0.10.5\",\n-]\n-\n-[[package]]\n-name = \"block-buffer\"\n-version = \"0.9.0\"\n+version = \"0.10.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4\"\n+checksum = \"b12e5fd123190ce1c2e559308a94c9bacad77907d4c6005d9e58fe1a0689e55e\"\ndependencies = [\n- \"generic-array\",\n+ \"digest\",\n]\n[[package]]\n@@ -561,9 +541,9 @@ checksum = \"14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610\"\n[[package]]\nname = \"bytes\"\n-version = \"1.2.1\"\n+version = \"1.3.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db\"\n+checksum = \"dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c\"\n[[package]]\nname = \"bytestring\"\n@@ -582,9 +562,9 @@ checksum = \"4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b\"\n[[package]]\nname = \"cc\"\n-version = \"1.0.76\"\n+version = \"1.0.77\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f\"\n+checksum = \"e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4\"\ndependencies = [\n\"jobserver\",\n]\n@@ -715,9 +695,9 @@ dependencies = [\n[[package]]\nname = \"crossbeam-utils\"\n-version = \"0.8.12\"\n+version = \"0.8.14\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac\"\n+checksum = \"4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f\"\ndependencies = [\n\"cfg-if\",\n]\n@@ -781,20 +761,11 @@ dependencies = [\n[[package]]\nname = \"digest\"\n-version = \"0.9.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066\"\n-dependencies = [\n- \"generic-array\",\n-]\n-\n-[[package]]\n-name = \"digest\"\n-version = \"0.10.5\"\n+version = \"0.10.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c\"\n+checksum = \"8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f\"\ndependencies = [\n- \"block-buffer 0.10.3\",\n+ \"block-buffer\",\n\"crypto-common\",\n\"subtle\",\n]\n@@ -859,17 +830,38 @@ dependencies = [\n[[package]]\nname = \"env_logger\"\n-version = \"0.9.3\"\n+version = \"0.10.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7\"\n+checksum = \"85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0\"\ndependencies = [\n- \"atty\",\n\"humantime\",\n+ \"is-terminal\",\n\"log\",\n\"regex\",\n\"termcolor\",\n]\n+[[package]]\n+name = \"errno\"\n+version = \"0.2.8\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1\"\n+dependencies = [\n+ \"errno-dragonfly\",\n+ \"libc\",\n+ \"winapi 0.3.9\",\n+]\n+\n+[[package]]\n+name = \"errno-dragonfly\"\n+version = \"0.1.2\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf\"\n+dependencies = [\n+ \"cc\",\n+ \"libc\",\n+]\n+\n[[package]]\nname = \"error\"\nversion = \"0.1.9\"\n@@ -903,9 +895,9 @@ dependencies = [\n[[package]]\nname = \"flate2\"\n-version = \"1.0.24\"\n+version = \"1.0.25\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6\"\n+checksum = \"a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841\"\ndependencies = [\n\"crc32fast\",\n\"miniz_oxide\",\n@@ -1147,6 +1139,15 @@ dependencies = [\n\"libc\",\n]\n+[[package]]\n+name = \"hermit-abi\"\n+version = \"0.2.6\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7\"\n+dependencies = [\n+ \"libc\",\n+]\n+\n[[package]]\nname = \"hex\"\nversion = \"0.4.3\"\n@@ -1270,9 +1271,9 @@ dependencies = [\n[[package]]\nname = \"indexmap\"\n-version = \"1.9.1\"\n+version = \"1.9.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e\"\n+checksum = \"1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399\"\ndependencies = [\n\"autocfg\",\n\"hashbrown\",\n@@ -1287,6 +1288,16 @@ dependencies = [\n\"cfg-if\",\n]\n+[[package]]\n+name = \"io-lifetimes\"\n+version = \"1.0.3\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c\"\n+dependencies = [\n+ \"libc\",\n+ \"windows-sys 0.42.0\",\n+]\n+\n[[package]]\nname = \"ipgen\"\nversion = \"1.0.2\"\n@@ -1312,6 +1323,18 @@ dependencies = [\n\"serde\",\n]\n+[[package]]\n+name = \"is-terminal\"\n+version = \"0.4.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330\"\n+dependencies = [\n+ \"hermit-abi 0.2.6\",\n+ \"io-lifetimes\",\n+ \"rustix\",\n+ \"windows-sys 0.42.0\",\n+]\n+\n[[package]]\nname = \"itertools\"\nversion = \"0.9.0\"\n@@ -1377,9 +1400,12 @@ dependencies = [\n[[package]]\nname = \"keccak\"\n-version = \"0.1.2\"\n+version = \"0.1.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838\"\n+checksum = \"3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768\"\n+dependencies = [\n+ \"cpufeatures\",\n+]\n[[package]]\nname = \"language-tags\"\n@@ -1454,6 +1480,12 @@ version = \"0.5.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f\"\n+[[package]]\n+name = \"linux-raw-sys\"\n+version = \"0.1.3\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f\"\n+\n[[package]]\nname = \"local-channel\"\nversion = \"0.1.3\"\n@@ -1514,13 +1546,11 @@ checksum = \"a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f\"\n[[package]]\nname = \"md-5\"\n-version = \"0.9.1\"\n+version = \"0.10.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15\"\n+checksum = \"6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca\"\ndependencies = [\n- \"block-buffer 0.9.0\",\n- \"digest 0.9.0\",\n- \"opaque-debug\",\n+ \"digest\",\n]\n[[package]]\n@@ -1543,9 +1573,9 @@ checksum = \"68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a\"\n[[package]]\nname = \"miniz_oxide\"\n-version = \"0.5.4\"\n+version = \"0.6.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34\"\n+checksum = \"b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa\"\ndependencies = [\n\"adler\",\n]\n@@ -1768,7 +1798,7 @@ version = \"1.14.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5\"\ndependencies = [\n- \"hermit-abi\",\n+ \"hermit-abi 0.1.19\",\n\"libc\",\n]\n@@ -1784,17 +1814,11 @@ version = \"0.1.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"44d11de466f4a3006fe8a5e7ec84e93b79c70cb992ae0aa0eb631ad2df8abfe2\"\n-[[package]]\n-name = \"opaque-debug\"\n-version = \"0.3.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5\"\n-\n[[package]]\nname = \"openssh-keys\"\n-version = \"0.5.0\"\n+version = \"0.6.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e7249a699cdeea261ac73f1bf9350777cb867324f44373aafb5a287365bf1771\"\n+checksum = \"37b58a8e78d8aa4cb398da5616fd29ab28b615c46b452aac6cbab45a9e5ac0ac\"\ndependencies = [\n\"base64\",\n\"byteorder\",\n@@ -1805,9 +1829,9 @@ dependencies = [\n[[package]]\nname = \"openssl\"\n-version = \"0.10.42\"\n+version = \"0.10.43\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13\"\n+checksum = \"020433887e44c27ff16365eaa2d380547a94544ad509aff6eb5b6e3e0b27b376\"\ndependencies = [\n\"bitflags\",\n\"cfg-if\",\n@@ -1846,9 +1870,9 @@ dependencies = [\n[[package]]\nname = \"openssl-sys\"\n-version = \"0.9.77\"\n+version = \"0.9.78\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a\"\n+checksum = \"07d5c8cb6e57b3a3612064d7b18b117912b4ce70955c2504d4b741c9e244b132\"\ndependencies = [\n\"autocfg\",\n\"cc\",\n@@ -1887,7 +1911,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f\"\ndependencies = [\n\"lock_api\",\n- \"parking_lot_core 0.9.4\",\n+ \"parking_lot_core 0.9.5\",\n]\n[[package]]\n@@ -1906,9 +1930,9 @@ dependencies = [\n[[package]]\nname = \"parking_lot_core\"\n-version = \"0.9.4\"\n+version = \"0.9.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0\"\n+checksum = \"7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba\"\ndependencies = [\n\"cfg-if\",\n\"libc\",\n@@ -1931,9 +1955,9 @@ checksum = \"478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e\"\n[[package]]\nname = \"pest\"\n-version = \"2.4.1\"\n+version = \"2.5.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a528564cc62c19a7acac4d81e01f39e53e25e17b934878f4c6d25cc2836e62f8\"\n+checksum = \"5f400b0f7905bf702f9f3dc3df5a121b16c54e9e8012c082905fdf09a931861a\"\ndependencies = [\n\"thiserror\",\n\"ucd-trie\",\n@@ -1941,9 +1965,9 @@ dependencies = [\n[[package]]\nname = \"pest_derive\"\n-version = \"2.4.1\"\n+version = \"2.5.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d5fd9bc6500181952d34bd0b2b0163a54d794227b498be0b7afa7698d0a7b18f\"\n+checksum = \"423c2ba011d6e27b02b482a3707c773d19aec65cc024637aec44e19652e66f63\"\ndependencies = [\n\"pest\",\n\"pest_generator\",\n@@ -1951,9 +1975,9 @@ dependencies = [\n[[package]]\nname = \"pest_generator\"\n-version = \"2.4.1\"\n+version = \"2.5.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d2610d5ac5156217b4ff8e46ddcef7cdf44b273da2ac5bca2ecbfa86a330e7c4\"\n+checksum = \"3e64e6c2c85031c02fdbd9e5c72845445ca0a724d419aa0bc068ac620c9935c1\"\ndependencies = [\n\"pest\",\n\"pest_meta\",\n@@ -1964,9 +1988,9 @@ dependencies = [\n[[package]]\nname = \"pest_meta\"\n-version = \"2.4.1\"\n+version = \"2.5.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"824749bf7e21dd66b36fbe26b3f45c713879cccd4a009a917ab8e045ca8246fe\"\n+checksum = \"57959b91f0a133f89a68be874a5c88ed689c19cd729ecdb5d762ebf16c64d662\"\ndependencies = [\n\"once_cell\",\n\"pest\",\n@@ -2149,9 +2173,9 @@ dependencies = [\n[[package]]\nname = \"reqwest\"\n-version = \"0.11.12\"\n+version = \"0.11.13\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc\"\n+checksum = \"68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c\"\ndependencies = [\n\"base64\",\n\"bytes\",\n@@ -2186,7 +2210,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.20.4\"\n+version = \"0.20.5\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2220,7 +2244,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.20.4\"\n+version = \"0.20.5\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2255,7 +2279,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.20.4\"\n+version = \"0.20.5\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-service\",\n@@ -2294,7 +2318,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.20.4\"\n+version = \"0.20.5\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2334,6 +2358,20 @@ dependencies = [\n\"semver\",\n]\n+[[package]]\n+name = \"rustix\"\n+version = \"0.36.4\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"cb93e85278e08bb5788653183213d3a60fc242b10cb9be96586f5a73dcb67c23\"\n+dependencies = [\n+ \"bitflags\",\n+ \"errno\",\n+ \"io-lifetimes\",\n+ \"libc\",\n+ \"linux-raw-sys\",\n+ \"windows-sys 0.42.0\",\n+]\n+\n[[package]]\nname = \"ryu\"\nversion = \"1.0.11\"\n@@ -2423,9 +2461,9 @@ checksum = \"e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4\"\n[[package]]\nname = \"serde\"\n-version = \"1.0.147\"\n+version = \"1.0.148\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965\"\n+checksum = \"e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc\"\ndependencies = [\n\"serde_derive\",\n]\n@@ -2463,9 +2501,9 @@ dependencies = [\n[[package]]\nname = \"serde_derive\"\n-version = \"1.0.147\"\n+version = \"1.0.148\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852\"\n+checksum = \"a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -2474,9 +2512,9 @@ dependencies = [\n[[package]]\nname = \"serde_json\"\n-version = \"1.0.87\"\n+version = \"1.0.89\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45\"\n+checksum = \"020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db\"\ndependencies = [\n\"itoa\",\n\"ryu\",\n@@ -2523,20 +2561,18 @@ checksum = \"f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3\"\ndependencies = [\n\"cfg-if\",\n\"cpufeatures\",\n- \"digest 0.10.5\",\n+ \"digest\",\n]\n[[package]]\nname = \"sha2\"\n-version = \"0.9.9\"\n+version = \"0.10.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800\"\n+checksum = \"82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0\"\ndependencies = [\n- \"block-buffer 0.9.0\",\n\"cfg-if\",\n\"cpufeatures\",\n- \"digest 0.9.0\",\n- \"opaque-debug\",\n+ \"digest\",\n]\n[[package]]\n@@ -2545,7 +2581,7 @@ version = \"0.10.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9\"\ndependencies = [\n- \"digest 0.10.5\",\n+ \"digest\",\n\"keccak\",\n]\n@@ -2621,9 +2657,9 @@ checksum = \"6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601\"\n[[package]]\nname = \"syn\"\n-version = \"1.0.103\"\n+version = \"1.0.104\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d\"\n+checksum = \"4ae548ec36cf198c0ef7710d3c230987c2d6d7bd98ad6edc0274462724c585ce\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -2717,9 +2753,9 @@ checksum = \"cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c\"\n[[package]]\nname = \"tokio\"\n-version = \"1.21.2\"\n+version = \"1.22.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099\"\n+checksum = \"d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3\"\ndependencies = [\n\"autocfg\",\n\"bytes\",\n@@ -2737,9 +2773,9 @@ dependencies = [\n[[package]]\nname = \"tokio-macros\"\n-version = \"1.8.0\"\n+version = \"1.8.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484\"\n+checksum = \"d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -2896,9 +2932,9 @@ dependencies = [\n[[package]]\nname = \"uuid\"\n-version = \"1.2.1\"\n+version = \"1.2.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"feb41e78f93363bb2df8b0e86a2ca30eed7806ea16ea0c790d757cf93f79be83\"\n+checksum = \"422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c\"\ndependencies = [\n\"getrandom\",\n]\n@@ -3020,9 +3056,9 @@ dependencies = [\n[[package]]\nname = \"web30\"\n-version = \"0.19.6\"\n+version = \"0.20.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"426f817a02df256fec6bff3ec5ef3859204658774af9cd5ef2525ca8d50f6f2c\"\n+checksum = \"e866d2880fe2a62fea9a60d98607bd2bcfa066313421b7049378b4f79f0127f7\"\ndependencies = [\n\"awc\",\n\"clarity\",\n@@ -3204,9 +3240,9 @@ dependencies = [\n[[package]]\nname = \"zstd-sys\"\n-version = \"2.0.1+zstd.1.5.2\"\n+version = \"2.0.4+zstd.1.5.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b\"\n+checksum = \"4fa202f2ef00074143e219d15b62ffc317d17cc33909feac471c044087cad7b0\"\ndependencies = [\n\"cc\",\n\"libc\",\n" }, { "change_type": "MODIFY", "old_path": "antenna_forwarding_client/Cargo.toml", "new_path": "antenna_forwarding_client/Cargo.toml", "diff": "@@ -5,7 +5,7 @@ authors = [\"Justin Kilpatrick <justin@althea.net>\"]\nedition = \"2018\"\n[dependencies]\n-env_logger = \"0.9\"\n+env_logger = \"0.10\"\nlog = \"0.4\"\noping = \"0.3\"\nsodiumoxide = \"0.2\"\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.19\"\n+web30 = \"0.20\"\nnum256 = \"0.3\"\nclarity = \"0.5\"\nrand = \"0.8\"\n" }, { "change_type": "MODIFY", "old_path": "babel_monitor/Cargo.toml", "new_path": "babel_monitor/Cargo.toml", "diff": "@@ -6,7 +6,7 @@ edition = \"2018\"\n[dependencies]\nascii = \"1.0\"\n-env_logger = \"0.9\"\n+env_logger = \"0.10\"\nipnetwork = \"0.20\"\nlog = \"0.4\"\nserde = \"1.0\"\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.9.0\"\n+env_logger = \"0.10.0\"\nipgen = \"1.0.1\"\nrand = \"0.8\"\nserde = \"1.0\"\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.20.4\"\n+version = \"0.20.5\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\nbuild = \"build.rs\"\n@@ -29,7 +29,7 @@ serde_json = \"1.0\"\narrayvec = {version= \"0.7\", features = [\"serde\"]}\nhex-literal = \"0.3\"\nopenssl-probe = \"0.1\"\n-env_logger = \"0.9\"\n+env_logger = \"0.10\"\nlazy_static = \"1.4\"\nphonenumber = \"0.3\"\nr2d2 = \"0.8\"\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "[package]\nname = \"rita_client\"\n-version = \"0.20.4\"\n+version = \"0.20.5\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n@@ -27,14 +27,14 @@ babel_monitor = { path = \"../babel_monitor\" }\narrayvec = {version= \"0.7\", features = [\"serde\"]}\nsodiumoxide = \"0.2\"\nclu = { path = \"../clu\" }\n-web30 = \"0.19\"\n+web30 = \"0.20\"\nawc = \"3.0.0\"\nipnetwork = \"0.20\"\nactix-async = {package=\"actix\", version = \"0.13\"}\nactix-web-async = { package=\"actix-web\", version = \"4.0.1\", default_features = false, features= [\"openssl\"]}\nactix-web-httpauth-async = { package=\"actix-web-httpauth\", version = \"0.8.0\"}\nclarity = \"0.5\"\n-openssh-keys = \"0.5\"\n+openssh-keys = \"0.6\"\n[lib]\nname = \"rita_client\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "[package]\nname = \"rita_common\"\n-version = \"0.20.4\"\n+version = \"0.20.5\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n@@ -34,7 +34,7 @@ actix-web-httpauth-async = { package=\"actix-web-httpauth\", version = \"0.8.0\"}\nactix-web-async = { package=\"actix-web\", version = \"4.0.1\", default_features = false, features= [\"openssl\"]}\nawc = {version = \"3.0.0-beta.21\", default-features = false, features=[\"openssl\", \"compress-gzip\", \"compress-zstd\"]}\nactix-service = \"2.0.2\"\n-web30 = \"0.19\"\n+web30 = \"0.20\"\nalthea_types = { path = \"../althea_types\" }\n[dependencies.regex]\nversion = \"1.6\"\n@@ -42,7 +42,7 @@ default-features = false\nfeatures = [\"std\"]\n[dev-dependencies]\n-env_logger = \"0.9\"\n+env_logger = \"0.10\"\n[features]\n# disables cors for dash debugging\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/dashboard/own_info.rs", "new_path": "rita_common/src/dashboard/own_info.rs", "diff": "@@ -6,7 +6,7 @@ use actix_web_async::HttpResponse;\nuse clarity::Address;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 20 RC4\";\n+pub static READABLE_VERSION: &str = \"Beta 20 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.20.4\"\n+version = \"0.20.5\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 20 RC5
20,243
17.11.2022 10:37:32
28,800
59ccfda8684e724c9b63f08c51b5b20e4c27868a
Creating new endpoint to grab all lan devices Endpoint handles parsing ip neigh command from the kernel command as well as grabbing device names from their dhcp lease. It also attempts to remove any ip addresses that are not LAN based.
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -301,6 +301,7 @@ dependencies = [\n\"itertools 0.10.5\",\n\"lazy_static\",\n\"log\",\n+ \"mac_address\",\n\"oping\",\n\"regex\",\n\"serde\",\n@@ -718,7 +719,7 @@ version = \"3.2.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"1d91974fbbe88ec1df0c24a4f00f99583667a7e2e6272b2b92d294d81e462173\"\ndependencies = [\n- \"nix\",\n+ \"nix 0.25.0\",\n\"winapi 0.3.9\",\n]\n@@ -1532,6 +1533,16 @@ dependencies = [\n\"linked-hash-map\",\n]\n+[[package]]\n+name = \"mac_address\"\n+version = \"1.1.4\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"b238e3235c8382b7653c6408ed1b08dd379bdb9fdf990fb0bbae3db2cc0ae963\"\n+dependencies = [\n+ \"nix 0.23.1\",\n+ \"winapi 0.3.9\",\n+]\n+\n[[package]]\nname = \"match_cfg\"\nversion = \"0.1.0\"\n@@ -1559,6 +1570,15 @@ version = \"2.5.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d\"\n+[[package]]\n+name = \"memoffset\"\n+version = \"0.6.5\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce\"\n+dependencies = [\n+ \"autocfg\",\n+]\n+\n[[package]]\nname = \"mime\"\nversion = \"0.3.16\"\n@@ -1610,6 +1630,19 @@ dependencies = [\n\"tempfile\",\n]\n+[[package]]\n+name = \"nix\"\n+version = \"0.23.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6\"\n+dependencies = [\n+ \"bitflags\",\n+ \"cc\",\n+ \"cfg-if\",\n+ \"libc\",\n+ \"memoffset\",\n+]\n+\n[[package]]\nname = \"nix\"\nversion = \"0.25.0\"\n@@ -2263,6 +2296,7 @@ dependencies = [\n\"lazy_static\",\n\"lettre\",\n\"log\",\n+ \"mac_address\",\n\"num-traits\",\n\"num256\",\n\"openssh-keys\",\n" }, { "change_type": "MODIFY", "old_path": "althea_kernel_interface/Cargo.toml", "new_path": "althea_kernel_interface/Cargo.toml", "diff": "@@ -15,6 +15,7 @@ serde_derive = \"1.0\"\nserde = \"1.0\"\nalthea_types = { path = \"../althea_types\" }\nipnetwork = \"0.20\"\n+mac_address = \"1.1.4\"\n[dependencies.regex]\nversion = \"1.6\"\n" }, { "change_type": "ADD", "old_path": null, "new_path": "althea_kernel_interface/src/ip_neigh.rs", "diff": "+use crate::KernelInterface;\n+use mac_address::MacAddress;\n+use std::io::{Error, ErrorKind};\n+use std::net::IpAddr;\n+\n+impl dyn KernelInterface {\n+ /// Runs the ip neigh command via the Kernel interface lazy static and returns an error if it doesn't work\n+ pub fn grab_ip_neigh(&self) -> Result<Vec<(IpAddr, MacAddress)>, std::io::Error> {\n+ info!(\"Sending ip neigh command to kernel\");\n+ let res = self.run_command(\"ip\", &[\"neigh\"]);\n+ match res {\n+ Ok(output) => {\n+ // Extra checking since output struct is ambigious on how it works\n+ if !output.stdout.is_empty() {\n+ let string_to_parse = String::from_utf8_lossy(&output.stdout).to_string();\n+ Ok(parse_ip_neigh(string_to_parse))\n+ } else {\n+ Err(Error::new(\n+ ErrorKind::Other,\n+ \"Empty ip neigh command. Failed\".to_string(),\n+ ))\n+ }\n+ }\n+ Err(e) => Err(Error::new(\n+ ErrorKind::Other,\n+ format!(\n+ \"Unable to grab ip neigh from router. Failed with error {:?}\",\n+ e\n+ ),\n+ )),\n+ }\n+ }\n+}\n+\n+/// Parses the ip neighb command and returns a mapping of the following format:\n+/// (IP_ADDR, MAC_ADDRESS)\n+fn parse_ip_neigh(command: String) -> Vec<(IpAddr, MacAddress)> {\n+ let lines = command.lines();\n+ let mut arp_mapping = Vec::new();\n+ for line in lines {\n+ let entries = line.split_whitespace();\n+ let (mut valid_ip_address, mut valid_mac_address) = (None, None);\n+ let mut reachable: Option<bool> = None;\n+ for entry in entries {\n+ if entry.eq(\"STALE\") {\n+ reachable = Some(false);\n+ } else if entry.eq(\"REACHABLE\") {\n+ reachable = Some(true);\n+ }\n+ let ip_address = entry.parse::<IpAddr>();\n+ let mac_address = entry.parse::<MacAddress>();\n+ match (ip_address, mac_address) {\n+ (Ok(valid_ip), _) => valid_ip_address = Some(valid_ip),\n+ (_, Ok(valid_mac)) => valid_mac_address = Some(valid_mac),\n+ (_, _) => continue,\n+ }\n+ }\n+ if let (Some(ip_address), Some(mac_address)) = (valid_ip_address, valid_mac_address) {\n+ if let Some(value) = reachable {\n+ if value {\n+ arp_mapping.push((ip_address, mac_address));\n+ }\n+ }\n+ }\n+ }\n+ arp_mapping\n+}\n" }, { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/lib.rs", "new_path": "althea_kernel_interface/src/lib.rs", "diff": "@@ -37,6 +37,7 @@ mod get_neighbors;\npub mod hardware_info;\nmod interface_tools;\nmod ip_addr;\n+pub mod ip_neigh;\nmod ip_route;\nmod iptables;\nmod is_openwrt;\n" }, { "change_type": "MODIFY", "old_path": "rita_client/Cargo.toml", "new_path": "rita_client/Cargo.toml", "diff": "@@ -35,6 +35,7 @@ actix-web-async = { package=\"actix-web\", version = \"4.0.1\", default_features = f\nactix-web-httpauth-async = { package=\"actix-web-httpauth\", version = \"0.8.0\"}\nclarity = \"0.5\"\nopenssh-keys = \"0.6\"\n+mac_address = \"1.1.4\"\n[lib]\nname = \"rita_client\"\n" }, { "change_type": "ADD", "old_path": null, "new_path": "rita_client/src/dashboard/devices_on_lan.rs", "diff": "+use std::{\n+ collections::{HashMap, HashSet},\n+ convert::TryInto,\n+ net::IpAddr,\n+};\n+\n+use actix_web_async::{HttpRequest, HttpResponse};\n+use althea_kernel_interface::hardware_info::get_hardware_info;\n+use althea_types::HardwareInfo;\n+use mac_address::MacAddress;\n+use rita_common::KI;\n+use serde::Serializer;\n+\n+/// Devices can have multiple ip addresses but mac addresses on a wlan should be unique to each device\n+fn consolidate_wlan_arp_table(\n+ arp_table: Vec<(IpAddr, MacAddress)>,\n+) -> HashMap<MacAddress, HashSet<IpAddr>> {\n+ let mut new_arp_table = HashMap::new();\n+ for (ip_addr, mac_addr) in arp_table {\n+ new_arp_table\n+ .entry(mac_addr)\n+ .or_insert_with(HashSet::new)\n+ .insert(ip_addr);\n+ }\n+ new_arp_table\n+}\n+\n+/// Used to prune all devices not part of the lan by using the netmask to delete invalid ips\n+fn prune_non_lan_entries(mut arp_table: Vec<(IpAddr, MacAddress)>) -> Vec<(IpAddr, MacAddress)> {\n+ let ip4 = KI.get_ip_from_iface(\"br-lan\");\n+ let ip6 = KI.get_ipv6_from_iface(\"br-lan\");\n+\n+ // The long set of calls essentially grabs each ipaddress out of the arp table and checks if there is a singular\n+ // address match within each of the interfaces for ipv4 or ipv6. Otherwise, it prunes the ipaddress out of the arp\n+ // table.\n+ match (ip4, ip6) {\n+ (Ok(valid4), Ok(valid6)) => {\n+ arp_table.retain(|(ipaddr, _macaddr)| {\n+ match valid4\n+ .clone()\n+ .into_iter()\n+ .find(|(ip4, bitmask)| !check_ip_in_subnet(*ipaddr, IpAddr::V4(*ip4), *bitmask))\n+ {\n+ Some((_val1, _val2)) => true,\n+ None => false,\n+ }\n+ });\n+\n+ arp_table.retain(|(ipaddr, _macaddr)| {\n+ match valid6\n+ .clone()\n+ .into_iter()\n+ .find(|(ip6, bitmask)| !check_ip_in_subnet(*ipaddr, IpAddr::V6(*ip6), *bitmask))\n+ {\n+ Some((_val1, _val2)) => true,\n+ None => false,\n+ }\n+ });\n+ }\n+ (Ok(valid4), Err(_)) => {\n+ arp_table.retain(|(ipaddr, _macaddr)| {\n+ match valid4\n+ .clone()\n+ .into_iter()\n+ .find(|(ip4, bitmask)| !check_ip_in_subnet(*ipaddr, IpAddr::V4(*ip4), *bitmask))\n+ {\n+ Some((_val1, _val2)) => true,\n+ None => false,\n+ }\n+ });\n+ }\n+ (Err(_), Ok(valid6)) => {\n+ arp_table.retain(|(ipaddr, _macaddr)| {\n+ match valid6\n+ .clone()\n+ .into_iter()\n+ .find(|(ip6, bitmask)| !check_ip_in_subnet(*ipaddr, IpAddr::V6(*ip6), *bitmask))\n+ {\n+ Some((_val1, _val2)) => true,\n+ None => false,\n+ }\n+ });\n+ }\n+ (Err(_), Err(_)) => (),\n+ }\n+\n+ arp_table\n+}\n+\n+/// The endpoint struct sent back to the devices on the frontend\n+#[derive(Debug, Clone, Serialize, PartialEq, Eq)]\n+pub struct LanDevice {\n+ pub wired: bool,\n+ pub ip_addr: HashSet<IpAddr>,\n+ #[serde(serialize_with = \"mac_serialize\")]\n+ pub mac_addr: MacAddress,\n+ pub name: String,\n+ pub signal_strength: Option<String>,\n+ pub upload_bytes_used: Option<u64>,\n+ pub download_bytes_used: Option<u64>,\n+}\n+\n+pub fn mac_serialize<S>(mac_addr: &MacAddress, serializer: S) -> Result<S::Ok, S::Error>\n+where\n+ S: Serializer,\n+{\n+ serializer.collect_str(&mac_addr.to_string())\n+}\n+\n+#[derive(Debug, Clone, Serialize, PartialEq, Eq)]\n+pub struct LanDevices {\n+ pub all_lan_devices: Vec<LanDevice>,\n+}\n+\n+/// Generates the lan devices\n+pub fn generate_lan_device(\n+ lan_arp_table: HashMap<MacAddress, HashSet<IpAddr>>,\n+ hardware_to_check: HardwareInfo,\n+) -> LanDevices {\n+ let mut lan_devices = Vec::new();\n+\n+ for (mac_addr, ip_addr) in lan_arp_table {\n+ let mut no_matches = true;\n+ for wifi_device in &hardware_to_check.wifi_devices {\n+ for station in &wifi_device.station_data {\n+ if let Ok(mac_address) = station.clone().station.parse::<MacAddress>() {\n+ if mac_address.eq(&mac_addr) {\n+ lan_devices.push(LanDevice {\n+ signal_strength: Some(station.signal_dbm.clone()),\n+ upload_bytes_used: Some(station.rx_bytes),\n+ download_bytes_used: Some(station.tx_bytes),\n+ name: resolve_name(ip_addr.clone(), mac_addr),\n+ ip_addr: ip_addr.clone(),\n+ mac_addr,\n+ wired: false,\n+ });\n+ no_matches = false;\n+ break;\n+ }\n+ }\n+ }\n+ }\n+ if no_matches {\n+ lan_devices.push(LanDevice {\n+ signal_strength: None,\n+ upload_bytes_used: None,\n+ download_bytes_used: None,\n+ name: resolve_name(ip_addr.clone(), mac_addr),\n+ ip_addr,\n+ mac_addr,\n+ wired: true,\n+ });\n+ }\n+ }\n+\n+ LanDevices {\n+ all_lan_devices: lan_devices,\n+ }\n+}\n+\n+/// This function grabs all ip addresses associated to the device and attempts to\n+/// resolve its name by checking the dhcp lease and see if the name is in their\n+/// if it isn't it simply returns its mac addresses to use\n+fn resolve_name(ip_addresses: HashSet<IpAddr>, mac_addr: MacAddress) -> String {\n+ info!(\"Sending cat command to kernel\");\n+ let res = KI.run_command(\"cat\", &[\"/tmp/dhcp.leases\"]);\n+ match res {\n+ Ok(output) => {\n+ if !output.stdout.is_empty() {\n+ let parsed_output = String::from_utf8_lossy(&output.stdout).to_string();\n+ let lines = parsed_output.lines();\n+ for line in lines {\n+ let mut found_match = false;\n+ let entries = line.split_whitespace();\n+ for (index, entry) in entries.into_iter().enumerate() {\n+ if index == 2 {\n+ match entry.parse::<IpAddr>() {\n+ Ok(val) => {\n+ if ip_addresses.contains(&val) {\n+ found_match = true;\n+ } else {\n+ break;\n+ }\n+ }\n+ Err(_) => break,\n+ }\n+ }\n+ if index == 3 && found_match {\n+ if entry.to_string().len() <= 3 {\n+ return mac_addr.to_string();\n+ } else {\n+ return entry.to_string();\n+ }\n+ }\n+ }\n+ }\n+ mac_addr.to_string()\n+ } else {\n+ mac_addr.to_string()\n+ }\n+ }\n+ Err(_e) => mac_addr.to_string(),\n+ }\n+}\n+\n+/// This is an endpoint to grab all the lan devices mapping to ip address and\n+/// returns the json request populated with the related hardware information\n+pub async fn get_devices_lan_endpoint(_req: HttpRequest) -> HttpResponse {\n+ let command_response = KI.grab_ip_neigh();\n+ match command_response {\n+ Ok(output) => {\n+ let arp_table = output;\n+ info!(\"Arp table length: {:?}\", arp_table);\n+\n+ let lan_arp_table = prune_non_lan_entries(arp_table);\n+ let consolidated_lan_arp_table = consolidate_wlan_arp_table(lan_arp_table);\n+\n+ let rita_client = settings::get_rita_client();\n+ let hardware_to_check = match get_hardware_info(rita_client.network.device) {\n+ Ok(info) => info,\n+ Err(e) => {\n+ return HttpResponse::InternalServerError().json(format!(\n+ \"Unable to grab rita client hardware information. Failed with error {:?}\",\n+ e\n+ ));\n+ }\n+ };\n+\n+ HttpResponse::Ok().json(generate_lan_device(\n+ consolidated_lan_arp_table,\n+ hardware_to_check,\n+ ))\n+ }\n+ Err(e) => HttpResponse::InternalServerError().json(e.to_string()),\n+ }\n+}\n+\n+/// Checks to see if a target ip addresses falls within the lan subnet by using an address w/ bitmask\n+/// This is done by bitmasking each address and comparing to see if they are the same\n+/// OUTPUTS:\n+/// Returns false if the ip addresses do not match the same format ipv4 with ipv6 or ipv6 with ipv4\n+/// Returns true if the addresses do not fall within each other subnets\n+fn check_ip_in_subnet(address1: IpAddr, address2: IpAddr, subnet_mask: u8) -> bool {\n+ match (address1, address2) {\n+ // The fancy long set of function calls essentially just modifies the ip addresses\n+ // by applying a bitmask to each octet of the ip address whether it's a 4 format or 6.\n+ (IpAddr::V4(ip1), IpAddr::V4(ip2)) => {\n+ let mut octets1: [u8; 4] = ip1.octets();\n+ octets1 = octets1\n+ .iter()\n+ .enumerate()\n+ .map(|(index, x)| {\n+ apply_subnet_mask_to_ip_octet(*x, subnet_mask - ((index as u8) * 8))\n+ })\n+ .collect::<Vec<u8>>()\n+ .as_slice()\n+ .try_into()\n+ .unwrap();\n+ let mut octets2: [u8; 4] = ip2.octets();\n+ octets2 = octets2\n+ .iter()\n+ .enumerate()\n+ .map(|(index, x)| {\n+ apply_subnet_mask_to_ip_octet(*x, subnet_mask - ((index as u8) * 8))\n+ })\n+ .collect::<Vec<u8>>()\n+ .as_slice()\n+ .try_into()\n+ .unwrap();\n+ octets1.eq(&octets2)\n+ }\n+ (IpAddr::V4(_), IpAddr::V6(_)) => false,\n+ (IpAddr::V6(_), IpAddr::V4(_)) => false,\n+ (IpAddr::V6(ip1), IpAddr::V6(ip2)) => {\n+ let mut octets1: [u8; 16] = ip1.octets();\n+ octets1 = octets1\n+ .iter()\n+ .enumerate()\n+ .map(|(index, x)| {\n+ apply_subnet_mask_to_ip_octet(*x, subnet_mask - ((index as u8) * 8))\n+ })\n+ .collect::<Vec<u8>>()\n+ .as_slice()\n+ .try_into()\n+ .unwrap();\n+ let mut octets2: [u8; 16] = ip2.octets();\n+ octets2 = octets2\n+ .iter()\n+ .enumerate()\n+ .map(|(index, x)| {\n+ apply_subnet_mask_to_ip_octet(*x, subnet_mask - ((index as u8) * 8))\n+ })\n+ .collect::<Vec<u8>>()\n+ .as_slice()\n+ .try_into()\n+ .unwrap();\n+ octets1.eq(&octets2)\n+ }\n+ }\n+}\n+\n+/// Applies the bitmask octet to the related octet\n+fn apply_subnet_mask_to_ip_octet(octet: u8, subnet_mask: u8) -> u8 {\n+ if subnet_mask == 0 {\n+ return octet;\n+ }\n+\n+ // Bitwise and on the bitmask with the relevant digits which cannot exceed 8\n+ let bitmask_octet = 2 << if subnet_mask > 8 { 8 } else { subnet_mask };\n+ octet & bitmask_octet\n+}\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/mod.rs", "new_path": "rita_client/src/dashboard/mod.rs", "diff": "@@ -8,6 +8,7 @@ pub mod auth;\npub mod backup_created;\npub mod bandwidth_limit;\npub mod contact_info;\n+pub mod devices_on_lan;\npub mod eth_private_key;\npub mod exits;\npub mod installation_details;\n@@ -62,6 +63,8 @@ use rita_common::dashboard::wg_key::*;\nuse rita_common::middleware;\nuse rita_common::network_endpoints::*;\n+use self::devices_on_lan::get_devices_lan_endpoint;\n+\npub fn start_client_dashboard(rita_dashboard_port: u16) {\n// dashboard\nthread::spawn(move || {\n@@ -92,6 +95,7 @@ pub fn start_client_dashboard(rita_dashboard_port: u16) {\n.route(\"/local_fee/{fee}\", web::post().to(set_local_fee))\n.route(\"/metric_factor\", web::get().to(get_metric_factor))\n.route(\"/metric_factor/{factor}\", web::post().to(set_metric_factor))\n+ .route(\"/lan_devices\", web::get().to(get_devices_lan_endpoint))\n.route(\n\"/exits/{name}/verify/{code}\",\nweb::post().to(verify_on_exit_with_code),\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Creating new endpoint to grab all lan devices Endpoint handles parsing ip neigh command from the kernel command as well as grabbing device names from their dhcp lease. It also attempts to remove any ip addresses that are not LAN based.
20,244
30.11.2022 17:29:48
18,000
5b710c3bc8b781f83e7dc2cb69b094db1f62b34e
Simplify operator update logic Now that operator updates are in their own loop we no longer needd any logic for calling the function more often than we actually want to run it.
[ { "change_type": "MODIFY", "old_path": "rita_client/src/operator_update/mod.rs", "new_path": "rita_client/src/operator_update/mod.rs", "diff": "@@ -35,7 +35,6 @@ use std::io::BufRead;\nuse std::io::BufReader;\nuse std::io::Write;\nuse std::os::unix::fs::PermissionsExt;\n-use std::sync::{Arc, RwLock};\nuse std::time::{Duration, Instant};\nuse updater::update_system;\n/// Things that you are not allowed to put into the merge json field of the OperatorUpdate,\n@@ -78,10 +77,6 @@ impl UptimeStruct {\nlazy_static! {\n/// stores the startup time for Rita, used to compute uptime\nstatic ref RITA_UPTIME: Instant = Instant::now();\n- /// a timer of when we last ran an operator update, used to\n- /// keep from running updates too often\n- static ref OPERATOR_UPDATE: Arc<RwLock<Instant>> =\n- Arc::new(RwLock::new(Instant::now()));\n}\n/// Perform operator updates every UPDATE_FREQUENCY seconds,\n@@ -93,28 +88,8 @@ const UPDATE_FREQUENCY: Duration = Duration::from_secs(60);\n/// in the rita_client loop\npub const OPERATOR_UPDATE_TIMEOUT: Duration = CLIENT_LOOP_TIMEOUT;\n-pub struct Update;\n-\n-fn get_operator_update() -> Instant {\n- *OPERATOR_UPDATE.write().unwrap()\n-}\n-\n-fn set_operator_update(set: Instant) {\n- *OPERATOR_UPDATE.write().unwrap() = set;\n-}\n-\n-pub async fn operator_update() {\n- let operator_update = get_operator_update();\n- let time_elapsed = Instant::now().checked_duration_since(operator_update);\n- if time_elapsed.is_some() && time_elapsed.unwrap() > UPDATE_FREQUENCY {\n- checkin().await;\n- let operator_update = Instant::now();\n- set_operator_update(operator_update);\n- }\n-}\n-\n/// Checks in with the operator server\n-async fn checkin() {\n+pub async fn operator_update() {\nlet url: &str;\nif cfg!(feature = \"dev_env\") {\nurl = \"http://0.0.0.0:8080/checkin\";\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/operator_update/update_loop.rs", "new_path": "rita_client/src/operator_update/update_loop.rs", "diff": "//! Independent loop for operator updates, this prevents errors in the rita fast loop from causing the\n//! router to become unresponsive to updates or reboot instructions\n-use crate::operator_update::operator_update;\n-use crate::rita_loop::CLIENT_LOOP_SPEED;\n+use crate::operator_update::{operator_update, UPDATE_FREQUENCY};\nuse actix_async::System as AsyncSystem;\nuse std::thread;\nuse std::time::{Duration, Instant};\n@@ -33,12 +32,7 @@ pub fn start_operator_update_loop() {\nstart.elapsed().subsec_millis()\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 update_loop_speed = Duration::from_secs(CLIENT_LOOP_SPEED);\n- if start.elapsed() < update_loop_speed {\n- thread::sleep(update_loop_speed - start.elapsed());\n- }\n+ thread::sleep(UPDATE_FREQUENCY);\n})\n.join()\n} {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Simplify operator update logic Now that operator updates are in their own loop we no longer needd any logic for calling the function more often than we actually want to run it.
20,244
30.11.2022 17:33:18
18,000
a20ac82099a93af7926f0fe4cc3beb1b438667f6
Simplify duration control in all loops This patch removes code focused on trying to sync up Rita loops to even seconds, there's both a risk of logic strageness here and it's generally unjustified complexity.
[ { "change_type": "MODIFY", "old_path": "rita_client/src/rita_loop/mod.rs", "new_path": "rita_client/src/rita_loop/mod.rs", "diff": "@@ -65,7 +65,7 @@ pub fn metrics_permitted() -> bool {\n}\n// the speed in seconds for the client loop\n-pub const CLIENT_LOOP_SPEED: u64 = 5;\n+pub const CLIENT_LOOP_SPEED: Duration = Duration::from_secs(5);\npub const CLIENT_LOOP_TIMEOUT: Duration = Duration::from_secs(4);\n/// Rita loop thread spawning function, there are currently two rita loops, one that\n@@ -113,12 +113,7 @@ pub fn start_rita_loop() {\nstart.elapsed().subsec_millis()\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+ thread::sleep(CLIENT_LOOP_SPEED);\n})\n.join()\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": "@@ -45,7 +45,6 @@ pub fn start_rita_fast_loop() {\n// with some fancy destructuring\nwhile let Err(e) = {\nthread::spawn(move || loop {\n- let start = Instant::now();\ntrace!(\"Common Fast tick!\");\nlet runner = AsyncSystem::new();\n@@ -133,11 +132,7 @@ pub fn start_rita_fast_loop() {\neth_compatible_withdraw().await;\n});\n- // sleep until it has been FAST_LOOP_SPEED seconds from start, whenever that may be\n- // if it has been more than FAST_LOOP_SPEED seconds from start, go right ahead\n- if start.elapsed() < FAST_LOOP_SPEED {\n- thread::sleep(FAST_LOOP_SPEED - start.elapsed());\n- }\n+ thread::sleep(FAST_LOOP_SPEED);\n})\n.join()\n} {\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/rita_loop/slow_loop.rs", "new_path": "rita_common/src/rita_loop/slow_loop.rs", "diff": "@@ -21,7 +21,6 @@ pub fn start_rita_slow_loop() {\n// with some fancy destructuring\nwhile let Err(e) = {\nthread::spawn(move || loop {\n- let start = Instant::now();\ninfo!(\"Common Slow tick!\");\nlet runner = AsyncSystem::new();\n@@ -37,7 +36,6 @@ pub fn start_rita_slow_loop() {\n// we really only need to run this on startup, but doing so periodically\n// could catch the edge case where babel is restarted under us\nset_babel_price();\n- info!(\"Common Slow tick completed!\");\n// This checks that all tunnels are attached to babel. This may not be the case when babel restarts\nlet babel_port = settings::get_rita_common().network.babel_port;\n@@ -46,11 +44,8 @@ pub fn start_rita_slow_loop() {\ntm_monitor_check(&babel_interfaces);\n}\n- // sleep until it has been SLOW_LOOP_SPEED seconds from start, whenever that may be\n- // if it has been more than SLOW_LOOP_SPEED seconds from start, go right ahead\n- if start.elapsed() < SLOW_LOOP_SPEED {\n- thread::sleep(SLOW_LOOP_SPEED - start.elapsed());\n- }\n+ thread::sleep(SLOW_LOOP_SPEED);\n+ info!(\"Common Slow tick completed!\");\n})\n.join()\n} {\n" }, { "change_type": "MODIFY", "old_path": "rita_exit/src/rita_loop/mod.rs", "new_path": "rita_exit/src/rita_loop/mod.rs", "diff": "@@ -163,11 +163,7 @@ fn rita_exit_loop(\n}\n}\n}\n- // sleep until it has been 5 seconds from start, whenever that may be\n- // if it has been more than 5 seconds from start, go right ahead\n- if start.elapsed() < EXIT_LOOP_SPEED_DURATION {\n- thread::sleep(EXIT_LOOP_SPEED_DURATION - start.elapsed());\n- }\n+ thread::sleep(EXIT_LOOP_SPEED_DURATION);\n}\nfn bill(babel_port: u16, start: Instant, ids: Vec<Identity>) {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Simplify duration control in all loops This patch removes code focused on trying to sync up Rita loops to even seconds, there's both a risk of logic strageness here and it's generally unjustified complexity.
20,255
05.12.2022 12:26:12
28,800
f7c2e727f702e4f9d79a434d225130ff83f7e7bd
Remove cake qdisc that was attached to the end of a client class on the htb qdisc
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/traffic_control.rs", "new_path": "althea_kernel_interface/src/traffic_control.rs", "diff": "@@ -397,26 +397,6 @@ impl dyn KernelInterface {\n)));\n}\n- let output = self.run_command(\n- \"tc\",\n- &[\n- \"qdisc\",\n- modifier,\n- \"dev\",\n- iface_name,\n- \"parent\",\n- &format!(\"1:{}\", class_id),\n- \"handle\",\n- &format!(\"{}:\", class_id),\n- \"cake\",\n- \"metro\",\n- ],\n- )?;\n-\n- if !output.status.success() {\n- let res = String::from_utf8(output.stderr)?;\n- trace!(\"Operating system does not support cake :( {:?}\", res);\n- }\nOk(())\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove cake qdisc that was attached to the end of a client class on the htb qdisc
20,255
06.12.2022 14:29:33
28,800
629a77060093ceda170806f59d75e30742cd5241
Set flapping threshold to 50% The flapping thres determines how much better an exit metric needs to be than our current babel metric in order to switch to it. We set it currently to 50% as a conservative value to ensure flapping doesnt happen every 15 mins
[ { "change_type": "MODIFY", "old_path": "rita_client/src/exit_manager/exit_switcher.rs", "new_path": "rita_client/src/exit_manager/exit_switcher.rs", "diff": "@@ -31,6 +31,11 @@ use std::sync::RwLock;\n/// use an exit without swtiching is 15 mins, this values is 15 * 60/5\nconst METRIC_ENTRIES: usize = (15 * 60) / (FAST_LOOP_SPEED.as_secs() as usize);\n+/// This is the threshold we use to ensure that a tracking exit is worth switching to. The average\n+/// metric of a tracking exit of a period of 15 mins needs be atleast 50% better than our current exit\n+/// to be considered as an exit to switch to\n+const FLAPPING_THRESH: f64 = 0.5;\n+\nlazy_static! {\n/// This lazy static tracks metric values of the exit that we potentially consider switching to during every tick.\n/// To switch, this vector needs to be full of values from a single exit.\n@@ -711,7 +716,8 @@ fn worth_switching_tracking_exit(\nif avg_tracking_metric < avg_best_metric || avg_best_metric == 0 {\nfalse\n} else {\n- (((avg_tracking_metric - avg_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))\n+ > FLAPPING_THRESH\n}\n}\n@@ -790,7 +796,7 @@ mod tests {\nassert!(!worth_switching_tracking_exit(&mut vec, ip, &mut exit_map));\nexit_map.insert(ip, ExitTracker::new(89, 89, 1));\n- assert!(worth_switching_tracking_exit(&mut vec, ip, &mut exit_map));\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@@ -799,7 +805,7 @@ mod tests {\nassert!(!worth_switching_tracking_exit(&mut vec, ip, &mut exit_map));\nexit_map.insert(ip, ExitTracker::new(11, 11 * 5, 5));\n- assert!(worth_switching_tracking_exit(&mut vec, ip, &mut exit_map));\n+ assert!(!worth_switching_tracking_exit(&mut vec, ip, &mut exit_map));\n}\n#[test]\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Set flapping threshold to 50% The flapping thres determines how much better an exit metric needs to be than our current babel metric in order to switch to it. We set it currently to 50% as a conservative value to ensure flapping doesnt happen every 15 mins
20,255
07.12.2022 09:42:59
28,800
4cb7519028bcfd1da40d31da8f03136c35cd4d06
Send current exit info to OpTools
[ { "change_type": "MODIFY", "old_path": "althea_types/src/interop.rs", "new_path": "althea_types/src/interop.rs", "diff": "@@ -587,6 +587,14 @@ pub struct ShaperSettings {\npub min_speed: usize,\n}\n+/// This struct is sent up to op to display info related to a routers connect exit there\n+#[derive(Default, Debug, Clone, Serialize, Deserialize, Hash, Eq, PartialEq)]\n+pub struct CurExitInfo {\n+ pub cluster_name: Option<String>,\n+ pub instance_name: Option<String>,\n+ pub instance_ip: Option<String>,\n+}\n+\nfn default_shaper_settings() -> ShaperSettings {\nShaperSettings {\nmax_speed: 1000,\n@@ -606,6 +614,8 @@ pub struct OperatorCheckinMessage {\n/// we don't know what this router is supposed to be configured like, the best\n/// proxy for that is the system chain value\npub system_chain: SystemChain,\n+ /// Infomation about current exit\n+ pub cur_exit: Option<CurExitInfo>,\n/// The status of this devices peers, this is data that we want to communicate\n/// with the operator server but don't really have space in the purely udp\n/// heartbeat packet, neither is it required that this data be sent very often\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/operator_update/mod.rs", "new_path": "rita_client/src/operator_update/mod.rs", "diff": "@@ -4,6 +4,7 @@ pub mod updater;\nextern crate openssh_keys;\nuse crate::dashboard::system_chain::set_system_blockchain;\nuse crate::dashboard::wifi::reset_wifi_pass;\n+use crate::exit_manager::get_selected_exit;\nuse crate::rita_loop::is_gateway_client;\nuse crate::rita_loop::CLIENT_LOOP_TIMEOUT;\nuse crate::set_router_update_instruction;\n@@ -13,6 +14,7 @@ use althea_types::AuthorizedKeys;\nuse althea_types::BillingDetails;\nuse althea_types::ContactStorage;\nuse althea_types::ContactType;\n+use althea_types::CurExitInfo;\nuse althea_types::HardwareInfo;\nuse althea_types::OperatorAction;\nuse althea_types::OperatorCheckinMessage;\n@@ -153,6 +155,18 @@ pub async fn operator_update() {\nhardware_info_logs(&hardware_info);\n+ // Get current exit info\n+ let cur_cluster = settings::get_rita_client().exit_client.current_exit;\n+ let cur_exit = Some(CurExitInfo {\n+ cluster_name: cur_cluster.clone(),\n+ // Hopefully ops fills this in\n+ instance_name: None,\n+ instance_ip: match cur_cluster {\n+ Some(a) => get_selected_exit(a).map(|a| a.to_string()),\n+ None => None,\n+ },\n+ });\n+\nlet client = awc::Client::default();\nlet response = client\n.post(url)\n@@ -161,6 +175,7 @@ pub async fn operator_update() {\nid,\noperator_address,\nsystem_chain,\n+ cur_exit,\nneighbor_info,\ncontact_info,\ninstall_details,\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Send current exit info to OpTools
20,244
09.12.2022 18:15:03
18,000
eb8fa7442e1acbb48378a1f67b25e945fd7e815c
Bump for Beta 20rc6
[ { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.20.5\"\n+version = \"0.20.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.20.5\"\n+version = \"0.20.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.20.5\"\n+version = \"0.20.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": "@@ -6,7 +6,7 @@ use actix_web_async::HttpResponse;\nuse clarity::Address;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 20 RC5\";\n+pub static READABLE_VERSION: &str = \"Beta 20 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.20.5\"\n+version = \"0.20.6\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 20rc6
20,253
08.12.2022 11:51:57
28,800
b3692e576413feeae9d3363f04b106ff8aa82427
Add a new container for integration tests
[ { "change_type": "MODIFY", "old_path": ".github/workflows/rust.yml", "new_path": ".github/workflows/rust.yml", "diff": "@@ -114,3 +114,12 @@ jobs:\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\nrun: bash scripts/test-ci.sh\n+ integration-test-v2:\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/integration-test-v2.sh\n" }, { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -715,12 +715,12 @@ dependencies = [\n[[package]]\nname = \"ctrlc\"\n-version = \"3.2.3\"\n+version = \"3.2.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"1d91974fbbe88ec1df0c24a4f00f99583667a7e2e6272b2b92d294d81e462173\"\n+checksum = \"1631ca6e3c59112501a9d87fd86f21591ff77acd31331e8a73f8d80a65bbdd71\"\ndependencies = [\n- \"nix 0.25.0\",\n- \"winapi 0.3.9\",\n+ \"nix 0.26.1\",\n+ \"windows-sys 0.42.0\",\n]\n[[package]]\n@@ -1311,9 +1311,9 @@ dependencies = [\n[[package]]\nname = \"ipnet\"\n-version = \"2.5.1\"\n+version = \"2.7.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745\"\n+checksum = \"11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e\"\n[[package]]\nname = \"ipnetwork\"\n@@ -1459,9 +1459,9 @@ dependencies = [\n[[package]]\nname = \"libc\"\n-version = \"0.2.137\"\n+version = \"0.2.138\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89\"\n+checksum = \"db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8\"\n[[package]]\nname = \"libsodium-sys\"\n@@ -1539,7 +1539,7 @@ version = \"1.1.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"b238e3235c8382b7653c6408ed1b08dd379bdb9fdf990fb0bbae3db2cc0ae963\"\ndependencies = [\n- \"nix 0.23.1\",\n+ \"nix 0.23.2\",\n\"winapi 0.3.9\",\n]\n@@ -1632,9 +1632,9 @@ dependencies = [\n[[package]]\nname = \"nix\"\n-version = \"0.23.1\"\n+version = \"0.23.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6\"\n+checksum = \"8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c\"\ndependencies = [\n\"bitflags\",\n\"cc\",\n@@ -1645,14 +1645,14 @@ dependencies = [\n[[package]]\nname = \"nix\"\n-version = \"0.25.0\"\n+version = \"0.26.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb\"\n+checksum = \"46a58d1d356c6597d08cde02c2f09d785b09e28711837b1ed667dc652c08a694\"\ndependencies = [\n- \"autocfg\",\n\"bitflags\",\n\"cfg-if\",\n\"libc\",\n+ \"static_assertions\",\n]\n[[package]]\n@@ -1862,9 +1862,9 @@ dependencies = [\n[[package]]\nname = \"openssl\"\n-version = \"0.10.43\"\n+version = \"0.10.44\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"020433887e44c27ff16365eaa2d380547a94544ad509aff6eb5b6e3e0b27b376\"\n+checksum = \"29d971fd5722fec23977260f6e81aa67d2f22cadbdc2aa049f1022d9a3be1566\"\ndependencies = [\n\"bitflags\",\n\"cfg-if\",\n@@ -1903,9 +1903,9 @@ dependencies = [\n[[package]]\nname = \"openssl-sys\"\n-version = \"0.9.78\"\n+version = \"0.9.79\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"07d5c8cb6e57b3a3612064d7b18b117912b4ce70955c2504d4b741c9e244b132\"\n+checksum = \"5454462c0eced1e97f2ec09036abc8da362e66802f66fd20f86854d9d8cbcbc4\"\ndependencies = [\n\"autocfg\",\n\"cc\",\n@@ -1988,9 +1988,9 @@ checksum = \"478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e\"\n[[package]]\nname = \"pest\"\n-version = \"2.5.0\"\n+version = \"2.5.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5f400b0f7905bf702f9f3dc3df5a121b16c54e9e8012c082905fdf09a931861a\"\n+checksum = \"cc8bed3549e0f9b0a2a78bf7c0018237a2cdf085eecbbc048e52612438e4e9d0\"\ndependencies = [\n\"thiserror\",\n\"ucd-trie\",\n@@ -1998,9 +1998,9 @@ dependencies = [\n[[package]]\nname = \"pest_derive\"\n-version = \"2.5.0\"\n+version = \"2.5.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"423c2ba011d6e27b02b482a3707c773d19aec65cc024637aec44e19652e66f63\"\n+checksum = \"cdc078600d06ff90d4ed238f0119d84ab5d43dbaad278b0e33a8820293b32344\"\ndependencies = [\n\"pest\",\n\"pest_generator\",\n@@ -2008,9 +2008,9 @@ dependencies = [\n[[package]]\nname = \"pest_generator\"\n-version = \"2.5.0\"\n+version = \"2.5.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"3e64e6c2c85031c02fdbd9e5c72845445ca0a724d419aa0bc068ac620c9935c1\"\n+checksum = \"28a1af60b1c4148bb269006a750cff8e2ea36aff34d2d96cf7be0b14d1bed23c\"\ndependencies = [\n\"pest\",\n\"pest_meta\",\n@@ -2021,9 +2021,9 @@ dependencies = [\n[[package]]\nname = \"pest_meta\"\n-version = \"2.5.0\"\n+version = \"2.5.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"57959b91f0a133f89a68be874a5c88ed689c19cd729ecdb5d762ebf16c64d662\"\n+checksum = \"fec8605d59fc2ae0c6c1aefc0c7c7a9769732017c0ce07f7a9cfffa7b4404f20\"\ndependencies = [\n\"once_cell\",\n\"pest\",\n@@ -2112,9 +2112,9 @@ dependencies = [\n[[package]]\nname = \"quoted_printable\"\n-version = \"0.4.5\"\n+version = \"0.4.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"3fee2dce59f7a43418e3382c766554c614e06a552d53a8f07ef499ea4b332c0f\"\n+checksum = \"20f14e071918cbeefc5edc986a7aa92c425dae244e003a35e1cdddb5ca39b5cb\"\n[[package]]\nname = \"r2d2\"\n@@ -2243,7 +2243,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.20.5\"\n+version = \"0.20.6\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2277,7 +2277,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.20.5\"\n+version = \"0.20.6\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2313,7 +2313,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.20.5\"\n+version = \"0.20.6\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-service\",\n@@ -2352,7 +2352,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.20.5\"\n+version = \"0.20.6\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2394,9 +2394,9 @@ dependencies = [\n[[package]]\nname = \"rustix\"\n-version = \"0.36.4\"\n+version = \"0.36.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"cb93e85278e08bb5788653183213d3a60fc242b10cb9be96586f5a73dcb67c23\"\n+checksum = \"a3807b5d10909833d3e9acd1eb5fb988f79376ff10fce42937de71a449c4c588\"\ndependencies = [\n\"bitflags\",\n\"errno\",\n@@ -2448,9 +2448,9 @@ checksum = \"d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd\"\n[[package]]\nname = \"secp256k1\"\n-version = \"0.24.1\"\n+version = \"0.24.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ff55dc09d460954e9ef2fa8a7ced735a964be9981fd50e870b2b3b0705e14964\"\n+checksum = \"d9512ffd81e3a3503ed401f79c33168b9148c75038956039166cd750eaa037c3\"\ndependencies = [\n\"secp256k1-sys\",\n]\n@@ -2495,9 +2495,9 @@ checksum = \"e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4\"\n[[package]]\nname = \"serde\"\n-version = \"1.0.148\"\n+version = \"1.0.150\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc\"\n+checksum = \"e326c9ec8042f1b5da33252c8a37e9ffbd2c9bef0155215b6e6c80c790e05f91\"\ndependencies = [\n\"serde_derive\",\n]\n@@ -2535,9 +2535,9 @@ dependencies = [\n[[package]]\nname = \"serde_derive\"\n-version = \"1.0.148\"\n+version = \"1.0.150\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c\"\n+checksum = \"42a3df25b0713732468deadad63ab9da1f1fd75a48a15024b50363f128db627e\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -2691,9 +2691,9 @@ checksum = \"6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601\"\n[[package]]\nname = \"syn\"\n-version = \"1.0.104\"\n+version = \"1.0.105\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4ae548ec36cf198c0ef7710d3c230987c2d6d7bd98ad6edc0274462724c585ce\"\n+checksum = \"60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -2723,6 +2723,10 @@ dependencies = [\n\"winapi-util\",\n]\n+[[package]]\n+name = \"test_runner\"\n+version = \"0.1.0\"\n+\n[[package]]\nname = \"thiserror\"\nversion = \"1.0.37\"\n@@ -2787,9 +2791,9 @@ checksum = \"cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c\"\n[[package]]\nname = \"tokio\"\n-version = \"1.22.0\"\n+version = \"1.23.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3\"\n+checksum = \"eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46\"\ndependencies = [\n\"autocfg\",\n\"bytes\",\n@@ -2802,7 +2806,7 @@ dependencies = [\n\"signal-hook-registry\",\n\"socket2\",\n\"tokio-macros\",\n- \"winapi 0.3.9\",\n+ \"windows-sys 0.42.0\",\n]\n[[package]]\n@@ -2922,9 +2926,9 @@ checksum = \"1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887\"\n[[package]]\nname = \"typenum\"\n-version = \"1.15.0\"\n+version = \"1.16.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987\"\n+checksum = \"497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba\"\n[[package]]\nname = \"ucd-trie\"\n@@ -3090,9 +3094,9 @@ dependencies = [\n[[package]]\nname = \"web30\"\n-version = \"0.20.0\"\n+version = \"0.20.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e866d2880fe2a62fea9a60d98607bd2bcfa066313421b7049378b4f79f0127f7\"\n+checksum = \"8f88e9105094b3c4e320024fe491fd760df1671fca3823616bd06f4904d09374\"\ndependencies = [\n\"awc\",\n\"clarity\",\n" }, { "change_type": "MODIFY", "old_path": "Cargo.toml", "new_path": "Cargo.toml", "diff": "@@ -5,7 +5,7 @@ authors = [\"Stan Drozd <drozdziak1@gmail.com>\"]\nedition = \"2018\"\n[workspace]\n-members = [\"althea_kernel_interface\", \"settings\", \"clu\", \"exit_db\", \"antenna_forwarding_client\", \"antenna_forwarding_protocol\", \"auto_bridge\",\"rita_common\",\"rita_exit\",\"rita_client\", \"rita_bin\"]\n+members = [\"althea_kernel_interface\", \"settings\", \"clu\", \"exit_db\", \"antenna_forwarding_client\", \"antenna_forwarding_protocol\", \"auto_bridge\",\"rita_common\",\"rita_exit\",\"rita_client\", \"rita_bin\", \"test_runner\"]\n[profile.release]\nopt-level = \"z\"\n" }, { "change_type": "ADD", "old_path": null, "new_path": "integration_tests_v2/container/Dockerfile", "diff": "+FROM postgres\n+ENV DEBIAN_FRONTEND=noninteractive\n+RUN apt-get update && apt-get install -y sudo iputils-ping iproute2 jq vim netcat default-libmysqlclient-dev libsqlite3-dev postgresql-client-11 postgresql-server-dev-11 libpq-dev python3-pip bridge-utils wireguard linux-source curl git libssl-dev pkg-config build-essential ipset python3-setuptools python3-wheel dh-autoreconf procps iperf3\n+RUN curl https://sh.rustup.rs -sSf | sh -s -- -y\n+RUN PATH=$PATH:$HOME/.cargo/bin cargo install diesel_cli --force\n+# we pull in the git tar instead of the local folder becuase the raw code is much much smaller\n+# note that changes have to be checked in to be pulled in and tested! we pull this in near\n+# the bottom to maximize caching of earlier containers\n+ADD rita.tar.gz /\n+CMD PATH=$PATH:$HOME/.cargo/bin cargo run --manifest-path /althea_rs/test_runner/Cargo.toml\n" }, { "change_type": "ADD", "old_path": null, "new_path": "scripts/integration-test-v2.sh", "diff": "+# Remove existing container instance\n+set +e\n+docker rm -f integration-test\n+set -e\n+\n+DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\n+DOCKERFOLDER=$DIR/../integration_tests_v2/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 integration-test .\n+time docker run --name integration-test --privileged -it integration-test\n+popd\n+\n+rm rita.tar.gz\n+\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test_runner/Cargo.toml", "diff": "+[package]\n+name = \"test_runner\"\n+version = \"0.1.0\"\n+edition = \"2018\"\n+build = \"build.rs\"\n+\n+[[bin]]\n+name = \"tester\"\n+path = \"src/main.rs\"\n+\n+[dependencies]\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test_runner/build.rs", "diff": "+use std::process::Command;\n+\n+fn main() {\n+ let git_hash = Command::new(\"git\")\n+ .args([\"rev-parse\", \"HEAD\"])\n+ .output()\n+ .ok()\n+ .and_then(|output| String::from_utf8(output.stdout).ok())\n+ .unwrap_or_else(|| \"(unknown)\".to_string());\n+ println!(\"cargo:rustc-env=GIT_HASH={}\", git_hash);\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test_runner/src/main.rs", "diff": "+fn main() {\n+ println!(\"Hello, world!\");\n+}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add a new container for integration tests
20,255
09.12.2022 11:59:52
28,800
0ab8eee18a8409d501c2b469a8c26dda88928886
Display Client public ipv6 addr on Ops
[ { "change_type": "MODIFY", "old_path": "althea_types/src/interop.rs", "new_path": "althea_types/src/interop.rs", "diff": "@@ -592,7 +592,15 @@ pub struct ShaperSettings {\npub struct CurExitInfo {\npub cluster_name: Option<String>,\npub instance_name: Option<String>,\n- pub instance_ip: Option<String>,\n+ pub instance_ip: Option<IpAddr>,\n+}\n+\n+/// This struct is sent up to op to display info related to a current exit connection\n+/// This includes exit deatails, client ipv6 address, etc\n+#[derive(Default, Debug, Clone, Serialize, Deserialize, Hash, Eq, PartialEq)]\n+pub struct ExitConnection {\n+ pub cur_exit: Option<CurExitInfo>,\n+ pub client_pub_ipv6: Option<IpNetwork>,\n}\nfn default_shaper_settings() -> ShaperSettings {\n@@ -615,7 +623,7 @@ pub struct OperatorCheckinMessage {\n/// proxy for that is the system chain value\npub system_chain: SystemChain,\n/// Infomation about current exit\n- pub cur_exit: Option<CurExitInfo>,\n+ pub exit_con: Option<ExitConnection>,\n/// The status of this devices peers, this is data that we want to communicate\n/// with the operator server but don't really have space in the purely udp\n/// heartbeat packet, neither is it required that this data be sent very often\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/exit_manager/mod.rs", "new_path": "rita_client/src/exit_manager/mod.rs", "diff": "@@ -37,6 +37,7 @@ use althea_types::{ExitClientIdentity, ExitRegistrationDetails, ExitState, ExitV\nuse babel_monitor::Route;\nuse exit_switcher::{get_babel_routes, set_best_exit};\n+use ipnetwork::IpNetwork;\nuse rita_common::blockchain_oracle::low_balance;\nuse rita_common::KI;\nuse settings::client::{ExitServer, SelectedExit};\n@@ -991,3 +992,19 @@ pub async fn exit_manager_tick() {\n}\n}\n}\n+\n+pub fn get_client_pub_ipv6() -> Option<IpNetwork> {\n+ let rita_settings = settings::get_rita_client();\n+ let current_exit = rita_settings.exit_client.current_exit;\n+ if let Some(exit) = current_exit {\n+ let exit_ser = rita_settings.exit_client.exits.get(&exit);\n+ if let Some(exit_ser) = exit_ser {\n+ let exit_info = exit_ser.info.clone();\n+\n+ if let ExitState::Registered { our_details, .. } = exit_info {\n+ return our_details.internet_ipv6_subnet;\n+ }\n+ }\n+ }\n+ None\n+}\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/operator_update/mod.rs", "new_path": "rita_client/src/operator_update/mod.rs", "diff": "@@ -4,6 +4,7 @@ pub mod updater;\nextern crate openssh_keys;\nuse crate::dashboard::system_chain::set_system_blockchain;\nuse crate::dashboard::wifi::reset_wifi_pass;\n+use crate::exit_manager::get_client_pub_ipv6;\nuse crate::exit_manager::get_selected_exit;\nuse crate::rita_loop::is_gateway_client;\nuse crate::rita_loop::CLIENT_LOOP_TIMEOUT;\n@@ -15,6 +16,7 @@ use althea_types::BillingDetails;\nuse althea_types::ContactStorage;\nuse althea_types::ContactType;\nuse althea_types::CurExitInfo;\n+use althea_types::ExitConnection;\nuse althea_types::HardwareInfo;\nuse althea_types::OperatorAction;\nuse althea_types::OperatorCheckinMessage;\n@@ -162,11 +164,16 @@ pub async fn operator_update() {\n// Hopefully ops fills this in\ninstance_name: None,\ninstance_ip: match cur_cluster {\n- Some(a) => get_selected_exit(a).map(|a| a.to_string()),\n+ Some(a) => get_selected_exit(a),\nNone => None,\n},\n});\n+ let exit_con = Some(ExitConnection {\n+ cur_exit,\n+ client_pub_ipv6: get_client_pub_ipv6(),\n+ });\n+\nlet client = awc::Client::default();\nlet response = client\n.post(url)\n@@ -175,7 +182,7 @@ pub async fn operator_update() {\nid,\noperator_address,\nsystem_chain,\n- cur_exit,\n+ exit_con,\nneighbor_info,\ncontact_info,\ninstall_details,\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Display Client public ipv6 addr on Ops
20,244
15.12.2022 16:32:18
18,000
6c7eef09af31f5e531846168b0cd58d6c33cb260
Move tunnel manager GC to slow loop Tunnel manager gc was in the fast loop in rita common because for some time we had only migrated the fast loop to async/await. Now that this is no longer a concern it can be migrated back.
[ { "change_type": "MODIFY", "old_path": "rita_common/src/rita_loop/fast_loop.rs", "new_path": "rita_common/src/rita_loop/fast_loop.rs", "diff": "@@ -7,16 +7,12 @@ use crate::network_monitor::NetworkInfo as NetworkMonitorTick;\nuse crate::payment_controller::tick_payment_controller;\nuse crate::payment_validator::validate;\nuse crate::peer_listener::peerlistener_tick;\n-use crate::tm_trigger_gc;\nuse crate::traffic_watcher::watch;\nuse crate::tunnel_manager::contact_peers::tm_contact_peers;\n-use crate::tunnel_manager::gc::TriggerGc;\nuse crate::tunnel_manager::tm_get_neighbors;\nuse crate::update_neighbor_status;\n-\nuse actix_async::System as AsyncSystem;\nuse babel_monitor::open_babel_stream;\n-use babel_monitor::parse_interfaces;\nuse babel_monitor::parse_neighs;\nuse babel_monitor::parse_routes;\n@@ -84,7 +80,6 @@ pub fn start_rita_fast_loop() {\nlet rita_neighbors = tm_get_neighbors();\nif let Ok(mut stream) = open_babel_stream(babel_port, FAST_LOOP_TIMEOUT) {\nlet babel_neighbors = parse_neighs(&mut stream);\n- let babel_interfaces = parse_interfaces(&mut stream);\nlet babel_routes = parse_routes(&mut stream);\nif let (Ok(babel_neighbors), Ok(babel_routes)) =\n(babel_neighbors, babel_routes)\n@@ -96,15 +91,6 @@ pub fn start_rita_fast_loop() {\nrita_neighbors,\n});\n}\n-\n- if let Ok(babel_interfaces) = babel_interfaces {\n- trace!(\"Sending tunnel GC\");\n- let _res = tm_trigger_gc(TriggerGc {\n- tunnel_timeout: TUNNEL_TIMEOUT,\n- tunnel_handshake_timeout: TUNNEL_HANDSHAKE_TIMEOUT,\n- babel_interfaces,\n- });\n- }\n}\n// Update debts\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/rita_loop/slow_loop.rs", "new_path": "rita_common/src/rita_loop/slow_loop.rs", "diff": "use crate::simulated_txfee_manager::tick_simulated_tx;\n+use crate::tm_trigger_gc;\nuse crate::token_bridge::tick_token_bridge;\nuse crate::tunnel_manager::tm_monitor_check;\n+use crate::TUNNEL_HANDSHAKE_TIMEOUT;\n+use crate::TUNNEL_TIMEOUT;\nuse actix_async::System as AsyncSystem;\nuse babel_monitor::open_babel_stream;\nuse babel_monitor::parse_interfaces;\n@@ -40,8 +43,22 @@ pub fn start_rita_slow_loop() {\n// This checks that all tunnels are attached to babel. This may not be the case when babel restarts\nlet babel_port = settings::get_rita_common().network.babel_port;\nif let Ok(mut stream) = open_babel_stream(babel_port, SLOW_LOOP_TIMEOUT) {\n- let babel_interfaces = parse_interfaces(&mut stream);\n+ match parse_interfaces(&mut stream) {\n+ Ok(babel_interfaces) => {\ntm_monitor_check(&babel_interfaces);\n+\n+ trace!(\"Sending tunnel GC\");\n+ let _res = tm_trigger_gc(\n+ TUNNEL_TIMEOUT,\n+ TUNNEL_HANDSHAKE_TIMEOUT,\n+ babel_interfaces,\n+ );\n+ }\n+ Err(e) => error!(\n+ \"Failed to parse babel interfaces in common slow loop with {:?}\",\n+ e\n+ ),\n+ }\n}\nthread::sleep(SLOW_LOOP_SPEED);\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/tunnel_manager/gc.rs", "new_path": "rita_common/src/tunnel_manager/gc.rs", "diff": "@@ -3,61 +3,31 @@ use crate::tunnel_manager::TUNNEL_MANAGER;\nuse crate::RitaCommonError;\nuse crate::KI;\nuse althea_types::Identity;\n-use babel_monitor::Interface as InterfaceLegacy;\n+use babel_monitor::Interface;\nuse std::{collections::HashMap, time::Instant};\n-use std::{sync::Arc, sync::RwLock, time::Duration};\n+use std::{time::Duration};\n-/// We will not run TunnelGC more frequently than this duration. This lets us call TunnelGC in the fast loop\n-/// once ever 5 seconds but run it as little as we like. We must run TunnelGC in the fast loop, at least until\n-/// tunnels are async/await refactored, then it can be moved back to the slow loop.\n-const GC_FREQUENCY: Duration = Duration::from_secs(60);\n-\n-lazy_static! {\n- /// for lack of a better way to do it until we move TunnelManager to a lock format this keeps\n- /// track of when we last ran GC\n- static ref LAST_GC: Arc<RwLock<Instant>> = Arc::new(RwLock::new(Instant::now()));\n-}\n-\n-/// gets the last GC instant\n-fn get_last_gc() -> Instant {\n- *LAST_GC.read().unwrap()\n-}\n-\n-/// sets the last GC time to the current instant\n-fn set_last_gc() {\n- let mut last_gc = LAST_GC.write().unwrap();\n- *last_gc = Instant::now();\n-}\n-\n-/// A message type for deleting all tunnels we haven't heard from for more than the duration.\n-pub struct TriggerGc {\n+/// Performs a cleanup of all babel tunnels that we have not heard from in the configured time\n+/// tunnel_timeout:\n+///\n/// if we do not receive a hello within this many seconds we attempt to gc the tunnel\n/// this garbage collection can be avoided if the tunnel has seen a handshake within\n/// tunnel_handshake_timeout time\n- pub tunnel_timeout: Duration,\n+///\n+/// tunnel_handshake_timeout\n+///\n/// The backup value that prevents us from deleting an active tunnel. We check the last\n/// handshake on the tunnel and if it's within this amount of time we don't GC it.\n- pub tunnel_handshake_timeout: Duration,\n+///\n+/// babel_interfaces\n/// a vector of babel interfaces, if we find an interface that babel doesn't classify as\n/// 'up' we will gc it for recreation via the normal hello/ihu process, this prevents us\n/// from having tunnels that don't work for babel peers\n- pub babel_interfaces: Vec<InterfaceLegacy>,\n-}\n-\n-pub fn tm_trigger_gc(msg: TriggerGc) -> Result<(), RitaCommonError> {\n+pub fn tm_trigger_gc(\n+ tunnel_timeout: Duration, tunnel_handshake_timeout: Duration, babel_interfaces: Vec<Interface>) -> Result<(), RitaCommonError> {\nlet tunnel_manager = &mut *TUNNEL_MANAGER.write().unwrap();\n- let time_since = Instant::now().checked_duration_since(get_last_gc());\n- match time_since {\n- Some(time) => {\n- if time < GC_FREQUENCY {\n- return Ok(());\n- }\n- }\n- None => return Ok(()),\n- }\n- set_last_gc();\n- let interfaces = into_interfaces_hashmap(&msg.babel_interfaces);\n+ let interfaces = into_interfaces_hashmap(&babel_interfaces);\ntrace!(\"Starting tunnel gc {:?}\", interfaces);\nlet mut good: HashMap<Identity, Vec<Tunnel>> = HashMap::new();\nlet mut to_delete: HashMap<Identity, Vec<Tunnel>> = HashMap::new();\n@@ -66,7 +36,7 @@ pub fn tm_trigger_gc(msg: TriggerGc) -> Result<(), RitaCommonError> {\n// checker issues, we should consider a method that does modify in place\nfor (_identity, tunnels) in tunnel_manager.tunnels.iter() {\nfor tunnel in tunnels.iter() {\n- if tunnel_should_be_kept(tunnel, &msg, &interfaces) {\n+ if tunnel_should_be_kept(tunnel, tunnel_handshake_timeout, tunnel_timeout, &interfaces) {\ninsert_into_tunnel_list(tunnel, &mut good);\n} else {\ninsert_into_tunnel_list(tunnel, &mut to_delete)\n@@ -152,7 +122,8 @@ pub fn tm_trigger_gc(msg: TriggerGc) -> Result<(), RitaCommonError> {\n/// table and solve both this and the previous complication at once. So that's a possible improvement to this routine.\nfn tunnel_should_be_kept(\ntunnel: &Tunnel,\n- msg: &TriggerGc,\n+ tunnel_handshake_timeout: Duration,\n+ tunnel_timeout: Duration,\ninterfaces: &HashMap<String, bool>,\n) -> bool {\nlet since_created = Instant::now().checked_duration_since(tunnel.created());\n@@ -161,10 +132,10 @@ fn tunnel_should_be_kept(\n// for the next gc round in that case.\nif let (Some(since_created), Some(since_last_contact)) = (since_created, since_last_contact) {\nlet handshake_timeout =\n- !check_handshake_time(msg.tunnel_handshake_timeout, &tunnel.iface_name);\n- let created_recently = since_created < msg.tunnel_timeout;\n+ !check_handshake_time(tunnel_handshake_timeout, &tunnel.iface_name);\n+ let created_recently = since_created < tunnel_timeout;\nlet tunnel_up = tunnel_up(interfaces, &tunnel.iface_name);\n- let contact_timeout = since_last_contact > msg.tunnel_timeout;\n+ let contact_timeout = since_last_contact > tunnel_timeout;\nmatch (\ncreated_recently,\n@@ -237,7 +208,7 @@ fn check_handshake_time(handshake_timeout: Duration, ifname: &str) -> bool {\n}\n/// sorts the interfaces vector into a hashmap of interface name to up status\n-fn into_interfaces_hashmap(interfaces: &[InterfaceLegacy]) -> HashMap<String, bool> {\n+fn into_interfaces_hashmap(interfaces: &[Interface]) -> HashMap<String, bool> {\nlet mut ret = HashMap::new();\nfor interface in interfaces {\nret.insert(interface.name.clone(), interface.up);\n@@ -248,8 +219,8 @@ fn into_interfaces_hashmap(interfaces: &[InterfaceLegacy]) -> HashMap<String, bo\n/// Searches the list of Babel tunnels for a given tunnel, if the tunnel is found\n/// and it is down (not up in this case) we return false, indicating that this tunnel\n/// needs to be deleted. If we do not find the tunnel return true. Because it is possible\n-/// that during a tunnel monitor failure we may encounter such a tunnel. We log this case\n-/// for later inspection to determine if this ever actually happens.\n+/// that during a tunnel monitor failure we may encounter such a tunnel, this happens with\n+/// some frequency\nfn tunnel_up(interfaces: &HashMap<String, bool>, tunnel_name: &str) -> bool {\ntrace!(\"Checking if {} is up\", tunnel_name);\nif let Some(up) = interfaces.get(tunnel_name) {\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/tunnel_manager/mod.rs", "new_path": "rita_common/src/tunnel_manager/mod.rs", "diff": "@@ -303,14 +303,7 @@ impl Neighbor {\n}\n/// This function goes through all tunnels preset in rita memory and add them to babel is they are not present already\n-pub fn tm_monitor_check(interface: &Result<Vec<Interface>, BabelMonitorError>) {\n- let empty = &vec![];\n- let interface_list: &Vec<Interface> = if interface.is_ok() {\n- interface.as_ref().unwrap()\n- } else {\n- empty\n- };\n-\n+pub fn tm_monitor_check(interface_list: &[Interface]) {\n// Hashset of all interface names. This allows for an O(n) search instead of O(n^2)\nlet mut interface_map: HashSet<String> = HashSet::new();\nfor int in interface_list {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Move tunnel manager GC to slow loop Tunnel manager gc was in the fast loop in rita common because for some time we had only migrated the fast loop to async/await. Now that this is no longer a concern it can be migrated back.
20,244
16.12.2022 09:07:41
18,000
9e9cc85100fb7112cfc846815ffe7b9b71caba5f
Remove dead structs from TunnelManager Not sure how dead code detection didn't get these they aren't marked to be ignored and are clearly left over from the actix days.
[ { "change_type": "MODIFY", "old_path": "rita_common/src/tunnel_manager/mod.rs", "new_path": "rita_common/src/tunnel_manager/mod.rs", "diff": "@@ -28,17 +28,12 @@ use std::collections::HashSet;\nuse std::collections::VecDeque;\nuse std::fmt;\nuse std::fmt::Display;\n-use std::fmt::{Formatter, Result as FmtResult};\nuse std::net::{IpAddr, Ipv4Addr, SocketAddr};\nuse std::path::Path;\nuse std::sync::Arc;\nuse std::sync::RwLock;\nuse std::time::Instant;\n-/// Holds messages from NetworkMonitor that need to be processed by TunnelManager\n-#[derive(Debug, Default)]\n-struct NetworkMonitorQueue {}\n-\nlazy_static! {\nstatic ref TUNNEL_MANAGER: Arc<RwLock<TunnelManager>> =\nArc::new(RwLock::new(TunnelManager::default()));\n@@ -48,18 +43,6 @@ pub fn get_tunnel_manager() -> TunnelManager {\nTUNNEL_MANAGER.read().unwrap().clone()\n}\n-#[derive(Debug)]\n-pub enum TunnelManagerError {\n- _InvalidStateError,\n-}\n-impl Display for TunnelManagerError {\n- fn fmt(&self, f: &mut Formatter) -> FmtResult {\n- match self {\n- TunnelManagerError::_InvalidStateError => write!(f, \"Invalid state\"),\n- }\n- }\n-}\n-\n/// Used to trigger the enforcement handler\n#[derive(Debug, Clone)]\npub enum TunnelAction {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove dead structs from TunnelManager Not sure how dead code detection didn't get these they aren't marked to be ignored and are clearly left over from the actix days.
20,244
16.12.2022 12:43:36
18,000
dd280f29004b16654d255f5c1c5f393b010b1238
Refine loop logging This patch removes redundant log statements and adds timing statements where they are now more interesting. Mostly this is an artifact of the actix refactor some actions that used to take a variable amount of time are now completely uninteresting.
[ { "change_type": "MODIFY", "old_path": "rita_common/src/rita_loop/fast_loop.rs", "new_path": "rita_common/src/rita_loop/fast_loop.rs", "diff": "@@ -48,17 +48,10 @@ pub fn start_rita_fast_loop() {\nlet babel_port = settings::get_rita_common().network.babel_port;\ntrace!(\"Common tick!\");\n- let start = Instant::now();\n-\nlet res = tm_get_neighbors();\ntrace!(\"Currently open tunnels: {:?}\", res);\nlet neighbors = res;\nlet neigh = Instant::now();\n- info!(\n- \"GetNeighbors completed in {}s {}ms\",\n- start.elapsed().as_secs(),\n- start.elapsed().subsec_millis()\n- );\nif let Ok(mut stream) = open_babel_stream(babel_port, FAST_LOOP_TIMEOUT) {\nif let Ok(babel_routes) = parse_routes(&mut stream) {\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/rita_loop/slow_loop.rs", "new_path": "rita_common/src/rita_loop/slow_loop.rs", "diff": "@@ -33,6 +33,7 @@ pub fn start_rita_slow_loop() {\nwhile let Err(e) = {\nthread::spawn(move || loop {\ninfo!(\"Common Slow tick!\");\n+ let start = Instant::now();\nlet runner = AsyncSystem::new();\nrunner.block_on(async move {\n@@ -97,7 +98,10 @@ pub fn start_rita_slow_loop() {\n}\nthread::sleep(SLOW_LOOP_SPEED);\n- info!(\"Common Slow tick completed!\");\n+ info!(\"Common Slow tick completed in {}s {}ms\",\n+ start.elapsed().as_secs(),\n+ start.elapsed().subsec_millis()\n+ );\n})\n.join()\n} {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Refine loop logging This patch removes redundant log statements and adds timing statements where they are now more interesting. Mostly this is an artifact of the actix refactor some actions that used to take a variable amount of time are now completely uninteresting.
20,244
16.12.2022 13:01:22
18,000
5e832a893df0b9148ce30149dfc778f128cf26ff
Optimize rita fast loop This increases the parallelism and reduces the number of babel requests made by the common fast loop.
[ { "change_type": "MODIFY", "old_path": "rita_common/src/rita_loop/fast_loop.rs", "new_path": "rita_common/src/rita_loop/fast_loop.rs", "diff": "@@ -15,6 +15,7 @@ use actix_async::System as AsyncSystem;\nuse babel_monitor::open_babel_stream;\nuse babel_monitor::parse_neighs;\nuse babel_monitor::parse_routes;\n+use futures::future::join4;\nuse std::thread;\nuse std::time::{Duration, Instant};\n@@ -42,6 +43,7 @@ pub fn start_rita_fast_loop() {\nwhile let Err(e) = {\nthread::spawn(move || loop {\ntrace!(\"Common Fast tick!\");\n+ let start = Instant::now();\nlet runner = AsyncSystem::new();\nrunner.block_on(async move {\n@@ -55,7 +57,7 @@ pub fn start_rita_fast_loop() {\nif let Ok(mut stream) = open_babel_stream(babel_port, FAST_LOOP_TIMEOUT) {\nif let Ok(babel_routes) = parse_routes(&mut stream) {\n- if let Err(e) = watch(babel_routes, &neighbors) {\n+ if let Err(e) = watch(babel_routes.clone(), &neighbors) {\nerror!(\"Error for Rita common traffic watcher {}\", e);\n}\ninfo!(\n@@ -63,20 +65,10 @@ pub fn start_rita_fast_loop() {\nneigh.elapsed().as_secs(),\nneigh.elapsed().subsec_millis()\n);\n- }\n- }\n- // Observe the dataplane for status and problems. Tunnel GC checks for specific issues\n- // (tunnels that are installed but not active) and cleans up cruft. We put these together\n- // because both can fail without anything truly bad happening and we get a slight efficiency\n- // bonus running them together (fewer babel socket connections per loop iteration)\n+ // Observe the dataplane for status and problems.\n+ if let Ok(babel_neighbors) = parse_neighs(&mut stream) {\nlet rita_neighbors = tm_get_neighbors();\n- if let Ok(mut stream) = open_babel_stream(babel_port, FAST_LOOP_TIMEOUT) {\n- let babel_neighbors = parse_neighs(&mut stream);\n- let babel_routes = parse_routes(&mut stream);\n- if let (Ok(babel_neighbors), Ok(babel_routes)) =\n- (babel_neighbors, babel_routes)\n- {\ntrace!(\"Sending network monitor tick\");\nupdate_network_info(NetworkMonitorTick {\nbabel_neighbors,\n@@ -85,6 +77,7 @@ pub fn start_rita_fast_loop() {\n});\n}\n}\n+ }\n// Update debts\nif let Err(e) = send_debt_update() {\n@@ -97,19 +90,26 @@ pub fn start_rita_fast_loop() {\n// updating blockchain info often is easier than dealing with edge cases\n// like out of date nonces or balances, also users really really want fast\n// balance updates, think very long and very hard before running this more slowly\n- BlockchainOracleUpdate().await;\n+ let bou = BlockchainOracleUpdate();\n// Check on payments, only really needs to be run this quickly\n// on large nodes where very high variation in throughput can result\n// in blowing through the entire grace in less than a minute\n- validate().await;\n+ let val = validate();\n// Process payments queued for sending, needs to be run often for\n// the same reason as the validate code, during high throughput periods\n// payments must be sent quickly to avoid enforcement\n- tick_payment_controller().await;\n+ let tpc = tick_payment_controller();\n// processes user withdraw requests from the dashboard, only needed until we\n// migrate our endpoints to async/await\n- eth_compatible_withdraw().await;\n+ let ecw = eth_compatible_withdraw();\n+ // execute the above in parallel\n+ join4(bou, val, tpc, ecw).await;\n});\n+ info!(\n+ \"Common Fast tick completed in {}s {}ms\",\n+ start.elapsed().as_secs(),\n+ start.elapsed().subsec_millis()\n+ );\nthread::sleep(FAST_LOOP_SPEED);\n})\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Optimize rita fast loop This increases the parallelism and reduces the number of babel requests made by the common fast loop.
20,255
19.12.2022 11:01:17
28,800
f08c925225c98fe534e2f4587af45cc72a5beea0
Better Logging Log when class is deleted. Remove logs that print ip6tables setup sevveral times every tick
[ { "change_type": "MODIFY", "old_path": "rita_exit/src/database/mod.rs", "new_path": "rita_exit/src/database/mod.rs", "diff": "@@ -472,7 +472,12 @@ pub fn setup_clients(\nex_nic.clone(),\n);\n- info!(\"IPV6: Setup client ip6tables rules with: {:?}\", res);\n+ if res.is_err() {\n+ error!(\n+ \"IPV6 Error: Setup client ip6tables rules failed with: {:?}\",\n+ res\n+ );\n+ }\n}\nOk(wg_clients)\n@@ -583,6 +588,7 @@ pub fn enforce_exit_clients(\n} else {\n// Delete exisiting enforcement class, users who are not enforced are unclassifed becuase\n// leaving the class in place reduces their speeds.\n+ info!(\"Deleting enforcement classes for {}\", client.wg_pubkey);\nif let Err(e) = KI.delete_class(\"wg_exit\", ip) {\nerror!(\"Unable to delete class on wg_exit, is {} still enforced when they shouldnt be? {:?}\", ip, e);\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Better Logging Log when class is deleted. Remove logs that print ip6tables setup sevveral times every tick
20,255
20.12.2022 15:43:56
28,800
c755248e3df3dfa6c75de2e11febd15d43aba96c
Add flag to enable/disable enforcement in payment settings
[ { "change_type": "MODIFY", "old_path": "rita_common/src/debt_keeper/mod.rs", "new_path": "rita_common/src/debt_keeper/mod.rs", "diff": "@@ -574,6 +574,7 @@ impl DebtKeeper {\nlet pay_threshold = get_pay_thresh();\nlet debt_limit_enabled = payment_settings.debt_limit_enabled;\nlet apply_incoming_credit_immediately = payment_settings.apply_incoming_credit_immediately;\n+ let enable_enforcement = payment_settings.enable_enforcement;\ntrace!(\n\"Debt is {} and close is {}\",\n@@ -602,12 +603,17 @@ impl DebtKeeper {\nreturn Ok(DebtAction::OpenTunnel);\n}\n+ if enable_enforcement {\ninfo!(\n\"debt {} is below close threshold {} for {}. suspending forwarding\",\ndebt_data.debt, close_threshold, ident.wg_public_key\n);\ndebt_data.action = DebtAction::SuspendTunnel;\nOk(DebtAction::SuspendTunnel)\n+ } else {\n+ debt_data.action = DebtAction::OpenTunnel;\n+ Ok(DebtAction::OpenTunnel)\n+ }\n}\n(false, true, false) => {\nlet to_pay: Uint256 = debt_data.debt.to_uint256().ok_or_else(|| {\n" }, { "change_type": "MODIFY", "old_path": "settings/src/payment.rs", "new_path": "settings/src/payment.rs", "diff": "@@ -75,6 +75,10 @@ pub fn default_payment_threshold() -> Int256 {\n300_000_000_000_000_000i64.into()\n}\n+fn default_enable_enforcement() -> bool {\n+ true\n+}\n+\n/// This struct is used by both rita and rita_exit to configure the dummy payment controller and\n/// debt keeper\n#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]\n@@ -103,6 +107,9 @@ pub struct PaymentSettings {\n/// to determine when a router needs to be enforced\n#[serde(default = \"default_payment_threshold\")]\npub payment_threshold: Int256,\n+ /// When this flag is false, no client is enforced\n+ #[serde(default = \"default_enable_enforcement\")]\n+ pub enable_enforcement: bool,\n/// Our own eth private key we do not store address, instead it is derived from here\npub eth_private_key: Option<PrivateKey>,\n// Our own eth Address, derived from the private key on startup and not stored\n@@ -168,6 +175,7 @@ impl Default for PaymentSettings {\nclient_can_use_free_tier: default_client_can_use_free_tier(),\nbalance_warning_level: default_balance_warning_level(),\npayment_threshold: default_payment_threshold(),\n+ enable_enforcement: true,\neth_private_key: None,\neth_address: None,\nnode_list: default_node_list(),\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add flag to enable/disable enforcement in payment settings
20,244
22.12.2022 20:26:32
18,000
bece562772312f3ddf58fbab1679aa91d154d455
Bump for Beta 20 RC7
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -2243,7 +2243,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.20.6\"\n+version = \"0.20.7\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2277,7 +2277,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.20.6\"\n+version = \"0.20.7\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2314,7 +2314,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.20.6\"\n+version = \"0.20.7\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-service\",\n@@ -2353,7 +2353,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.20.6\"\n+version = \"0.20.7\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.20.6\"\n+version = \"0.20.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.20.6\"\n+version = \"0.20.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.20.6\"\n+version = \"0.20.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": "@@ -7,7 +7,7 @@ use actix_web_async::HttpResponse;\nuse clarity::Address;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 20 RC6\";\n+pub static READABLE_VERSION: &str = \"Beta 20 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.20.6\"\n+version = \"0.20.7\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 20 RC7
20,255
06.01.2023 10:55:49
28,800
4ba9b1c1d1335511a3c98774070460423ac36042
Remove cake codel shaping setup on wg_exit on rita_client
[ { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/exit_client_tunnel.rs", "new_path": "althea_kernel_interface/src/exit_client_tunnel.rs", "diff": "@@ -168,8 +168,7 @@ impl dyn KernelInterface {\n)));\n}\n- let _res = self.set_codel_shaping(\"wg_exit\", args.user_specified_speed, true);\n- let _res = self.set_codel_shaping(\"br-lan\", args.user_specified_speed, false);\n+ let _res = self.set_codel_shaping(\"br-lan\", args.user_specified_speed);\nOk(())\n}\n" }, { "change_type": "MODIFY", "old_path": "althea_kernel_interface/src/traffic_control.rs", "new_path": "althea_kernel_interface/src/traffic_control.rs", "diff": "@@ -141,12 +141,7 @@ impl dyn KernelInterface {\n/// This sets up latency protecting flow control, either cake on openwrt\n/// or fq_codel on older devices/kernels, the Cake configuration sets several advanced parameters\n/// that are not reflected if we fall back to codel\n- pub fn set_codel_shaping(\n- &self,\n- iface_name: &str,\n- speed: Option<usize>,\n- exit_tunnel: bool,\n- ) -> Result<(), Error> {\n+ pub fn set_codel_shaping(&self, iface_name: &str, speed: Option<usize>) -> Result<(), Error> {\nlet operator = if self.has_qdisc(iface_name)? {\n\"change\"\n} else {\n@@ -166,55 +161,17 @@ impl dyn KernelInterface {\nNone => cake_args.extend([\"unlimited\"]),\n}\n- if exit_tunnel {\n- // cake arguments for the *client side* of the wg_exit tunnel\n- cake_args.extend([\n- // we want to use the 'internet' parameter here because the total rtt\n- // of the path from endpoint to endpoint is what this value cares about\n- // not neighbor to neighbor\n- \"internet\",\n- // look at man tc-cake and the Ethernet default\n- // add 80 bytes for WireGuard overhead since this qdisc\n- // will always route double-encapsulated packets for the exit\n- \"overhead\",\n- \"118\",\n- \"mpu\",\n- \"84\",\n- \"noatm\",\n- // diffserv4 allocates 50% of the connection to video streams and\n- // generally recognizes more traffic classes than the default diffserv3\n- // there's some debate by cake maintainers internally if this is a good idea\n- \"diffserv4\",\n- // obviously this is a nat (in fact a double nat) but we want to do a lookup\n- // at this level\n- \"nat\",\n- // shape ingress traffic, rather than egress traffic, since most traffic coming\n- // into the client is download and the exit has to use tbf all the time to allow\n- // for enforcement, therefore there's no actual SQM within the exit tunnel that's\n- // aware of in network flows\n- \"ingress\",\n- ]);\n- } else {\n// cake arguments for per hop tunnels only\ncake_args.extend([\n// we want to use the 'internet' parameter here because the total rtt\n// of the path from endpoint to endpoint is what this value cares about\n// not neighbor to neighbor\n\"internet\",\n- // look at man tc-cake and the Ethernet default\n- // add 40 bytes for WireGuard overhead since this qdisc\n- // will always route encapsulated packets\n- \"overhead\",\n- \"78\",\n- \"mpu\",\n- \"84\",\n- \"noatm\",\n// diffserv4 allocates 50% of the connection to video streams and\n// generally recognizes more traffic classes than the default diffserv3\n// there's some debate by cake maintainers internally if this is a good idea\n\"diffserv4\",\n]);\n- }\nlet output = self.run_command(\"tc\", &cake_args)?;\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/bandwidth_limit.rs", "new_path": "rita_client/src/dashboard/bandwidth_limit.rs", "diff": "@@ -23,8 +23,7 @@ pub async fn set_bandwidth_limit(path: Path<String>) -> HttpResponse {\n} else {\nreturn HttpResponse::BadRequest().finish();\n}\n- let _res = KI.set_codel_shaping(\"wg_exit\", network.user_bandwidth_limit, true);\n- let _res = KI.set_codel_shaping(\"br-lan\", network.user_bandwidth_limit, false);\n+ let _res = KI.set_codel_shaping(\"br-lan\", network.user_bandwidth_limit);\nrita_client.network = network;\nsettings::set_rita_client(rita_client);\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/tunnel_manager/mod.rs", "new_path": "rita_common/src/tunnel_manager/mod.rs", "diff": "@@ -157,7 +157,7 @@ impl Tunnel {\n};\nKI.open_tunnel(args)?;\n- KI.set_codel_shaping(&iface_name, speed_limit, false)?;\n+ KI.set_codel_shaping(&iface_name, speed_limit)?;\nlet now = Instant::now();\nlet t = Tunnel {\n@@ -708,7 +708,7 @@ fn tunnel_bw_limit_update(tunnels: &HashMap<Identity, Vec<Tunnel>>) -> Result<()\nif *payment_state == PaymentState::Overdue {\nKI.set_classless_limit(iface_name, bw_per_iface)?;\n} else if *payment_state == PaymentState::Paid && has_limit {\n- KI.set_codel_shaping(iface_name, None, false)?;\n+ KI.set_codel_shaping(iface_name, None)?;\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": "@@ -118,7 +118,7 @@ pub fn handle_shaping() {\n/// tiny little helper function for GotBloat() limit is in mbps\nfn set_shaping_or_error(iface: &str, limit: Option<usize>) {\n- if let Err(e) = KI.set_codel_shaping(iface, limit, false) {\n+ if let Err(e) = KI.set_codel_shaping(iface, limit) {\nerror!(\"Failed to shape tunnel for bloat! {}\", e);\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove cake codel shaping setup on wg_exit on rita_client
20,253
06.01.2023 17:04:15
28,800
e2d82f1c43e189cf8bb2c95d314056299558bb74
Fix integration test failing inaccurately
[ { "change_type": "MODIFY", "old_path": "scripts/integration-test-v2.sh", "new_path": "scripts/integration-test-v2.sh", "diff": "@@ -9,8 +9,9 @@ REPOFOLDER=$DIR/..\ngit archive --format=tar.gz -o $DOCKERFOLDER/rita.tar.gz --prefix=althea_rs/ HEAD\npushd $DOCKERFOLDER\ntime docker build -t integration-test .\n-time docker run --name integration-test --privileged -it integration-test\n+time docker run --name integration-test --privileged -t integration-test\n+rm rita.tar.gz\n+\npopd\n-rm rita.tar.gz\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix integration test failing inaccurately
20,244
09.01.2023 12:09:36
18,000
96bed027d0b013ac8b5eb01fed987e483f033155
Bump for Beta 20 rc8
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -395,7 +395,7 @@ dependencies = [\n\"clarity\",\n\"futures 0.3.25\",\n\"log\",\n- \"num 0.4.0\",\n+ \"num\",\n\"num256\",\n\"rand\",\n\"serde\",\n@@ -491,9 +491,9 @@ checksum = \"bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a\"\n[[package]]\nname = \"blake2\"\n-version = \"0.10.5\"\n+version = \"0.10.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b12e5fd123190ce1c2e559308a94c9bacad77907d4c6005d9e58fe1a0689e55e\"\n+checksum = \"46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe\"\ndependencies = [\n\"digest\",\n]\n@@ -578,17 +578,18 @@ checksum = \"baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd\"\n[[package]]\nname = \"clarity\"\n-version = \"0.5.2\"\n+version = \"0.5.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"880114aafee14fa3a183582a82407474d53f4950b1695658e95bbb5d049bb253\"\n+checksum = \"d4571596842d9326a73c215e81b36c7c6e110656ce7aa905cb4df495f138ff71\"\ndependencies = [\n+ \"byteorder\",\n\"lazy_static\",\n- \"num-bigint 0.4.3\",\n+ \"num\",\n+ \"num-bigint\",\n\"num-traits\",\n\"num256\",\n\"secp256k1\",\n\"serde\",\n- \"serde-rlp\",\n\"serde_bytes\",\n\"serde_derive\",\n\"sha3\",\n@@ -720,7 +721,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"1631ca6e3c59112501a9d87fd86f21591ff77acd31331e8a73f8d80a65bbdd71\"\ndependencies = [\n\"nix 0.26.1\",\n- \"windows-sys 0.42.0\",\n+ \"windows-sys\",\n]\n[[package]]\n@@ -863,16 +864,6 @@ dependencies = [\n\"libc\",\n]\n-[[package]]\n-name = \"error\"\n-version = \"0.1.9\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a6e606f14042bb87cc02ef6a14db6c90ab92ed6f62d87e69377bc759fd7987cc\"\n-dependencies = [\n- \"traitobject\",\n- \"typeable\",\n-]\n-\n[[package]]\nname = \"exit_db\"\nversion = \"0.1.0\"\n@@ -1113,9 +1104,9 @@ checksum = \"eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7\"\n[[package]]\nname = \"handlebars\"\n-version = \"4.3.5\"\n+version = \"4.3.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"433e4ab33f1213cdc25b5fa45c76881240cfe79284cf2b395e8b9e312a30a2fd\"\n+checksum = \"035ef95d03713f2c347a72547b7cd38cbc9af7cd51e6099fb62d586d4a6dee3a\"\ndependencies = [\n\"log\",\n\"pest\",\n@@ -1131,15 +1122,6 @@ version = \"0.12.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888\"\n-[[package]]\n-name = \"hermit-abi\"\n-version = \"0.1.19\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33\"\n-dependencies = [\n- \"libc\",\n-]\n-\n[[package]]\nname = \"hermit-abi\"\nversion = \"0.2.6\"\n@@ -1296,7 +1278,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c\"\ndependencies = [\n\"libc\",\n- \"windows-sys 0.42.0\",\n+ \"windows-sys\",\n]\n[[package]]\n@@ -1311,9 +1293,9 @@ dependencies = [\n[[package]]\nname = \"ipnet\"\n-version = \"2.7.0\"\n+version = \"2.7.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e\"\n+checksum = \"30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146\"\n[[package]]\nname = \"ipnetwork\"\n@@ -1326,14 +1308,14 @@ dependencies = [\n[[package]]\nname = \"is-terminal\"\n-version = \"0.4.1\"\n+version = \"0.4.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330\"\n+checksum = \"28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189\"\ndependencies = [\n- \"hermit-abi 0.2.6\",\n+ \"hermit-abi\",\n\"io-lifetimes\",\n\"rustix\",\n- \"windows-sys 0.42.0\",\n+ \"windows-sys\",\n]\n[[package]]\n@@ -1356,9 +1338,9 @@ dependencies = [\n[[package]]\nname = \"itoa\"\n-version = \"1.0.4\"\n+version = \"1.0.5\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc\"\n+checksum = \"fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440\"\n[[package]]\nname = \"jemalloc-sys\"\n@@ -1436,7 +1418,7 @@ dependencies = [\n\"idna 0.2.3\",\n\"mime\",\n\"native-tls\",\n- \"nom 7.1.1\",\n+ \"nom 7.1.2\",\n\"once_cell\",\n\"quoted_printable\",\n\"serde\",\n@@ -1459,9 +1441,9 @@ dependencies = [\n[[package]]\nname = \"libc\"\n-version = \"0.2.138\"\n+version = \"0.2.139\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8\"\n+checksum = \"201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79\"\n[[package]]\nname = \"libsodium-sys\"\n@@ -1609,7 +1591,7 @@ dependencies = [\n\"libc\",\n\"log\",\n\"wasi\",\n- \"windows-sys 0.42.0\",\n+ \"windows-sys\",\n]\n[[package]]\n@@ -1668,50 +1650,25 @@ dependencies = [\n[[package]]\nname = \"nom\"\n-version = \"7.1.1\"\n+version = \"7.1.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36\"\n+checksum = \"e5507769c4919c998e69e49c839d9dc6e693ede4cc4290d6ad8b41d4f09c548c\"\ndependencies = [\n\"memchr\",\n\"minimal-lexical\",\n]\n-[[package]]\n-name = \"num\"\n-version = \"0.2.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36\"\n-dependencies = [\n- \"num-bigint 0.2.6\",\n- \"num-complex 0.2.4\",\n- \"num-integer\",\n- \"num-iter\",\n- \"num-rational 0.2.4\",\n- \"num-traits\",\n-]\n-\n[[package]]\nname = \"num\"\nversion = \"0.4.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606\"\ndependencies = [\n- \"num-bigint 0.4.3\",\n- \"num-complex 0.4.2\",\n+ \"num-bigint\",\n+ \"num-complex\",\n\"num-integer\",\n\"num-iter\",\n- \"num-rational 0.4.1\",\n- \"num-traits\",\n-]\n-\n-[[package]]\n-name = \"num-bigint\"\n-version = \"0.2.6\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304\"\n-dependencies = [\n- \"autocfg\",\n- \"num-integer\",\n+ \"num-rational\",\n\"num-traits\",\n]\n@@ -1727,16 +1684,6 @@ dependencies = [\n\"serde\",\n]\n-[[package]]\n-name = \"num-complex\"\n-version = \"0.2.4\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95\"\n-dependencies = [\n- \"autocfg\",\n- \"num-traits\",\n-]\n-\n[[package]]\nname = \"num-complex\"\nversion = \"0.4.2\"\n@@ -1778,18 +1725,6 @@ dependencies = [\n\"num-traits\",\n]\n-[[package]]\n-name = \"num-rational\"\n-version = \"0.2.4\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef\"\n-dependencies = [\n- \"autocfg\",\n- \"num-bigint 0.2.6\",\n- \"num-integer\",\n- \"num-traits\",\n-]\n-\n[[package]]\nname = \"num-rational\"\nversion = \"0.4.1\"\n@@ -1797,7 +1732,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0\"\ndependencies = [\n\"autocfg\",\n- \"num-bigint 0.4.3\",\n+ \"num-bigint\",\n\"num-integer\",\n\"num-traits\",\n]\n@@ -1818,7 +1753,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"aa9b5179e82f0867b23e0b9b822493821f9345561f271364f409c8e4a058367d\"\ndependencies = [\n\"lazy_static\",\n- \"num 0.4.0\",\n+ \"num\",\n\"num-derive\",\n\"num-traits\",\n\"serde\",\n@@ -1827,19 +1762,19 @@ dependencies = [\n[[package]]\nname = \"num_cpus\"\n-version = \"1.14.0\"\n+version = \"1.15.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5\"\n+checksum = \"0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b\"\ndependencies = [\n- \"hermit-abi 0.1.19\",\n+ \"hermit-abi\",\n\"libc\",\n]\n[[package]]\nname = \"once_cell\"\n-version = \"1.16.0\"\n+version = \"1.17.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860\"\n+checksum = \"6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66\"\n[[package]]\nname = \"oncemutex\"\n@@ -1862,9 +1797,9 @@ dependencies = [\n[[package]]\nname = \"openssl\"\n-version = \"0.10.44\"\n+version = \"0.10.45\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"29d971fd5722fec23977260f6e81aa67d2f22cadbdc2aa049f1022d9a3be1566\"\n+checksum = \"b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1\"\ndependencies = [\n\"bitflags\",\n\"cfg-if\",\n@@ -1903,9 +1838,9 @@ dependencies = [\n[[package]]\nname = \"openssl-sys\"\n-version = \"0.9.79\"\n+version = \"0.9.80\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5454462c0eced1e97f2ec09036abc8da362e66802f66fd20f86854d9d8cbcbc4\"\n+checksum = \"23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7\"\ndependencies = [\n\"autocfg\",\n\"cc\",\n@@ -1971,14 +1906,14 @@ dependencies = [\n\"libc\",\n\"redox_syscall\",\n\"smallvec\",\n- \"windows-sys 0.42.0\",\n+ \"windows-sys\",\n]\n[[package]]\nname = \"paste\"\n-version = \"1.0.10\"\n+version = \"1.0.11\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"cf1c2c742266c2f1041c914ba65355a83ae8747b05f208319784083583494b4b\"\n+checksum = \"d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba\"\n[[package]]\nname = \"percent-encoding\"\n@@ -1988,9 +1923,9 @@ checksum = \"478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e\"\n[[package]]\nname = \"pest\"\n-version = \"2.5.1\"\n+version = \"2.5.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"cc8bed3549e0f9b0a2a78bf7c0018237a2cdf085eecbbc048e52612438e4e9d0\"\n+checksum = \"0f6e86fb9e7026527a0d46bc308b841d73170ef8f443e1807f6ef88526a816d4\"\ndependencies = [\n\"thiserror\",\n\"ucd-trie\",\n@@ -1998,9 +1933,9 @@ dependencies = [\n[[package]]\nname = \"pest_derive\"\n-version = \"2.5.1\"\n+version = \"2.5.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"cdc078600d06ff90d4ed238f0119d84ab5d43dbaad278b0e33a8820293b32344\"\n+checksum = \"96504449aa860c8dcde14f9fba5c58dc6658688ca1fe363589d6327b8662c603\"\ndependencies = [\n\"pest\",\n\"pest_generator\",\n@@ -2008,9 +1943,9 @@ dependencies = [\n[[package]]\nname = \"pest_generator\"\n-version = \"2.5.1\"\n+version = \"2.5.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"28a1af60b1c4148bb269006a750cff8e2ea36aff34d2d96cf7be0b14d1bed23c\"\n+checksum = \"798e0220d1111ae63d66cb66a5dcb3fc2d986d520b98e49e1852bfdb11d7c5e7\"\ndependencies = [\n\"pest\",\n\"pest_meta\",\n@@ -2021,9 +1956,9 @@ dependencies = [\n[[package]]\nname = \"pest_meta\"\n-version = \"2.5.1\"\n+version = \"2.5.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"fec8605d59fc2ae0c6c1aefc0c7c7a9769732017c0ce07f7a9cfffa7b4404f20\"\n+checksum = \"984298b75898e30a843e278a9f2452c31e349a073a0ce6fd950a12a74464e065\"\ndependencies = [\n\"once_cell\",\n\"pest\",\n@@ -2085,9 +2020,9 @@ dependencies = [\n[[package]]\nname = \"proc-macro2\"\n-version = \"1.0.47\"\n+version = \"1.0.49\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725\"\n+checksum = \"57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5\"\ndependencies = [\n\"unicode-ident\",\n]\n@@ -2103,9 +2038,9 @@ dependencies = [\n[[package]]\nname = \"quote\"\n-version = \"1.0.21\"\n+version = \"1.0.23\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179\"\n+checksum = \"8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b\"\ndependencies = [\n\"proc-macro2\",\n]\n@@ -2168,9 +2103,9 @@ dependencies = [\n[[package]]\nname = \"regex\"\n-version = \"1.7.0\"\n+version = \"1.7.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a\"\n+checksum = \"48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733\"\ndependencies = [\n\"aho-corasick\",\n\"memchr\",\n@@ -2243,7 +2178,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.20.7\"\n+version = \"0.20.8\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2277,7 +2212,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.20.7\"\n+version = \"0.20.8\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2314,7 +2249,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.20.7\"\n+version = \"0.20.8\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-service\",\n@@ -2353,7 +2288,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.20.7\"\n+version = \"0.20.8\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2395,23 +2330,23 @@ dependencies = [\n[[package]]\nname = \"rustix\"\n-version = \"0.36.5\"\n+version = \"0.36.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a3807b5d10909833d3e9acd1eb5fb988f79376ff10fce42937de71a449c4c588\"\n+checksum = \"4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549\"\ndependencies = [\n\"bitflags\",\n\"errno\",\n\"io-lifetimes\",\n\"libc\",\n\"linux-raw-sys\",\n- \"windows-sys 0.42.0\",\n+ \"windows-sys\",\n]\n[[package]]\nname = \"ryu\"\n-version = \"1.0.11\"\n+version = \"1.0.12\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09\"\n+checksum = \"7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde\"\n[[package]]\nname = \"same-file\"\n@@ -2424,12 +2359,11 @@ dependencies = [\n[[package]]\nname = \"schannel\"\n-version = \"0.1.20\"\n+version = \"0.1.21\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2\"\n+checksum = \"713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3\"\ndependencies = [\n- \"lazy_static\",\n- \"windows-sys 0.36.1\",\n+ \"windows-sys\",\n]\n[[package]]\n@@ -2449,18 +2383,18 @@ checksum = \"d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd\"\n[[package]]\nname = \"secp256k1\"\n-version = \"0.24.2\"\n+version = \"0.25.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d9512ffd81e3a3503ed401f79c33168b9148c75038956039166cd750eaa037c3\"\n+checksum = \"550fc3b723a478be77bf74718947cdcdd75144d508aaa70f0a320036905df2a8\"\ndependencies = [\n\"secp256k1-sys\",\n]\n[[package]]\nname = \"secp256k1-sys\"\n-version = \"0.6.1\"\n+version = \"0.7.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b\"\n+checksum = \"8058e28ae464daf5ac14c5c0f78110b58616e796c4e4e28cfcca38fdb13d8f22\"\ndependencies = [\n\"cc\",\n]\n@@ -2490,36 +2424,24 @@ dependencies = [\n[[package]]\nname = \"semver\"\n-version = \"1.0.14\"\n+version = \"1.0.16\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4\"\n+checksum = \"58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a\"\n[[package]]\nname = \"serde\"\n-version = \"1.0.151\"\n+version = \"1.0.152\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"97fed41fc1a24994d044e6db6935e69511a1153b52c15eb42493b26fa87feba0\"\n+checksum = \"bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb\"\ndependencies = [\n\"serde_derive\",\n]\n-[[package]]\n-name = \"serde-rlp\"\n-version = \"0.1.4\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"69472f967577700225f282233c0625f7b73c371c3953b72d6dcfb91bd0133ca9\"\n-dependencies = [\n- \"byteorder\",\n- \"error\",\n- \"num 0.2.1\",\n- \"serde\",\n-]\n-\n[[package]]\nname = \"serde_bytes\"\n-version = \"0.11.7\"\n+version = \"0.11.8\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"cfc50e8183eeeb6178dcb167ae34a8051d63535023ae38b5d8d12beae193d37b\"\n+checksum = \"718dc5fff5b36f99093fc49b280cfc96ce6fc824317783bff5a1fed0c7a64819\"\ndependencies = [\n\"serde\",\n]\n@@ -2536,9 +2458,9 @@ dependencies = [\n[[package]]\nname = \"serde_derive\"\n-version = \"1.0.151\"\n+version = \"1.0.152\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"255abe9a125a985c05190d687b320c12f9b1f0b99445e608c21ba0782c719ad8\"\n+checksum = \"af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -2547,9 +2469,9 @@ dependencies = [\n[[package]]\nname = \"serde_json\"\n-version = \"1.0.89\"\n+version = \"1.0.91\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db\"\n+checksum = \"877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883\"\ndependencies = [\n\"itoa\",\n\"ryu\",\n@@ -2692,9 +2614,9 @@ checksum = \"6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601\"\n[[package]]\nname = \"syn\"\n-version = \"1.0.105\"\n+version = \"1.0.107\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908\"\n+checksum = \"1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -2730,18 +2652,18 @@ version = \"0.1.0\"\n[[package]]\nname = \"thiserror\"\n-version = \"1.0.37\"\n+version = \"1.0.38\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e\"\n+checksum = \"6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0\"\ndependencies = [\n\"thiserror-impl\",\n]\n[[package]]\nname = \"thiserror-impl\"\n-version = \"1.0.37\"\n+version = \"1.0.38\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb\"\n+checksum = \"1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -2792,9 +2714,9 @@ checksum = \"cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c\"\n[[package]]\nname = \"tokio\"\n-version = \"1.23.0\"\n+version = \"1.24.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46\"\n+checksum = \"1d9f76183f91ecfb55e1d7d5602bd1d979e38a3a522fe900241cf195624d67ae\"\ndependencies = [\n\"autocfg\",\n\"bytes\",\n@@ -2807,7 +2729,7 @@ dependencies = [\n\"signal-hook-registry\",\n\"socket2\",\n\"tokio-macros\",\n- \"windows-sys 0.42.0\",\n+ \"windows-sys\",\n]\n[[package]]\n@@ -2907,23 +2829,11 @@ dependencies = [\n\"once_cell\",\n]\n-[[package]]\n-name = \"traitobject\"\n-version = \"0.1.0\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079\"\n-\n[[package]]\nname = \"try-lock\"\n-version = \"0.2.3\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642\"\n-\n-[[package]]\n-name = \"typeable\"\n-version = \"0.1.2\"\n+version = \"0.2.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887\"\n+checksum = \"3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed\"\n[[package]]\nname = \"typenum\"\n@@ -2945,9 +2855,9 @@ checksum = \"099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992\"\n[[package]]\nname = \"unicode-ident\"\n-version = \"1.0.5\"\n+version = \"1.0.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3\"\n+checksum = \"84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc\"\n[[package]]\nname = \"unicode-normalization\"\n@@ -3095,16 +3005,16 @@ dependencies = [\n[[package]]\nname = \"web30\"\n-version = \"0.21.0\"\n+version = \"0.22.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0905abe6181998356bfe935901627dbdafcc8e67705b64def0beedfe1e28635c\"\n+checksum = \"6b5db33bc4a6465d2111c276858700924031c09d0fbf633d693189d88361d7a5\"\ndependencies = [\n\"awc\",\n\"clarity\",\n\"futures 0.3.25\",\n\"lazy_static\",\n\"log\",\n- \"num 0.4.0\",\n+ \"num\",\n\"num256\",\n\"serde\",\n\"serde_derive\",\n@@ -3149,19 +3059,6 @@ version = \"0.4.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f\"\n-[[package]]\n-name = \"windows-sys\"\n-version = \"0.36.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2\"\n-dependencies = [\n- \"windows_aarch64_msvc 0.36.1\",\n- \"windows_i686_gnu 0.36.1\",\n- \"windows_i686_msvc 0.36.1\",\n- \"windows_x86_64_gnu 0.36.1\",\n- \"windows_x86_64_msvc 0.36.1\",\n-]\n-\n[[package]]\nname = \"windows-sys\"\nversion = \"0.42.0\"\n@@ -3169,12 +3066,12 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7\"\ndependencies = [\n\"windows_aarch64_gnullvm\",\n- \"windows_aarch64_msvc 0.42.0\",\n- \"windows_i686_gnu 0.42.0\",\n- \"windows_i686_msvc 0.42.0\",\n- \"windows_x86_64_gnu 0.42.0\",\n+ \"windows_aarch64_msvc\",\n+ \"windows_i686_gnu\",\n+ \"windows_i686_msvc\",\n+ \"windows_x86_64_gnu\",\n\"windows_x86_64_gnullvm\",\n- \"windows_x86_64_msvc 0.42.0\",\n+ \"windows_x86_64_msvc\",\n]\n[[package]]\n@@ -3183,48 +3080,24 @@ version = \"0.42.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e\"\n-[[package]]\n-name = \"windows_aarch64_msvc\"\n-version = \"0.36.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47\"\n-\n[[package]]\nname = \"windows_aarch64_msvc\"\nversion = \"0.42.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4\"\n-[[package]]\n-name = \"windows_i686_gnu\"\n-version = \"0.36.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6\"\n-\n[[package]]\nname = \"windows_i686_gnu\"\nversion = \"0.42.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7\"\n-[[package]]\n-name = \"windows_i686_msvc\"\n-version = \"0.36.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024\"\n-\n[[package]]\nname = \"windows_i686_msvc\"\nversion = \"0.42.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246\"\n-[[package]]\n-name = \"windows_x86_64_gnu\"\n-version = \"0.36.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1\"\n-\n[[package]]\nname = \"windows_x86_64_gnu\"\nversion = \"0.42.0\"\n@@ -3237,12 +3110,6 @@ version = \"0.42.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028\"\n-[[package]]\n-name = \"windows_x86_64_msvc\"\n-version = \"0.36.1\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680\"\n-\n[[package]]\nname = \"windows_x86_64_msvc\"\nversion = \"0.42.0\"\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.21\"\n+web30 = \"0.22\"\nnum256 = \"0.3\"\nclarity = \"0.5\"\nrand = \"0.8\"\n@@ -13,7 +13,7 @@ num = \"0.4\"\nlog = \"0.4\"\nserde_derive = \"1.0\"\nserde = \"1.0\"\n-tokio = \"1.0\"\n+tokio = \"1.2\"\nfutures = {version=\"0.3\", features = [\"thread-pool\"]}\n[dev-dependencies]\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.20.7\"\n+version = \"0.20.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.20.7\"\n+version = \"0.20.8\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n@@ -27,7 +27,7 @@ babel_monitor = { path = \"../babel_monitor\" }\narrayvec = {version= \"0.7\", features = [\"serde\"]}\nsodiumoxide = \"0.2\"\nclu = { path = \"../clu\" }\n-web30 = \"0.21\"\n+web30 = \"0.22\"\nawc = \"3.0.0\"\nipnetwork = \"0.20\"\nactix-async = {package=\"actix\", version = \"0.13\"}\n" }, { "change_type": "MODIFY", "old_path": "rita_common/Cargo.toml", "new_path": "rita_common/Cargo.toml", "diff": "[package]\nname = \"rita_common\"\n-version = \"0.20.7\"\n+version = \"0.20.8\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n@@ -34,7 +34,7 @@ actix-web-httpauth-async = { package=\"actix-web-httpauth\", version = \"0.8.0\"}\nactix-web-async = { package=\"actix-web\", version = \"4.0.1\", default_features = false, features= [\"openssl\"]}\nawc = {version = \"3.0.0-beta.21\", default-features = false, features=[\"openssl\", \"compress-gzip\", \"compress-zstd\"]}\nactix-service = \"2.0.2\"\n-web30 = \"0.21\"\n+web30 = \"0.22\"\nalthea_types = { path = \"../althea_types\" }\n[dependencies.regex]\nversion = \"1.6\"\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/dashboard/own_info.rs", "new_path": "rita_common/src/dashboard/own_info.rs", "diff": "@@ -7,7 +7,7 @@ use actix_web_async::HttpResponse;\nuse clarity::Address;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 20 RC7\";\n+pub static READABLE_VERSION: &str = \"Beta 20 RC8\";\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.20.7\"\n+version = \"0.20.8\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 20 rc8
20,244
17.01.2023 11:35:08
18,000
2084c24d8ba4d9c7ba6a335703b75252349868d8
Remove light client functionality This patch removes the phone based light client funcionality, with our transition to full LTE based systems how we interact with phones on the network will change significantly and this code simply isn't useful as it has no current users.
[ { "change_type": "MODIFY", "old_path": "althea_types/src/user_info.rs", "new_path": "althea_types/src/user_info.rs", "diff": "@@ -51,9 +51,6 @@ pub struct InstallationDetails {\n/// point to point links going downstream. If the vec is empty there are no\n/// relay antennas\npub relay_antennas: Vec<Ipv4Addr>,\n- /// A list of addresses for light client antennas. The vec can of course\n- /// be empty representing no phone client antennas.\n- pub phone_client_antennas: Vec<Ipv4Addr>,\n/// The address of this installation, this has no structure and should\n/// simply be displayed. Depending on the country address formats will\n/// be very different and we might even only have GPS points\n" }, { "change_type": "MODIFY", "old_path": "antenna_forwarding_client/src/lib.rs", "new_path": "antenna_forwarding_client/src/lib.rs", "diff": "@@ -301,7 +301,7 @@ fn setup_networking<S: ::std::hash::BuildHasher>(\n/// Finds the antenna on the appropriate physical interface by iterating\n/// over the list of provided interfaces, attempting a ping\n/// and repeating until the appropriate interface is located\n-/// TODO handle overlapping edge cases for gateway ip, lan ip, br-pbs etc\n+/// TODO handle overlapping edge cases for gateway ip, lan ip, etc\nfn find_antenna<S: ::std::hash::BuildHasher>(\ntarget_ip: IpAddr,\ninterfaces: &HashSet<String, S>,\n" }, { "change_type": "MODIFY", "old_path": "rita_bin/src/client.rs", "new_path": "rita_bin/src/client.rs", "diff": "@@ -28,7 +28,6 @@ use docopt::Docopt;\nuse rita_client::dashboard::start_client_dashboard;\nuse rita_client::get_client_usage;\nuse rita_client::rita_loop::start_antenna_forwarder;\n-use rita_client::rita_loop::start_rita_client_endpoints;\nuse rita_client::rita_loop::start_rita_client_loops;\nuse rita_client::Args;\nuse rita_common::debt_keeper::save_debt_on_shutdown;\n@@ -148,7 +147,6 @@ fn main() {\nsettings::get_rita_client(),\n));\nstart_core_rita_endpoints(4);\n- start_rita_client_endpoints(1);\nstart_client_dashboard(settings.network.rita_dashboard_port);\nstart_antenna_forwarder(settings);\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/installation_details.rs", "new_path": "rita_client/src/dashboard/installation_details.rs", "diff": "@@ -61,7 +61,6 @@ pub async fn set_installation_details(req: Json<InstallationDetailsPost>) -> Htt\n// take a common separated string and parse it into the correct\n// values\nlet mut parsed_relay_antenna_ips = Vec::new();\n- let mut parsed_phone_client_anntenna_ips = Vec::new();\nif let Some(val) = input.relay_antennas {\nfor ip_str in val.split(',') {\nif let Ok(ip) = ip_str.parse() {\n@@ -74,16 +73,6 @@ pub async fn set_installation_details(req: Json<InstallationDetailsPost>) -> Htt\n}\n}\n}\n- if let Some(val) = input.phone_client_antennas {\n- for ip_str in val.split(',') {\n- if let Ok(ip) = ip_str.parse() {\n- parsed_phone_client_anntenna_ips.push(ip);\n- } else {\n- trace!(\"false to parse {}\", ip_str);\n- return HttpResponse::BadRequest().finish();\n- }\n- }\n- }\nlet parsed_client_antenna_ip = match input.client_antenna_ip {\nSome(ip_str) => match ip_str.parse() {\nOk(ip) => Some(ip),\n@@ -102,7 +91,6 @@ pub async fn set_installation_details(req: Json<InstallationDetailsPost>) -> Htt\nlet new_installation_details = InstallationDetails {\nclient_antenna_ip: parsed_client_antenna_ip,\nrelay_antennas: parsed_relay_antenna_ips,\n- phone_client_antennas: parsed_phone_client_anntenna_ips,\nphysical_address: input.physical_address,\nequipment_details: input.equipment_details,\ninstall_date: None,\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/interfaces.rs", "new_path": "rita_client/src/dashboard/interfaces.rs", "diff": "@@ -42,10 +42,6 @@ pub enum InterfaceMode {\n},\n/// Similar to WAN, but not a gateway, so no static DNS routes and only IP peers (10.45.0.1)\nLTE,\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- Phone,\n/// Ambiguous wireless modes like monitor, or promiscuous show up here, but other things that might also\n/// be unknown are various forms of malformed configs. Take for example a StaticWAN missing a config param\nUnknown,\n@@ -58,7 +54,6 @@ impl ToString for InterfaceMode {\nInterfaceMode::Lan => \"LAN\".to_owned(),\nInterfaceMode::Wan => \"WAN\".to_owned(),\nInterfaceMode::StaticWan { .. } => \"StaticWAN\".to_owned(),\n- InterfaceMode::Phone => \"Phone\".to_owned(),\nInterfaceMode::Unknown => \"unknown\".to_owned(),\nInterfaceMode::LTE => \"LTE\".to_owned(),\n}\n@@ -76,18 +71,12 @@ pub fn get_interfaces() -> Result<HashMap<String, InterfaceMode>, RitaClientErro\n// it's a list and we need to handle that\nif value.contains(' ') {\nfor list_member in value.split(' ') {\n- if list_member.contains(\"pbs-wlan\") {\n- continue;\n- }\nretval.insert(\nlist_member.replace(' ', \"\").to_string(),\nethernet2mode(&value, &setting_name)?,\n);\n}\n} else {\n- if value.contains(\"pbs-wlan\") {\n- continue;\n- }\nretval.insert(value.clone(), ethernet2mode(&value, &setting_name)?);\n}\n}\n@@ -108,7 +97,6 @@ pub fn ethernet2mode(ifname: &str, setting_name: &str) -> Result<InterfaceMode,\nOk(match &setting_name.replace(\".ifname\", \"\") {\ns if s.contains(\"rita_\") => InterfaceMode::Mesh,\ns if s.contains(\"lan\") => InterfaceMode::Lan,\n- s if s.contains(\"pbs\") => InterfaceMode::Phone,\ns if s.contains(\"lte\") => InterfaceMode::LTE,\ns if s.contains(\"backhaul\") => {\nlet prefix = \"network.backhaul\";\n@@ -276,14 +264,6 @@ pub fn ethernet_transform_mode(\nlet ret = KI.set_uci_var(\"network.lan.ifname\", &new_list);\nreturn_codes.push(ret);\n}\n- // just like LAN we are adding and removing a device from the list just this time\n- // on pbs\n- InterfaceMode::Phone => {\n- let list = KI.get_uci_var(\"network.pbs.ifname\")?;\n- let new_list = list_remove(&list, ifname);\n- let ret = KI.set_uci_var(\"network.pbs.ifname\", &new_list);\n- return_codes.push(ret);\n- }\n// for mesh we need to send an unlisten so that Rita stops\n// listening then we can remove the section, we also need to remove it\n// from the config\n@@ -361,29 +341,6 @@ pub fn ethernet_transform_mode(\n}\n}\n}\n- InterfaceMode::Phone => {\n- trace!(\"Converting interface to Phone with ifname {:?}\", ifname);\n- let ret = KI.get_uci_var(\"network.pbs.ifname\");\n- match ret {\n- Ok(list) => {\n- trace!(\"The existing Phone interfaces list is {:?}\", list);\n- let new_list = list_add(&list, ifname);\n- trace!(\"Setting the new list {:?}\", new_list);\n- let ret = KI.set_uci_var(\"network.pbs.ifname\", &new_list);\n- return_codes.push(ret);\n- }\n- Err(e) => {\n- if e.to_string().contains(\"Entry not found\") {\n- trace!(\"No Phone interfaces found, setting one now\");\n- let ret = KI.set_uci_var(\"network.pbs.ifname\", ifname);\n- return_codes.push(ret);\n- } else {\n- warn!(\"Trying to read Phone ifname returned {:?}\", e);\n- return_codes.push(Err(e));\n- }\n- }\n- }\n- }\nInterfaceMode::Mesh => {\nnetwork.peer_interfaces.insert(ifname.to_string());\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/lib.rs", "new_path": "rita_client/src/lib.rs", "diff": "@@ -10,7 +10,6 @@ extern crate serde_derive;\npub mod dashboard;\npub mod exit_manager;\npub mod heartbeat;\n-pub mod light_client_manager;\npub mod logging;\npub mod operator_fee_manager;\npub mod operator_update;\n" }, { "change_type": "DELETE", "old_path": "rita_client/src/light_client_manager/mod.rs", "new_path": null, "diff": "-//! This module adds support for light clients, light clients being android hpones which connect directly to a client hotspot and have their\n-//! traffic piped out over the clients exit tunnel in exchange for payment. Light clients do not register to exits neither do they participate\n-//! in routing in any way. The billing and connection process is sort of a 'mini exit' at the router level. This isn't an ideal design at all,\n-//! especially since the client traffic exits unencrypted at one point on the participating Rita Client router. Sadly this is unavoidable as\n-//! far as I can tell due to the restrictive nature of how and when Android allows ipv6 routing.\n-\n-use actix_web_async::http::StatusCode;\n-use actix_web_async::{web::Json, HttpRequest, HttpResponse};\n-use althea_kernel_interface::wg_iface_counter::prepare_usage_history;\n-use althea_kernel_interface::wg_iface_counter::WgUsage;\n-use althea_types::{Identity, LightClientLocalIdentity, LocalIdentity, WgKey};\n-use rita_common::debt_keeper::traffic_update;\n-use rita_common::debt_keeper::Traffic;\n-use rita_common::peer_listener::Peer;\n-use rita_common::tunnel_manager::id_callback::IdentityCallback;\n-use rita_common::tunnel_manager::Tunnel;\n-use rita_common::utils::ip_increment::incrementv4;\n-use rita_common::{tm_identity_callback, KI};\n-use std::collections::HashMap;\n-use std::collections::HashSet;\n-use std::net::Ipv4Addr;\n-use std::sync::{Arc, RwLock};\n-\n-use crate::traffic_watcher::get_exit_dest_price;\n-use crate::RitaClientError;\n-\n-lazy_static! {\n- static ref LIGHT_CLIENT_MANAGER: Arc<RwLock<LightClientManager>> =\n- Arc::new(RwLock::new(LightClientManager::default()));\n-}\n-\n-/// Sets up a variant of the exit tunnel nat rules, assumes that the exit\n-/// tunnel is already created and doesn't change the system routing table\n-fn setup_light_client_forwarding(client_addr: Ipv4Addr, nic: &str) -> Result<(), RitaClientError> {\n- // the way this works is pretty heavy on the routes and iptables rules\n- // it wouldn't be feasible if we expected more than a few dozen phone\n- // clients on a single device. Instead of having an aggregating network\n- // like br-lan to allow us to treat multiple interfaces as a single nic\n- // we manipulate routes and iptables rules for the wg tunnels directly\n- // this is easier to manage programatically but as mentioned before\n- // doesn't exactly scale well.\n- // Key points to note here is that the routes and addresses\n- // get cleaned up on their own whent the interface is deleted but\n- // the iptables rule does not and requires explicit deletion\n- trace!(\"adding light client nat rules\");\n- KI.add_ipv4(\"192.168.20.0\".parse().unwrap(), nic)?;\n- KI.run_command(\n- \"ip\",\n- &[\"route\", \"add\", &format!(\"{}/32\", client_addr), \"dev\", nic],\n- )?;\n- // forwards phone client packets while blocking other destinations this\n- // needs to be cleaned up at some point\n- KI.add_iptables_rule(\n- \"iptables\",\n- &[\n- \"-I\",\n- \"FORWARD\",\n- \"-i\",\n- nic,\n- \"--src\",\n- &format!(\"{}/32\", client_addr),\n- \"-j\",\n- \"ACCEPT\",\n- ],\n- )?;\n- Ok(())\n-}\n-\n-/// Response to the light_client_hello endpoint on the Rita client module with a modified hello packet\n-/// this modified packet includes an ipv4 address and opens a modified tunnel that is attached to the\n-/// phone network bridge into a natted ipv4 network rather than into a Babel network.\n-pub async fn light_client_hello_response(req: (Json<LocalIdentity>, HttpRequest)) -> HttpResponse {\n- let their_id = *req.0;\n- let light_client_address = lcm_get_address(GetAddress(their_id));\n- let exit_dest_price = get_exit_dest_price();\n-\n- let err_mesg = \"Malformed light client hello tcp packet!\";\n- let socket = match req.1.peer_addr() {\n- Some(val) => val,\n- None => {\n- error!(\"{}\", err_mesg);\n- return HttpResponse::build(StatusCode::INTERNAL_SERVER_ERROR).json(err_mesg);\n- }\n- };\n- let (light_client_address_option, light_client_address) = match light_client_address {\n- Ok(addr) => (Some(addr), addr),\n- Err(e) => {\n- let err_mesg = \"Could not allocate address!\";\n- error!(\"{} {}\", err_mesg, e);\n- return HttpResponse::build(StatusCode::INTERNAL_SERVER_ERROR).json(err_mesg);\n- }\n- };\n- trace!(\"Got light client Hello from {:?}\", req.1.peer_addr());\n- trace!(\n- \"opening tunnel in light_client_hello_response for {:?}\",\n- their_id\n- );\n- let peer = Peer {\n- contact_socket: socket,\n- ifidx: 0, // only works because we lookup ifname in kernel interface\n- };\n- let tunnel = tm_identity_callback(IdentityCallback::new(\n- their_id,\n- peer,\n- None,\n- light_client_address_option,\n- ));\n- let (tunnel, have_tunnel) = match tunnel {\n- Some(val) => val,\n- None => {\n- error!(\"Light Client Manager: tunnel open failure!\");\n- return HttpResponse::build(StatusCode::INTERNAL_SERVER_ERROR).json(err_mesg);\n- }\n- };\n- let lci = LightClientLocalIdentity {\n- global: match settings::get_rita_client().get_identity() {\n- Some(id) => id,\n- None => {\n- error!(\"Light Client Manager: Identity has no mesh IP ready yet\");\n- return HttpResponse::build(StatusCode::INTERNAL_SERVER_ERROR).json(err_mesg);\n- }\n- },\n- wg_port: tunnel.listen_port,\n- have_tunnel: Some(have_tunnel),\n- tunnel_address: light_client_address,\n- price: settings::get_rita_client().payment.light_client_fee as u128 + exit_dest_price,\n- };\n- // Two bools -> 4 state truth table, in 3 of\n- // those states we need to re-add these rules\n- // router phone\n- // false false we need to add rules to new tunnel\n- // true false tunnel will be re-created so new rules\n- // false true new tunnel on our side new rules\n- // true true only case where we don't need to run this\n- if let Some(they_have_tunnel) = their_id.have_tunnel {\n- if !(have_tunnel && they_have_tunnel) {\n- if let Err(e) = setup_light_client_forwarding(light_client_address, &tunnel.iface_name)\n- {\n- error!(\"Light Client Manager: {}\", e);\n- return HttpResponse::build(StatusCode::INTERNAL_SERVER_ERROR).json(err_mesg);\n- }\n- }\n- } else {\n- error!(\"Light clients should never send the none tunnel option!\");\n- }\n- // We send the callback, which can safely allocate a port because it already successfully\n- // contacted a neighbor. The exception to this is when the TCP session fails at exactly\n- // the wrong time.\n- HttpResponse::Ok().json(lci)\n-}\n-\n-pub struct LightClientManager {\n- start_address: Ipv4Addr,\n- prefix: u8,\n- assigned_addresses: HashMap<Identity, Ipv4Addr>,\n- last_seen_bytes: HashMap<WgKey, WgUsage>,\n-}\n-\n-impl Default for LightClientManager {\n- fn default() -> LightClientManager {\n- LightClientManager {\n- start_address: \"192.168.20.1\".parse().unwrap(),\n- prefix: 24,\n- assigned_addresses: HashMap::new(),\n- last_seen_bytes: HashMap::new(),\n- }\n- }\n-}\n-\n-pub struct GetAddress(LocalIdentity);\n-\n-pub fn lcm_get_address(msg: GetAddress) -> Result<Ipv4Addr, RitaClientError> {\n- let lcm = &mut *LIGHT_CLIENT_MANAGER.write().unwrap();\n- let requester_id = msg.0;\n- assign_client_address(\n- &mut lcm.assigned_addresses,\n- requester_id.global,\n- lcm.start_address,\n- lcm.prefix,\n- )\n-}\n-\n-fn assign_client_address(\n- assigned_addresses: &mut HashMap<Identity, Ipv4Addr>,\n- requester_id: Identity,\n- start_address: Ipv4Addr,\n- prefix: u8,\n-) -> Result<Ipv4Addr, RitaClientError> {\n- trace!(\"Assigning light client address\");\n- // we already have an ip for this id on record, send the same one out\n- if let Some(ip) = assigned_addresses.get(&requester_id) {\n- trace!(\"Found existing record, no ip assigned\");\n- return Ok(*ip);\n- }\n- let assigned_ips = {\n- let mut set = HashSet::new();\n- for (_id, ip) in assigned_addresses.iter() {\n- set.insert(ip);\n- }\n- set\n- };\n-\n- // get the first unused address this is kinda inefficient, I'm sure we could do this in all O(1) operations\n- // but at the cost of more memory usage, which I'd rather avoid. Either way it's trivial\n- // both in terms of memory and cpu at the scale of only 16 bits of address space (ipv4 private range size)\n- let mut new_address: Ipv4Addr = start_address;\n- while assigned_ips.contains(&new_address) {\n- trace!(\"light client address {} is already assigned\", new_address);\n- new_address = incrementv4(new_address, prefix)?;\n- }\n- assigned_addresses.insert(requester_id, new_address);\n- trace!(\n- \"finished selecting light client address, it is {}\",\n- new_address\n- );\n- Ok(new_address)\n-}\n-\n-/// Returns addresses not assigned to tunnels to the pool, this is\n-/// inefficient versus having tunnel manager notify us when it deletes\n-/// a tunnel but it turns out getting the conditional complication required\n-/// for that to all workout is moderately complicated.\n-fn return_addresses(tunnels: &[Tunnel], assigned_addresses: &mut HashMap<Identity, Ipv4Addr>) {\n- trace!(\n- \"starting address GC tunnels {:?}, addresses {:?}\",\n- tunnels,\n- assigned_addresses\n- );\n- let mut addresses_to_remove: Vec<Identity> = Vec::new();\n- for (id, ip) in assigned_addresses.iter() {\n- let mut found = false;\n- for tunnel in tunnels.iter() {\n- if let Some(tunnel_ip) = tunnel.light_client_details {\n- if tunnel_ip == *ip {\n- found = true;\n- break;\n- }\n- }\n- }\n- if !found {\n- addresses_to_remove.push(*id);\n- }\n- }\n- info!(\"{} LC ADDR GC\", addresses_to_remove.len());\n- for id in addresses_to_remove {\n- assigned_addresses.remove(&id);\n- }\n- info!(\"{} LC ACTIVE\", assigned_addresses.len());\n-}\n-\n-/// Traffic watcher implementation for light clients, this is conceptually\n-/// very simple, just iterate over tunnels from tunnel manager, determine\n-/// which ones are light clients, those that are check their usage and shoot\n-/// off a message to debt keeper with an updated debt total. Conceptually similar\n-/// to the exit billing system. Biggest difference is that the phone client doesn't\n-/// need to concern itself with full route prices. Because this data is not being\n-/// 'forwarded' but instead sent over the exit tunnel and paid for in the same way\n-/// client usage is.\n-pub struct Watch {\n- pub tunnels: Vec<Tunnel>,\n- pub exit_dest_price: u128,\n-}\n-\n-pub fn lcm_watch(msg: Watch) {\n- let lcm = &mut *LIGHT_CLIENT_MANAGER.write().unwrap();\n- trace!(\"Starting light client traffic watcher\");\n- let our_price =\n- settings::get_rita_client().payment.light_client_fee as u128 + msg.exit_dest_price;\n- let tunnels = msg.tunnels;\n- let mut debts: HashMap<Identity, i128> = HashMap::new();\n- for tunnel in tunnels.iter() {\n- if let Some(_val) = tunnel.light_client_details {\n- if let Ok(counter) = KI.read_wg_counters(&tunnel.iface_name) {\n- prepare_usage_history(&counter, &mut lcm.last_seen_bytes);\n- // there should only be one, more than one client on a single\n- // interface is not supported\n- assert!(counter.len() == 1);\n- // get only the first element\n- let (key, usage) = counter.iter().next().unwrap();\n- // unwrap is safe before prepare usage history will ensure an entry exits\n- let last_seen_usage = lcm.last_seen_bytes.get_mut(key).unwrap();\n- let round_upload = usage.upload - last_seen_usage.upload;\n- let round_download = usage.download - last_seen_usage.download;\n- *last_seen_usage = *usage;\n- let debt = ((round_upload + round_download) * our_price as u64) as i128;\n- subtract_or_insert_and_subtract(&mut debts, tunnel.neigh_id.global, debt);\n- }\n- }\n- }\n- let mut traffic_vec = Vec::new();\n- for (from, amount) in debts {\n- traffic_vec.push(Traffic {\n- from,\n- amount: amount.into(),\n- })\n- }\n- traffic_update(traffic_vec);\n- // tunnel address garbage collection\n- return_addresses(&tunnels, &mut lcm.assigned_addresses);\n-}\n-\n-/// inserts and also negates since negative means they owe us and we can never owe phone clients\n-fn subtract_or_insert_and_subtract(data: &mut HashMap<Identity, i128>, i: Identity, debt: i128) {\n- if let Some(val) = data.get_mut(&i) {\n- *val -= debt;\n- } else {\n- data.insert(i, -debt);\n- }\n-}\n-\n-#[cfg(test)]\n-mod tests {\n- use super::*;\n- use clu::generate_mesh_ip;\n- use rita_common::tunnel_manager::get_test_id;\n- use rita_common::tunnel_manager::get_test_tunnel;\n-\n- fn get_random_id() -> Identity {\n- Identity {\n- mesh_ip: generate_mesh_ip().unwrap(),\n- eth_address: \"0x4288C538A553357Bb6c3b77Cf1A60Da6E77931F6\"\n- .parse()\n- .unwrap(),\n- wg_public_key: \"GIaAXDi1PbGq3PsKqBnT6kIPoE2K1Ssv9HSb7++dzl4=\"\n- .parse()\n- .unwrap(),\n- nickname: None,\n- }\n- }\n-\n- #[test]\n- fn test_basic_assign() {\n- let mut assigned_addresses = HashMap::new();\n- let res: Ipv4Addr = assign_client_address(\n- &mut assigned_addresses,\n- get_random_id(),\n- \"192.168.1.0\".parse().unwrap(),\n- 24,\n- )\n- .expect(\"Failed to assign ip\");\n- assert_eq!(\"192.168.1.0\".parse::<Ipv4Addr>().unwrap(), res);\n- let res: Ipv4Addr = assign_client_address(\n- &mut assigned_addresses,\n- get_random_id(),\n- \"192.168.1.0\".parse().unwrap(),\n- 24,\n- )\n- .expect(\"Failed to assign ip\");\n- assert_eq!(\"192.168.1.1\".parse::<Ipv4Addr>().unwrap(), res);\n- let res: Ipv4Addr = assign_client_address(\n- &mut assigned_addresses,\n- get_random_id(),\n- \"192.168.1.0\".parse().unwrap(),\n- 24,\n- )\n- .expect(\"Failed to assign ip\");\n- assert_eq!(\"192.168.1.2\".parse::<Ipv4Addr>().unwrap(), res);\n- }\n-\n- #[test]\n- fn test_failed_assign() {\n- let mut assigned_addresses = HashMap::new();\n- let _res = assign_client_address(\n- &mut assigned_addresses,\n- get_test_id(),\n- \"192.168.1.255\".parse().unwrap(),\n- 24,\n- );\n- let res = assign_client_address(\n- &mut assigned_addresses,\n- get_random_id(),\n- \"192.168.1.255\".parse().unwrap(),\n- 24,\n- );\n- assert!(res.is_err());\n- }\n-\n- #[test]\n- fn test_gc() {\n- let mut assigned_addresses = HashMap::new();\n- let _res = assign_client_address(\n- &mut assigned_addresses,\n- get_test_id(),\n- \"192.168.1.0\".parse().unwrap(),\n- 24,\n- );\n- let _res = assign_client_address(\n- &mut assigned_addresses,\n- get_random_id(),\n- \"192.168.1.0\".parse().unwrap(),\n- 24,\n- );\n- let empty_tunnels = [] as [Tunnel; 0];\n- return_addresses(&empty_tunnels, &mut assigned_addresses);\n- assert!(assigned_addresses.is_empty());\n- }\n-\n- #[test]\n- fn test_not_gc() {\n- let mut assigned_addresses = HashMap::new();\n- let ip = \"192.168.1.0\".parse().unwrap();\n- let _res = assign_client_address(&mut assigned_addresses, get_test_id(), ip, 24);\n- let _res = assign_client_address(&mut assigned_addresses, get_random_id(), ip, 24);\n- let tunnels = [get_test_tunnel(ip, true)];\n- println!(\"{:?}\", assigned_addresses);\n- return_addresses(&tunnels, &mut assigned_addresses);\n- assert_eq!(assigned_addresses.len(), 1);\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": "@@ -8,20 +8,13 @@ use crate::exit_manager::exit_manager_tick;\nuse crate::exit_manager::get_selected_exit;\nuse crate::heartbeat::send_heartbeat_loop;\nuse crate::heartbeat::HEARTBEAT_SERVER_KEY;\n-use crate::light_client_manager::lcm_watch;\n-use crate::light_client_manager::light_client_hello_response;\n-use crate::light_client_manager::Watch;\nuse crate::operator_fee_manager::tick_operator_payments;\n-use crate::traffic_watcher::get_exit_dest_price;\nuse actix_async::System as AsyncSystem;\n-use actix_web_async::web;\n-use actix_web_async::{App, HttpServer};\nuse althea_kernel_interface::KI;\nuse althea_types::ExitState;\nuse antenna_forwarding_client::start_antenna_forwarding_proxy;\nuse rita_common::rita_loop::set_gateway;\nuse rita_common::tunnel_manager::tm_get_neighbors;\n-use rita_common::tunnel_manager::tm_get_tunnels;\nuse settings::client::RitaClientSettings;\nuse std::fs::File;\nuse std::fs::OpenOptions;\n@@ -100,19 +93,6 @@ pub fn start_rita_loop() {\nstart.elapsed().subsec_millis()\n);\n- let exit_dest_price = get_exit_dest_price();\n- let tunnels = tm_get_tunnels().unwrap();\n- info!(\n- \"Rita Client loop get tunnels in {}s {}ms\",\n- start.elapsed().as_secs(),\n- start.elapsed().subsec_millis()\n- );\n-\n- lcm_watch(Watch {\n- tunnels,\n- exit_dest_price,\n- });\n-\ncheck_for_gateway_client_billing_corner_case();\ninfo!(\n\"Rita Client loop corner case in {}s {}ms\",\n@@ -210,36 +190,6 @@ fn check_for_gateway_client_billing_corner_case() {\n}\n}\n-pub fn start_rita_client_endpoints(workers: usize) {\n- // listen on the light client gateway ip if it's not none\n- thread::spawn(move || {\n- let runner = AsyncSystem::new();\n- runner.block_on(async move {\n- if let Some(gateway_ip) = settings::get_rita_client().network.light_client_router_ip {\n- trace!(\"Listening for light client hellos on {}\", gateway_ip);\n- let unstarted_server = HttpServer::new(|| {\n- App::new().route(\n- \"/light_client_hello\",\n- web::post().to(light_client_hello_response),\n- )\n- })\n- .workers(workers)\n- .bind(format!(\n- \"{}:{}\",\n- gateway_ip,\n- settings::get_rita_client().network.light_client_hello_port\n- ));\n- if let Ok(val) = unstarted_server {\n- info!(\"Starting client endpoint: light client\");\n- let _res = val.shutdown_timeout(0).run().await;\n- } else {\n- trace!(\"Failed to bind to light client ip, probably toggled off!\")\n- }\n- }\n- });\n- });\n-}\n-\npub fn start_antenna_forwarder(settings: RitaClientSettings) {\nif metrics_permitted() {\nlet url: &str;\n@@ -253,8 +203,7 @@ pub fn start_antenna_forwarder(settings: RitaClientSettings) {\nlet our_id = settings.get_identity().unwrap();\nlet network = settings.network;\n- let mut interfaces = network.peer_interfaces.clone();\n- interfaces.insert(\"br-pbs\".to_string());\n+ let interfaces = network.peer_interfaces.clone();\nstart_antenna_forwarding_proxy(\nurl.to_string(),\nour_id,\n" }, { "change_type": "MODIFY", "old_path": "settings/src/network.rs", "new_path": "settings/src/network.rs", "diff": "use althea_kernel_interface::DefaultRoute;\nuse althea_types::ShaperSettings;\nuse std::collections::HashSet;\n-use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};\n+use std::net::{IpAddr, Ipv6Addr};\nuse althea_types::WgKey;\n@@ -27,10 +27,6 @@ fn default_shaper_settings() -> ShaperSettings {\n}\n}\n-fn default_light_client_hello_port() -> u16 {\n- 4878\n-}\n-\n#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]\npub struct NetworkSettings {\n/// How much non-financial metrics matter compared to a route's cost. By default a 2x more\n@@ -52,13 +48,6 @@ pub struct NetworkSettings {\n/// Port on which rita starts the per hop tunnel handshake on (needs to be constant across an\n/// entire althea deployment)\npub rita_hello_port: u16,\n- /// Port on which phones will contact Rita, this SHOULD be firewalled from the rest of the mesh\n- /// network\n- #[serde(default = \"default_light_client_hello_port\")]\n- pub light_client_hello_port: u16,\n- /// This devices address on the inside of the AltheaPhone network, this is set by the firmware builder. If it's\n- /// none it was never set by the firmware builder and light client operations simply aren't enabled\n- pub light_client_router_ip: Option<Ipv4Addr>,\n/// Port on which rita contacts other althea nodes over the mesh (needs to be constant across an\n/// entire althea deployment)\npub rita_contact_port: u16,\n@@ -129,8 +118,6 @@ impl Default for NetworkSettings {\nbabel_port: 6872,\nrita_contact_port: 4874,\nrita_hello_port: 4876,\n- light_client_hello_port: default_light_client_hello_port(),\n- light_client_router_ip: None,\nrita_dashboard_port: 4877,\nrita_dashboard_password: None,\nrita_tick_interval: 5,\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove light client functionality This patch removes the phone based light client funcionality, with our transition to full LTE based systems how we interact with phones on the network will change significantly and this code simply isn't useful as it has no current users.
20,253
19.12.2022 13:36:49
28,800
ae40ef8e4797c4d21fbed92dc4bb034a767bf3fa
Add namespaces to new integration test container
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -2649,6 +2649,9 @@ dependencies = [\n[[package]]\nname = \"test_runner\"\nversion = \"0.1.0\"\n+dependencies = [\n+ \"althea_kernel_interface\",\n+]\n[[package]]\nname = \"thiserror\"\n" }, { "change_type": "MODIFY", "old_path": "scripts/integration-test-v2.sh", "new_path": "scripts/integration-test-v2.sh", "diff": "@@ -14,4 +14,7 @@ rm rita.tar.gz\npopd\n+<<<<<<< HEAD\n+=======\n+>>>>>>> 48aecd88 (Add namespaces to new integration test container)\n" }, { "change_type": "MODIFY", "old_path": "test_runner/Cargo.toml", "new_path": "test_runner/Cargo.toml", "diff": "@@ -9,3 +9,5 @@ name = \"tester\"\npath = \"src/main.rs\"\n[dependencies]\n+althea_kernel_interface = { path = \"../althea_kernel_interface\" }\n+\n" }, { "change_type": "MODIFY", "old_path": "test_runner/src/main.rs", "new_path": "test_runner/src/main.rs", "diff": "+//use core::time;\n+//use std::thread;\n+\n+use althea_kernel_interface::{KernelInterfaceError, KI};\n+\n+/// This struct holds the setup instructions for namespaces\n+#[derive(Clone, Eq, PartialEq)]\n+pub struct NamespaceInfo {\n+ /// the names of the namespaces\n+ pub names: Vec<String>,\n+ /// Linked nodes written as tuple pairs\n+ /// The string is for the namespace name(NOTE: names must be <=4 characters as interfaces\n+ /// cannot be more than 15 char, and we input as veth-{}-{})\n+ /// The u32 is for the subnet on the 3rd octet\n+ pub linked: Vec<((String, u32), (String, u32))>,\n+}\n+\nfn main() {\n- println!(\"Hello, world!\");\n+ // uncomment this for manual debugging\n+ // let ten_mins = time::Duration::from_secs(600);\n+\n+ let namespaces = five_node_config();\n+\n+ validate_connections(namespaces.clone());\n+\n+ let res = setup_ns(namespaces);\n+ println!(\"Namespaces setup: {:?}\", res);\n+ // this sleep is for debugging so that the container can be accessed to poke around in\n+ // thread::sleep(ten_mins);\n+}\n+\n+fn five_node_config() -> NamespaceInfo {\n+ /*\n+ These are connected as such:\n+ A---------B\n+ \\ /|\n+ \\ / |\n+ \\ / |\n+ \\ / |\n+ X |\n+ / \\ |\n+ / \\ |\n+ / \\ |\n+ / \\|\n+ D---------C\n+ */\n+ let testa = (\"nA\".to_string(), 0);\n+ let testb = (\"nB\".to_string(), 1);\n+ let testc = (\"nC\".to_string(), 2);\n+ let testd = (\"nD\".to_string(), 3);\n+\n+ NamespaceInfo {\n+ names: vec![\n+ testa.clone().0,\n+ testb.clone().0,\n+ testc.clone().0,\n+ testd.clone().0,\n+ ],\n+ linked: vec![\n+ // arbitrary connections\n+ (testa.clone(), testb.clone()),\n+ (testb.clone(), testc.clone()),\n+ (testa, testc.clone()),\n+ (testc, testd.clone()),\n+ (testb, testd),\n+ ],\n+ }\n+}\n+\n+fn setup_ns(spaces: NamespaceInfo) -> Result<(), KernelInterfaceError> {\n+ // arbitrary number for the IP assignment\n+ let mut counter = 6;\n+ // clear namespaces\n+ KI.run_command(\"ip\", &[\"-all\", \"netns\", \"delete\", \"||\", \"true\"])?;\n+ // add namespaces\n+ for name in spaces.names {\n+ let res = KI.run_command(\"ip\", &[\"netns\", \"add\", &name]);\n+ println!(\"{:?}\", res);\n+ // ip netns exec nB ip link set dev lo up\n+ let res = KI.run_command(\n+ \"ip\",\n+ &[\n+ \"netns\", \"exec\", &name, \"ip\", \"link\", \"set\", \"dev\", \"lo\", \"up\",\n+ ],\n+ );\n+ println!(\"{:?}\", res);\n+ }\n+ for link in spaces.linked {\n+ let veth_ab = format!(\"veth-{}-{}\", link.0 .0, link.1 .0);\n+ let veth_ba = format!(\"veth-{}-{}\", link.1 .0, link.0 .0);\n+ let ip_ab = format!(\"192.168.{}.{}/24\", link.0 .1, counter);\n+ let ip_ba = format!(\"192.168.{}.{}/24\", link.1 .1, counter);\n+ let subnet_a = format!(\"192.168.{}.0/24\", link.0 .1);\n+ let subnet_b = format!(\"192.168.{}.0/24\", link.1 .1);\n+\n+ counter += 1;\n+ // create veth to link them\n+ let res = KI.run_command(\n+ \"ip\",\n+ &[\n+ \"link\", \"add\", &veth_ab, \"type\", \"veth\", \"peer\", \"name\", &veth_ba,\n+ ],\n+ );\n+ println!(\"{:?}\", res);\n+ // assign each side of the veth to one of the nodes namespaces\n+ let res = KI.run_command(\"ip\", &[\"link\", \"set\", &veth_ab, \"netns\", &link.0 .0]);\n+ println!(\"{:?}\", res);\n+ let res = KI.run_command(\"ip\", &[\"link\", \"set\", &veth_ba, \"netns\", &link.1 .0]);\n+ println!(\"{:?}\", res);\n+\n+ // add ip addresses on each side\n+ let res = KI.run_command(\n+ \"ip\",\n+ &[\n+ \"netns\", \"exec\", &link.0 .0, \"ip\", \"addr\", \"add\", &ip_ab, \"dev\", &veth_ab,\n+ ],\n+ );\n+ println!(\"{:?}\", res);\n+\n+ let res = KI.run_command(\n+ \"ip\",\n+ &[\n+ \"netns\", \"exec\", &link.1 .0, \"ip\", \"addr\", \"add\", &ip_ba, \"dev\", &veth_ba,\n+ ],\n+ );\n+ println!(\"{:?}\", res);\n+\n+ // bring the interfaces up\n+ let res = KI.run_command(\n+ \"ip\",\n+ &[\n+ \"netns\", \"exec\", &link.0 .0, \"ip\", \"link\", \"set\", \"dev\", &veth_ab, \"up\",\n+ ],\n+ );\n+ println!(\"{:?}\", res);\n+\n+ let res = KI.run_command(\n+ \"ip\",\n+ &[\n+ \"netns\", \"exec\", &link.1 .0, \"ip\", \"link\", \"set\", \"dev\", &veth_ba, \"up\",\n+ ],\n+ );\n+ println!(\"{:?}\", res);\n+\n+ // ip netns exec nC ip route add 192.168.0.0/24 dev veth-nC-nA\n+ // add routes to each other's subnets\n+ let res = KI.run_command(\n+ \"ip\",\n+ &[\n+ \"netns\", \"exec\", &link.0 .0, \"ip\", \"route\", \"add\", &subnet_b, \"dev\", &veth_ab,\n+ ],\n+ );\n+ println!(\"{:?}\", res);\n+ let res = KI.run_command(\n+ \"ip\",\n+ &[\n+ \"netns\", \"exec\", &link.1 .0, \"ip\", \"route\", \"add\", &subnet_a, \"dev\", &veth_ba,\n+ ],\n+ );\n+ println!(\"{:?}\", res);\n+ }\n+\n+ Ok(())\n+}\n+\n+/// Validate the list of linked namespaces\n+fn validate_connections(namespaces: NamespaceInfo) {\n+ for link in namespaces.linked {\n+ if !namespaces.names.contains(&link.0 .0) || !namespaces.names.contains(&link.1 .0) {\n+ panic!(\n+ \"One or both of these names is not in the given namespace list: {}, {}\",\n+ link.0 .0, link.1 .0\n+ )\n+ }\n+ if link.0 .0.len() + link.1 .0.len() > 8 {\n+ panic!(\n+ \"Namespace names are too long(max 4 chars): {}, {}\",\n+ link.0 .0, link.1 .0,\n+ )\n+ }\n+ if link.0 .0.eq(&link.1 .0) {\n+ panic!(\"Cannot link namespace to itself!\")\n+ }\n+ }\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add namespaces to new integration test container
20,253
29.12.2022 22:09:08
28,800
351931ccc7c3810daa77242a12729dab24b3ac20
Run babel and rita inside namespaces New threads for babel and rita respectively run these for each namespace and set the namespace as the thread's owner.
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -79,7 +79,7 @@ dependencies = [\n\"actix-tls\",\n\"actix-utils\",\n\"ahash\",\n- \"base64\",\n+ \"base64 0.13.1\",\n\"bitflags\",\n\"brotli\",\n\"bytes\",\n@@ -233,7 +233,7 @@ checksum = \"6dda62cf04bc3a9ad2ea8f314f721951cfdb4cdacec4e984d20e77c7bb170991\"\ndependencies = [\n\"actix-utils\",\n\"actix-web\",\n- \"base64\",\n+ \"base64 0.13.1\",\n\"futures-core\",\n\"futures-util\",\n\"log\",\n@@ -318,7 +318,7 @@ version = \"0.1.0\"\ndependencies = [\n\"arrayvec 0.7.2\",\n\"babel_monitor\",\n- \"base64\",\n+ \"base64 0.13.1\",\n\"bincode\",\n\"clarity\",\n\"hex\",\n@@ -423,7 +423,7 @@ dependencies = [\n\"actix-tls\",\n\"actix-utils\",\n\"ahash\",\n- \"base64\",\n+ \"base64 0.13.1\",\n\"bytes\",\n\"cfg-if\",\n\"cookie\",\n@@ -474,6 +474,12 @@ version = \"0.13.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8\"\n+[[package]]\n+name = \"base64\"\n+version = \"0.21.0\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a\"\n+\n[[package]]\nname = \"bincode\"\nversion = \"1.3.3\"\n@@ -520,9 +526,9 @@ dependencies = [\n[[package]]\nname = \"brotli-decompressor\"\n-version = \"2.3.2\"\n+version = \"2.3.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"59ad2d4653bf5ca36ae797b1f4bb4dbddb60ce49ca4aed8a2ce4829f60425b80\"\n+checksum = \"4b6561fd3f895a11e8f72af2cb7d22e08366bebc2b6b57f7744c4bda27034744\"\ndependencies = [\n\"alloc-no-stdlib\",\n\"alloc-stdlib\",\n@@ -530,9 +536,9 @@ dependencies = [\n[[package]]\nname = \"bumpalo\"\n-version = \"3.11.1\"\n+version = \"3.12.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba\"\n+checksum = \"0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535\"\n[[package]]\nname = \"byteorder\"\n@@ -720,7 +726,7 @@ version = \"3.2.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"1631ca6e3c59112501a9d87fd86f21591ff77acd31331e8a73f8d80a65bbdd71\"\ndependencies = [\n- \"nix 0.26.1\",\n+ \"nix 0.26.2\",\n\"windows-sys\",\n]\n@@ -792,9 +798,9 @@ checksum = \"77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f\"\n[[package]]\nname = \"ed25519\"\n-version = \"1.5.2\"\n+version = \"1.5.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369\"\n+checksum = \"91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7\"\ndependencies = [\n\"signature\",\n]\n@@ -811,7 +817,7 @@ version = \"0.1.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"34dd14c63662e0206599796cd5e1ad0268ab2b9d19b868d6050d688eba2bbf98\"\ndependencies = [\n- \"base64\",\n+ \"base64 0.13.1\",\n\"memchr\",\n]\n@@ -1273,9 +1279,9 @@ dependencies = [\n[[package]]\nname = \"io-lifetimes\"\n-version = \"1.0.3\"\n+version = \"1.0.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c\"\n+checksum = \"e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e\"\ndependencies = [\n\"libc\",\n\"windows-sys\",\n@@ -1408,7 +1414,7 @@ version = \"0.10.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"2eabca5e0b4d0e98e7f2243fb5b7520b6af2b65d8f87bcc86f2c75185a6ff243\"\ndependencies = [\n- \"base64\",\n+ \"base64 0.13.1\",\n\"email-encoding\",\n\"email_address\",\n\"fastrand\",\n@@ -1418,7 +1424,7 @@ dependencies = [\n\"idna 0.2.3\",\n\"mime\",\n\"native-tls\",\n- \"nom 7.1.2\",\n+ \"nom 7.1.3\",\n\"once_cell\",\n\"quoted_printable\",\n\"serde\",\n@@ -1561,6 +1567,15 @@ dependencies = [\n\"autocfg\",\n]\n+[[package]]\n+name = \"memoffset\"\n+version = \"0.7.1\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4\"\n+dependencies = [\n+ \"autocfg\",\n+]\n+\n[[package]]\nname = \"mime\"\nversion = \"0.3.16\"\n@@ -1622,18 +1637,20 @@ dependencies = [\n\"cc\",\n\"cfg-if\",\n\"libc\",\n- \"memoffset\",\n+ \"memoffset 0.6.5\",\n]\n[[package]]\nname = \"nix\"\n-version = \"0.26.1\"\n+version = \"0.26.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"46a58d1d356c6597d08cde02c2f09d785b09e28711837b1ed667dc652c08a694\"\n+checksum = \"bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a\"\ndependencies = [\n\"bitflags\",\n\"cfg-if\",\n\"libc\",\n+ \"memoffset 0.7.1\",\n+ \"pin-utils\",\n\"static_assertions\",\n]\n@@ -1650,9 +1667,9 @@ dependencies = [\n[[package]]\nname = \"nom\"\n-version = \"7.1.2\"\n+version = \"7.1.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"e5507769c4919c998e69e49c839d9dc6e693ede4cc4290d6ad8b41d4f09c548c\"\n+checksum = \"d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a\"\ndependencies = [\n\"memchr\",\n\"minimal-lexical\",\n@@ -1686,9 +1703,9 @@ dependencies = [\n[[package]]\nname = \"num-complex\"\n-version = \"0.4.2\"\n+version = \"0.4.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19\"\n+checksum = \"02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d\"\ndependencies = [\n\"num-traits\",\n]\n@@ -1788,7 +1805,7 @@ version = \"0.6.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"37b58a8e78d8aa4cb398da5616fd29ab28b615c46b452aac6cbab45a9e5ac0ac\"\ndependencies = [\n- \"base64\",\n+ \"base64 0.13.1\",\n\"byteorder\",\n\"md-5\",\n\"sha2\",\n@@ -1879,7 +1896,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f\"\ndependencies = [\n\"lock_api\",\n- \"parking_lot_core 0.9.5\",\n+ \"parking_lot_core 0.9.6\",\n]\n[[package]]\n@@ -1898,9 +1915,9 @@ dependencies = [\n[[package]]\nname = \"parking_lot_core\"\n-version = \"0.9.5\"\n+version = \"0.9.6\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba\"\n+checksum = \"ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf\"\ndependencies = [\n\"cfg-if\",\n\"libc\",\n@@ -1923,9 +1940,9 @@ checksum = \"478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e\"\n[[package]]\nname = \"pest\"\n-version = \"2.5.2\"\n+version = \"2.5.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0f6e86fb9e7026527a0d46bc308b841d73170ef8f443e1807f6ef88526a816d4\"\n+checksum = \"4257b4a04d91f7e9e6290be5d3da4804dd5784fafde3a497d73eb2b4a158c30a\"\ndependencies = [\n\"thiserror\",\n\"ucd-trie\",\n@@ -1933,9 +1950,9 @@ dependencies = [\n[[package]]\nname = \"pest_derive\"\n-version = \"2.5.2\"\n+version = \"2.5.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"96504449aa860c8dcde14f9fba5c58dc6658688ca1fe363589d6327b8662c603\"\n+checksum = \"241cda393b0cdd65e62e07e12454f1f25d57017dcc514b1514cd3c4645e3a0a6\"\ndependencies = [\n\"pest\",\n\"pest_generator\",\n@@ -1943,9 +1960,9 @@ dependencies = [\n[[package]]\nname = \"pest_generator\"\n-version = \"2.5.2\"\n+version = \"2.5.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"798e0220d1111ae63d66cb66a5dcb3fc2d986d520b98e49e1852bfdb11d7c5e7\"\n+checksum = \"46b53634d8c8196302953c74d5352f33d0c512a9499bd2ce468fc9f4128fa27c\"\ndependencies = [\n\"pest\",\n\"pest_meta\",\n@@ -1956,13 +1973,13 @@ dependencies = [\n[[package]]\nname = \"pest_meta\"\n-version = \"2.5.2\"\n+version = \"2.5.3\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"984298b75898e30a843e278a9f2452c31e349a073a0ce6fd950a12a74464e065\"\n+checksum = \"0ef4f1332a8d4678b41966bb4cc1d0676880e84183a1ecc3f4b69f03e99c7a51\"\ndependencies = [\n\"once_cell\",\n\"pest\",\n- \"sha1\",\n+ \"sha2\",\n]\n[[package]]\n@@ -2020,9 +2037,9 @@ dependencies = [\n[[package]]\nname = \"proc-macro2\"\n-version = \"1.0.49\"\n+version = \"1.0.50\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5\"\n+checksum = \"6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2\"\ndependencies = [\n\"unicode-ident\",\n]\n@@ -2141,11 +2158,11 @@ dependencies = [\n[[package]]\nname = \"reqwest\"\n-version = \"0.11.13\"\n+version = \"0.11.14\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c\"\n+checksum = \"21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9\"\ndependencies = [\n- \"base64\",\n+ \"base64 0.21.0\",\n\"bytes\",\n\"encoding_rs\",\n\"futures-core\",\n@@ -2330,9 +2347,9 @@ dependencies = [\n[[package]]\nname = \"rustix\"\n-version = \"0.36.6\"\n+version = \"0.36.7\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549\"\n+checksum = \"d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03\"\ndependencies = [\n\"bitflags\",\n\"errno\",\n@@ -2401,9 +2418,9 @@ dependencies = [\n[[package]]\nname = \"security-framework\"\n-version = \"2.7.0\"\n+version = \"2.8.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c\"\n+checksum = \"645926f31b250a2dca3c232496c2d898d91036e45ca0e97e0e2390c54e11be36\"\ndependencies = [\n\"bitflags\",\n\"core-foundation\",\n@@ -2414,9 +2431,9 @@ dependencies = [\n[[package]]\nname = \"security-framework-sys\"\n-version = \"2.6.1\"\n+version = \"2.8.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556\"\n+checksum = \"31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4\"\ndependencies = [\n\"core-foundation-sys\",\n\"libc\",\n@@ -2639,9 +2656,9 @@ dependencies = [\n[[package]]\nname = \"termcolor\"\n-version = \"1.1.3\"\n+version = \"1.2.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755\"\n+checksum = \"be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6\"\ndependencies = [\n\"winapi-util\",\n]\n@@ -2650,7 +2667,16 @@ dependencies = [\nname = \"test_runner\"\nversion = \"0.1.0\"\ndependencies = [\n+ \"actix 0.13.0\",\n\"althea_kernel_interface\",\n+ \"clu\",\n+ \"docopt\",\n+ \"env_logger\",\n+ \"log\",\n+ \"nix 0.26.2\",\n+ \"rita_client\",\n+ \"rita_common\",\n+ \"settings\",\n]\n[[package]]\n@@ -2717,9 +2743,9 @@ checksum = \"cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c\"\n[[package]]\nname = \"tokio\"\n-version = \"1.24.1\"\n+version = \"1.24.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"1d9f76183f91ecfb55e1d7d5602bd1d979e38a3a522fe900241cf195624d67ae\"\n+checksum = \"597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb\"\ndependencies = [\n\"autocfg\",\n\"bytes\",\n@@ -2798,9 +2824,9 @@ dependencies = [\n[[package]]\nname = \"toml\"\n-version = \"0.5.10\"\n+version = \"0.5.11\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f\"\n+checksum = \"f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234\"\ndependencies = [\n\"serde\",\n]\n@@ -2852,9 +2878,9 @@ checksum = \"9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81\"\n[[package]]\nname = \"unicode-bidi\"\n-version = \"0.3.8\"\n+version = \"0.3.10\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992\"\n+checksum = \"d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58\"\n[[package]]\nname = \"unicode-ident\"\n@@ -3079,45 +3105,45 @@ dependencies = [\n[[package]]\nname = \"windows_aarch64_gnullvm\"\n-version = \"0.42.0\"\n+version = \"0.42.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e\"\n+checksum = \"8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608\"\n[[package]]\nname = \"windows_aarch64_msvc\"\n-version = \"0.42.0\"\n+version = \"0.42.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4\"\n+checksum = \"4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7\"\n[[package]]\nname = \"windows_i686_gnu\"\n-version = \"0.42.0\"\n+version = \"0.42.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7\"\n+checksum = \"de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640\"\n[[package]]\nname = \"windows_i686_msvc\"\n-version = \"0.42.0\"\n+version = \"0.42.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246\"\n+checksum = \"bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605\"\n[[package]]\nname = \"windows_x86_64_gnu\"\n-version = \"0.42.0\"\n+version = \"0.42.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed\"\n+checksum = \"c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45\"\n[[package]]\nname = \"windows_x86_64_gnullvm\"\n-version = \"0.42.0\"\n+version = \"0.42.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028\"\n+checksum = \"628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463\"\n[[package]]\nname = \"windows_x86_64_msvc\"\n-version = \"0.42.0\"\n+version = \"0.42.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5\"\n+checksum = \"447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd\"\n[[package]]\nname = \"winreg\"\n@@ -3149,10 +3175,11 @@ dependencies = [\n[[package]]\nname = \"zstd-sys\"\n-version = \"2.0.4+zstd.1.5.2\"\n+version = \"2.0.5+zstd.1.5.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4fa202f2ef00074143e219d15b62ffc317d17cc33909feac471c044087cad7b0\"\n+checksum = \"edc50ffce891ad571e9f9afe5039c4837bede781ac4bb13052ed7ae695518596\"\ndependencies = [\n\"cc\",\n\"libc\",\n+ \"pkg-config\",\n]\n" }, { "change_type": "MODIFY", "old_path": "integration_tests_v2/container/Dockerfile", "new_path": "integration_tests_v2/container/Dockerfile", "diff": "FROM postgres\nENV DEBIAN_FRONTEND=noninteractive\n-RUN apt-get update && apt-get install -y sudo iputils-ping iproute2 jq vim netcat default-libmysqlclient-dev libsqlite3-dev postgresql-client-11 postgresql-server-dev-11 libpq-dev python3-pip bridge-utils wireguard linux-source curl git libssl-dev pkg-config build-essential ipset python3-setuptools python3-wheel dh-autoreconf procps iperf3\n+RUN apt-get update && apt-get install -y sudo iputils-ping iproute2 jq vim netcat default-libmysqlclient-dev libsqlite3-dev postgresql-client-11 postgresql-server-dev-11 libpq-dev python3-pip bridge-utils wireguard linux-source curl git libssl-dev pkg-config build-essential ipset python3-setuptools python3-wheel dh-autoreconf procps iperf3 babeld make\nRUN curl https://sh.rustup.rs -sSf | sh -s -- -y\nRUN PATH=$PATH:$HOME/.cargo/bin cargo install diesel_cli --force\n+RUN rm -rf /var/babeld\n+RUN mkdir /var/babeld && cd /var/babeld && git clone -b master https://github.com/althea-mesh/babeld.git\n+RUN cd /var/babeld/babeld && make install\n# we pull in the git tar instead of the local folder becuase the raw code is much much smaller\n# note that changes have to be checked in to be pulled in and tested! we pull this in near\n# the bottom to maximize caching of earlier containers\nADD rita.tar.gz /\n-CMD PATH=$PATH:$HOME/.cargo/bin cargo run --manifest-path /althea_rs/test_runner/Cargo.toml\n+CMD RUST_LOG=INFO RUST_BACKTRACE=FULL PATH=$PATH:$HOME/.cargo/bin cargo run --manifest-path /althea_rs/test_runner/Cargo.toml\n" }, { "change_type": "MODIFY", "old_path": "scripts/integration-test-v2.sh", "new_path": "scripts/integration-test-v2.sh", "diff": "@@ -14,7 +14,3 @@ rm rita.tar.gz\npopd\n-<<<<<<< HEAD\n-\n-=======\n->>>>>>> 48aecd88 (Add namespaces to new integration test container)\n" }, { "change_type": "MODIFY", "old_path": "settings/Cargo.toml", "new_path": "settings/Cargo.toml", "diff": "@@ -19,3 +19,6 @@ clarity = \"0.5\"\narrayvec = {version= \"0.7\", features = [\"serde\"]}\nphonenumber = \"0.3\"\nipnetwork = \"0.20\"\n+\n+[features]\n+load_from_disk = []\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "test_runner/Cargo.toml", "new_path": "test_runner/Cargo.toml", "diff": "@@ -9,5 +9,15 @@ name = \"tester\"\npath = \"src/main.rs\"\n[dependencies]\n+env_logger = \"0.10\"\n+log = \"0.4\"\n+docopt = \"1.1\"\n+actix-async = {package=\"actix\", version = \"0.13\"}\n+nix = \"0.26.1\"\n+\nalthea_kernel_interface = { path = \"../althea_kernel_interface\" }\n+clu = { path = \"../clu\" }\n+settings = { path = \"../settings\" }\n+rita_client = { path = \"../rita_client\", default-features = false }\n+rita_common = { path = \"../rita_common\", default-features = false }\n" }, { "change_type": "MODIFY", "old_path": "test_runner/src/main.rs", "new_path": "test_runner/src/main.rs", "diff": "+extern crate log;\n+// Uncomment for manual debugging\n// use core::time;\n-//use std::thread;\n+use std::{\n+ collections::{HashMap, HashSet},\n+ convert::TryInto,\n+ fs,\n+ net::{IpAddr, Ipv6Addr},\n+ thread,\n+};\nuse althea_kernel_interface::{KernelInterfaceError, KI};\n+use log::info;\n+use nix::{\n+ fcntl::{open, OFlag},\n+ sched::{setns, CloneFlags},\n+ sys::stat::Mode,\n+};\n+use rita_client::{\n+ dashboard::start_client_dashboard,\n+ rita_loop::{start_antenna_forwarder, start_rita_client_loops},\n+};\n+use rita_common::rita_loop::{\n+ start_core_rita_endpoints, start_rita_common_loops,\n+ write_to_disk::{save_to_disk_loop, SettingsOnDisk},\n+};\n+use settings::client::RitaClientSettings;\n/// This struct holds the setup instructions for namespaces\n#[derive(Clone, Eq, PartialEq)]\n@@ -16,15 +39,19 @@ pub struct NamespaceInfo {\n}\nfn main() {\n- // uncomment this for manual debugging\n+ // uncomment these 2 lines for manual debugging\n// let ten_mins = time::Duration::from_secs(600);\n+ // env_logger::init();\nlet namespaces = five_node_config();\nvalidate_connections(namespaces.clone());\n- let res = setup_ns(namespaces);\n+ let res = setup_ns(namespaces.clone());\nprintln!(\"Namespaces setup: {:?}\", res);\n+\n+ let res = thread_spawner(namespaces);\n+ println!(\"Thread Spawner: {:?}\", res);\n// this sleep is for debugging so that the container can be accessed to poke around in\n// thread::sleep(ten_mins);\n}\n@@ -44,10 +71,10 @@ fn five_node_config() -> NamespaceInfo {\n/ \\|\nD---------C\n*/\n- let testa = (\"nA\".to_string(), 0);\n- let testb = (\"nB\".to_string(), 1);\n- let testc = (\"nC\".to_string(), 2);\n- let testd = (\"nD\".to_string(), 3);\n+ let testa = (\"n-0\".to_string(), 0);\n+ let testb = (\"n-1\".to_string(), 1);\n+ let testc = (\"n-2\".to_string(), 2);\n+ let testd = (\"n-3\".to_string(), 3);\nNamespaceInfo {\nnames: vec![\n@@ -163,9 +190,46 @@ fn setup_ns(spaces: NamespaceInfo) -> Result<(), KernelInterfaceError> {\nOk(())\n}\n+/// Spawn a rita and babel thread for each namespace, then assign those threads to said namespace\n+fn thread_spawner(namespaces: NamespaceInfo) -> Result<(), KernelInterfaceError> {\n+ let babeld_path = \"/var/babeld/babeld/babeld\".to_string();\n+ let babelconf_path = \"/var/babeld/config\".to_string();\n+ let ritasettings = RitaClientSettings::new(\"/althea_rs/settings/test.toml\").unwrap();\n+ let babelconf_data = \"default enable-timestamps true\\ndefault update-interval 1\";\n+ // pass the config arguments for babel to a config file as they cannot be successfully passed as arguments via run_command()\n+ fs::write(babelconf_path.clone(), babelconf_data).unwrap();\n+ for ns in namespaces.names.clone() {\n+ let veth_interfaces = get_veth_interfaces(namespaces.clone());\n+ let veth_interfaces = veth_interfaces.get(&ns).unwrap().clone();\n+ let rcsettings = ritasettings.clone();\n+ let nspath = format!(\"/var/run/netns/{}\", ns);\n+ let nsfd = open(nspath.as_str(), OFlag::O_RDONLY, Mode::empty())\n+ .unwrap_or_else(|_| panic!(\"Could not open netns file: {}\", nspath));\n+\n+ spawn_rita(ns.clone(), veth_interfaces, rcsettings, nsfd);\n+\n+ spawn_babel(ns, babelconf_path.clone(), babeld_path.clone(), nsfd);\n+ }\n+ Ok(())\n+}\n+\n/// Validate the list of linked namespaces\nfn validate_connections(namespaces: NamespaceInfo) {\nfor link in namespaces.linked {\n+ let s = \"Namespace names must follow naming convention: xyz-123 (ex. A-0):\";\n+ let name1: Vec<&str> = link.0 .0.split('-').collect();\n+ let _num1: u32 = name1\n+ .get(1)\n+ .expect(&format!(\"{} {}\", s, link.0 .0))\n+ .parse()\n+ .expect(&format!(\"{} {}\", s, link.0 .0));\n+ let name2: Vec<&str> = link.1 .0.split('-').collect();\n+ let _num2: u32 = name2\n+ .get(1)\n+ .expect(&format!(\"{} {}\", s, link.0 .0))\n+ .parse()\n+ .expect(&format!(\"{} {}\", s, link.0 .0));\n+\nif !namespaces.names.contains(&link.0 .0) || !namespaces.names.contains(&link.1 .0) {\npanic!(\n\"One or both of these names is not in the given namespace list: {}, {}\",\n@@ -183,3 +247,113 @@ fn validate_connections(namespaces: NamespaceInfo) {\n}\n}\n}\n+\n+/// get veth interfaces in a given namespace\n+fn get_veth_interfaces(nsinfo: NamespaceInfo) -> HashMap<String, HashSet<String>> {\n+ let mut res: HashMap<String, HashSet<String>> = HashMap::new();\n+ for name in nsinfo.names {\n+ res.insert(name, HashSet::new());\n+ }\n+ for link in nsinfo.linked {\n+ let veth_ab = format!(\"veth-{}-{}\", link.0 .0, link.1 .0);\n+ let veth_ba = format!(\"veth-{}-{}\", link.1 .0, link.0 .0);\n+ res.entry(link.0 .0).or_default().insert(veth_ab);\n+ res.entry(link.1 .0).or_default().insert(veth_ba);\n+ }\n+ res\n+}\n+\n+/// Spawn a thread for rita given a NamespaceInfo which will be assigned to the namespace given\n+fn spawn_rita(\n+ ns: String,\n+ veth_interfaces: HashSet<String>,\n+ mut rcsettings: RitaClientSettings,\n+ nsfd: i32,\n+) {\n+ let wg_keypath = format!(\"/var/tmp/{}\", ns);\n+ //let settings_file = format!(\"/var/tmp/settings_{}\", ns);\n+ let _rita_handler = thread::spawn(move || {\n+ // set the host of this thread to the ns\n+ setns(nsfd, CloneFlags::CLONE_NEWNET).expect(\"Couldn't set network namespace\");\n+\n+ // NOTE: this is why the names for the namespaces must include a number identifier, as it is used in\n+ // their mesh ip assignment\n+ let nameclone = ns.clone();\n+ let nsname: Vec<&str> = nameclone.split('-').collect();\n+ let id: u32 = nsname.get(1).unwrap().parse().unwrap();\n+\n+ rcsettings.network.mesh_ip = Some(IpAddr::V6(Ipv6Addr::new(\n+ 0xfd00,\n+ 0,\n+ 0,\n+ 0,\n+ 0,\n+ 0,\n+ 0,\n+ id.try_into().unwrap(),\n+ )));\n+ rcsettings.network.wg_private_key_path = wg_keypath;\n+ rcsettings.network.peer_interfaces = veth_interfaces;\n+ rcsettings.payment.local_fee = 10; //arbitrary for now\n+\n+ // mirrored from rita_bin/src/client.rs\n+ let s = clu::init(\"linux\", rcsettings);\n+ // s.write(&settings_file).unwrap();\n+ settings::set_rita_client(s.clone());\n+\n+ let system = actix_async::System::new();\n+\n+ start_rita_common_loops();\n+ start_rita_client_loops();\n+ save_to_disk_loop(SettingsOnDisk::RitaClientSettings(\n+ settings::get_rita_client(),\n+ ));\n+ start_core_rita_endpoints(4);\n+ start_client_dashboard(s.network.rita_dashboard_port);\n+ start_antenna_forwarder(s);\n+ println!(\"Started rita loops\");\n+\n+ if let Err(e) = system.run() {\n+ panic!(\"Starting client failed with {}\", e);\n+ }\n+\n+ info!(\"Started Rita Client!\");\n+ });\n+}\n+\n+/// Spawn a thread for rita given a NamespaceInfo which will be assigned to the namespace given\n+fn spawn_babel(ns: String, babelconf_path: String, babeld_path: String, nsfd: i32) {\n+ let _babel_handler = thread::spawn(move || {\n+ let babeld_pid = format!(\"/var/run/babeld-{}.pid\", ns);\n+ let babeld_log = format!(\"/var/log/babeld-{}.log\", ns);\n+ // 1 here is for log\n+ let res = KI.run_command(\n+ \"ip\",\n+ &[\n+ \"netns\",\n+ \"exec\",\n+ &ns,\n+ &babeld_path,\n+ \"-I\",\n+ &babeld_pid,\n+ \"-d\",\n+ \"1\",\n+ \"-r\",\n+ \"-L\",\n+ &babeld_log,\n+ \"-H\",\n+ \"1\",\n+ \"-G\",\n+ \"6872\",\n+ \"-w\",\n+ \"lo\",\n+ \"-c\",\n+ &babelconf_path,\n+ \"-D\",\n+ ],\n+ );\n+ println!(\"res of babel {:?}\", res);\n+ // set the host of this thread to the ns\n+ setns(nsfd, CloneFlags::CLONE_NEWNET).expect(\"Couldn't set network namespace\");\n+ });\n+}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Run babel and rita inside namespaces New threads for babel and rita respectively run these for each namespace and set the namespace as the thread's owner.
20,253
20.01.2023 10:12:59
28,800
13889e645c0c2b626ad22567f9e4e9149d9dbf26
Settings add load_from_disk feature This feature loads and saves RitaClientSettings from a saved file and is meant only for use in the integration test, where the usual lazy static cannot be used as multiple instances of rita hosted in threads all try to access the same version of settings.
[ { "change_type": "MODIFY", "old_path": "integration_tests_v2/container/Dockerfile", "new_path": "integration_tests_v2/container/Dockerfile", "diff": "@@ -10,4 +10,4 @@ RUN cd /var/babeld/babeld && make install\n# note that changes have to be checked in to be pulled in and tested! we pull this in near\n# the bottom to maximize caching of earlier containers\nADD rita.tar.gz /\n-CMD RUST_LOG=INFO RUST_BACKTRACE=FULL PATH=$PATH:$HOME/.cargo/bin cargo run --manifest-path /althea_rs/test_runner/Cargo.toml\n+CMD RUST_LOG=INFO RUST_BACKTRACE=FULL PATH=$PATH:$HOME/.cargo/bin cargo run --manifest-path /althea_rs/test_runner/Cargo.toml --features \"load_from_disk\"\n" }, { "change_type": "MODIFY", "old_path": "settings/src/lib.rs", "new_path": "settings/src/lib.rs", "diff": "@@ -17,6 +17,7 @@ extern crate serde_derive;\nextern crate log;\nextern crate arrayvec;\n+use althea_kernel_interface::KI;\nuse althea_types::Identity;\nuse network::NetworkSettings;\nuse payment::PaymentSettings;\n@@ -132,6 +133,10 @@ impl RitaSettings {\n/// write the current SETTINGS from memory to file\npub fn write_config() -> Result<(), SettingsError> {\n+ if cfg!(feature = \"load_from_disk\") {\n+ // settings already saved in any set step\n+ return Ok(());\n+ }\nmatch &*SETTINGS.read().unwrap() {\nSome(Settings::Adaptor(adapt)) => adapt.adaptor.write_config(),\nSome(Settings::Client(settings)) => {\n@@ -181,6 +186,16 @@ pub fn merge_config_json(changed_settings: serde_json::Value) -> Result<(), Sett\n/// Does not currently save the identity paramater, as we don't\n/// need to modify that in a generic context.\npub fn set_rita_common(input: RitaSettings) {\n+ if cfg!(feature = \"load_from_disk\") {\n+ let settings_file = get_settings_file_from_ns();\n+ // load settings data from the settings file\n+ let mut ritasettings = RitaClientSettings::new(&settings_file).unwrap();\n+ ritasettings.network = input.network;\n+ ritasettings.payment = input.payment;\n+ // save to file\n+ set_rita_client(ritasettings);\n+ return;\n+ }\nlet settings_ref: &mut Option<Settings> = &mut SETTINGS.write().unwrap();\nmatch settings_ref {\nSome(Settings::Adaptor(adapt)) => {\n@@ -212,6 +227,17 @@ pub fn set_rita_common(input: RitaSettings) {\n/// get the current settings and extract generic RitaSettings from it\npub fn get_rita_common() -> RitaSettings {\n+ if cfg!(feature = \"load_from_disk\") {\n+ let settings_file = get_settings_file_from_ns();\n+ // load settings data from the settings file\n+ let ritasettings = RitaClientSettings::new(&settings_file).unwrap();\n+ let commonsettings = RitaSettings {\n+ payment: ritasettings.payment.clone(),\n+ network: ritasettings.network.clone(),\n+ identity: ritasettings.get_identity(),\n+ };\n+ return commonsettings;\n+ }\nmatch &*SETTINGS.read().unwrap() {\nSome(Settings::Adaptor(adapt)) => {\nlet settings = adapt.adaptor.get_client().unwrap();\n@@ -256,6 +282,12 @@ pub fn get_flag_config() -> String {\n/// set client settings into local or adaptor memory\n/// panics if called on exit settings\npub fn set_rita_client(client_setting: RitaClientSettings) {\n+ if cfg!(feature = \"load_from_disk\") {\n+ let settings_file = get_settings_file_from_ns();\n+ // save new data to the settings file\n+ client_setting.write(&settings_file).unwrap();\n+ return;\n+ }\nlet settings_ref = &mut *SETTINGS.write().unwrap();\nmatch settings_ref {\n// if there's an adaptor already saved, then use it to set there\n@@ -272,6 +304,12 @@ pub fn set_rita_client(client_setting: RitaClientSettings) {\n/// get client settings from local or adaptor memory\n/// panics if called on exit settings\npub fn get_rita_client() -> RitaClientSettings {\n+ if cfg!(feature = \"load_from_disk\") {\n+ let settings_file = get_settings_file_from_ns();\n+ // load settings data from the settings file\n+ let ritasettings = RitaClientSettings::new(&settings_file).unwrap();\n+ return ritasettings;\n+ }\nmatch &*SETTINGS.read().unwrap() {\nSome(Settings::Adaptor(adapt)) => adapt.adaptor.get_client().unwrap(),\nSome(Settings::Client(settings)) => settings.clone(),\n@@ -319,6 +357,18 @@ pub fn json_merge(a: &mut Value, b: &Value) {\n}\n}\n+/// Gets the current namespace that rita is executing in and returns the name of the\n+/// settings file associated with this instance of rita. ONLY FOR INTEGRATION TEST V2\n+fn get_settings_file_from_ns() -> String {\n+ let ns = KI.run_command(\"ip\", &[\"netns\", \"identify\"]).unwrap();\n+ let ns = match String::from_utf8(ns.stdout) {\n+ Ok(s) => s,\n+ Err(_) => panic!(\"Could not get netns name!\"),\n+ };\n+ let settings_file = format!(\"/var/tmp/settings_{}\", ns);\n+ settings_file\n+}\n+\n/// FileWrite does the actual write of settings to disk.\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.\n" }, { "change_type": "MODIFY", "old_path": "test_runner/Cargo.toml", "new_path": "test_runner/Cargo.toml", "diff": "@@ -21,3 +21,6 @@ settings = { path = \"../settings\" }\nrita_client = { path = \"../rita_client\", default-features = false }\nrita_common = { path = \"../rita_common\", default-features = false }\n+[features]\n+load_from_disk = [\"settings/load_from_disk\"]\n+\n" }, { "change_type": "MODIFY", "old_path": "test_runner/src/main.rs", "new_path": "test_runner/src/main.rs", "diff": "@@ -216,19 +216,19 @@ fn thread_spawner(namespaces: NamespaceInfo) -> Result<(), KernelInterfaceError>\n/// Validate the list of linked namespaces\nfn validate_connections(namespaces: NamespaceInfo) {\nfor link in namespaces.linked {\n- let s = \"Namespace names must follow naming convention: xyz-123 (ex. A-0):\";\n+ let s = \"Namespace names must follow naming convention: abc-123 (ex. A-0):\";\nlet name1: Vec<&str> = link.0 .0.split('-').collect();\nlet _num1: u32 = name1\n.get(1)\n- .expect(&format!(\"{} {}\", s, link.0 .0))\n+ .unwrap_or_else(|| panic!(\"{} {}\", s, link.0 .0))\n.parse()\n- .expect(&format!(\"{} {}\", s, link.0 .0));\n+ .unwrap_or_else(|_| panic!(\"{} {}\", s, link.0 .0));\nlet name2: Vec<&str> = link.1 .0.split('-').collect();\nlet _num2: u32 = name2\n.get(1)\n- .expect(&format!(\"{} {}\", s, link.0 .0))\n+ .unwrap_or_else(|| panic!(\"{} {}\", s, link.0 .0))\n.parse()\n- .expect(&format!(\"{} {}\", s, link.0 .0));\n+ .unwrap_or_else(|_| panic!(\"{} {}\", s, link.0 .0));\nif !namespaces.names.contains(&link.0 .0) || !namespaces.names.contains(&link.1 .0) {\npanic!(\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Settings add load_from_disk feature This feature loads and saves RitaClientSettings from a saved file and is meant only for use in the integration test, where the usual lazy static cannot be used as multiple instances of rita hosted in threads all try to access the same version of settings.
20,253
24.01.2023 10:18:52
28,800
9589a2e28b1a525a4ebc4972d92f88ad0f068c71
Update rita-test.toml to be compatible with new integration test
[ { "change_type": "MODIFY", "old_path": "scripts/rita-test.toml", "new_path": "scripts/rita-test.toml", "diff": "@@ -11,9 +11,8 @@ babel_port = 6872\nrita_hello_port = 4876\nrita_contact_port = 4874\nrita_dashboard_port = 4877\n-wg_private_key = \"priv\"\n+rita_tick_interval = 5\nwg_private_key_path = \"/tmp/priv\"\n-wg_public_key = \"pub\"\nwg_start_port = 60000\npeer_interfaces = [\"eth0.2\", \"eth0.3\", \"eth0.4\"]\nmanual_peers = [\"1.1.1.1\", \"2.2.2.2\"]\n@@ -24,6 +23,7 @@ default_route = []\nexit_ip = \"fd96::1337:0e1f\"\nexit_registration_port = 4875\nwg_listen_port = 59999\n+lan_nics = [\"lo\"]\n[exit_client.exits.exit_a]\nip = \"fd00::5\"\nregistration_port = 4875\n" }, { "change_type": "MODIFY", "old_path": "test_runner/src/main.rs", "new_path": "test_runner/src/main.rs", "diff": "@@ -194,7 +194,7 @@ fn setup_ns(spaces: NamespaceInfo) -> Result<(), KernelInterfaceError> {\nfn thread_spawner(namespaces: NamespaceInfo) -> Result<(), KernelInterfaceError> {\nlet babeld_path = \"/var/babeld/babeld/babeld\".to_string();\nlet babelconf_path = \"/var/babeld/config\".to_string();\n- let ritasettings = RitaClientSettings::new(\"/althea_rs/settings/test.toml\").unwrap();\n+ let ritasettings = RitaClientSettings::new(\"/althea_rs/scripts/rita-test.toml\").unwrap();\nlet babelconf_data = \"default enable-timestamps true\\ndefault update-interval 1\";\n// pass the config arguments for babel to a config file as they cannot be successfully passed as arguments via run_command()\nfs::write(babelconf_path.clone(), babelconf_data).unwrap();\n@@ -271,7 +271,6 @@ fn spawn_rita(\nnsfd: i32,\n) {\nlet wg_keypath = format!(\"/var/tmp/{}\", ns);\n- //let settings_file = format!(\"/var/tmp/settings_{}\", ns);\nlet _rita_handler = thread::spawn(move || {\n// set the host of this thread to the ns\nsetns(nsfd, CloneFlags::CLONE_NEWNET).expect(\"Couldn't set network namespace\");\n@@ -298,7 +297,6 @@ fn spawn_rita(\n// mirrored from rita_bin/src/client.rs\nlet s = clu::init(\"linux\", rcsettings);\n- // s.write(&settings_file).unwrap();\nsettings::set_rita_client(s.clone());\nlet system = actix_async::System::new();\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Update rita-test.toml to be compatible with new integration test
20,255
25.01.2023 12:53:00
28,800
e71319ceebe0ad9926f45075763032b617df4c41
Fix exit manager exit change bug When an exit is manually changed, the last exit also changes and doesnt trigger teh linux setup exit tunnel function. Storing this in a lazy static instead of derviving each tick should account for manual changes to exits
[ { "change_type": "MODIFY", "old_path": "rita_client/src/exit_manager/mod.rs", "new_path": "rita_client/src/exit_manager/mod.rs", "diff": "@@ -85,6 +85,16 @@ pub struct ExitManager {\npub selected_exit_list: HashMap<String, SelectedExit>,\n/// Every tick we query an exit endpoint to get a list of exits in that cluster. We use this list for exit switching\npub exit_list: ExitList,\n+ /// Store last exit here, when we see an exit change, we reset wg tunnels\n+ pub last_exit: Option<IpAddr>,\n+}\n+\n+pub fn set_last_exit(e: Option<IpAddr>) {\n+ EXIT_MANAGER.write().unwrap().last_exit = e;\n+}\n+\n+pub fn get_last_exit() -> Option<IpAddr> {\n+ EXIT_MANAGER.read().unwrap().last_exit\n}\n/// This functions sets the exit list ONLY IF the list arguments provived is not empty. This is need for the following edge case:\n@@ -763,7 +773,7 @@ pub async fn exit_manager_tick() {\nNone => \"\".to_string(),\n};\n- let last_exit = get_selected_exit(current_exit.clone());\n+ let last_exit = get_last_exit();\nlet mut exits = rita_client.exit_client.exits;\n// Initialize all exits ip addrs in local lazy static if they havent been set already\n@@ -832,6 +842,7 @@ pub async fn exit_manager_tick() {\n};\ninfo!(\"Exit_Switcher: After selecting best exit this tick, we have selected_id: {:?}, selected_metric: {:?}, tracking_ip: {:?}\", get_selected_exit(current_exit.clone()), get_selected_exit_metric(current_exit.clone()), get_selected_exit_tracking(current_exit.clone()));\n+ set_last_exit(selected_exit);\n// check the exit's time and update locally if it's very different\nmaybe_set_local_to_exit_time(exit.clone(), current_exit.clone()).await;\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix exit manager exit change bug When an exit is manually changed, the last exit also changes and doesnt trigger teh linux setup exit tunnel function. Storing this in a lazy static instead of derviving each tick should account for manual changes to exits
20,255
25.01.2023 14:49:54
28,800
bc5a5049324cf7763164c7ef5fa477e9b443a484
Fix bug in payment validator Calling HISTORY lock twice in a function leads to a deadlock
[ { "change_type": "MODIFY", "old_path": "rita_common/src/payment_validator/mod.rs", "new_path": "rita_common/src/payment_validator/mod.rs", "diff": "@@ -99,8 +99,8 @@ impl Default for PaymentValidator {\n}\n/// This stores payments of all tx that we sent to different nodes.\n-pub fn store_payment(pmt: PaymentTx) {\n- let data = &mut HISTORY.write().unwrap().successful_transactions_sent;\n+pub fn store_payment(pmt: PaymentTx, history: &mut PaymentValidator) {\n+ let data = &mut history.successful_transactions_sent;\nlet neighbor = pmt.to;\nif let std::collections::hash_map::Entry::Vacant(e) = data.entry(neighbor) {\n@@ -436,7 +436,7 @@ fn handle_tx_messaging(\nupdate_payments(pmt.clone());\n// Store this payment as a receipt to send in the future if this receiver doesnt see the payment\n- store_payment(pmt);\n+ store_payment(pmt, history);\n}\n(true, true, _) => {\nerror!(\"Transaction to ourselves!\");\n@@ -538,7 +538,8 @@ mod tests {\namount: 10u8.into(),\ntxid: Some(1u8.into()),\n};\n- store_payment(pmt1.clone());\n+\n+ store_payment(pmt1.clone(), &mut HISTORY.write().unwrap());\nsent_hashset.insert(pmt1.clone());\nassert_eq!(get_payment_txids(pmt1.to), sent_hashset);\n@@ -548,7 +549,8 @@ mod tests {\namount: 100u8.into(),\ntxid: Some(2u8.into()),\n};\n- store_payment(pmt2.clone());\n+ store_payment(pmt2.clone(), &mut HISTORY.write().unwrap());\n+\nsent_hashset.insert(pmt2.clone());\nassert_eq!(get_payment_txids(pmt2.to), sent_hashset);\n@@ -558,7 +560,9 @@ mod tests {\namount: 100u8.into(),\ntxid: Some(2u8.into()),\n};\n- store_payment(pmt3.clone());\n+\n+ store_payment(pmt3.clone(), &mut HISTORY.write().unwrap());\n+\nassert_eq!(get_payment_txids(pmt3.to), sent_hashset);\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Fix bug in payment validator Calling HISTORY lock twice in a function leads to a deadlock
20,255
26.01.2023 12:56:14
28,800
f8aaefd1f0e054b5f3181b22564ee85031009597
Restructure payment validator to use atomic setters/getters for lazy static
[ { "change_type": "MODIFY", "old_path": "rita_common/src/payment_validator/mod.rs", "new_path": "rita_common/src/payment_validator/mod.rs", "diff": "@@ -82,6 +82,43 @@ pub struct PaymentValidator {\nsuccessful_transactions: HashSet<Uint256>,\n}\n+// Setters and getters HISTORY lazy static\n+pub fn add_unvalidated_transaction(tx: ToValidate) {\n+ HISTORY.write().unwrap().unvalidated_transactions.insert(tx);\n+}\n+\n+pub fn remove_unvalidated_transaction(tx: ToValidate) -> bool {\n+ HISTORY\n+ .write()\n+ .unwrap()\n+ .unvalidated_transactions\n+ .remove(&tx)\n+}\n+\n+pub fn get_unvalidated_transactions() -> HashSet<ToValidate> {\n+ HISTORY.read().unwrap().unvalidated_transactions.clone()\n+}\n+\n+pub fn get_successful_tx_sent() -> HashMap<Identity, HashSet<PaymentTx>> {\n+ HISTORY\n+ .write()\n+ .unwrap()\n+ .successful_transactions_sent\n+ .clone()\n+}\n+\n+pub fn set_successful_tx_sent(v: HashMap<Identity, HashSet<PaymentTx>>) {\n+ HISTORY.write().unwrap().successful_transactions_sent = v;\n+}\n+\n+pub fn get_all_successful_tx() -> HashSet<Uint256> {\n+ HISTORY.read().unwrap().successful_transactions.clone()\n+}\n+\n+pub fn add_successful_tx(v: Uint256) {\n+ HISTORY.write().unwrap().successful_transactions.insert(v);\n+}\n+\nimpl PaymentValidator {\npub fn new() -> Self {\nPaymentValidator {\n@@ -99,8 +136,8 @@ impl Default for PaymentValidator {\n}\n/// This stores payments of all tx that we sent to different nodes.\n-pub fn store_payment(pmt: PaymentTx, history: &mut PaymentValidator) {\n- let data = &mut history.successful_transactions_sent;\n+pub fn store_payment(pmt: PaymentTx) {\n+ let mut data = get_successful_tx_sent();\nlet neighbor = pmt.to;\nif let std::collections::hash_map::Entry::Vacant(e) = data.entry(neighbor) {\n@@ -113,6 +150,8 @@ pub fn store_payment(pmt: PaymentTx, history: &mut PaymentValidator) {\n.expect(\"This key should have an initialized set\");\nset.insert(pmt);\n}\n+\n+ set_successful_tx_sent(data);\n}\n/// Given an id, get all payments made to that id\n@@ -131,9 +170,7 @@ pub fn get_payment_txids(id: Identity) -> HashSet<PaymentTx> {\n/// Input: takes in an identity which represents the router we are\n/// going to exclude from the total amount of all unverified payments.\npub fn calculate_unverified_payments(router: Identity) -> Uint256 {\n- let history = HISTORY.read().unwrap();\n- let payments_to_process = history.unvalidated_transactions.clone();\n- drop(history);\n+ let payments_to_process = get_unvalidated_transactions();\nlet mut total_unverified_payment: Uint256 = Uint256::from(0u32);\nfor iterate in payments_to_process.iter() {\nif iterate.payment.from == router && iterate.payment.to != router {\n@@ -150,12 +187,10 @@ pub fn calculate_unverified_payments(router: Identity) -> Uint256 {\n/// This endpoint specifically (and only this one) is fully idempotent so that we can retry\n/// txid transmissions\npub fn validate_later(ts: ToValidate) -> Result<(), RitaCommonError> {\n- let mut history = HISTORY.write().unwrap();\n-\nif let Some(txid) = ts.payment.txid.clone() {\n- if !history.successful_transactions.contains(&txid) {\n+ if !get_all_successful_tx().contains(&txid) {\n// insert is safe to run multiple times just so long as we check successful tx's for duplicates\n- history.unvalidated_transactions.insert(ts);\n+ add_unvalidated_transaction(ts);\n}\n} else {\nerror!(\n@@ -184,14 +219,12 @@ struct Remove {\n/// Removes a transaction from the pending validation queue, it may either\n/// have been discovered to be invalid or have been successfully accepted\n-fn remove(msg: Remove, history: &mut PaymentValidator) {\n- let was_present = history.unvalidated_transactions.remove(&msg.tx);\n+fn remove(msg: Remove) {\n+ let was_present = remove_unvalidated_transaction(msg.tx.clone());\n// store successful transactions so that they can't be played back to us, at least\n// during this session\nif msg.success && was_present {\n- history\n- .successful_transactions\n- .insert(msg.tx.payment.clone().txid.unwrap());\n+ add_successful_tx(msg.tx.payment.clone().txid.unwrap());\n}\nif was_present {\ninfo!(\"Transaction {} was removed\", msg.tx);\n@@ -206,12 +239,12 @@ fn remove(msg: Remove, history: &mut PaymentValidator) {\n/// Marks a transaction as 'checked' in that we have talked to a full node about it\n/// if we fail to talk to a full node about a transaction for the full duration of\n/// the timeout we attempt to restart our node.\n-fn checked(msg: ToValidate, history: &mut PaymentValidator) {\n- if history.unvalidated_transactions.take(&msg).is_some() {\n+fn checked(msg: ToValidate) {\n+ if remove_unvalidated_transaction(msg.clone()) {\nlet mut checked_tx = msg;\nchecked_tx.checked = true;\ninfo!(\"We successfully checked tx {:?}\", checked_tx);\n- history.unvalidated_transactions.insert(checked_tx);\n+ add_unvalidated_transaction(checked_tx);\n} else {\nerror!(\"Tried to mark a tx {:?} we don't have as checked!\", msg);\n@@ -227,17 +260,13 @@ pub async fn validate() {\nlet our_address = settings::get_rita_common().payment.eth_address.unwrap();\nlet mut to_delete = Vec::new();\n- let unvalidated_transactions: HashSet<ToValidate>;\n- {\n- let history = HISTORY.read().unwrap();\n- unvalidated_transactions = history.unvalidated_transactions.clone();\n+ let unvalidated_transactions = get_unvalidated_transactions();\ninfo!(\n\"Attempting to validate {} transactions {}\",\n- history.unvalidated_transactions.len(),\n- print_txids(&history.unvalidated_transactions)\n+ unvalidated_transactions.len(),\n+ print_txids(&unvalidated_transactions)\n);\n- }\nlet mut futs = Vec::new();\nfor item in unvalidated_transactions {\n@@ -285,9 +314,8 @@ pub async fn validate() {\n// execute all of the above verification operations in parallel\njoin_all(futs).await;\n- let mut history = HISTORY.write().unwrap();\nfor item in to_delete.iter() {\n- history.unvalidated_transactions.remove(item);\n+ remove_unvalidated_transaction(item.clone());\n}\n}\n@@ -303,26 +331,25 @@ pub async fn validate_transaction(ts: ToValidate) {\nlet block_num = web3.eth_block_number().await;\nlet transaction = web3.eth_get_transaction_by_hash(txid.clone()).await;\n- let mut history = HISTORY.write().unwrap();\nmatch (transaction, block_num) {\n(Ok(Some(transaction)), Ok(block_num)) => {\nif !ts.checked {\n- checked(ts.clone(), &mut history);\n+ checked(ts.clone());\n}\n- handle_tx_messaging(txid, transaction, ts.clone(), block_num, &mut history);\n+ handle_tx_messaging(txid, transaction, ts.clone(), block_num);\n}\n(Ok(None), _) => {\n// we have a response back from the full node that this tx is not in the mempool this\n// satisfies our checked requirement\nif !ts.checked {\n- checked(ts.clone(), &mut history);\n+ checked(ts.clone());\n}\n}\n(Err(_), Ok(_)) => {\n// we get an error from the full node but a successful block request, clearly we can contact\n// the full node so the transaction check has been attempted\nif !ts.checked {\n- checked(ts.clone(), &mut history);\n+ checked(ts.clone());\n}\n}\n(Ok(Some(_)), Err(_)) => trace!(\"Failed to check transaction {:#066x}\", txid),\n@@ -337,7 +364,6 @@ fn handle_tx_messaging(\ntransaction: TransactionResponse,\nts: ToValidate,\ncurrent_block: Uint256,\n- history: &mut PaymentValidator,\n) {\nlet from_address = ts.payment.from.eth_address;\nlet amount = ts.payment.amount.clone();\n@@ -350,13 +376,10 @@ fn handle_tx_messaging(\nSome(val) => val,\nNone => {\nerror!(\"Invalid TX! No destination!\");\n- remove(\n- Remove {\n+ remove(Remove {\ntx: ts,\nsuccess: false,\n- },\n- history,\n- );\n+ });\nreturn;\n}\n};\n@@ -372,25 +395,19 @@ fn handle_tx_messaging(\nif !value_correct {\nerror!(\"Transaction with invalid amount!\");\n- remove(\n- Remove {\n+ remove(Remove {\ntx: ts,\nsuccess: false,\n- },\n- history,\n- );\n+ });\nreturn;\n}\nif is_old {\nerror!(\"Transaction is more than 6 hours old! {:#066x}\", txid);\n- remove(\n- Remove {\n+ remove(Remove {\ntx: ts,\nsuccess: false,\n- },\n- history,\n- );\n+ });\nreturn;\n}\n@@ -398,13 +415,10 @@ fn handle_tx_messaging(\n// we were successfully paid\n(true, false, true) => {\n// remove this transaction from our storage\n- remove(\n- Remove {\n+ remove(Remove {\ntx: ts,\nsuccess: true,\n- },\n- history,\n- );\n+ });\ninfo!(\n\"payment {:#066x} from {} for {} wei successfully validated!\",\ntxid, from_address, amount\n@@ -422,13 +436,10 @@ fn handle_tx_messaging(\ntxid, from_address, amount\n);\n// remove this transaction from our storage\n- remove(\n- Remove {\n+ remove(Remove {\ntx: ts,\nsuccess: true,\n- },\n- history,\n- );\n+ });\n// update debt keeper with the details of this payment\nlet _ = payment_succeeded(pmt.to, pmt.amount.clone());\n@@ -436,27 +447,21 @@ fn handle_tx_messaging(\nupdate_payments(pmt.clone());\n// Store this payment as a receipt to send in the future if this receiver doesnt see the payment\n- store_payment(pmt, history);\n+ store_payment(pmt);\n}\n(true, true, _) => {\nerror!(\"Transaction to ourselves!\");\n- remove(\n- Remove {\n+ remove(Remove {\ntx: ts,\nsuccess: false,\n- },\n- history,\n- );\n+ });\n}\n(false, false, _) => {\nerror!(\"Transaction has nothing to do with us?\");\n- remove(\n- Remove {\n+ remove(Remove {\ntx: ts,\nsuccess: false,\n- },\n- history,\n- );\n+ });\n}\n(_, _, false) => {\n//transaction waiting for validation, do nothing\n@@ -539,7 +544,7 @@ mod tests {\ntxid: Some(1u8.into()),\n};\n- store_payment(pmt1.clone(), &mut HISTORY.write().unwrap());\n+ store_payment(pmt1.clone());\nsent_hashset.insert(pmt1.clone());\nassert_eq!(get_payment_txids(pmt1.to), sent_hashset);\n@@ -549,7 +554,7 @@ mod tests {\namount: 100u8.into(),\ntxid: Some(2u8.into()),\n};\n- store_payment(pmt2.clone(), &mut HISTORY.write().unwrap());\n+ store_payment(pmt2.clone());\nsent_hashset.insert(pmt2.clone());\nassert_eq!(get_payment_txids(pmt2.to), sent_hashset);\n@@ -561,7 +566,7 @@ mod tests {\ntxid: Some(2u8.into()),\n};\n- store_payment(pmt3.clone(), &mut HISTORY.write().unwrap());\n+ store_payment(pmt3.clone());\nassert_eq!(get_payment_txids(pmt3.to), sent_hashset);\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Restructure payment validator to use atomic setters/getters for lazy static
20,244
28.01.2023 07:19:44
18,000
9f94b080c070b67e848d101fc6e5da5b17ced0de
Bump for Beta 20 RC9
[ { "change_type": "MODIFY", "old_path": "rita_bin/Cargo.toml", "new_path": "rita_bin/Cargo.toml", "diff": "[package]\nname = \"rita_bin\"\n-version = \"0.20.8\"\n+version = \"0.20.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.20.8\"\n+version = \"0.20.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.20.8\"\n+version = \"0.20.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": "@@ -7,7 +7,7 @@ use actix_web_async::HttpResponse;\nuse clarity::Address;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 20 RC8\";\n+pub static READABLE_VERSION: &str = \"Beta 20 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.20.8\"\n+version = \"0.20.9\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 20 RC9
20,255
31.01.2023 09:52:52
28,800
2fd7ec0ff89381abd99d05af829a43ab8b66558e
Remove return on status error for opkg update Output of opkg update always returns an error since opkg cannot download our customfeed url. Returning in this case would not run opkg install and stop the update process. We should continue to try to run opkg even after an error
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -2195,7 +2195,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.20.8\"\n+version = \"0.20.9\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2229,7 +2229,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.20.8\"\n+version = \"0.20.9\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2266,7 +2266,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.20.8\"\n+version = \"0.20.9\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-service\",\n@@ -2305,7 +2305,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.20.8\"\n+version = \"0.20.9\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n" }, { "change_type": "MODIFY", "old_path": "rita_client/src/operator_update/updater.rs", "new_path": "rita_client/src/operator_update/updater.rs", "diff": "@@ -19,11 +19,10 @@ pub fn update_system(instruction: UpdateType) -> Result<(), KernelInterfaceError\nlet res = KI.perform_opkg(cmd);\nmatch res {\nOk(o) => match o.status.code() {\n- Some(0) => info!(\"opkg update completed successfully! {:?}\", o),\n+ Some(0) => info!(\"opkg completed successfully! {:?}\", o),\nSome(_) => {\n- let err = format!(\"opkg update has failed! {:?}\", o);\n+ let err = format!(\"opkg has failed! {:?}\", o);\nerror!(\"{}\", err);\n- return Err(KernelInterfaceError::RuntimeError(err));\n}\nNone => warn!(\"No return code form opkg update? {:?}\", o),\n},\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Remove return on status error for opkg update Output of opkg update always returns an error since opkg cannot download our customfeed url. Returning in this case would not run opkg install and stop the update process. We should continue to try to run opkg even after an error
20,244
31.01.2023 15:24:48
18,000
c93c7b6bd3e973fb2ad1ed674f95c665689a1df4
Bump for Beta 20 RC10
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -69,9 +69,9 @@ dependencies = [\n[[package]]\nname = \"actix-http\"\n-version = \"3.2.2\"\n+version = \"3.3.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0c83abf9903e1f0ad9973cc4f7b9767fd5a03a583f51a5b7a339e07987cd2724\"\n+checksum = \"0070905b2c4a98d184c4e81025253cb192aa8a73827553f38e9410801ceb35bb\"\ndependencies = [\n\"actix-codec\",\n\"actix-rt\",\n@@ -79,7 +79,7 @@ dependencies = [\n\"actix-tls\",\n\"actix-utils\",\n\"ahash\",\n- \"base64 0.13.1\",\n+ \"base64 0.21.0\",\n\"bitflags\",\n\"brotli\",\n\"bytes\",\n@@ -101,6 +101,8 @@ dependencies = [\n\"rand\",\n\"sha1\",\n\"smallvec\",\n+ \"tokio\",\n+ \"tokio-util 0.7.4\",\n\"tracing\",\n\"zstd\",\n]\n@@ -120,9 +122,9 @@ dependencies = [\n[[package]]\nname = \"actix-rt\"\n-version = \"2.7.0\"\n+version = \"2.8.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7ea16c295198e958ef31930a6ef37d0fb64e9ca3b6116e6b93a8bdae96ee1000\"\n+checksum = \"15265b6b8e2347670eb363c47fc8c75208b4a4994b27192f345fcbe707804f3e\"\ndependencies = [\n\"futures-core\",\n\"tokio\",\n@@ -130,9 +132,9 @@ dependencies = [\n[[package]]\nname = \"actix-server\"\n-version = \"2.1.1\"\n+version = \"2.2.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0da34f8e659ea1b077bb4637948b815cd3768ad5a188fdcd74ff4d84240cd824\"\n+checksum = \"3e8613a75dd50cc45f473cee3c34d59ed677c0f7b44480ce3b8247d7dc519327\"\ndependencies = [\n\"actix-rt\",\n\"actix-service\",\n@@ -188,9 +190,9 @@ dependencies = [\n[[package]]\nname = \"actix-web\"\n-version = \"4.2.1\"\n+version = \"4.3.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"d48f7b6534e06c7bfc72ee91db7917d4af6afe23e7d223b51e68fffbb21e96b9\"\n+checksum = \"464e0fddc668ede5f26ec1f9557a8d44eda948732f40c6b0ad79126930eb775f\"\ndependencies = [\n\"actix-codec\",\n\"actix-http\",\n@@ -393,7 +395,7 @@ version = \"0.1.5\"\ndependencies = [\n\"actix 0.13.0\",\n\"clarity\",\n- \"futures 0.3.25\",\n+ \"futures 0.3.26\",\n\"log\",\n\"num\",\n\"num256\",\n@@ -412,9 +414,9 @@ checksum = \"d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa\"\n[[package]]\nname = \"awc\"\n-version = \"3.0.1\"\n+version = \"3.1.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"80ca7ff88063086d2e2c70b9f3b29b2fcd999bac68ac21731e66781970d68519\"\n+checksum = \"0dff3fc64a176e0d4398c71b0f2c2679ff4a723c6ed8fcc68dfe5baa00665388\"\ndependencies = [\n\"actix-codec\",\n\"actix-http\",\n@@ -423,7 +425,7 @@ dependencies = [\n\"actix-tls\",\n\"actix-utils\",\n\"ahash\",\n- \"base64 0.13.1\",\n+ \"base64 0.21.0\",\n\"bytes\",\n\"cfg-if\",\n\"cookie\",\n@@ -548,9 +550,9 @@ checksum = \"14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610\"\n[[package]]\nname = \"bytes\"\n-version = \"1.3.0\"\n+version = \"1.4.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c\"\n+checksum = \"89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be\"\n[[package]]\nname = \"bytestring\"\n@@ -569,9 +571,9 @@ checksum = \"4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b\"\n[[package]]\nname = \"cc\"\n-version = \"1.0.78\"\n+version = \"1.0.79\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d\"\n+checksum = \"50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f\"\ndependencies = [\n\"jobserver\",\n]\n@@ -631,7 +633,7 @@ dependencies = [\n\"awc\",\n\"backoff\",\n\"flate2\",\n- \"futures 0.3.25\",\n+ \"futures 0.3.26\",\n\"lazy_static\",\n\"log\",\n\"serde\",\n@@ -807,17 +809,17 @@ dependencies = [\n[[package]]\nname = \"either\"\n-version = \"1.8.0\"\n+version = \"1.8.1\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797\"\n+checksum = \"7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91\"\n[[package]]\nname = \"email-encoding\"\n-version = \"0.1.3\"\n+version = \"0.2.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"34dd14c63662e0206599796cd5e1ad0268ab2b9d19b868d6050d688eba2bbf98\"\n+checksum = \"dbfb21b9878cf7a348dcb8559109aabc0ec40d69924bd706fa5149846c4fef75\"\ndependencies = [\n- \"base64 0.13.1\",\n+ \"base64 0.21.0\",\n\"memchr\",\n]\n@@ -945,9 +947,9 @@ checksum = \"3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678\"\n[[package]]\nname = \"futures\"\n-version = \"0.3.25\"\n+version = \"0.3.26\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0\"\n+checksum = \"13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84\"\ndependencies = [\n\"futures-channel\",\n\"futures-core\",\n@@ -960,9 +962,9 @@ dependencies = [\n[[package]]\nname = \"futures-channel\"\n-version = \"0.3.25\"\n+version = \"0.3.26\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed\"\n+checksum = \"2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5\"\ndependencies = [\n\"futures-core\",\n\"futures-sink\",\n@@ -970,15 +972,15 @@ dependencies = [\n[[package]]\nname = \"futures-core\"\n-version = \"0.3.25\"\n+version = \"0.3.26\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac\"\n+checksum = \"ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608\"\n[[package]]\nname = \"futures-executor\"\n-version = \"0.3.25\"\n+version = \"0.3.26\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2\"\n+checksum = \"e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e\"\ndependencies = [\n\"futures-core\",\n\"futures-task\",\n@@ -988,15 +990,15 @@ dependencies = [\n[[package]]\nname = \"futures-io\"\n-version = \"0.3.25\"\n+version = \"0.3.26\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb\"\n+checksum = \"bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531\"\n[[package]]\nname = \"futures-macro\"\n-version = \"0.3.25\"\n+version = \"0.3.26\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d\"\n+checksum = \"95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70\"\ndependencies = [\n\"proc-macro2\",\n\"quote\",\n@@ -1005,21 +1007,21 @@ dependencies = [\n[[package]]\nname = \"futures-sink\"\n-version = \"0.3.25\"\n+version = \"0.3.26\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9\"\n+checksum = \"f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364\"\n[[package]]\nname = \"futures-task\"\n-version = \"0.3.25\"\n+version = \"0.3.26\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea\"\n+checksum = \"dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366\"\n[[package]]\nname = \"futures-util\"\n-version = \"0.3.25\"\n+version = \"0.3.26\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6\"\n+checksum = \"9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1\"\ndependencies = [\n\"futures 0.1.31\",\n\"futures-channel\",\n@@ -1237,17 +1239,6 @@ dependencies = [\n\"tokio-native-tls\",\n]\n-[[package]]\n-name = \"idna\"\n-version = \"0.2.3\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8\"\n-dependencies = [\n- \"matches\",\n- \"unicode-bidi\",\n- \"unicode-normalization\",\n-]\n-\n[[package]]\nname = \"idna\"\nversion = \"0.3.0\"\n@@ -1410,18 +1401,18 @@ checksum = \"e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646\"\n[[package]]\nname = \"lettre\"\n-version = \"0.10.1\"\n+version = \"0.10.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"2eabca5e0b4d0e98e7f2243fb5b7520b6af2b65d8f87bcc86f2c75185a6ff243\"\n+checksum = \"dd84a055407850bcf4791baa77cb4818d37cbb79ad4e60b9b659727b920d2c65\"\ndependencies = [\n- \"base64 0.13.1\",\n+ \"base64 0.21.0\",\n\"email-encoding\",\n\"email_address\",\n\"fastrand\",\n\"futures-util\",\n\"hostname\",\n\"httpdate\",\n- \"idna 0.2.3\",\n+ \"idna\",\n\"mime\",\n\"native-tls\",\n\"nom 7.1.3\",\n@@ -1429,6 +1420,7 @@ dependencies = [\n\"quoted_printable\",\n\"serde\",\n\"socket2\",\n+ \"tokio\",\n\"uuid\",\n]\n@@ -1537,12 +1529,6 @@ version = \"0.1.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4\"\n-[[package]]\n-name = \"matches\"\n-version = \"0.1.9\"\n-source = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f\"\n-\n[[package]]\nname = \"md-5\"\nversion = \"0.10.5\"\n@@ -1940,9 +1926,9 @@ checksum = \"478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e\"\n[[package]]\nname = \"pest\"\n-version = \"2.5.3\"\n+version = \"2.5.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"4257b4a04d91f7e9e6290be5d3da4804dd5784fafde3a497d73eb2b4a158c30a\"\n+checksum = \"4ab62d2fa33726dbe6321cc97ef96d8cde531e3eeaf858a058de53a8a6d40d8f\"\ndependencies = [\n\"thiserror\",\n\"ucd-trie\",\n@@ -1950,9 +1936,9 @@ dependencies = [\n[[package]]\nname = \"pest_derive\"\n-version = \"2.5.3\"\n+version = \"2.5.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"241cda393b0cdd65e62e07e12454f1f25d57017dcc514b1514cd3c4645e3a0a6\"\n+checksum = \"8bf026e2d0581559db66d837fe5242320f525d85c76283c61f4d51a1238d65ea\"\ndependencies = [\n\"pest\",\n\"pest_generator\",\n@@ -1960,9 +1946,9 @@ dependencies = [\n[[package]]\nname = \"pest_generator\"\n-version = \"2.5.3\"\n+version = \"2.5.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"46b53634d8c8196302953c74d5352f33d0c512a9499bd2ce468fc9f4128fa27c\"\n+checksum = \"2b27bd18aa01d91c8ed2b61ea23406a676b42d82609c6e2581fba42f0c15f17f\"\ndependencies = [\n\"pest\",\n\"pest_meta\",\n@@ -1973,9 +1959,9 @@ dependencies = [\n[[package]]\nname = \"pest_meta\"\n-version = \"2.5.3\"\n+version = \"2.5.4\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"0ef4f1332a8d4678b41966bb4cc1d0676880e84183a1ecc3f4b69f03e99c7a51\"\n+checksum = \"9f02b677c1859756359fc9983c2e56a0237f18624a3789528804406b7e915e5d\"\ndependencies = [\n\"once_cell\",\n\"pest\",\n@@ -2195,7 +2181,7 @@ dependencies = [\n[[package]]\nname = \"rita_bin\"\n-version = \"0.20.9\"\n+version = \"0.20.10\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2229,7 +2215,7 @@ dependencies = [\n[[package]]\nname = \"rita_client\"\n-version = \"0.20.9\"\n+version = \"0.20.10\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2243,7 +2229,7 @@ dependencies = [\n\"clarity\",\n\"clu\",\n\"compressed_log\",\n- \"futures 0.3.25\",\n+ \"futures 0.3.26\",\n\"hex-literal\",\n\"ipnetwork\",\n\"lazy_static\",\n@@ -2266,7 +2252,7 @@ dependencies = [\n[[package]]\nname = \"rita_common\"\n-version = \"0.20.9\"\n+version = \"0.20.10\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-service\",\n@@ -2286,7 +2272,7 @@ dependencies = [\n\"docopt\",\n\"env_logger\",\n\"flate2\",\n- \"futures 0.3.25\",\n+ \"futures 0.3.26\",\n\"hex-literal\",\n\"ipnetwork\",\n\"lazy_static\",\n@@ -2305,7 +2291,7 @@ dependencies = [\n[[package]]\nname = \"rita_exit\"\n-version = \"0.20.9\"\n+version = \"0.20.10\"\ndependencies = [\n\"actix 0.13.0\",\n\"actix-web\",\n@@ -2418,9 +2404,9 @@ dependencies = [\n[[package]]\nname = \"security-framework\"\n-version = \"2.8.0\"\n+version = \"2.8.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"645926f31b250a2dca3c232496c2d898d91036e45ca0e97e0e2390c54e11be36\"\n+checksum = \"a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254\"\ndependencies = [\n\"bitflags\",\n\"core-foundation\",\n@@ -2743,9 +2729,9 @@ checksum = \"cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c\"\n[[package]]\nname = \"tokio\"\n-version = \"1.24.2\"\n+version = \"1.25.0\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb\"\n+checksum = \"c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af\"\ndependencies = [\n\"autocfg\",\n\"bytes\",\n@@ -2904,7 +2890,7 @@ source = \"registry+https://github.com/rust-lang/crates.io-index\"\nchecksum = \"0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643\"\ndependencies = [\n\"form_urlencoded\",\n- \"idna 0.3.0\",\n+ \"idna\",\n\"percent-encoding\",\n]\n@@ -3040,7 +3026,7 @@ checksum = \"6b5db33bc4a6465d2111c276858700924031c09d0fbf633d693189d88361d7a5\"\ndependencies = [\n\"awc\",\n\"clarity\",\n- \"futures 0.3.25\",\n+ \"futures 0.3.26\",\n\"lazy_static\",\n\"log\",\n\"num\",\n@@ -3156,18 +3142,18 @@ dependencies = [\n[[package]]\nname = \"zstd\"\n-version = \"0.11.2+zstd.1.5.2\"\n+version = \"0.12.3+zstd.1.5.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4\"\n+checksum = \"76eea132fb024e0e13fd9c2f5d5d595d8a967aa72382ac2f9d39fcc95afd0806\"\ndependencies = [\n\"zstd-safe\",\n]\n[[package]]\nname = \"zstd-safe\"\n-version = \"5.0.2+zstd.1.5.2\"\n+version = \"6.0.3+zstd.1.5.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db\"\n+checksum = \"68e4a3f57d13d0ab7e478665c60f35e2a613dcd527851c2c7287ce5c787e134a\"\ndependencies = [\n\"libc\",\n\"zstd-sys\",\n@@ -3175,9 +3161,9 @@ dependencies = [\n[[package]]\nname = \"zstd-sys\"\n-version = \"2.0.5+zstd.1.5.2\"\n+version = \"2.0.6+zstd.1.5.2\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n-checksum = \"edc50ffce891ad571e9f9afe5039c4837bede781ac4bb13052ed7ae695518596\"\n+checksum = \"68a3f9792c0c3dc6c165840a75f47ae1f4da402c2d006881129579f6597e801b\"\ndependencies = [\n\"cc\",\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.20.9\"\n+version = \"0.20.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.20.9\"\n+version = \"0.20.10\"\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.20.9\"\n+version = \"0.20.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": "@@ -7,7 +7,7 @@ use actix_web_async::HttpResponse;\nuse clarity::Address;\nuse num256::{Int256, Uint256};\n-pub static READABLE_VERSION: &str = \"Beta 20 RC9\";\n+pub static READABLE_VERSION: &str = \"Beta 20 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.20.9\"\n+version = \"0.20.10\"\nedition = \"2018\"\nlicense = \"Apache-2.0\"\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Bump for Beta 20 RC10
20,247
02.02.2023 21:26:35
28,800
d59393547955b7c090c679e7d7da1af9c82b7473
fix wire_enabled bug The value was lost in translation when converting from the Op Tools response to the local settings. The merge_settings_safely fn was previously just dropping the new values. It now actually merges them into settings which are then saved to memory later.
[ { "change_type": "MODIFY", "old_path": "rita_client/src/operator_update/mod.rs", "new_path": "rita_client/src/operator_update/mod.rs", "diff": "@@ -245,7 +245,9 @@ pub async fn operator_update() {\noperator.operator_fee = new_operator_fee;\noperator.installation_details = None;\nrita_client.operator = operator;\n- merge_settings_safely(new_settings.merge_json.clone());\n+\n+ // merge the new settings into the local settings\n+ merge_settings_safely(&mut rita_client, new_settings.merge_json.clone());\n// Every tick, update the local router update instructions\nlet update_instructions = match (\n@@ -556,14 +558,14 @@ fn check_billing_update(current: Option<BillingDetails>, incoming: Option<Billin\n/// Merges an arbitrary settings string, after first filtering for several\n/// forbidden values\n-fn merge_settings_safely(new_settings: Value) {\n+fn merge_settings_safely(client_settings: &mut RitaClientSettings, new_settings: Value) {\ntrace!(\"Got new settings from server {:?}\", new_settings);\n// merge in arbitrary setting change string if it's not blank\nif new_settings != \"\" {\nif let Value::Object(map) = new_settings.clone() {\nlet contains_forbidden_key = contains_forbidden_key(map, &FORBIDDEN_MERGE_VALUES);\nif !contains_forbidden_key {\n- match settings::get_rita_client().merge(new_settings.clone()) {\n+ match client_settings.merge(new_settings.clone()) {\nOk(_) => trace!(\"Merged new settings successfully {:?}\", new_settings),\nErr(e) => error!(\n\"Failed to merge OperatorUpdate settings {:?} {:?}\",\n" }, { "change_type": "MODIFY", "old_path": "settings/src/client.rs", "new_path": "settings/src/client.rs", "diff": "@@ -228,6 +228,8 @@ pub struct RitaClientSettings {\n}\nimpl RitaClientSettings {\n+ /// This is a low level fn that mutates the current settings object, but does not save it.\n+ /// prefer the higher level settings::merge_config_json(new_settings), which calls this, to actually merge into memory\npub fn merge(&mut self, changed_settings: serde_json::Value) -> Result<(), SettingsError> {\nlet mut settings_value = serde_json::to_value(self.clone())?;\n" }, { "change_type": "MODIFY", "old_path": "settings/src/localization.rs", "new_path": "settings/src/localization.rs", "diff": "use phonenumber::PhoneNumber;\nfn default_wyre_enabled() -> bool {\n- true\n+ false\n}\nfn default_display_currency_symbol() -> bool {\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
fix wire_enabled bug The value was lost in translation when converting from the Op Tools response to the local settings. The merge_settings_safely fn was previously just dropping the new values. It now actually merges them into settings which are then saved to memory later.
20,244
03.02.2023 17:48:34
18,000
8b4d1193c688723a60e21cba08b831df580fc97a
Filter out pbs-wlan This fitler is required for light client specific interfaces and network configurations. New firmware builds no longer have this interface but old firmware builds still have it around. So we need to keep filtering it until they have totally turned over. Somthing that will take years at least.
[ { "change_type": "MODIFY", "old_path": "rita_client/src/dashboard/interfaces.rs", "new_path": "rita_client/src/dashboard/interfaces.rs", "diff": "@@ -71,12 +71,22 @@ pub fn get_interfaces() -> Result<HashMap<String, InterfaceMode>, RitaClientErro\n// it's a list and we need to handle that\nif value.contains(' ') {\nfor list_member in value.split(' ') {\n+ // legacy filter for phone light clients a removed feature\n+ // this may be removable some day when all router configs have turned over\n+ if list_member.contains(\"pbs-wlan\") {\n+ continue;\n+ }\nretval.insert(\nlist_member.replace(' ', \"\").to_string(),\nethernet2mode(&value, &setting_name)?,\n);\n}\n} else {\n+ // legacy filter for phone light clients a removed feature\n+ // this may be removable some day when all router configs have turned over\n+ if value.contains(\"pbs-wlan\") {\n+ continue;\n+ }\nretval.insert(value.clone(), ethernet2mode(&value, &setting_name)?);\n}\n}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Filter out pbs-wlan This fitler is required for light client specific interfaces and network configurations. New firmware builds no longer have this interface but old firmware builds still have it around. So we need to keep filtering it until they have totally turned over. Somthing that will take years at least.
20,253
03.02.2023 10:20:42
28,800
19e044300025fd7aeef98b21c2a9242998f79d84
Add test routes to the integration test environment test_routes tests setup of babel routes within the network, based on the current hard coded setup of 5-node config.
[ { "change_type": "MODIFY", "old_path": "Cargo.lock", "new_path": "Cargo.lock", "diff": "@@ -893,6 +893,12 @@ dependencies = [\n\"instant\",\n]\n+[[package]]\n+name = \"fixedbitset\"\n+version = \"0.4.2\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80\"\n+\n[[package]]\nname = \"flate2\"\nversion = \"1.0.25\"\n@@ -1968,6 +1974,16 @@ dependencies = [\n\"sha2\",\n]\n+[[package]]\n+name = \"petgraph\"\n+version = \"0.6.2\"\n+source = \"registry+https://github.com/rust-lang/crates.io-index\"\n+checksum = \"e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143\"\n+dependencies = [\n+ \"fixedbitset\",\n+ \"indexmap\",\n+]\n+\n[[package]]\nname = \"phonenumber\"\nversion = \"0.3.1+8.12.9\"\n@@ -2655,11 +2671,14 @@ version = \"0.1.0\"\ndependencies = [\n\"actix 0.13.0\",\n\"althea_kernel_interface\",\n+ \"babel_monitor\",\n\"clu\",\n\"docopt\",\n\"env_logger\",\n+ \"ipnetwork\",\n\"log\",\n\"nix 0.26.2\",\n+ \"petgraph\",\n\"rita_client\",\n\"rita_common\",\n\"settings\",\n" }, { "change_type": "MODIFY", "old_path": "rita_common/src/peer_listener/mod.rs", "new_path": "rita_common/src/peer_listener/mod.rs", "diff": "@@ -256,7 +256,7 @@ impl ListenInterface {\nlet iface_index: u32 = if cfg!(feature = \"integration_test_v2\") {\n// ip netns exec n-1 cat /sys/class/net/veth-n-1-n-2/iflink\nlet ns = KI.get_namespace().unwrap();\n- let location = format!(\"/sys/class/net/{}/ifindex\", ifname);\n+ let location = format!(\"/sys/class/net/{ifname}/ifindex\");\nlet index = KI\n.run_command(\"ip\", &[\"netns\", \"exec\", &ns, \"cat\", &location])\n.unwrap();\n" }, { "change_type": "MODIFY", "old_path": "test_runner/Cargo.toml", "new_path": "test_runner/Cargo.toml", "diff": "@@ -9,12 +9,14 @@ name = \"tester\"\npath = \"src/main.rs\"\n[dependencies]\n+ipnetwork = \"0.20\"\nenv_logger = \"0.10\"\nlog = \"0.4\"\ndocopt = \"1.1\"\nactix-async = {package=\"actix\", version = \"0.13\"}\nnix = \"0.26.1\"\n-\n+petgraph = \"0.6.2\"\n+babel_monitor = { path = \"../babel_monitor\" }\nalthea_kernel_interface = { path = \"../althea_kernel_interface\" }\nclu = { path = \"../clu\" }\nsettings = { path = \"../settings\" }\n" }, { "change_type": "MODIFY", "old_path": "test_runner/src/main.rs", "new_path": "test_runner/src/main.rs", "diff": "extern crate log;\n// Uncomment for manual debugging\n-//use core::time;\n+use core::time;\nuse std::{\ncollections::{HashMap, HashSet},\nconvert::TryInto,\n@@ -26,29 +26,52 @@ use rita_common::rita_loop::{\n};\nuse settings::client::RitaClientSettings;\n-use crate::tests::test_reach_all;\n+use crate::tests::{test_reach_all, test_routes};\npub mod tests;\n+/// This struct holds the format for a namespace info\n+#[derive(Clone, Eq, PartialEq, Hash, Debug)]\n+pub struct Namespace {\n+ /// Name assigned to the namespace\n+ pub name: String,\n+ /// ID number of the namespace\n+ pub id: u32,\n+ /// Local Fee of the rita instance in the namespace, used also to assign\n+ /// edge weight on the network graph\n+ pub cost: u32,\n+}\n+\n/// This struct holds the setup instructions for namespaces\n#[derive(Clone, Eq, PartialEq)]\npub struct NamespaceInfo {\n/// Namespace names and corresponding numbers for ip assignment to avoid having to string\n- /// parse every time we want its number for ips\n- pub names: Vec<(String, u32)>,\n+ /// parse every time we want its number for ips, last number is cost (local fee)\n+ pub names: Vec<Namespace>,\n/// Linked nodes written as tuple pairs\n/// The string is for the namespace name(NOTE: names must be <=4 characters as interfaces\n/// cannot be more than 15 char, and we input as veth-{}-{})\n/// The u32 is for the subnet on the 3rd octet\n- pub linked: Vec<((String, u32), (String, u32))>,\n+ pub linked: Vec<(Namespace, Namespace)>,\n+}\n+\n+/// For each key in destination, the u32 value is the price we expect to see in its route,\n+/// and the namespace value is the next hop we take to reach the key. This struct is meant to\n+/// be used within an outer hashmap which holds the \"from\" namespace.\n+pub struct RouteHop {\n+ pub destination: HashMap<Namespace, (u32, Namespace)>,\n}\nfn main() {\n// uncomment these 2 lines for manual debugging 600\n- //let ten_mins = time::Duration::from_secs(300);\n+ //let five_mins = time::Duration::from_secs(300);\n//env_logger::init();\n- let namespaces = five_node_config();\n+ let one_min = time::Duration::from_secs(60);\n+\n+ let node_config = five_node_config();\n+ let namespaces = node_config.0;\n+ let expected_routes = node_config.1;\nvalidate_connections(namespaces.clone());\n@@ -58,14 +81,21 @@ fn main() {\nlet res = thread_spawner(namespaces.clone());\nprintln!(\"Thread Spawner: {:?}\", res);\n+ // allow setup to finish before running tests\n+ thread::sleep(one_min);\n+\n// this sleep is for debugging so that the container can be accessed to poke around in\n- //thread::sleep(ten_mins);\n+ //thread::sleep(five_mins);\n- let res = test_reach_all(namespaces).expect(\"Could not reach all namespaces!\");\n+ let res = test_reach_all(namespaces.clone()).expect(\"Could not reach all namespaces!\");\nprintln!(\"Reachability Test: {:?}\", res);\n+\n+ let res = test_routes(namespaces, expected_routes);\n+ // this just returns a number at the moment, which must be 12 until more test instances are added\n+ println!(\"Routes Test: {:?}\", res);\n}\n-fn five_node_config() -> NamespaceInfo {\n+fn five_node_config() -> (NamespaceInfo, HashMap<Namespace, RouteHop>) {\n/*\nThese are connected as such:\nA---------B\n@@ -80,22 +110,89 @@ fn five_node_config() -> NamespaceInfo {\n/ \\|\nD---------C\n*/\n- let testa = (\"n-1\".to_string(), 1);\n- let testb = (\"n-2\".to_string(), 2);\n- let testc = (\"n-3\".to_string(), 3);\n- let testd = (\"n-4\".to_string(), 4);\n+ let testa = Namespace {\n+ name: \"n-1\".to_string(),\n+ id: 1,\n+ cost: 25,\n+ };\n+ let testb = Namespace {\n+ name: \"n-2\".to_string(),\n+ id: 2,\n+ cost: 40,\n+ };\n+ let testc = Namespace {\n+ name: \"n-3\".to_string(),\n+ id: 3,\n+ cost: 10,\n+ };\n+ let testd = Namespace {\n+ name: \"n-4\".to_string(),\n+ id: 4,\n+ cost: 60,\n+ };\n- NamespaceInfo {\n+ let nsinfo = NamespaceInfo {\nnames: vec![testa.clone(), testb.clone(), testc.clone(), testd.clone()],\nlinked: vec![\n// arbitrary connections\n(testa.clone(), testb.clone()),\n(testb.clone(), testc.clone()),\n- (testa, testc.clone()),\n- (testc, testd.clone()),\n- (testb, testd),\n+ (testa.clone(), testc.clone()),\n+ (testc.clone(), testd.clone()),\n+ (testb.clone(), testd.clone()),\n],\n- }\n+ };\n+ // This is a Hashmap that contains the key namespace, and how it connects to each node in the network as its values.\n+ // For each namespace in the outer hashmap(A), we have an inner hashmap holding the other namespace nodes(B), how\n+ // much the expected price from A -> B is, and what the next hop would be from A -> B.\n+ let mut expected_routes = HashMap::new();\n+ let testa_routes = RouteHop {\n+ destination: [\n+ (testb.clone(), (0, testb.clone())),\n+ (testc.clone(), (0, testc.clone())),\n+ (testd.clone(), (10, testc.clone())),\n+ ]\n+ .iter()\n+ .cloned()\n+ .collect(),\n+ };\n+ let testb_routes = RouteHop {\n+ destination: [\n+ (testa.clone(), (0, testa.clone())),\n+ (testc.clone(), (0, testc.clone())),\n+ (testd.clone(), (0, testd.clone())),\n+ ]\n+ .iter()\n+ .cloned()\n+ .collect(),\n+ };\n+ let testc_routes = RouteHop {\n+ destination: [\n+ (testa.clone(), (0, testa.clone())),\n+ (testb.clone(), (0, testb.clone())),\n+ (testd.clone(), (0, testd.clone())),\n+ ]\n+ .iter()\n+ .cloned()\n+ .collect(),\n+ };\n+ let testd_routes = RouteHop {\n+ destination: [\n+ (testa.clone(), (10, testc.clone())),\n+ (testb.clone(), (0, testb.clone())),\n+ (testc.clone(), (0, testc.clone())),\n+ ]\n+ .iter()\n+ .cloned()\n+ .collect(),\n+ };\n+\n+ expected_routes.insert(testa, testa_routes);\n+ expected_routes.insert(testb, testb_routes);\n+ expected_routes.insert(testc, testc_routes);\n+ expected_routes.insert(testd, testd_routes);\n+\n+ (nsinfo, expected_routes)\n}\nfn setup_ns(spaces: NamespaceInfo) -> Result<(), KernelInterfaceError> {\n@@ -104,25 +201,25 @@ fn setup_ns(spaces: NamespaceInfo) -> Result<(), KernelInterfaceError> {\n// clear namespaces\nKI.run_command(\"ip\", &[\"-all\", \"netns\", \"delete\", \"||\", \"true\"])?;\n// add namespaces\n- for name in spaces.names {\n- let res = KI.run_command(\"ip\", &[\"netns\", \"add\", &name.0]);\n+ for ns in spaces.names {\n+ let res = KI.run_command(\"ip\", &[\"netns\", \"add\", &ns.name]);\nprintln!(\"{:?}\", res);\n// ip netns exec nB ip link set dev lo up\nlet res = KI.run_command(\n\"ip\",\n&[\n- \"netns\", \"exec\", &name.0, \"ip\", \"link\", \"set\", \"dev\", \"lo\", \"up\",\n+ \"netns\", \"exec\", &ns.name, \"ip\", \"link\", \"set\", \"dev\", \"lo\", \"up\",\n],\n);\nprintln!(\"{res:?}\");\n}\nfor link in spaces.linked {\n- let veth_ab = format!(\"veth-{}-{}\", link.0 .0, link.1 .0);\n- let veth_ba = format!(\"veth-{}-{}\", link.1 .0, link.0 .0);\n- let ip_ab = format!(\"192.168.{}.{}/24\", link.0 .1, counter);\n- let ip_ba = format!(\"192.168.{}.{}/24\", link.1 .1, counter);\n- let subnet_a = format!(\"192.168.{}.0/24\", link.0 .1);\n- let subnet_b = format!(\"192.168.{}.0/24\", link.1 .1);\n+ let veth_ab = format!(\"veth-{}-{}\", link.0.name, link.1.name);\n+ let veth_ba = format!(\"veth-{}-{}\", link.1.name, link.0.name);\n+ let ip_ab = format!(\"192.168.{}.{}/24\", link.0.id, counter);\n+ let ip_ba = format!(\"192.168.{}.{}/24\", link.1.id, counter);\n+ let subnet_a = format!(\"192.168.{}.0/24\", link.0.id);\n+ let subnet_b = format!(\"192.168.{}.0/24\", link.1.id);\ncounter += 1;\n// create veth to link them\n@@ -134,16 +231,24 @@ fn setup_ns(spaces: NamespaceInfo) -> Result<(), KernelInterfaceError> {\n);\nprintln!(\"{res:?}\");\n// assign each side of the veth to one of the nodes namespaces\n- let res = KI.run_command(\"ip\", &[\"link\", \"set\", &veth_ab, \"netns\", &link.0 .0]);\n- println!(\"{res:?}\");\n- let res = KI.run_command(\"ip\", &[\"link\", \"set\", &veth_ba, \"netns\", &link.1 .0]);\n- println!(\"{res:?}\");\n+ let res = KI.run_command(\"ip\", &[\"link\", \"set\", &veth_ab, \"netns\", &link.0.name]);\n+ println!(\"{:?}\", res);\n+ let res = KI.run_command(\"ip\", &[\"link\", \"set\", &veth_ba, \"netns\", &link.1.name]);\n+ println!(\"{:?}\", res);\n// add ip addresses on each side\nlet res = KI.run_command(\n\"ip\",\n&[\n- \"netns\", \"exec\", &link.0 .0, \"ip\", \"addr\", \"add\", &ip_ab, \"dev\", &veth_ab,\n+ \"netns\",\n+ \"exec\",\n+ &link.0.name,\n+ \"ip\",\n+ \"addr\",\n+ \"add\",\n+ &ip_ab,\n+ \"dev\",\n+ &veth_ab,\n],\n);\nprintln!(\"{res:?}\");\n@@ -151,7 +256,15 @@ fn setup_ns(spaces: NamespaceInfo) -> Result<(), KernelInterfaceError> {\nlet res = KI.run_command(\n\"ip\",\n&[\n- \"netns\", \"exec\", &link.1 .0, \"ip\", \"addr\", \"add\", &ip_ba, \"dev\", &veth_ba,\n+ \"netns\",\n+ \"exec\",\n+ &link.1.name,\n+ \"ip\",\n+ \"addr\",\n+ \"add\",\n+ &ip_ba,\n+ \"dev\",\n+ &veth_ba,\n],\n);\nprintln!(\"{res:?}\");\n@@ -160,7 +273,15 @@ fn setup_ns(spaces: NamespaceInfo) -> Result<(), KernelInterfaceError> {\nlet res = KI.run_command(\n\"ip\",\n&[\n- \"netns\", \"exec\", &link.0 .0, \"ip\", \"link\", \"set\", \"dev\", &veth_ab, \"up\",\n+ \"netns\",\n+ \"exec\",\n+ &link.0.name,\n+ \"ip\",\n+ \"link\",\n+ \"set\",\n+ \"dev\",\n+ &veth_ab,\n+ \"up\",\n],\n);\nprintln!(\"{res:?}\");\n@@ -168,7 +289,15 @@ fn setup_ns(spaces: NamespaceInfo) -> Result<(), KernelInterfaceError> {\nlet res = KI.run_command(\n\"ip\",\n&[\n- \"netns\", \"exec\", &link.1 .0, \"ip\", \"link\", \"set\", \"dev\", &veth_ba, \"up\",\n+ \"netns\",\n+ \"exec\",\n+ &link.1.name,\n+ \"ip\",\n+ \"link\",\n+ \"set\",\n+ \"dev\",\n+ &veth_ba,\n+ \"up\",\n],\n);\nprintln!(\"{res:?}\");\n@@ -178,14 +307,30 @@ fn setup_ns(spaces: NamespaceInfo) -> Result<(), KernelInterfaceError> {\nlet res = KI.run_command(\n\"ip\",\n&[\n- \"netns\", \"exec\", &link.0 .0, \"ip\", \"route\", \"add\", &subnet_b, \"dev\", &veth_ab,\n+ \"netns\",\n+ \"exec\",\n+ &link.0.name,\n+ \"ip\",\n+ \"route\",\n+ \"add\",\n+ &subnet_b,\n+ \"dev\",\n+ &veth_ab,\n],\n);\nprintln!(\"{res:?}\");\nlet res = KI.run_command(\n\"ip\",\n&[\n- \"netns\", \"exec\", &link.1 .0, \"ip\", \"route\", \"add\", &subnet_a, \"dev\", &veth_ba,\n+ \"netns\",\n+ \"exec\",\n+ &link.1.name,\n+ \"ip\",\n+ \"route\",\n+ \"add\",\n+ &subnet_a,\n+ \"dev\",\n+ &veth_ba,\n],\n);\nprintln!(\"{res:?}\");\n@@ -204,15 +349,22 @@ fn thread_spawner(namespaces: NamespaceInfo) -> Result<(), KernelInterfaceError>\nfs::write(babelconf_path.clone(), babelconf_data).unwrap();\nfor ns in namespaces.names.clone() {\nlet veth_interfaces = get_veth_interfaces(namespaces.clone());\n- let veth_interfaces = veth_interfaces.get(&ns.0).unwrap().clone();\n+ let veth_interfaces = veth_interfaces.get(&ns.name).unwrap().clone();\nlet rcsettings = ritasettings.clone();\n- let nspath = format!(\"/var/run/netns/{}\", ns.0);\n+ let nspath = format!(\"/var/run/netns/{}\", ns.name);\nlet nsfd = open(nspath.as_str(), OFlag::O_RDONLY, Mode::empty())\n.unwrap_or_else(|_| panic!(\"Could not open netns file: {}\", nspath));\n+ let local_fee = ns.cost;\n+\n+ spawn_rita(\n+ ns.clone().name,\n+ veth_interfaces,\n+ rcsettings,\n+ nsfd,\n+ local_fee,\n+ );\n- spawn_rita(ns.clone().0, veth_interfaces, rcsettings, nsfd);\n-\n- spawn_babel(ns.0, babelconf_path.clone(), babeld_path.clone(), nsfd);\n+ spawn_babel(ns.name, babelconf_path.clone(), babeld_path.clone(), nsfd);\n}\nOk(())\n}\n@@ -223,16 +375,16 @@ fn validate_connections(namespaces: NamespaceInfo) {\nif !namespaces.names.contains(&link.0) || !namespaces.names.contains(&link.1) {\npanic!(\n\"One or both of these names is not in the given namespace list: {}, {}\",\n- link.0 .0, link.1 .0\n+ link.0.name, link.1.name\n)\n}\n- if link.0 .0.len() + link.1 .0.len() > 8 {\n+ if link.0.name.len() + link.1.name.len() > 8 {\npanic!(\n\"Namespace names are too long(max 4 chars): {}, {}\",\n- link.0 .0, link.1 .0,\n+ link.0.name, link.1.name,\n)\n}\n- if link.0 .0.eq(&link.1 .0) {\n+ if link.0.name.eq(&link.1.name) {\npanic!(\"Cannot link namespace to itself!\")\n}\n}\n@@ -242,13 +394,13 @@ fn validate_connections(namespaces: NamespaceInfo) {\nfn get_veth_interfaces(nsinfo: NamespaceInfo) -> HashMap<String, HashSet<String>> {\nlet mut res: HashMap<String, HashSet<String>> = HashMap::new();\nfor name in nsinfo.names {\n- res.insert(name.0, HashSet::new());\n+ res.insert(name.name, HashSet::new());\n}\nfor link in nsinfo.linked {\n- let veth_ab = format!(\"veth-{}-{}\", link.0 .0, link.1 .0);\n- let veth_ba = format!(\"veth-{}-{}\", link.1 .0, link.0 .0);\n- res.entry(link.0 .0).or_default().insert(veth_ab);\n- res.entry(link.1 .0).or_default().insert(veth_ba);\n+ let veth_ab = format!(\"veth-{}-{}\", link.0.name, link.1.name);\n+ let veth_ba = format!(\"veth-{}-{}\", link.1.name, link.0.name);\n+ res.entry(link.0.name).or_default().insert(veth_ab);\n+ res.entry(link.1.name).or_default().insert(veth_ba);\n}\nres\n}\n@@ -259,6 +411,7 @@ fn spawn_rita(\nveth_interfaces: HashSet<String>,\nmut rcsettings: RitaClientSettings,\nnsfd: i32,\n+ local_fee: u32,\n) {\nlet wg_keypath = format!(\"/var/tmp/{ns}\");\nlet _rita_handler = thread::spawn(move || {\n@@ -283,7 +436,7 @@ fn spawn_rita(\n)));\nrcsettings.network.wg_private_key_path = wg_keypath;\nrcsettings.network.peer_interfaces = veth_interfaces;\n- rcsettings.payment.local_fee = 10; //arbitrary for now\n+ rcsettings.payment.local_fee = local_fee;\n// mirrored from rita_bin/src/client.rs\nlet s = clu::init(\"linux\", rcsettings);\n" }, { "change_type": "MODIFY", "old_path": "test_runner/src/tests.rs", "new_path": "test_runner/src/tests.rs", "diff": "-use std::str::from_utf8;\n+use std::{\n+ collections::HashMap,\n+ convert::TryInto,\n+ net::{IpAddr, Ipv6Addr},\n+ str::from_utf8,\n+ thread,\n+ time::Duration,\n+};\nuse althea_kernel_interface::{KernelInterfaceError, KI};\n+use babel_monitor::{open_babel_stream, parse_routes};\n+use ipnetwork::IpNetwork;\n+use log::info;\n+use nix::{\n+ fcntl::{open, OFlag},\n+ sched::{setns, CloneFlags},\n+ sys::stat::Mode,\n+};\n-use crate::NamespaceInfo;\n+use crate::{Namespace, NamespaceInfo, RouteHop};\n+/// test pingability between namespaces on babel routes\npub fn test_reach_all(nsinfo: NamespaceInfo) -> Result<u16, KernelInterfaceError> {\nlet mut count: u16 = 0;\nfor i in nsinfo.clone().names {\n@@ -16,14 +32,95 @@ pub fn test_reach_all(nsinfo: NamespaceInfo) -> Result<u16, KernelInterfaceError\nOk(count)\n}\n-fn test_reach(from: (String, u32), to: (String, u32)) -> bool {\n+fn test_reach(from: Namespace, to: Namespace) -> bool {\n// ip netns exec n-1 ping6 fd00::2\n- let ip = format!(\"fd00::{}\", to.1);\n- let errormsg = format!(\"Could not run ping6 from {} to {}\", from.0, to.0);\n+ let ip = format!(\"fd00::{}\", to.id);\n+ let errormsg = format!(\"Could not run ping6 from {} to {}\", from.name, to.name);\nlet output = KI\n- .run_command(\"ip\", &[\"netns\", \"exec\", &from.0, \"ping6\", &ip, \"-c\", \"1\"])\n+ .run_command(\n+ \"ip\",\n+ &[\"netns\", \"exec\", &from.name, \"ping6\", &ip, \"-c\", \"1\"],\n+ )\n.expect(&errormsg);\nlet output = from_utf8(&output.stdout).expect(\"could not get output for ping6!\");\nprintln!(\"ping output: {:?} end\", output);\noutput.contains(\"1 packets transmitted, 1 received, 0% packet loss\")\n}\n+\n+/// check the presence of all optimal routes\n+pub fn test_routes(nsinfo: NamespaceInfo, expected: HashMap<Namespace, RouteHop>) -> u32 {\n+ // add ALL routes for each namespace into a map to search through for the next portion\n+ let mut routesmap = HashMap::new();\n+ for ns in nsinfo.clone().names {\n+ let rita_handler = thread::spawn(move || {\n+ let nspath = format!(\"/var/run/netns/{}\", ns.name);\n+ let nsfd = open(nspath.as_str(), OFlag::O_RDONLY, Mode::empty())\n+ .unwrap_or_else(|_| panic!(\"Could not open netns file: {}\", nspath));\n+ setns(nsfd, CloneFlags::CLONE_NEWNET).expect(\"Couldn't set network namespace\");\n+ let babel_port = settings::get_rita_common().network.babel_port;\n+\n+ if let Ok(mut stream) = open_babel_stream(babel_port, Duration::from_secs(4)) {\n+ if let Ok(babel_routes) = parse_routes(&mut stream) {\n+ routesmap.insert(ns.name, babel_routes);\n+ routesmap\n+ } else {\n+ routesmap\n+ }\n+ } else {\n+ routesmap\n+ }\n+ });\n+ routesmap = rita_handler.join().unwrap();\n+ }\n+ let mut count = 0;\n+ for ns1 in nsinfo.clone().names {\n+ for ns2 in &nsinfo.names {\n+ if &ns1 == ns2 {\n+ continue;\n+ }\n+ info!(\"finding route for {:?}, {:?}\", ns1.name, ns2.name);\n+\n+ let routes = routesmap.get(&ns1.name).unwrap();\n+ //within routes there must be a route that matches the expected price between the dest (fd00::id) and the expected next hop (fe80::id)\n+\n+ let expected_data = expected.get(&ns1).unwrap().destination.get(ns2).unwrap();\n+ let expected_cost = expected_data.clone().0;\n+ let expected_hop = expected_data.clone().1;\n+ let neigh_ip = IpAddr::V6(Ipv6Addr::new(\n+ 0xfe80,\n+ 0,\n+ 0,\n+ 0,\n+ 0,\n+ 0,\n+ 0,\n+ expected_hop.id.try_into().unwrap(),\n+ ));\n+ let dest_ip = IpAddr::V6(Ipv6Addr::new(\n+ 0xfd00,\n+ 0,\n+ 0,\n+ 0,\n+ 0,\n+ 0,\n+ 0,\n+ ns2.id.try_into().unwrap(),\n+ ));\n+ for r in routes {\n+ if let IpNetwork::V6(ref ip) = r.prefix {\n+ if ip.ip() == dest_ip\n+ && r.price == expected_cost\n+ && r.fee == ns1.cost\n+ && r.neigh_ip == neigh_ip\n+ && r.installed\n+ {\n+ info!(\"We found route for {:?}, {:?}: {:?}\", ns1.name, ns2.name, r);\n+ count += 1;\n+ }\n+ }\n+ }\n+ }\n+ }\n+\n+ count\n+}\n" } ]
Rust
Apache License 2.0
althea-net/althea_rs
Add test routes to the integration test environment test_routes tests setup of babel routes within the network, based on the current hard coded setup of 5-node config.
244,071
23.01.2017 11:58:37
0
a14c4f3d5a99dfea6b2dd216087b1075a2b2e90c
Added support for SBT based builds
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -178,6 +178,47 @@ android {\nCurrently, the generated `classpath.txt` does not contain android platform library, e.g., `/opt/android-sdk-linux/platforms/android-23/android.jar`. You would need to add it manually. See issue #23.\n+### SBT (Lightbend Activator)\n+\n+Add this to your `build.sbt` file to generate `classpath.txt` every time you execute the `compile` or `run` tasks. This has been tested with Lightbend Activator/sbt 0.13.11.\n+\n+```scala\n+val genClasspath = taskKey[String](\"Generate classpath.txt for use with VS Code.\")\n+\n+genClasspath := {\n+ val log = streams.value.log\n+ val cp: Seq[File] = (dependencyClasspath in Compile).value.files\n+\n+ val file = baseDirectory.value / \"classpath.txt\"\n+ log.info(\"Writing classpath details to: \" + file.getAbsolutePath)\n+ IO.write(file, cp.map(_.getAbsolutePath).mkString(java.io.File.pathSeparator))\n+ file.getAbsolutePath\n+}\n+\n+// Generate classpath.txt every time you compile or run the project\n+compile in Compile <<= (compile in Compile).dependsOn(genClasspath)\n+run in Compile <<= (run in Compile).dependsOn(genClasspath)\n+\n+```\n+\n+#### javaconfig.json\n+\n+Add this file and configure `sourcePath` and `outputDirectory` as needed:\n+```json\n+{\n+ \"sourcePath\": [\"app\"],\n+ \"classPathFile\": \"classpath.txt\",\n+ \"outputDirectory\": \"target\"\n+}\n+```\n+\n+#### .gitignore\n+\n+Ignore `classpath.txt`, since it will be different on every host\n+\n+ classpath.txt\n+ ...\n+\n## Directory structure\n### Java service process\n" } ]
Java
MIT License
georgewfraser/java-language-server
Added support for SBT based builds
244,057
07.09.2018 21:44:20
14,400
9ef02db431615fdd1462a8c48cfdcea22f5b1f72
Check for drive-letter prefixed paths
[ { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/ChildFirstClassLoader.java", "new_path": "src/main/java/org/javacs/ChildFirstClassLoader.java", "diff": "@@ -8,6 +8,8 @@ import java.nio.file.Paths;\nimport java.util.Arrays;\nimport java.util.logging.Logger;\n+import org.javacs.Urls;\n+\nclass ChildFirstClassLoader extends URLClassLoader {\nprivate final String[] packages;\nprivate static final Logger LOG = Logger.getLogger(\"main\");\n@@ -22,19 +24,10 @@ class ChildFirstClassLoader extends URLClassLoader {\nstatic URL[] parseClassPath(String classPath) {\nreturn Arrays.stream(classPath.split(File.pathSeparator))\n- .map(ChildFirstClassLoader::parse)\n+ .map(Urls::of)\n.toArray(URL[]::new);\n}\n- private static URL parse(String urlString) {\n- try {\n- if (urlString.startsWith(\"/\")) return Paths.get(urlString).toUri().toURL();\n- else return new URL(urlString);\n- } catch (MalformedURLException e) {\n- throw new RuntimeException(e);\n- }\n- }\n-\nstatic ChildFirstClassLoader fromClassPath(\nString classPath, String[] packages, ClassLoader parent) {\nreturn new ChildFirstClassLoader(parseClassPath(classPath), packages, parent);\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/main/java/org/javacs/Urls.java", "diff": "+package org.javacs;\n+\n+import java.net.MalformedURLException;\n+import java.net.URL;\n+import java.nio.file.Paths;\n+\n+public final class Urls {\n+\n+ public static URL of(String path) {\n+ try {\n+ if (isSystemPath(path))\n+ return Paths.get(path).toUri().toURL();\n+ else\n+ return new URL(path);\n+ } catch (MalformedURLException e) {\n+ throw new RuntimeException(e);\n+ }\n+ }\n+\n+ static boolean isSystemPath(String path) {\n+ return path.startsWith(\"/\") || path.matches(\"^[a-zA-Z]:/.*\");\n+ }\n+}\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/test/java/org/javacs/UrlsTest.java", "diff": "+package org.javacs;\n+\n+import static org.junit.Assert.assertEquals;\n+import static org.junit.Assert.assertTrue;\n+import static org.junit.Assert.assertFalse;\n+\n+import java.net.URL;\n+import org.junit.Test;\n+\n+public class UrlsTest {\n+\n+ @Test\n+ public void of_whenPathStartsWithSlash() throws Exception {\n+ URL actual = Urls.of(\"/a/b/c\");\n+ assertEquals(\"file\", actual.getProtocol());\n+ assertEquals(\"/a/b/c\", actual.getPath());\n+ }\n+\n+ @Test\n+ public void of_whenPathStartsWithProtocol() throws Exception {\n+ URL actual = Urls.of(\"file:///a/b/c\");\n+ assertEquals(\"file\", actual.getProtocol());\n+ assertEquals(\"/a/b/c\", actual.getPath());\n+ }\n+\n+ @Test\n+ public void of_whenPathStartsWithDriveLetter() throws Exception {\n+ URL actual = Urls.of(\"c:/a/b/c\");\n+ assertEquals(\"file\", actual.getProtocol());\n+ }\n+\n+ @Test\n+ public void isSystemPath_whenPathStartsWithSlash() {\n+ assertTrue(Urls.isSystemPath(\"/a/b/c\"));\n+ }\n+\n+ @Test\n+ public void isSystemPath_whenPathStartsWithDriveLetter() {\n+ assertTrue(Urls.isSystemPath(\"c:/a/b/c\"));\n+ }\n+\n+ @Test\n+ public void isSystemPath_whenPathStartsWithProtocol() {\n+ assertFalse(Urls.isSystemPath(\"file://a/b/c\"));\n+ }\n+}\n\\ No newline at end of file\n" } ]
Java
MIT License
georgewfraser/java-language-server
Check for drive-letter prefixed paths
244,057
07.09.2018 22:26:06
14,400
c3be00697f80c5749df7ea03231287dc05428776
Account for backslashes
[ { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/Urls.java", "new_path": "src/main/java/org/javacs/Urls.java", "diff": "@@ -13,11 +13,12 @@ public final class Urls {\nelse\nreturn new URL(path);\n} catch (MalformedURLException e) {\n- throw new RuntimeException(e);\n+ throw new RuntimeException(\"Failed to parse path \" + path, e);\n}\n}\nstatic boolean isSystemPath(String path) {\n- return path.startsWith(\"/\") || path.matches(\"^[a-zA-Z]:/.*\");\n+ return path.startsWith(\"/\") ||\n+ path.matches(\"^[/\\\\\\\\]?[a-zA-Z]:[/\\\\\\\\].*\");\n}\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/test/java/org/javacs/UrlsTest.java", "new_path": "src/test/java/org/javacs/UrlsTest.java", "diff": "@@ -11,7 +11,7 @@ public class UrlsTest {\n@Test\npublic void of_whenPathStartsWithSlash() throws Exception {\n- URL actual = Urls.of(\"/a/b/c\");\n+ URL actual = Urls.of(\"file:///a/b/c\");\nassertEquals(\"file\", actual.getProtocol());\nassertEquals(\"/a/b/c\", actual.getPath());\n}\n@@ -37,6 +37,7 @@ public class UrlsTest {\n@Test\npublic void isSystemPath_whenPathStartsWithDriveLetter() {\nassertTrue(Urls.isSystemPath(\"c:/a/b/c\"));\n+ assertTrue(Urls.isSystemPath(\"c:\\\\a\\\\b\\\\c\"));\n}\n@Test\n" } ]
Java
MIT License
georgewfraser/java-language-server
Account for backslashes
244,057
08.09.2018 00:04:23
14,400
10b0e69d7fa9aef647a78150d4aa81338dd9ada9
Add missing visibility modifier
[ { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/Urls.java", "new_path": "src/main/java/org/javacs/Urls.java", "diff": "@@ -25,7 +25,7 @@ public final class Urls {\n}\n}\n- static boolean isSystemPath(String path) {\n+ private static boolean isSystemPath(String path) {\nreturn path.startsWith(\"/\") ||\npath.matches(\"^[a-zA-Z]:[/\\\\\\\\].*\");\n}\n" } ]
Java
MIT License
georgewfraser/java-language-server
Add missing visibility modifier
244,057
09.09.2018 16:20:15
14,400
9998081cd796fbb9cc940f39e72ad20ceaa80552
Remove unecessary OS-dependent tests.
[ { "change_type": "MODIFY", "old_path": "src/test/java/org/javacs/UrlsTest.java", "new_path": "src/test/java/org/javacs/UrlsTest.java", "diff": "@@ -2,9 +2,6 @@ package org.javacs;\nimport static org.hamcrest.CoreMatchers.containsString;\nimport static org.hamcrest.CoreMatchers.equalTo;\n-import static org.junit.Assert.assertEquals;\n-import static org.junit.Assert.assertTrue;\n-import static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertThat;\nimport java.net.URL;\n@@ -16,14 +13,12 @@ public class UrlsTest {\npublic void pathToUrl_whenPathStartsWithForwardSlash() throws Exception {\nURL actual = Urls.pathToUrl(\"/a/b/c\");\nassertThat(actual.getProtocol(), equalTo(\"file\"));\n- assertThat(actual.getPath(), containsString(\"/a/b/c\"));\n}\n@Test\npublic void pathToUrl_whenPathStartsWithProtocol() throws Exception {\nURL actual = Urls.pathToUrl(\"file:///a/b/c\");\n- assertThat(\"file\", equalTo(actual.getProtocol()));\n- assertThat(actual.getPath(), containsString(\"/a/b/c\"));\n+ assertThat(actual.getProtocol(), equalTo(\"file\"));\n}\n@Test\n@@ -31,7 +26,6 @@ public class UrlsTest {\nthrows Exception {\nURL actual = Urls.pathToUrl(\"c:/a/b/c\");\nassertThat(actual.getProtocol(), equalTo(\"file\"));\n- assertThat(actual.getPath(), containsString(\"/a/b/c\"));\n}\n@Test\n@@ -39,6 +33,5 @@ public class UrlsTest {\nthrows Exception {\nURL actual = Urls.pathToUrl(\"c:\\\\a\\\\b\\\\c\");\nassertThat(actual.getProtocol(), equalTo(\"file\"));\n- assertThat(actual.getPath(), containsString(\"/a/b/c\"));\n}\n}\n" } ]
Java
MIT License
georgewfraser/java-language-server
Remove unecessary OS-dependent tests.
244,052
01.01.2019 21:27:25
18,000
989cdfa4e7958ef56979706723244c2f06203070
fix: adding java module exports for LSP
[ { "change_type": "MODIFY", "old_path": "src/main/java/module-info.java", "new_path": "src/main/java/module-info.java", "diff": "@@ -6,4 +6,5 @@ open module javacs {\nrequires gson;\nuses javax.tools.JavaCompiler;\n+ exports org.javacs.lsp;\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/main/java/org/javacs/lsp/DocumentLinkParams.java", "diff": "+package org.javacs.lsp;\n+\n+public class DocumentLinkParams {\n+\n+}\n" } ]
Java
MIT License
georgewfraser/java-language-server
fix: adding java module exports for LSP
244,052
01.01.2019 21:27:52
18,000
03c11ab291eebe0ffd71a4b391ec692989fdba85
Adding support for textDocument/documentLink
[ { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/lsp/DocumentLinkParams.java", "new_path": "src/main/java/org/javacs/lsp/DocumentLinkParams.java", "diff": "package org.javacs.lsp;\npublic class DocumentLinkParams {\n+ public TextDocumentIdentifier textDocument;\n+ public DocumentLinkParams() {\n+ }\n+\n+ public DocumentLinkParams(TextDocumentIdentifier textDocument) {\n+ this.textDocument = textDocument;\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/lsp/LSP.java", "new_path": "src/main/java/org/javacs/lsp/LSP.java", "diff": "@@ -13,6 +13,7 @@ import java.util.logging.Level;\nimport java.util.logging.Logger;\npublic class LSP {\n+\nprivate static final Gson gson = new Gson();\nprivate static String readHeader(InputStream client) {\n@@ -38,7 +39,9 @@ public class LSP {\nreturn -1;\n}\n- static class EndOfStream extends RuntimeException {}\n+ static class EndOfStream extends RuntimeException {\n+\n+ }\nprivate static char read(InputStream client) {\ntry {\n@@ -66,7 +69,9 @@ public class LSP {\nwhile (true) {\nresult.append(next);\ni++;\n- if (i == byteLength) break;\n+ if (i == byteLength) {\n+ break;\n+ }\nnext = read(client);\n}\nreturn result.toString();\n@@ -77,10 +82,14 @@ public class LSP {\nwhile (true) {\nvar line = readHeader(client);\n// If header is empty, next line is the start of the message\n- if (line.isEmpty()) return readLength(client, contentLength);\n+ if (line.isEmpty()) {\n+ return readLength(client, contentLength);\n+ }\n// If header contains length, save it\nvar maybeLength = parseHeader(line);\n- if (maybeLength != -1) contentLength = maybeLength;\n+ if (maybeLength != -1) {\n+ contentLength = maybeLength;\n+ }\n}\n}\n@@ -108,7 +117,8 @@ public class LSP {\nparams = option.orElse(null);\n}\nvar jsonText = gson.toJson(params);\n- var messageText = String.format(\"{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"id\\\":%d,\\\"result\\\":%s}\", requestId, jsonText);\n+ var messageText = String\n+ .format(\"{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"id\\\":%d,\\\"result\\\":%s}\", requestId, jsonText);\nwriteClient(client, messageText);\n}\n@@ -118,11 +128,13 @@ public class LSP {\nparams = option.orElse(null);\n}\nvar jsonText = gson.toJson(params);\n- var messageText = String.format(\"{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"method\\\":\\\"%s\\\",\\\"params\\\":%s}\", method, jsonText);\n+ var messageText = String\n+ .format(\"{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"method\\\":\\\"%s\\\",\\\"params\\\":%s}\", method, jsonText);\nwriteClient(client, messageText);\n}\nprivate static class RealClient implements LanguageClient {\n+\nfinal OutputStream send;\nRealClient(OutputStream send) {\n@@ -156,19 +168,26 @@ public class LSP {\n}\npublic static void connect(\n- Function<LanguageClient, LanguageServer> serverFactory, InputStream receive, OutputStream send) {\n+ Function<LanguageClient, LanguageServer> serverFactory, InputStream receive,\n+ OutputStream send) {\nvar server = serverFactory.apply(new RealClient(send));\nvar pending = new ArrayBlockingQueue<Message>(10);\nvar endOfStream = new Message();\n// Read messages and process cancellations on a separate thread\nclass MessageReader implements Runnable {\n+\nvoid peek(Message message) {\nif (message.method.equals(\"$/cancelRequest\")) {\nvar params = gson.fromJson(message.params, CancelParams.class);\nvar removed = pending.removeIf(r -> r.id != null && r.id.equals(params.id));\n- if (removed) LOG.info(String.format(\"Cancelled request %d, which had not yet started\", params.id));\n- else LOG.info(String.format(\"Cannot cancel request %d because it has already started\", params.id));\n+ if (removed) {\n+ LOG.info(\n+ String.format(\"Cancelled request %d, which had not yet started\", params.id));\n+ } else {\n+ LOG.info(String\n+ .format(\"Cannot cancel request %d because it has already started\", params.id));\n+ }\n}\n}\n@@ -194,7 +213,9 @@ public class LSP {\npeek(message);\npending.put(message);\n} catch (EndOfStream __) {\n- if (kill()) return;\n+ if (kill()) {\n+ return;\n+ }\n} catch (Exception e) {\nLOG.log(Level.SEVERE, e.getMessage(), e);\n}\n@@ -218,179 +239,160 @@ public class LSP {\nbreak processMessages;\n}\n// If poll(_) failed, loop again\n- if (r == null) continue;\n+ if (r == null) {\n+ continue;\n+ }\n// Otherwise, process the new message\nswitch (r.method) {\n- case \"initialize\":\n- {\n+ case \"initialize\": {\nvar params = gson.fromJson(r.params, InitializeParams.class);\nvar response = server.initialize(params);\nrespond(send, r.id, response);\nbreak;\n}\n- case \"initialized\":\n- {\n+ case \"initialized\": {\nserver.initialized();\nbreak;\n}\n- case \"shutdown\":\n- {\n+ case \"shutdown\": {\nLOG.warning(\"Got shutdown message\");\nbreak;\n}\n- case \"exit\":\n- {\n+ case \"exit\": {\nLOG.warning(\"Got exit message, exiting...\");\nbreak processMessages;\n}\n- case \"workspace/didChangeWorkspaceFolders\":\n- {\n+ case \"workspace/didChangeWorkspaceFolders\": {\nvar params = gson.fromJson(r.params, DidChangeWorkspaceFoldersParams.class);\nserver.didChangeWorkspaceFolders(params);\nbreak;\n}\n- case \"workspace/didChangeConfiguration\":\n- {\n+ case \"workspace/didChangeConfiguration\": {\nvar params = gson.fromJson(r.params, DidChangeConfigurationParams.class);\nserver.didChangeConfiguration(params);\nbreak;\n}\n- case \"workspace/didChangeWatchedFiles\":\n- {\n+ case \"workspace/didChangeWatchedFiles\": {\nvar params = gson.fromJson(r.params, DidChangeWatchedFilesParams.class);\nserver.didChangeWatchedFiles(params);\nbreak;\n}\n- case \"workspace/symbol\":\n- {\n+ case \"workspace/symbol\": {\nvar params = gson.fromJson(r.params, WorkspaceSymbolParams.class);\nvar response = server.workspaceSymbols(params);\nrespond(send, r.id, response);\nbreak;\n}\n- case \"textDocument/didOpen\":\n- {\n+ case \"textDocument/documentLink\": {\n+ var params = gson.fromJson(r.params, DocumentLinkParams.class);\n+ var response = server.documentLink(params);\n+ respond(send, r.id, response);\n+ break;\n+ }\n+ case \"textDocument/didOpen\": {\nvar params = gson.fromJson(r.params, DidOpenTextDocumentParams.class);\nserver.didOpenTextDocument(params);\nbreak;\n}\n- case \"textDocument/didChange\":\n- {\n+ case \"textDocument/didChange\": {\nvar params = gson.fromJson(r.params, DidChangeTextDocumentParams.class);\nserver.didChangeTextDocument(params);\nbreak;\n}\n- case \"textDocument/willSave\":\n- {\n+ case \"textDocument/willSave\": {\nvar params = gson.fromJson(r.params, WillSaveTextDocumentParams.class);\nserver.willSaveTextDocument(params);\nbreak;\n}\n- case \"textDocument/willSaveWaitUntil\":\n- {\n+ case \"textDocument/willSaveWaitUntil\": {\nvar params = gson.fromJson(r.params, WillSaveTextDocumentParams.class);\nvar response = server.willSaveWaitUntilTextDocument(params);\nrespond(send, r.id, response);\nbreak;\n}\n- case \"textDocument/didSave\":\n- {\n+ case \"textDocument/didSave\": {\nvar params = gson.fromJson(r.params, DidSaveTextDocumentParams.class);\nserver.didSaveTextDocument(params);\nbreak;\n}\n- case \"textDocument/didClose\":\n- {\n+ case \"textDocument/didClose\": {\nvar params = gson.fromJson(r.params, DidCloseTextDocumentParams.class);\nserver.didCloseTextDocument(params);\nbreak;\n}\n- case \"textDocument/completion\":\n- {\n+ case \"textDocument/completion\": {\nvar params = gson.fromJson(r.params, TextDocumentPositionParams.class);\nvar response = server.completion(params);\nrespond(send, r.id, response);\nbreak;\n}\n- case \"completionItem/resolve\":\n- {\n+ case \"completionItem/resolve\": {\nvar params = gson.fromJson(r.params, CompletionItem.class);\nvar response = server.resolveCompletionItem(params);\nrespond(send, r.id, response);\nbreak;\n}\n- case \"textDocument/hover\":\n- {\n+ case \"textDocument/hover\": {\nvar params = gson.fromJson(r.params, TextDocumentPositionParams.class);\nvar response = server.hover(params);\nrespond(send, r.id, response);\nbreak;\n}\n- case \"textDocument/signatureHelp\":\n- {\n+ case \"textDocument/signatureHelp\": {\nvar params = gson.fromJson(r.params, TextDocumentPositionParams.class);\nvar response = server.signatureHelp(params);\nrespond(send, r.id, response);\nbreak;\n}\n- case \"textDocument/definition\":\n- {\n+ case \"textDocument/definition\": {\nvar params = gson.fromJson(r.params, TextDocumentPositionParams.class);\nvar response = server.gotoDefinition(params);\nrespond(send, r.id, response);\nbreak;\n}\n- case \"textDocument/references\":\n- {\n+ case \"textDocument/references\": {\nvar params = gson.fromJson(r.params, ReferenceParams.class);\nvar response = server.findReferences(params);\nrespond(send, r.id, response);\nbreak;\n}\n- case \"textDocument/documentSymbol\":\n- {\n+ case \"textDocument/documentSymbol\": {\nvar params = gson.fromJson(r.params, DocumentSymbolParams.class);\nvar response = server.documentSymbol(params);\nrespond(send, r.id, response);\nbreak;\n}\n- case \"textDocument/codeAction\":\n- {\n+ case \"textDocument/codeAction\": {\nvar params = gson.fromJson(r.params, CodeActionParams.class);\nvar response = server.codeAction(params);\nrespond(send, r.id, response);\nbreak;\n}\n- case \"textDocument/codeLens\":\n- {\n+ case \"textDocument/codeLens\": {\nvar params = gson.fromJson(r.params, CodeLensParams.class);\nvar response = server.codeLens(params);\nrespond(send, r.id, response);\nbreak;\n}\n- case \"codeLens/resolve\":\n- {\n+ case \"codeLens/resolve\": {\nvar params = gson.fromJson(r.params, CodeLens.class);\nvar response = server.resolveCodeLens(params);\nrespond(send, r.id, response);\nbreak;\n}\n- case \"textDocument/rename\":\n- {\n+ case \"textDocument/rename\": {\nvar params = gson.fromJson(r.params, RenameParams.class);\nvar response = server.rename(params);\nrespond(send, r.id, response);\nbreak;\n}\n- case \"textDocument/formatting\":\n- {\n+ case \"textDocument/formatting\": {\nvar params = gson.fromJson(r.params, DocumentFormattingParams.class);\nvar response = server.formatting(params);\nrespond(send, r.id, response);\nbreak;\n}\n- case \"textDocument/foldingRange\":\n- {\n+ case \"textDocument/foldingRange\": {\nvar params = gson.fromJson(r.params, FoldingRangeParams.class);\nvar response = server.foldingRange(params);\nrespond(send, r.id, response);\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/lsp/LanguageServer.java", "new_path": "src/main/java/org/javacs/lsp/LanguageServer.java", "diff": "@@ -107,4 +107,8 @@ public class LanguageServer {\npublic List<FoldingRange> foldingRange(FoldingRangeParams params) {\nthrow new RuntimeException(\"Unimplemented\");\n}\n+\n+ public List<DocumentLink> documentLink(DocumentLinkParams params) {\n+ throw new RuntimeException(\"Unimplemented\");\n+ }\n}\n" } ]
Java
MIT License
georgewfraser/java-language-server
Adding support for textDocument/documentLink
244,059
05.02.2019 17:37:36
18,000
6cff7e1266e71c73c07dad1712e678004452901f
Turning off the ANSI control sequences which causes dependency resolution issues on some systems
[ { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/InferConfig.java", "new_path": "src/main/java/org/javacs/InferConfig.java", "diff": "@@ -283,6 +283,7 @@ class InferConfig {\nvar command =\nList.of(\ngetMvnCommand(),\n+ \"--batch-mode\", // Turns off ANSI control sequences\n\"validate\",\ngoal,\n\"-DincludeScope=test\",\n" } ]
Java
MIT License
georgewfraser/java-language-server
Turning off the ANSI control sequences which causes dependency resolution issues on some systems
244,061
17.02.2019 23:57:45
0
d343f43f51925514cdf69931c178c387afd9b5f1
Add installation instructions for vim What === Add installation instructions for vim using the vim plugin vim-lsc. Why === This tool works great in vim but it isn't straight forward setting it up. These instructions will help others get off the ground using this tool with vim.
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "# Language Server for Java using the [Java compiler API](https://docs.oracle.com/javase/10/docs/api/jdk.compiler-summary.html)\n-A Java [language server](https://github.com/Microsoft/vscode-languageserver-protocol) implemented using the Java compiler API.\n+A Java [language server](https://github.com/Microsoft/vscode-languageserver-protocol) based on v3.0 of the protocol and implemented using the Java compiler API.\n[![CircleCI](https://circleci.com/gh/georgewfraser/java-language-server.png)](https://circleci.com/gh/georgewfraser/java-language-server)\n-## Installation\n+## Installation (VS Code)\n[Install from the VS Code marketplace](https://marketplace.visualstudio.com/items?itemName=georgewfraser.vscode-javac)\n+## Installation (other editors)\n+\n+### Vim (with vim-lsc)\n+\n+- Checkout this repository\n+- Run `./scripts/link_mac.sh`\n+- Add the vim plugin [natebosch/vim-lsc](https://github.com/natebosch/vim-lsc) to your vimrc\n+- Add vim-lsc configuration:\n+ ```vimrc\n+ let g:lsc_server_commands = {'java': '<path-to-java-language-server>/java-language-server/dist/mac/bin/launcher --quiet'}\n+ ```\n+- See the [vim-lsc README](https://github.com/natebosch/vim-lsc/blob/master/README.md) for other configuration options.\n+\n+Note: This tool is not compatible with [vim-lsp](https://github.com/prabirshrestha/vim-lsp) as it only supports LSPv2.0.\n+\n## [Issues](https://github.com/georgewfraser/java-language-server/issues)\n## Features\n" } ]
Java
MIT License
georgewfraser/java-language-server
Add installation instructions for vim What === Add installation instructions for vim using the vim plugin vim-lsc. Why === This tool works great in vim but it isn't straight forward setting it up. These instructions will help others get off the ground using this tool with vim.
244,061
17.02.2019 21:15:59
0
db0146d2b85fd81d96766dafa92416eb3866cba1
Make existing scripts work with linux
[ { "change_type": "DELETE", "old_path": "scripts/link_debian.sh", "new_path": null, "diff": "-#!/bin/bash\n-# Links everything into a self-contained executable using jlink.\n-\n-set -e\n-\n-# Needed if you have a java version other than 11 as default\n-JAVA_HOME='/usr/lib/jvm/java-11-openjdk-amd64'\n-\n-# Compile sources\n-mvn compile\n-\n-# Patch gson\n-if [ ! -e modules/gson.jar ]; then\n- ./scripts/patch_gson.sh\n-fi\n-\n-# Build using jlink\n-rm -rf dist/debian\n-$JAVA_HOME/bin/jlink \\\n- --module-path modules/gson.jar:target/classes \\\n- --add-modules gson,javacs \\\n- --launcher launcher=javacs/org.javacs.Main \\\n- --output dist/debian \\\n- --compress 2\n" }, { "change_type": "MODIFY", "old_path": "scripts/link_mac.sh", "new_path": "scripts/link_mac.sh", "diff": "set -e\n# Needed if you have a java version other than 11 as default\n+echo \"JAVA_HOME is set to: $JAVA_HOME\"\n+if [[ \"$OSTYPE\" == \"linux-gnu\" ]]; then\n+ JAVA_HOME='/usr/lib/jvm/java-11-openjdk-amd64'\n+ echo \"JAVA_HOME overrided to be: $JAVA_HOME\"\n+elif [[ \"$OSTYPE\" == \"darwin\"* ]]; then\nJAVA_HOME=$(/usr/libexec/java_home -v 11)\n+ echo \"JAVA_HOME overrided to be: $JAVA_HOME\"\n+fi\n# Compile sources\nmvn compile\n" }, { "change_type": "MODIFY", "old_path": "scripts/link_windows.sh", "new_path": "scripts/link_windows.sh", "diff": "set -e\n# Needed if you have a java version other than 11 as default\n+echo \"JAVA_HOME is set to: $JAVA_HOME\"\n+if [[ \"$OSTYPE\" == \"linux-gnu\" ]]; then\n+ JAVA_HOME='/usr/lib/jvm/java-11-openjdk-amd64'\n+ echo \"JAVA_HOME overrided to be: $JAVA_HOME\"\n+elif [[ \"$OSTYPE\" == \"darwin\"* ]]; then\nJAVA_HOME=$(/usr/libexec/java_home -v 11)\n+ echo \"JAVA_HOME overrided to be: $JAVA_HOME\"\n+fi\n# Compile sources\nmvn compile\n" } ]
Java
MIT License
georgewfraser/java-language-server
Make existing scripts work with linux
244,061
17.02.2019 21:17:58
0
c6b1550e0d70b8ed3d454a5a058e7e205e3843fa
Use the java home set earlier as the real java home
[ { "change_type": "MODIFY", "old_path": "scripts/link_windows.sh", "new_path": "scripts/link_windows.sh", "diff": "@@ -32,8 +32,8 @@ if [ ! -e jdks/windows/jdk-11.0.1 ]; then\nfi\n# Set env variables to build with mac toolchain but windows target\n+REAL_JAVA_HOME=$JAVA_HOME\nJAVA_HOME=\"./jdks/windows/jdk-11.0.1\"\n-REAL_JAVA_HOME=$(/usr/libexec/java_home -v 11)\n# Build in dist/windows\nrm -rf dist/windows\n" } ]
Java
MIT License
georgewfraser/java-language-server
Use the java home set earlier as the real java home
244,061
18.02.2019 01:47:57
0
4dab3d97c069313e6d497c77162965f7464e50cb
Change to just check java version
[ { "change_type": "MODIFY", "old_path": "scripts/benchmark.sh", "new_path": "scripts/benchmark.sh", "diff": "#!/bin/bash\n-# Needed if you have a java version other than 11 as default\n-JAVA_HOME=$(/usr/libexec/java_home -v 11)\n+# Check JAVA_HOME points to correct java version\n+./scripts/check_java_home.sh\n# Compile the benchmark\nmvn test-compile\n" }, { "change_type": "MODIFY", "old_path": "scripts/build.sh", "new_path": "scripts/build.sh", "diff": "set -e\n-# Needed if you have a java version other than 11 as default\n-JAVA_HOME=$(/usr/libexec/java_home -v 11)\n+# Check JAVA_HOME points to correct java version\n+./scripts/check_java_home.sh\n# Needed once\nnpm install\n" }, { "change_type": "ADD", "old_path": null, "new_path": "scripts/check_java_home.sh", "diff": "+#!/bin/bash\n+# Check the version of java pointed to by JAVA_HOME in version 11.\n+\n+set -e\n+\n+if [[ -z \"${JAVA_HOME}\" ]]; then\n+ echo \"error: JAVA_HOME must be set\"\n+ exit 1\n+fi\n+\n+echo \"JAVA_HOME is set to: $JAVA_HOME\"\n+\n+java_version=$(\"$JAVA_HOME/bin/java\" -version 2>&1 | sed -n ';s/.* version \"\\(.*\\)\\.\\(.*\\)\\..*\".*/\\1/p;')\n+echo \"JAVA_HOME version is: $java_version\"\n+if [ \"$java_version\" -ne 11 ]; then\n+ echo \"error: JAVA_HOME must be set to a JDK version 11\"\n+ exit 1\n+fi\n" }, { "change_type": "MODIFY", "old_path": "scripts/link_mac.sh", "new_path": "scripts/link_mac.sh", "diff": "set -e\n-# Needed if you have a java version other than 11 as default\n-echo \"JAVA_HOME is set to: $JAVA_HOME\"\n-if [[ \"$OSTYPE\" == \"linux-gnu\" ]]; then\n- JAVA_HOME='/usr/lib/jvm/java-11-openjdk-amd64'\n- echo \"JAVA_HOME overrided to be: $JAVA_HOME\"\n-elif [[ \"$OSTYPE\" == \"darwin\"* ]]; then\n- JAVA_HOME=$(/usr/libexec/java_home -v 11)\n- echo \"JAVA_HOME overrided to be: $JAVA_HOME\"\n-fi\n+# Check JAVA_HOME points to correct java version\n+./scripts/check_java_home.sh\n# Compile sources\nmvn compile\n" }, { "change_type": "MODIFY", "old_path": "scripts/link_windows.sh", "new_path": "scripts/link_windows.sh", "diff": "set -e\n-# Needed if you have a java version other than 11 as default\n-echo \"JAVA_HOME is set to: $JAVA_HOME\"\n-if [[ \"$OSTYPE\" == \"linux-gnu\" ]]; then\n- JAVA_HOME='/usr/lib/jvm/java-11-openjdk-amd64'\n- echo \"JAVA_HOME overrided to be: $JAVA_HOME\"\n-elif [[ \"$OSTYPE\" == \"darwin\"* ]]; then\n- JAVA_HOME=$(/usr/libexec/java_home -v 11)\n- echo \"JAVA_HOME overrided to be: $JAVA_HOME\"\n-fi\n+# Check JAVA_HOME points to correct java version\n+./scripts/check_java_home.sh\n# Compile sources\nmvn compile\n" }, { "change_type": "MODIFY", "old_path": "scripts/patch_gson.sh", "new_path": "scripts/patch_gson.sh", "diff": "set -e\n-# Needed if you have a java version other than 11 as default\n-# and used if java_home is available\n-if [ -f /usr/libexec/java_home ] ; then\n- JAVA_HOME=$(/usr/libexec/java_home -v 11)\n-fi\n+# Check JAVA_HOME points to java 11\n+./scripts/check_java_home.sh\n# Download Gson jar\ncd modules\n" }, { "change_type": "MODIFY", "old_path": "scripts/run_test.sh", "new_path": "scripts/run_test.sh", "diff": "set -e\n-# Needed if you have a java version other than 11 as default\n-JAVA_HOME=$(/usr/libexec/java_home -v 11)\n+# Check JAVA_HOME points to correct java version\n+./scripts/check_java_home.sh\nmvn test -Dtest=$1#$2\n" } ]
Java
MIT License
georgewfraser/java-language-server
Change to just check java version
244,061
18.02.2019 01:52:55
0
a0e414cdef08fc68786f32edfeac91005a794dd6
Error if java binary doesn't exist
[ { "change_type": "MODIFY", "old_path": "scripts/check_java_home.sh", "new_path": "scripts/check_java_home.sh", "diff": "set -e\nif [[ -z \"${JAVA_HOME}\" ]]; then\n- echo \"error: JAVA_HOME must be set\"\n+ echo \"JAVA_HOME must be set\"\nexit 1\nfi\necho \"JAVA_HOME is set to: $JAVA_HOME\"\n+if [ ! -f \"$JAVA_HOME/bin/java\" ]; then\n+ echo \"JAVA_HOME does not point to an installation of Java\"\n+ exit 1\n+fi\n+\njava_version=$(\"$JAVA_HOME/bin/java\" -version 2>&1 | sed -n ';s/.* version \"\\(.*\\)\\.\\(.*\\)\\..*\".*/\\1/p;')\necho \"JAVA_HOME version is: $java_version\"\nif [ \"$java_version\" -ne 11 ]; then\n- echo \"error: JAVA_HOME must be set to a JDK version 11\"\n+ echo \"JAVA_HOME must be set to a JDK version 11\"\nexit 1\nfi\n" } ]
Java
MIT License
georgewfraser/java-language-server
Error if java binary doesn't exist
244,061
06.03.2019 07:09:59
0
c672bfae82ee2cb46f5c604a0ad7aa5fc028474a
Support other locations for finding src.zip What === Support other locations for finding src.zip so that it is found it if lives at either: - JAVA_HOME/lib/src.zip - JAVA_HOME/src.zip Why === I've observed in testing that some installations of JVMs include src.zip in the root, others in a lib/src.zip.
[ { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/Lib.java", "new_path": "src/main/java/org/javacs/Lib.java", "diff": "@@ -3,18 +3,25 @@ package org.javacs;\nimport java.io.File;\nimport java.lang.System;\nimport java.util.Optional;\n+import java.util.Arrays;\nimport java.nio.file.*;\nclass Lib {\nstatic Optional<Path> srcZipPath() {\nreturn Optional.ofNullable(System.getenv(\"JAVA_HOME\"))\n- .flatMap(home -> Optional.of(Paths.get(home).resolve(\"lib/src.zip\")))\n- .flatMap(path -> {\n+ .map(home -> {\n+ return Arrays.asList(new Path[]{\n+ Paths.get(home).resolve(\"lib/src.zip\"),\n+ Paths.get(home).resolve(\"src.zip\"),\n+ });\n+ })\n+ .flatMap(paths -> {\n+ for (Path path : paths) {\nif (path.toFile().exists()) {\nreturn Optional.of(path);\n- } else {\n- return Optional.empty();\n}\n+ }\n+ return Optional.empty();\n});\n}\n" } ]
Java
MIT License
georgewfraser/java-language-server
Support other locations for finding src.zip What === Support other locations for finding src.zip so that it is found it if lives at either: - JAVA_HOME/lib/src.zip - JAVA_HOME/src.zip Why === I've observed in testing that some installations of JVMs include src.zip in the root, others in a lib/src.zip.
244,061
06.03.2019 07:21:12
0
edae08737d4552283be500714830e14c05a14351
Only include docs if they are not blank Sometimes the docs are present but an empty string. Lets not add it unless there's actually text to add. This presents the data a little better to clients since clients don't get an empty MarkedString.
[ { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/JavaLanguageServer.java", "new_path": "src/main/java/org/javacs/JavaLanguageServer.java", "diff": "@@ -32,6 +32,7 @@ import java.util.Optional;\nimport java.util.Set;\nimport java.util.StringJoiner;\nimport java.util.UUID;\n+import java.util.function.Predicate;\nimport java.util.logging.Logger;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ExecutableElement;\n@@ -645,9 +646,9 @@ class JavaLanguageServer extends LanguageServer {\n// Add docs hover message\nvar docs = hoverDocs(el.get());\n- if (docs.isPresent()) {\n- result.add(new MarkedString(docs.get()));\n- }\n+ docs.filter(Predicate.not(String::isBlank)).ifPresent(doc -> {\n+ result.add(new MarkedString(doc));\n+ });\n// Add code hover message\nvar code = hoverCode(el.get());\n" } ]
Java
MIT License
georgewfraser/java-language-server
Only include docs if they are not blank Sometimes the docs are present but an empty string. Lets not add it unless there's actually text to add. This presents the data a little better to clients since clients don't get an empty MarkedString.
244,073
21.06.2019 18:07:48
-3,600
1bcf6d74c6d8251cda5672ab934b6ba9ddbb2622
Allow JDK versions higher than 11
[ { "change_type": "MODIFY", "old_path": "scripts/check_java_home.sh", "new_path": "scripts/check_java_home.sh", "diff": "@@ -16,9 +16,9 @@ if [ ! -f \"$JAVA_HOME/bin/java\" ]; then\nfi\njava_version=$(\"$JAVA_HOME/bin/java\" -version 2>&1 | sed -n ';s/.* version \"\\(.*\\)\\.\\(.*\\)\\..*\".*/\\1/p;')\n-if [ \"$java_version\" -ne 11 ]; then\n+if [ \"$java_version\" -lt 11 ]; then\necho \"JAVA_HOME is set to: $JAVA_HOME\"\necho \"JAVA_HOME version is: $java_version\"\n- echo \"JAVA_HOME must be set to a JDK version 11\"\n+ echo \"JAVA_HOME must be set to a JDK version >=11\"\nexit 1\nfi\n" } ]
Java
MIT License
georgewfraser/java-language-server
Allow JDK versions higher than 11
244,060
18.07.2019 16:58:53
-7,200
cc1a3e74a02552aaaa93ea22877ac10a8662fcd6
Correctly verify that directory witch ends with `.java` is not a java file.
[ { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/FileStore.java", "new_path": "src/main/java/org/javacs/FileStore.java", "diff": "@@ -353,7 +353,7 @@ class FileStore {\n// because it doesn't realize there are already up-to-date .class files.\n// The better solution would be for java-language server to detect the presence of module-info.java,\n// and go into its own \"module mode\" where it infers a module source path and a module class path.\n- return name.endsWith(\".java\") && !name.equals(\"module-info.java\");\n+ return name.endsWith(\".java\") && !Files.isDirectory(file) && !name.equals(\"module-info.java\");\n}\nstatic boolean isJavaFile(URI uri) {\n" } ]
Java
MIT License
georgewfraser/java-language-server
Correctly verify that directory witch ends with `.java` is not a java file. (#103)
244,054
22.10.2019 21:43:17
25,200
195778f559ce8eb3f1778b157ce32cd1bdf33ae3
Add some prerequisites to the Installing section.
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -171,7 +171,15 @@ The java service process will output a log file to stderr, which is visible in V\n### Installing\n-If you have npm and maven installed, you should be able to install locally using\n+Before installing locally, you need to install prerequisites: npm, maven, protobuf. For example on Mac OS, you can install these using [Brew](https://brew.sh):\n+\n+ brew install npm maven protobuf\n+\n+You also need to have [Java 13](https://www.oracle.com/technetwork/java/javase/downloads/index.html) installed. Point the `JAVA_HOME` environment variable to it. For example, on Mac OS:\n+\n+ export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/\n+\n+Assuming you have these prerequisites, you should be able to install locally using:\nnpm install -g vsce\nnpm install\n" } ]
Java
MIT License
georgewfraser/java-language-server
Add some prerequisites to the Installing section. (#120)
244,058
15.11.2019 22:23:40
28,800
564f167eebd2345cf03f1517d17eb59f3bcb87c0
Fix go-to-interface
[ { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/CompileBatch.java", "new_path": "src/main/java/org/javacs/CompileBatch.java", "diff": "@@ -241,7 +241,11 @@ class CompileBatch implements AutoCloseable {\npublic static final List<TreePath> CODE_NOT_FOUND = List.of();\nList<TreePath> definitions(Element el) {\n- LOG.info(String.format(\"Search for definitions of `%s` in %d files...\", el, roots.size()));\n+ if (roots.size() == 1) {\n+ LOG.info(String.format(\"Search for `%s` in %s\", el, roots.get(0).getSourceFile().getName()));\n+ } else {\n+ LOG.info(String.format(\"Search for `%s` in %d files...\", el, roots.size()));\n+ }\nif (el.asType().getKind() == TypeKind.ERROR) {\nLOG.info(String.format(\"...`%s` is an error type, giving up\", el.asType()));\nreturn CODE_NOT_FOUND;\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/FileStore.java", "new_path": "src/main/java/org/javacs/FileStore.java", "diff": "@@ -7,6 +7,7 @@ import java.nio.file.attribute.*;\nimport java.time.Instant;\nimport java.util.*;\nimport java.util.logging.Logger;\n+import javax.lang.model.element.TypeElement;\nimport org.javacs.lsp.DidChangeTextDocumentParams;\nimport org.javacs.lsp.DidCloseTextDocumentParams;\nimport org.javacs.lsp.DidOpenTextDocumentParams;\n@@ -363,18 +364,19 @@ class FileStore {\nreturn uri.getScheme().equals(\"file\") && isJavaFile(Paths.get(uri));\n}\n- static Optional<Path> findDeclaringFile(String qualifiedName) {\n+ static Optional<Path> findDeclaringFile(TypeElement el) {\n+ var qualifiedName = el.getQualifiedName().toString();\nvar packageName = StringSearch.mostName(qualifiedName);\nvar className = StringSearch.lastName(qualifiedName);\n// Fast path: look for text `class Foo` in file Foo.java\nfor (var f : list(packageName)) {\n- if (f.getFileName().toString().equals(className) && StringSearch.containsClass(f, className)) {\n+ if (f.getFileName().toString().equals(className) && StringSearch.containsType(f, el)) {\nreturn Optional.of(f);\n}\n}\n// Slow path: look for text `class Foo` in any file in package\nfor (var f : list(packageName)) {\n- if (StringSearch.containsClass(f, className)) {\n+ if (StringSearch.containsType(f, el)) {\nreturn Optional.of(f);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/Parser.java", "new_path": "src/main/java/org/javacs/Parser.java", "diff": "@@ -1016,7 +1016,7 @@ class Parser {\n}\n// Find file by looking at package and class name\nLOG.info(String.format(\"...top-level type is %s\", top.get()));\n- var file = findDeclaringFile(top.get());\n+ var file = FileStore.findDeclaringFile(top.get());\nif (!file.isPresent()) {\nLOG.info(String.format(\"...couldn't find declaring file for type\"));\nreturn Optional.empty();\n@@ -1035,12 +1035,6 @@ class Parser {\nreturn Optional.ofNullable(result);\n}\n- /** Find the file `e` was declared in */\n- private static Optional<Path> findDeclaringFile(TypeElement e) {\n- var name = e.getQualifiedName().toString();\n- return FileStore.findDeclaringFile(name);\n- }\n-\nprivate static Cache<String, Boolean> cacheContainsWord = new Cache<>();\nprivate static List<Path> containsWord(Collection<Path> allFiles, String name) {\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/StringSearch.java", "new_path": "src/main/java/org/javacs/StringSearch.java", "diff": "@@ -10,6 +10,7 @@ import java.util.*;\nimport java.util.logging.Logger;\nimport java.util.regex.Pattern;\nimport java.util.stream.Collectors;\n+import javax.lang.model.element.TypeElement;\n// Translated from https://golang.org/src/strings/search.go\n@@ -325,6 +326,17 @@ class StringSearch {\nreturn Character.isAlphabetic(c) || Character.isDigit(c) || c == '_' || c == '$';\n}\n+ static boolean containsType(Path file, TypeElement el) {\n+ switch (el.getKind()) {\n+ case INTERFACE:\n+ return containsInterface(file, el.getSimpleName().toString());\n+ case CLASS:\n+ return containsClass(file, el.getSimpleName().toString());\n+ default:\n+ throw new RuntimeException(\"Don't know what to do with \" + el.getKind());\n+ }\n+ }\n+\nstatic Cache<String, Boolean> cacheContainsClass = new Cache<>();\nstatic boolean containsClass(Path file, String simpleName) {\n@@ -335,6 +347,16 @@ class StringSearch {\nreturn cacheContainsClass.get(file, simpleName);\n}\n+ static Cache<String, Boolean> cacheContainsInterface = new Cache<>();\n+\n+ static boolean containsInterface(Path file, String simpleName) {\n+ if (cacheContainsInterface.needs(file, simpleName)) {\n+ cacheContainsInterface.load(file, simpleName, containsString(file, \"interface \" + simpleName));\n+ // TODO verify this by actually parsing the file\n+ }\n+ return cacheContainsInterface.get(file, simpleName);\n+ }\n+\nstatic boolean containsImport(Path file, String toPackage, String toClass) {\nif (toPackage.isEmpty()) return true;\nvar samePackage = Pattern.compile(\"^package +\" + toPackage + \";\");\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/test/examples/maven-project/src/org/javacs/example/GotoInterface.java", "diff": "+package org.javacs.example;\n+\n+class GotoInterface implements GotoInterfaceInterface {\n+}\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/test/examples/maven-project/src/org/javacs/example/GotoInterfaceInterface.java", "diff": "+package org.javacs.example;\n+\n+public interface GotoInterfaceInterface {\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/test/java/org/javacs/GotoTest.java", "new_path": "src/test/java/org/javacs/GotoTest.java", "diff": "@@ -180,6 +180,13 @@ public class GotoTest {\nassertThat(doGoto(file, 6, 28, true), hasItem(\"GotoSingleChar.java:5,16\"));\n}\n+ @Test\n+ public void gotoInterface() {\n+ String file = \"/org/javacs/example/GotoInterface.java\";\n+\n+ assertThat(doGoto(file, 3, 40, false), hasItem(\"GotoInterfaceInterface.java:3\"));\n+ }\n+\n@Test\npublic void packagePrivate() {\n// There is a separate bug where javac doesn't find package-private classes in files with different names.\n" } ]
Java
MIT License
georgewfraser/java-language-server
Fix go-to-interface
244,058
15.11.2019 22:27:36
28,800
b9d644fbb70c38c96fc241ae2ec7fd50d16ea55a
Color interface
[ { "change_type": "MODIFY", "old_path": "lib/treeSitterColor.ts", "new_path": "lib/treeSitterColor.ts", "diff": "@@ -45,7 +45,7 @@ export function colorJava(root: Parser.SyntaxNode, visibleRanges: { start: numbe\ncase 'identifier':\nconst parent = parents[parents.length-1];\n// If this identifier is the name of a class declaration, or part of a type parameter\n- const isTypeName = parent == 'class_declaration' || parent == 'type_parameter' || parent == 'class_literal';\n+ const isTypeName = parent == 'class_declaration' || parent == 'interface_declaration' || parent == 'type_parameter' || parent == 'class_literal';\nif (isTypeName) {\ntypes.push({start: cursor.startPosition, end: cursor.endPosition})\nbreak;\n" } ]
Java
MIT License
georgewfraser/java-language-server
Color interface
244,058
15.11.2019 22:40:12
28,800
ac7fef4e7e56fb4434c5ad478216c2ee16b212cc
Detect unused args
[ { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/WarnUnused.java", "new_path": "src/main/java/org/javacs/WarnUnused.java", "diff": "@@ -97,14 +97,22 @@ class WarnUnused extends TreeScanner<Void, Void> {\n}\nprivate boolean isLocalVariable(TreePath path) {\n- if (path.getLeaf() instanceof VariableTree) {\n- var parent = path.getParentPath().getLeaf();\n- return !(parent instanceof ClassTree)\n- && !(parent instanceof MethodTree) // TODO hint for unused parameters\n- && !(parent instanceof LambdaExpressionTree);\n+ var kind = path.getLeaf().getKind();\n+ if (kind != Tree.Kind.VARIABLE) {\n+ return false;\n+ }\n+ var parent = path.getParentPath().getLeaf().getKind();\n+ if (parent == Tree.Kind.CLASS) {\n+ return false;\n}\n+ if (parent == Tree.Kind.METHOD) {\n+ var method = (MethodTree) path.getParentPath().getLeaf();\n+ if (method.getBody() == null) {\nreturn false;\n}\n+ }\n+ return true;\n+ }\n@Override\npublic Void visitVariable(VariableTree t, Void __) {\n" } ]
Java
MIT License
georgewfraser/java-language-server
Detect unused args
244,058
15.11.2019 23:14:39
28,800
1f7d693d6a2490a83e9be465eed73b7aec31a2c1
Rename variable code action
[ { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/CompileBatch.java", "new_path": "src/main/java/org/javacs/CompileBatch.java", "diff": "@@ -140,7 +140,7 @@ class CompileBatch implements AutoCloseable {\n}\nprivate boolean okUnused(Name name) {\n- return name.charAt(0) == '_'; // TODO quick fix\n+ return name.charAt(0) == '_';\n}\nList<org.javacs.lsp.Diagnostic> reportErrors(Path file) {\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/JavaLanguageServer.java", "new_path": "src/main/java/org/javacs/JavaLanguageServer.java", "diff": "@@ -2,12 +2,14 @@ package org.javacs;\nimport com.google.gson.*;\nimport com.sun.source.tree.*;\n+import java.net.URI;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.time.Duration;\nimport java.time.Instant;\nimport java.util.*;\nimport java.util.logging.Logger;\n+import java.util.regex.Pattern;\nimport javax.lang.model.element.*;\nimport javax.tools.JavaFileObject;\nimport org.javacs.lsp.*;\n@@ -165,6 +167,7 @@ class JavaLanguageServer extends LanguageServer {\nvar codeLensOptions = new JsonObject();\nc.add(\"codeLensProvider\", codeLensOptions);\nc.addProperty(\"foldingRangeProvider\", true);\n+ c.addProperty(\"codeActionProvider\", true);\nreturn new InitializeResult(c);\n}\n@@ -932,6 +935,45 @@ class JavaLanguageServer extends LanguageServer {\n}\n}\n+ @Override\n+ public List<CodeAction> codeAction(CodeActionParams params) {\n+ var actions = new ArrayList<CodeAction>();\n+ for (var d : params.context.diagnostics) {\n+ if (d.code.equals(\"unused\")\n+ && d.severity == DiagnosticSeverity.Information) { // TODO why isn't this italic and blue?\n+ actions.add(fixUnusedCommand(params.textDocument.uri, d));\n+ }\n+ }\n+ return actions;\n+ }\n+\n+ private CodeAction fixUnusedCommand(URI file, Diagnostic d) {\n+ var from = extractUnusedName(d.message);\n+ var to = \"_\" + from;\n+ var a = new CodeAction();\n+ a.kind = CodeActionKind.QuickFix;\n+ a.title = String.format(\"Rename %s to %s\", from, to); // TODO why is from blue?\n+ a.edit = new WorkspaceEdit();\n+ a.edit.changes = Map.of(file, List.of(fixUnusedEdit(d.range, from)));\n+ return a;\n+ }\n+\n+ private static final Pattern NOT_USED = Pattern.compile(\"`(\\\\w+)` is not used\");\n+\n+ private String extractUnusedName(String message) {\n+ var matcher = NOT_USED.matcher(message);\n+ if (!matcher.matches()) {\n+ throw new RuntimeException(message);\n+ }\n+ return matcher.group(1);\n+ }\n+\n+ private TextEdit fixUnusedEdit(Range range, String from) {\n+ var end = range.end;\n+ var start = new Position(end.line, end.character - from.length());\n+ return new TextEdit(new Range(start, end), \"_\" + from);\n+ }\n+\n@Override\npublic void didSaveTextDocument(DidSaveTextDocumentParams params) {\nif (FileStore.isJavaFile(params.textDocument.uri)) {\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/lsp/CodeActionContext.java", "new_path": "src/main/java/org/javacs/lsp/CodeActionContext.java", "diff": "@@ -4,5 +4,5 @@ import java.util.List;\npublic class CodeActionContext {\npublic List<Diagnostic> diagnostics;\n- public List<CodeActionKind> only;\n+ public List<String> only;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/lsp/LanguageServer.java", "new_path": "src/main/java/org/javacs/lsp/LanguageServer.java", "diff": "@@ -80,7 +80,7 @@ public class LanguageServer {\nthrow new RuntimeException(\"Unimplemented\");\n}\n- public List<Command> codeAction(CodeActionParams params) {\n+ public List<CodeAction> codeAction(CodeActionParams params) {\nthrow new RuntimeException(\"Unimplemented\");\n}\n" } ]
Java
MIT License
georgewfraser/java-language-server
Rename variable code action
244,058
16.11.2019 09:13:32
28,800
66a3f97f01eec780f740f8c7d02cf1a6033e0093
Restart compiler as needed
[ { "change_type": "MODIFY", "old_path": "TODOS.md", "new_path": "TODOS.md", "diff": "- Restart debug test doesn't work\n- Javac doesn't find protobuf classes in bazel\n- Replace <a href=...>text</a> with text in docs, see List.copyOf for example.\n-- When no overload is matched, go-to all definitions of method name\n- Show 'not used' warnings for non-@Override package-private methods of private classes, because they can only be accessed from same file\n- Package template of new package which is sibling of existing package shows sibling + leaf, not parent + leaf.\n- `Thing#close()` shows 0 references for `try (thing)`\n## Features\n- Lint unused args when method isn't overloading something\n+- When no overload is matched, go-to all definitions of method name\n## Optimizations\n- Compilation is very slow in the presence of lots of errors\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/JavaLanguageServer.java", "new_path": "src/main/java/org/javacs/JavaLanguageServer.java", "diff": "@@ -21,16 +21,28 @@ class JavaLanguageServer extends LanguageServer {\nprivate JavaCompilerService cacheCompiler;\nprivate JsonObject cacheSettings;\nprivate JsonObject settings = new JsonObject();\n+ private boolean modifiedBuild = true;\nJavaCompilerService compiler() {\n- if (!settings.equals(cacheSettings)) {\n- LOG.info(\"Recreating compiler because\\n\\t\" + settings + \"\\nis different than\\n\\t\" + cacheSettings);\n+ if (needsCompiler()) {\ncacheCompiler = createCompiler();\ncacheSettings = settings;\n+ modifiedBuild = false;\n}\nreturn cacheCompiler;\n}\n+ private boolean needsCompiler() {\n+ if (modifiedBuild) {\n+ return true;\n+ }\n+ if (!settings.equals(cacheSettings)) {\n+ LOG.info(\"Settings\\n\\t\" + settings + \"\\nis different than\\n\\t\" + cacheSettings);\n+ return true;\n+ }\n+ return false;\n+ }\n+\nvoid lint(Collection<Path> files) {\nif (files.isEmpty()) {\nreturn;\n@@ -172,16 +184,25 @@ class JavaLanguageServer extends LanguageServer {\nreturn new InitializeResult(c);\n}\n+ private static final String[] watchFiles = {\n+ \"**/*.java\", \"**/pom.xml\", \"**/BUILD\",\n+ };\n+\n@Override\npublic void initialized() {\n- // Register for didChangeWatchedFiles notifications\n+ client.registerCapability(\"workspace/didChangeWatchedFiles\", watchFiles(watchFiles));\n+ }\n+\n+ private JsonObject watchFiles(String... globPatterns) {\nvar options = new JsonObject();\nvar watchers = new JsonArray();\n- var watchJava = new JsonObject();\n- watchJava.addProperty(\"globPattern\", \"**/*.java\");\n- watchers.add(watchJava);\n+ for (var p : globPatterns) {\n+ var config = new JsonObject();\n+ config.addProperty(\"globPattern\", p);\n+ watchers.add(config);\n+ }\noptions.add(\"watchers\", watchers);\n- client.registerCapability(\"workspace/didChangeWatchedFiles\", GSON.toJsonTree(options));\n+ return options;\n}\n@Override\n@@ -205,10 +226,9 @@ class JavaLanguageServer extends LanguageServer {\n@Override\npublic void didChangeWatchedFiles(DidChangeWatchedFilesParams params) {\n- // TODO update config when pom.xml changes\nfor (var c : params.changes) {\n- if (!FileStore.isJavaFile(c.uri)) continue;\nvar file = Paths.get(c.uri);\n+ if (FileStore.isJavaFile(file)) {\nswitch (c.type) {\ncase FileChangeType.Created:\nFileStore.externalCreate(file);\n@@ -220,6 +240,15 @@ class JavaLanguageServer extends LanguageServer {\nFileStore.externalDelete(file);\nbreak;\n}\n+ return;\n+ }\n+ var name = file.getFileName().toString();\n+ switch (name) {\n+ case \"BUILD\":\n+ case \"pom.xml\":\n+ LOG.info(\"Compiler needs to be re-created because \" + file + \"has changed\");\n+ modifiedBuild = true;\n+ }\n}\n}\n" } ]
Java
MIT License
georgewfraser/java-language-server
Restart compiler as needed
244,058
16.11.2019 12:49:25
28,800
77fd932fab1100c73fd2d7623a2a6dd5fce240c9
Simplify go-to
[ { "change_type": "MODIFY", "old_path": "TODOS.md", "new_path": "TODOS.md", "diff": "- Package template of new package which is sibling of existing package shows sibling + leaf, not parent + leaf.\n- `Thing#close()` shows 0 references for `try (thing)`\n- Changing `class Foo {}` to `static class Foo {}` doesn't fix \"non-static variables this\" in `static void test() { new Foo() }`\n-\n-## Features\n-- Lint unused args when method isn't overloading something\n-- When no overload is matched, go-to all definitions of method name\n+- Fields don't show up in debugger\n## Optimizations\n- Compilation is very slow in the presence of lots of errors\n- Use package graph to limit search for find-usages/goto-def\n+\n+## Refactorings\n+- Quick fixes\n+ - Remove parameter\n+ - Prepend _ to parameter name\n+ - Delete LHS of variable declaration\n+ - Delete unused tree\n+ - Fix imports\n+ - Create method\n+- Selection\n+ - Extract constant\n+ - Extract variable\n+ - Extract method\n+ - Change package\n+ - Add parameter\n+ - Inline\n+- Code lens\n+ - Inherited methods\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/CompileBatch.java", "new_path": "src/main/java/org/javacs/CompileBatch.java", "diff": "@@ -26,9 +26,9 @@ class CompileBatch implements AutoCloseable {\nprivate final JavaCompilerService parent;\nprivate final ReusableCompiler.Borrow borrow;\n- private final Trees trees;\n- private final Elements elements;\n- private final Types types;\n+ final Trees trees;\n+ final Elements elements;\n+ final Types types;\nprivate final List<CompilationUnitTree> roots;\nCompileBatch(JavaCompilerService parent, Collection<? extends JavaFileObject> files) {\n@@ -131,11 +131,14 @@ class CompileBatch implements AutoCloseable {\n}\n}\n- Optional<Element> element(Path file, int line, int character) {\n+ TreePath tree(Path file, int line, int character) {\nvar root = root(file);\nvar cursor = root.getLineMap().getPosition(line, character);\n- var path = findPath(file, cursor);\n- var el = trees.getElement(path);\n+ return findPath(file, cursor);\n+ }\n+\n+ Optional<Element> element(TreePath tree) {\n+ var el = trees.getElement(tree);\nreturn Optional.ofNullable(el);\n}\n@@ -240,25 +243,8 @@ class CompileBatch implements AutoCloseable {\npublic static final List<TreePath> CODE_NOT_FOUND = List.of();\n- List<TreePath> definitions(Element el) {\n- if (roots.size() == 1) {\n- LOG.info(String.format(\"Search for `%s` in %s\", el, roots.get(0).getSourceFile().getName()));\n- } else {\n- LOG.info(String.format(\"Search for `%s` in %d files...\", el, roots.size()));\n- }\n- if (el.asType().getKind() == TypeKind.ERROR) {\n- LOG.info(String.format(\"...`%s` is an error type, giving up\", el.asType()));\n- return CODE_NOT_FOUND;\n- }\n- var finder = new FindDefinitions(el, borrow.task);\n- for (var r : roots) {\n- finder.scan(r, null);\n- }\n- return finder.results;\n- }\n-\nList<TreePath> references(Path toFile, int toLine, int toColumn) {\n- var to = element(toFile, toLine, toColumn);\n+ var to = element(tree(toFile, toLine, toColumn));\nif (to.isEmpty()) {\nLOG.info(String.format(\"...no element at %s(%d, %d), giving up\", toFile, toLine, toColumn));\nreturn CODE_NOT_FOUND;\n@@ -280,6 +266,15 @@ class CompileBatch implements AutoCloseable {\nreturn list;\n}\n+ Location location(TreePath path) {\n+ var uri = path.getCompilationUnit().getSourceFile().toUri();\n+ var range = range(path);\n+ if (range == Range.NONE) {\n+ return Location.NONE;\n+ }\n+ return new Location(uri, range);\n+ }\n+\nRange range(TreePath path) {\nvar file = Paths.get(path.getCompilationUnit().getSourceFile().toUri());\nvar contents = FileStore.contents(file);\n" }, { "change_type": "DELETE", "old_path": "src/main/java/org/javacs/FindDefinitions.java", "new_path": null, "diff": "-package org.javacs;\n-\n-import com.sun.source.tree.*;\n-import com.sun.source.util.*;\n-import java.util.ArrayList;\n-import java.util.List;\n-import javax.lang.model.element.*;\n-import javax.lang.model.util.Elements;\n-\n-class FindDefinitions extends TreePathScanner<Void, Void> {\n- private final Element el;\n- private final Trees trees;\n- private final Elements elements;\n- final List<TreePath> results = new ArrayList<>();\n-\n- FindDefinitions(Element el, JavacTask task) {\n- this.el = el;\n- this.trees = Trees.instance(task);\n- this.elements = task.getElements();\n- }\n-\n- boolean sameSymbol(Element found) {\n- return el.equals(found);\n- }\n-\n- boolean isSubMethod(Element found) {\n- if (!(el instanceof ExecutableElement)) return false;\n- if (!(found instanceof ExecutableElement)) return false;\n- var superMethod = (ExecutableElement) el;\n- var subMethod = (ExecutableElement) found;\n- var subType = (TypeElement) subMethod.getEnclosingElement();\n- // TODO need to check if class is compatible as well\n- if (elements.overrides(subMethod, superMethod, subType)) {\n- // LOG.info(String.format(\"...`%s.%s` overrides `%s`\", subType, subMethod, superMethod));\n- return true;\n- }\n- return false;\n- }\n-\n- void check(TreePath from) {\n- var found = trees.getElement(from);\n- var match = sameSymbol(found) || isSubMethod(found);\n- if (match) results.add(from);\n- }\n-\n- @Override\n- public Void visitClass(ClassTree t, Void __) {\n- check(getCurrentPath());\n- return super.visitClass(t, null);\n- }\n-\n- @Override\n- public Void visitMethod(MethodTree t, Void __) {\n- check(getCurrentPath());\n- return super.visitMethod(t, null);\n- }\n-\n- @Override\n- public Void visitVariable(VariableTree t, Void __) {\n- check(getCurrentPath());\n- return super.visitVariable(t, null);\n- }\n-\n- @Override\n- public Void visitTypeParameter(TypeParameterTree t, Void __) {\n- check(getCurrentPath());\n- return super.visitTypeParameter(t, null);\n- }\n-}\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/JavaLanguageServer.java", "new_path": "src/main/java/org/javacs/JavaLanguageServer.java", "diff": "@@ -11,6 +11,7 @@ import java.util.*;\nimport java.util.logging.Logger;\nimport java.util.regex.Pattern;\nimport javax.lang.model.element.*;\n+import javax.lang.model.type.TypeKind;\nimport javax.tools.JavaFileObject;\nimport org.javacs.lsp.*;\n@@ -601,7 +602,7 @@ class JavaLanguageServer extends LanguageServer {\nvar sources = Set.of(new SourceFileObject(file));\ntry (var compile = compiler().compileBatch(sources)) {\n// Find element under cursor\n- var el = compile.element(file, line, column);\n+ var el = compile.element(compile.tree(file, line, column));\nif (!el.isPresent()) {\nLOG.info(\"...no element under cursor\");\nreturn Optional.empty();\n@@ -652,38 +653,94 @@ class JavaLanguageServer extends LanguageServer {\n// Compile from-file and identify element under cursor\nLOG.info(String.format(\"Go-to-def at %s:%d...\", fromUri, fromLine));\n- Optional<Element> toEl;\nvar sources = Set.of(new SourceFileObject(fromFile));\n- try (var compile = compiler().compileBatch(sources)) {\n- toEl = compile.element(fromFile, fromLine, fromColumn);\n+ try (var batch = compiler().compileBatch(sources)) {\n+ var fromTree = batch.tree(fromFile, fromLine, fromColumn);\n+ var toEl = batch.element(fromTree);\nif (!toEl.isPresent()) {\nLOG.info(String.format(\"...no element at cursor\"));\nreturn Optional.empty();\n}\n+ if (toEl.get().asType().getKind() == TypeKind.ERROR) {\n+ return gotoErrorDefinition(batch, toEl.get());\n+ }\n+ var toFile = Parser.declaringFile(toEl.get());\n+ if (toFile.isEmpty()) {\n+ LOG.info(String.format(\"...no file for %s\", toEl.get()));\n+ return Optional.empty();\n+ }\n+ batch.close();\n+ return resolveGotoDefinition(fromFile, fromLine, fromColumn, toFile.get());\n+ }\n}\n- // Compile all files that *might* contain definitions of fromEl\n- var toFiles = Parser.potentialDefinitions(toEl.get());\n- toFiles.add(fromFile);\n- var eraseCode = pruneWord(toFiles, Parser.simpleName(toEl.get()));\n- try (var batch = compiler().compileBatch(eraseCode)) {\n- // Find fromEl again, so that we have an Element from the current batch\n- var fromElAgain = batch.element(fromFile, fromLine, fromColumn).get();\n- // Find all definitions of fromElAgain\n- var toTreePaths = batch.definitions(fromElAgain);\n- if (toTreePaths == CompileBatch.CODE_NOT_FOUND) return Optional.empty();\n- var result = new ArrayList<Location>();\n- for (var path : toTreePaths) {\n- var toUri = path.getCompilationUnit().getSourceFile().toUri();\n- var toRange = batch.range(path);\n- if (toRange == Range.NONE) {\n- LOG.warning(String.format(\"Couldn't locate `%s`\", path.getLeaf()));\n+ private Optional<List<Location>> resolveGotoDefinition(Path fromFile, int fromLine, int fromColumn, Path toFile) {\n+ var sources = new HashSet<SourceFileObject>();\n+ sources.add(new SourceFileObject(fromFile));\n+ sources.add(new SourceFileObject(toFile));\n+ try (var batch = compiler().compileBatch(sources)) {\n+ var fromTree = batch.tree(fromFile, fromLine, fromColumn);\n+ var toEl = batch.element(fromTree).get();\n+ var toPath = batch.trees.getPath(toEl);\n+ if (toPath == null) {\n+ LOG.info(String.format(\"...no location for element %s\", toEl));\n+ return Optional.empty();\n+ }\n+ var location = batch.location(toPath);\n+ if (location == Location.NONE) {\n+ LOG.info(String.format(\"...no location for tree %s\", toPath.getLeaf()));\n+ return Optional.empty();\n+ }\n+ return Optional.of(List.of(location));\n+ }\n+ }\n+\n+ private Optional<List<Location>> gotoErrorDefinition(CompileBatch batch, Element toEl) {\n+ var name = toEl.getSimpleName();\n+ if (name == null) {\n+ LOG.info(String.format(\"...%s has no name\", toEl));\n+ return Optional.empty();\n+ }\n+ var parent = toEl.getEnclosingElement();\n+ if (!(parent instanceof TypeElement)) {\n+ LOG.info(String.format(\"...%s is not a type\", parent));\n+ return Optional.empty();\n+ }\n+\n+ var type = (TypeElement) parent;\n+ var toFile = Parser.declaringFile(type);\n+ if (toFile.isEmpty()) {\n+ LOG.info(String.format(\"...no file for %s\", type));\n+ return Optional.empty();\n+ }\n+ batch.close();\n+ return gotoAllMembers(type.getQualifiedName().toString(), name.toString(), toFile.get());\n+ }\n+\n+ private Optional<List<Location>> gotoAllMembers(String typeName, String memberName, Path inFile) {\n+ LOG.info(String.format(\"...go to members of %s named %s\", typeName, memberName));\n+ try (var batch = compiler().compileBatch(List.of(new SourceFileObject(inFile)))) {\n+ var type = batch.elements.getTypeElement(typeName);\n+ if (type == null) {\n+ LOG.info(String.format(\"...no type named %s in %s\", typeName, inFile.getFileName()));\n+ return Optional.empty();\n+ }\n+ var matches = new ArrayList<Location>();\n+ for (var member : batch.elements.getAllMembers(type)) {\n+ if (!member.getSimpleName().contentEquals(memberName)) continue;\n+ var path = batch.trees.getPath(member);\n+ if (path == null) {\n+ LOG.info(String.format(\"...no path for %s in %s\", member, inFile.getFileName()));\ncontinue;\n}\n- var from = new Location(toUri, toRange);\n- result.add(from);\n+ var location = batch.location(path);\n+ if (location == Location.NONE) {\n+ LOG.info(String.format(\"...no location for %s in %s\", path.getLeaf(), inFile.getFileName()));\n+ continue;\n}\n- return Optional.of(result);\n+ matches.add(location);\n+ }\n+ return Optional.of(matches);\n}\n}\n@@ -699,30 +756,30 @@ class JavaLanguageServer extends LanguageServer {\n// Compile from-file and identify element under cursor\nLOG.warning(String.format(\"Looking for references to %s(%d,%d)...\", toUri.getPath(), toLine, toColumn));\n- Optional<Element> toEl;\n+ Element toEl;\nvar sources = Set.of(new SourceFileObject(toFile));\n- try (var compile = compiler().compileBatch(sources)) {\n- toEl = compile.element(toFile, toLine, toColumn);\n- if (!toEl.isPresent()) {\n+ try (var batch = compiler().compileBatch(sources)) {\n+ var maybe = batch.element(batch.tree(toFile, toLine, toColumn));\n+ if (!maybe.isPresent()) {\nLOG.warning(\"...no element under cursor\");\nreturn Optional.empty();\n}\n+ toEl = maybe.get();\n}\n// Compile all files that *might* contain references to toEl\n- var name = Parser.simpleName(toEl.get());\n+ var name = Parser.simpleName(toEl);\nvar fromFiles = new HashSet<Path>();\n- var isLocal =\n- toEl.get() instanceof VariableElement && !(toEl.get().getEnclosingElement() instanceof TypeElement);\n+ var isLocal = toEl instanceof VariableElement && !(toEl.getEnclosingElement() instanceof TypeElement);\nif (!isLocal) {\nvar isType = false;\n- switch (toEl.get().getKind()) {\n+ switch (toEl.getKind()) {\ncase ANNOTATION_TYPE:\ncase CLASS:\ncase INTERFACE:\nisType = true;\n}\n- var flags = toEl.get().getModifiers();\n+ var flags = toEl.getModifiers();\nvar possible = Parser.potentialReferences(toFile, name, isType, flags);\nfromFiles.addAll(possible);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/Parser.java", "new_path": "src/main/java/org/javacs/Parser.java", "diff": "@@ -635,7 +635,7 @@ class Parser {\nreturn Objects.requireNonNull(find.found);\n}\n- private static void ignoreError(javax.tools.Diagnostic<? extends JavaFileObject> err) {\n+ private static void ignoreError(javax.tools.Diagnostic<? extends JavaFileObject> __) {\n// Too noisy, this only comes up in parse tasks which tend to be less important\n// LOG.warning(err.getMessage(Locale.getDefault()));\n}\n@@ -936,40 +936,6 @@ class Parser {\nreturn find.found;\n}\n- static Set<Path> potentialDefinitions(Element to) {\n- LOG.info(String.format(\"Find potential definitions of `%s`...\", to));\n-\n- // If `to` is private, any definitions must be in the same file\n- if (to.getModifiers().contains(Modifier.PRIVATE)) {\n- LOG.info(String.format(\"...`%s` is private\", to));\n- var set = new HashSet<Path>();\n- declaringFile(to).ifPresent(set::add);\n- return set;\n- }\n-\n- if (to instanceof ExecutableElement) {\n- var allFiles = FileStore.all();\n- // Check if the file contains the name of `to`\n- var hasWord = containsWord(allFiles, simpleName(to));\n- // Parse each file and check if the syntax tree is consistent with a definition of `to`\n- // This produces some false positives, but parsing is much faster than compiling,\n- // so it's an effective optimization\n- var matches = new HashSet<Path>();\n- for (var file : hasWord) {\n- if (parseFile(file).mightContainDefinition(to)) {\n- matches.add(file);\n- }\n- }\n- var findName = simpleName(to);\n- LOG.info(String.format(\"...%d files contain method `%s`\", matches.size(), findName));\n- return matches;\n- } else {\n- var files = new HashSet<Path>();\n- declaringFile(to).ifPresent(files::add);\n- return files;\n- }\n- }\n-\nstatic Set<Path> potentialReferences(Path file, String name, boolean isType, Set<Modifier> flags) {\nLOG.info(String.format(\"...find potential references to `%s`...\", name));\nvar pkg = FileStore.packageName(file);\n@@ -1006,7 +972,7 @@ class Parser {\nreturn matches;\n}\n- private static Optional<Path> declaringFile(Element e) {\n+ static Optional<Path> declaringFile(Element e) {\n// Find top-level type surrounding `to`\nLOG.info(String.format(\"...looking up declaring file of `%s`...\", e));\nvar top = topLevelDeclaration(e);\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/ReusableCompiler.java", "new_path": "src/main/java/org/javacs/ReusableCompiler.java", "diff": "@@ -133,6 +133,7 @@ class ReusableCompiler {\nclass Borrow implements AutoCloseable {\npublic final JavacTask task;\n+ private boolean closed;\nBorrow(JavacTask task, ReusableContext ctx) {\nthis.task = task;\n@@ -140,6 +141,7 @@ class ReusableCompiler {\n@Override\npublic void close() {\n+ if (closed) return;\n// not returning the context to the pool if task crashes with an exception\n// the task/context may be in a broken state\ncurrentContext.clear();\n@@ -151,6 +153,7 @@ class ReusableCompiler {\nthrow new RuntimeException(e);\n}\ncheckedOut = false;\n+ closed = true;\n}\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/test/examples/maven-project/src/org/javacs/example/GotoMismatchedMethod.java", "diff": "+package org.javacs.example;\n+\n+class GotoMismatchedMethod {\n+ void test() {\n+ method(1.0);\n+ }\n+ void method(String x) { }\n+ void method(int x) { }\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/test/java/org/javacs/GotoTest.java", "new_path": "src/test/java/org/javacs/GotoTest.java", "diff": "@@ -9,7 +9,6 @@ import java.util.List;\nimport org.javacs.lsp.*;\nimport org.junit.Test;\n-// TODO change :n to (n)\npublic class GotoTest {\nprivate static final String file = \"/org/javacs/example/Goto.java\";\nprivate static final String defaultConstructorFile = \"/org/javacs/example/GotoDefaultConstructor.java\";\n@@ -17,120 +16,103 @@ public class GotoTest {\n@Test\npublic void localVariable() {\nvar suggestions = doGoto(file, 10, 9);\n-\nassertThat(suggestions, hasItem(\"Goto.java:5\"));\n}\n@Test\npublic void defaultConstructor() {\nvar suggestions = doGoto(defaultConstructorFile, 5, 46);\n-\nassertThat(suggestions, hasItem(\"GotoDefaultConstructor.java:3\"));\n}\n@Test\npublic void constructor() {\nvar suggestions = doGoto(file, 11, 21);\n-\nassertThat(suggestions, hasItem(\"Goto.java:3\"));\n}\n@Test\npublic void className() {\nvar suggestions = doGoto(file, 16, 9);\n-\nassertThat(suggestions, hasItem(\"Goto.java:3\"));\n}\n@Test\npublic void staticField() {\nvar suggestions = doGoto(file, 13, 22);\n-\nassertThat(suggestions, hasItem(\"Goto.java:36\"));\n}\n@Test\npublic void field() {\nvar suggestions = doGoto(file, 14, 22);\n-\nassertThat(suggestions, hasItem(\"Goto.java:37\"));\n}\n@Test\npublic void staticMethod() {\nvar suggestions = doGoto(file, 16, 14);\n-\nassertThat(suggestions, hasItem(\"Goto.java:38\"));\n}\n@Test\npublic void method() {\nvar suggestions = doGoto(file, 17, 14);\n-\nassertThat(suggestions, hasItem(\"Goto.java:41\"));\n}\n@Test\npublic void staticMethodReference() {\nvar suggestions = doGoto(file, 19, 27);\n-\nassertThat(suggestions, hasItem(\"Goto.java:38\"));\n}\n@Test\npublic void methodReference() {\nvar suggestions = doGoto(file, 20, 27);\n-\nassertThat(suggestions, hasItem(\"Goto.java:41\"));\n}\n@Test\npublic void otherStaticMethod() {\nvar suggestions = doGoto(file, 29, 25);\n-\nassertThat(suggestions, hasItem(startsWith(\"GotoOther.java:\")));\n}\n@Test\npublic void otherMethod() {\nvar suggestions = doGoto(file, 30, 18);\n-\nassertThat(suggestions, hasItem(startsWith(\"GotoOther.java:\")));\n}\n@Test\npublic void otherCompiledFile() {\nvar suggestions = doGoto(file, 29, 25);\n-\nassertThat(suggestions, hasItem(startsWith(\"GotoOther.java:\")));\n}\n@Test\npublic void constructorInOtherFile() {\nvar suggestions = doGoto(file, 24, 17);\n-\nassertThat(suggestions, hasItem(\"GotoOther.java:12\"));\n}\n@Test\npublic void typeParam() {\nvar suggestions = doGoto(file, 46, 12);\n-\nassertThat(suggestions, hasItem(\"Goto.java:3\"));\n}\n@Test\npublic void gotoEnum() {\n- String file = \"/org/javacs/example/GotoEnum.java\";\n-\n+ var file = \"/org/javacs/example/GotoEnum.java\";\nassertThat(doGoto(file, 6, 31), not(empty()));\nassertThat(doGoto(file, 6, 36), not(empty()));\n}\n@Test\npublic void gotoOverload() {\n- String file = \"/org/javacs/example/GotoOverload.java\";\n-\n+ var file = \"/org/javacs/example/GotoOverload.java\";\nassertThat(doGoto(file, 7, 12), hasItem(\"GotoOverload.java:4\"));\nassertThat(doGoto(file, 8, 12), hasItem(\"GotoOverload.java:12\"));\nassertThat(doGoto(file, 9, 12), hasItem(\"GotoOverload.java:16\"));\n@@ -138,8 +120,7 @@ public class GotoTest {\n@Test\npublic void gotoOverloadInOtherFile() {\n- String file = \"/org/javacs/example/GotoOverloadInOtherFile.java\";\n-\n+ var file = \"/org/javacs/example/GotoOverloadInOtherFile.java\";\nassertThat(doGoto(file, 5, 25), hasItem(\"GotoOverload.java:4\"));\nassertThat(doGoto(file, 6, 25), hasItem(\"GotoOverload.java:12\"));\nassertThat(doGoto(file, 7, 25), hasItem(\"GotoOverload.java:16\"));\n@@ -147,46 +128,49 @@ public class GotoTest {\n@Test\npublic void gotoImplementation() {\n- String file = \"/org/javacs/example/GotoImplementation.java\";\n-\n- assertThat(doGoto(file, 5, 18), hasItems(\"GotoImplementation.java:9\", \"GotoImplementation.java:14\"));\n+ var file = \"/org/javacs/example/GotoImplementation.java\";\n+ assertThat(doGoto(file, 5, 18), hasItems(\"GotoImplementation.java:9\"));\n+ // assertThat(doGoto(file, 5, 18), hasItems(\"GotoImplementation.java:9\", \"GotoImplementation.java:14\"));\n}\n@Test\npublic void gotoImplementsRunnable() {\n- String file = \"/org/javacs/example/GotoOtherPackageMethod.java\";\n-\n- assertThat(doGoto(file, 7, 12), hasItem(\"ImplementsRunnable.java:5\"));\n+ var file = \"/org/javacs/example/GotoOtherPackageMethod.java\";\n+ assertThat(doGoto(file, 7, 12), empty());\n+ // assertThat(doGoto(file, 7, 12), hasItem(\"ImplementsRunnable.java:5\"));\n}\n@Test\npublic void gotoImplementsConsumer() {\n- String file = \"/org/javacs/example/GotoOtherPackageMethod.java\";\n-\n- assertThat(doGoto(file, 11, 12), hasItem(\"ImplementsConsumer.java:7\"));\n+ var file = \"/org/javacs/example/GotoOtherPackageMethod.java\";\n+ assertThat(doGoto(file, 11, 12), empty());\n+ // assertThat(doGoto(file, 11, 12), hasItem(\"ImplementsConsumer.java:7\"));\n}\n@Test\npublic void gotoError() {\n- String file = \"/org/javacs/example/GotoError.java\";\n-\n+ var file = \"/org/javacs/example/GotoError.java\";\nassertThat(doGoto(file, 5, 22), empty());\n}\n@Test\npublic void gotoSingleChar() {\n- String file = \"/org/javacs/example/GotoSingleChar.java\";\n-\n+ var file = \"/org/javacs/example/GotoSingleChar.java\";\nassertThat(doGoto(file, 6, 28, true), hasItem(\"GotoSingleChar.java:5,16\"));\n}\n@Test\npublic void gotoInterface() {\n- String file = \"/org/javacs/example/GotoInterface.java\";\n-\n+ var file = \"/org/javacs/example/GotoInterface.java\";\nassertThat(doGoto(file, 3, 40, false), hasItem(\"GotoInterfaceInterface.java:3\"));\n}\n+ @Test\n+ public void gotoMismatchedMethod() {\n+ var file = \"/org/javacs/example/GotoMismatchedMethod.java\";\n+ assertThat(doGoto(file, 5, 12, false), hasItems(\"GotoMismatchedMethod.java:7\", \"GotoMismatchedMethod.java:8\"));\n+ }\n+\n@Test\npublic void packagePrivate() {\n// There is a separate bug where javac doesn't find package-private classes in files with different names.\n" }, { "change_type": "MODIFY", "old_path": "src/test/java/org/javacs/PtrTest.java", "new_path": "src/test/java/org/javacs/PtrTest.java", "diff": "@@ -15,7 +15,7 @@ public class PtrTest {\n@Test\npublic void classPtr() {\n- var el = compile.element(file, 3, 15).get();\n+ var el = compile.element(compile.tree(file, 3, 15)).get();\nvar ptr = new Ptr(el);\nassertThat(ptr.toString(), equalTo(\"org.javacs.example/Ptrs\"));\n@@ -25,7 +25,7 @@ public class PtrTest {\n@Test\npublic void fieldPtr() {\n- var el = compile.element(file, 4, 20).get();\n+ var el = compile.element(compile.tree(file, 4, 20)).get();\nvar ptr = new Ptr(el);\nassertThat(ptr.toString(), equalTo(\"org.javacs.example/Ptrs#field\"));\n@@ -35,7 +35,7 @@ public class PtrTest {\n@Test\npublic void emptyMethodPtr() {\n- var el = compile.element(file, 6, 20).get();\n+ var el = compile.element(compile.tree(file, 6, 20)).get();\nvar ptr = new Ptr(el);\nassertThat(ptr.toString(), equalTo(\"org.javacs.example/Ptrs#method()\"));\n@@ -45,7 +45,7 @@ public class PtrTest {\n@Test\npublic void intMethodPtr() {\n- var el = compile.element(file, 8, 20).get();\n+ var el = compile.element(compile.tree(file, 8, 20)).get();\nvar ptr = new Ptr(el);\nassertThat(ptr.toString(), equalTo(\"org.javacs.example/Ptrs#method(int)\"));\n@@ -55,7 +55,7 @@ public class PtrTest {\n@Test\npublic void stringMethodPtr() {\n- var el = compile.element(file, 10, 20).get();\n+ var el = compile.element(compile.tree(file, 10, 20)).get();\nvar ptr = new Ptr(el);\nassertThat(ptr.toString(), equalTo(\"org.javacs.example/Ptrs#method(java.lang.String)\"));\n@@ -65,7 +65,7 @@ public class PtrTest {\n@Test\npublic void constructorPtr() {\n- var el = compile.element(file, 12, 13).get();\n+ var el = compile.element(compile.tree(file, 12, 13)).get();\nvar ptr = new Ptr(el);\nassertThat(ptr.toString(), equalTo(\"org.javacs.example/Ptrs#<init>(int)\"));\n@@ -75,7 +75,7 @@ public class PtrTest {\n@Test\npublic void innerClassPtr() {\n- var el = compile.element(file, 14, 20).get();\n+ var el = compile.element(compile.tree(file, 14, 20)).get();\nvar ptr = new Ptr(el);\nassertThat(ptr.toString(), equalTo(\"org.javacs.example/Ptrs.InnerClass\"));\n@@ -85,7 +85,7 @@ public class PtrTest {\n@Test\npublic void innerFieldPtr() {\n- var el = compile.element(file, 15, 20).get();\n+ var el = compile.element(compile.tree(file, 15, 20)).get();\nvar ptr = new Ptr(el);\nassertThat(ptr.toString(), equalTo(\"org.javacs.example/Ptrs.InnerClass#innerField\"));\n@@ -95,7 +95,7 @@ public class PtrTest {\n@Test\npublic void innerEmptyMethodPtr() {\n- var el = compile.element(file, 17, 25).get();\n+ var el = compile.element(compile.tree(file, 17, 25)).get();\nvar ptr = new Ptr(el);\nassertThat(ptr.toString(), equalTo(\"org.javacs.example/Ptrs.InnerClass#innerMethod()\"));\n@@ -105,7 +105,7 @@ public class PtrTest {\n@Test\npublic void innerConstructorPtr() {\n- var el = compile.element(file, 19, 21).get();\n+ var el = compile.element(compile.tree(file, 19, 21)).get();\nvar ptr = new Ptr(el);\nassertThat(ptr.toString(), equalTo(\"org.javacs.example/Ptrs.InnerClass#<init>()\"));\n" }, { "change_type": "MODIFY", "old_path": "src/test/java/org/javacs/WarningsTest.java", "new_path": "src/test/java/org/javacs/WarningsTest.java", "diff": "@@ -86,8 +86,8 @@ public class WarningsTest {\nassertThat(errors, hasItem(\"unused(22)\")); // private Unused(int i) { }\nassertThat(errors, hasItem(\"unused(24)\")); // private class UnusedClass { }\nassertThat(errors, hasItem(\"unused(26)\")); // void unusedSelfReference() { ... }\n- assertThat(errors, not(hasItem(\"unused(6)\"))); // test(int unusedParam)\n- assertThat(errors, not(hasItem(\"unused(12)\"))); // unusedLambdaParam -> {};\n+ assertThat(errors, not(\"unused(6)\")); // test(int unusedParam)\n+ assertThat(errors, not(\"unused(12)\")); // unusedLambdaParam -> {};\nassertThat(errors, not(hasItem(\"unused(20)\"))); // private Unused() { }\nassertThat(errors, hasItem(\"unused(30)\")); // private void unusedMutuallyRecursive1() { ... }\nassertThat(errors, hasItem(\"unused(34)\")); // private void unusedMutuallyRecursive2() { ... }\n" } ]
Java
MIT License
georgewfraser/java-language-server
Simplify go-to
244,058
16.11.2019 12:57:14
28,800
24e00043b0b6d14faf92df615402020623a2173a
Ignore static imports
[ { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/CompileBatch.java", "new_path": "src/main/java/org/javacs/CompileBatch.java", "diff": "@@ -336,6 +336,7 @@ class CompileBatch implements AutoCloseable {\n// Take the intersection of existing imports ^ existing identifiers\nvar qualifiedNames = new HashSet<String>();\nfor (var i : root.getImports()) {\n+ if (i.isStatic()) continue;\nvar imported = i.getQualifiedIdentifier().toString();\nif (imported.endsWith(\".*\")) {\nvar packageName = StringSearch.mostName(imported);\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/test/examples/simple-project/StaticImport.java", "diff": "+import static java.util.Arrays.asList;\n+\n+class MissingImport {\n+ void test() {\n+ var xs = asList(1, 2);\n+ xs.add(\"foo\");\n+ }\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/test/java/org/javacs/JavaCompilerServiceTest.java", "new_path": "src/test/java/org/javacs/JavaCompilerServiceTest.java", "diff": "@@ -59,6 +59,13 @@ public class JavaCompilerServiceTest {\nassertThat(qualifiedNames, hasItem(\"java.util.List\"));\n}\n+ @Test\n+ public void ignoreStaticImport() {\n+ var file = resourceFile(\"StaticImport.java\");\n+ var qualifiedNames = compiler.compileBatch(Set.of(new SourceFileObject(file))).fixImports(file);\n+ assertThat(qualifiedNames, not(hasItem(\"java.util.Arrays.asList\")));\n+ }\n+\n@Test\npublic void dontImportEnum() {\nvar file = resourceFile(\"DontImportEnum.java\");\n" } ]
Java
MIT License
georgewfraser/java-language-server
Ignore static imports
244,058
16.11.2019 15:33:18
28,800
6877dfc1989f73402742d7c976b697c9b0ca4f11
Skip invalid diags
[ { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/CompileBatch.java", "new_path": "src/main/java/org/javacs/CompileBatch.java", "diff": "@@ -155,6 +155,7 @@ class CompileBatch implements AutoCloseable {\nif (source == null) continue;\nvar path = Paths.get(source.toUri());\nif (!file.equals(path)) continue;\n+ if (!isValid(d)) continue;\ndiags.add(lspDiagnostic(d, root.getLineMap()));\n}\n// Check for unused privates\n@@ -171,6 +172,10 @@ class CompileBatch implements AutoCloseable {\nreturn diags;\n}\n+ private boolean isValid(javax.tools.Diagnostic<? extends JavaFileObject> d) {\n+ return d.getStartPosition() >= 0 && d.getEndPosition() >= 0;\n+ }\n+\n/**\n* lspDiagnostic(d, lines) converts d to LSP format, with its position shifted appropriately for the latest version\n* of the file.\n" } ]
Java
MIT License
georgewfraser/java-language-server
Skip invalid diags
244,058
16.11.2019 16:26:50
28,800
c3ebbf0cd46f2640b27ee18a239fa0c190fd18f7
Move prepend _ into Refactor
[ { "change_type": "MODIFY", "old_path": "TODOS.md", "new_path": "TODOS.md", "diff": "- `return json.get(\"name\").` doesn't auto-complete\n- `return \"foo\"\\n.` doesn't auto-complete\n- Restart debug test doesn't work\n-- Javac doesn't find protobuf classes in bazel\n- Replace <a href=...>text</a> with text in docs, see List.copyOf for example.\n- Show 'not used' warnings for non-@Override package-private methods of private classes, because they can only be accessed from same file\n- Package template of new package which is sibling of existing package shows sibling + leaf, not parent + leaf.\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/CompileBatch.java", "new_path": "src/main/java/org/javacs/CompileBatch.java", "diff": "@@ -12,6 +12,7 @@ import java.util.*;\nimport java.util.function.Consumer;\nimport java.util.function.Predicate;\nimport java.util.logging.Logger;\n+import java.util.regex.Pattern;\nimport javax.lang.model.element.*;\nimport javax.lang.model.type.ArrayType;\nimport javax.lang.model.type.DeclaredType;\n@@ -60,6 +61,7 @@ class CompileBatch implements AutoCloseable {\nvar addFiles = new HashSet<Path>();\nfor (var err : parent.diags) {\nif (!err.getCode().equals(\"compiler.err.cant.resolve.location\")) continue;\n+ if (!isValid(err)) continue;\nvar className = errorText(err);\nvar packageName = packageName(err);\nvar location = findPackagePrivateClass(packageName, className);\n@@ -217,23 +219,27 @@ class CompileBatch implements AutoCloseable {\nvar start = (int) pos.getStartPosition(root, leaf);\nvar end = (int) pos.getEndPosition(root, leaf);\nif (leaf instanceof VariableTree) {\n- var file = Paths.get(root.getSourceFile().toUri());\n- var contents = FileStore.contents(file);\nvar v = (VariableTree) leaf;\n- var name = v.getName().toString();\nvar offset = (int) pos.getEndPosition(root, v.getType());\n- if (offset == -1) offset = start;\n- offset = contents.indexOf(name, offset);\n- end = offset + name.length();\n- }\n- var message = String.format(\"`%s` is not used\", unusedEl.getSimpleName());\n- int severity;\n- if (unusedEl instanceof ExecutableElement || unusedEl instanceof TypeElement) {\n- severity = DiagnosticSeverity.Hint;\n- } else {\n- severity = DiagnosticSeverity.Information;\n+ if (offset != -1) {\n+ start = offset;\n}\n- return lspWarnUnused(severity, message, start, end, root.getLineMap());\n+ }\n+ var file = Paths.get(root.getSourceFile().toUri());\n+ var contents = FileStore.contents(file);\n+ var name = unusedEl.getSimpleName();\n+ if (name.contentEquals(\"<init>\")) {\n+ name = unusedEl.getEnclosingElement().getSimpleName();\n+ }\n+ var region = contents.subSequence(start, end);\n+ var matcher = Pattern.compile(\"\\\\b\" + name + \"\\\\b\").matcher(region);\n+ if (matcher.find()) {\n+ start += matcher.start();\n+ end = start + name.length();\n+ }\n+ var message = String.format(\"`%s` is not used\", name);\n+ // TODO create an additional warning with severity Hint that fades methods and classes\n+ return lspWarnUnused(DiagnosticSeverity.Information, message, start, end, root.getLineMap());\n}\nstatic org.javacs.lsp.Diagnostic lspWarnUnused(int severity, String message, int start, int end, LineMap lines) {\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/JavaLanguageServer.java", "new_path": "src/main/java/org/javacs/JavaLanguageServer.java", "diff": "@@ -2,14 +2,12 @@ package org.javacs;\nimport com.google.gson.*;\nimport com.sun.source.tree.*;\n-import java.net.URI;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.time.Duration;\nimport java.time.Instant;\nimport java.util.*;\nimport java.util.logging.Logger;\n-import java.util.regex.Pattern;\nimport javax.lang.model.element.*;\nimport javax.lang.model.type.TypeKind;\nimport javax.tools.JavaFileObject;\n@@ -1027,38 +1025,12 @@ class JavaLanguageServer extends LanguageServer {\nfor (var d : params.context.diagnostics) {\nif (d.code.equals(\"unused\")\n&& d.severity == DiagnosticSeverity.Information) { // TODO why isn't this italic and blue?\n- actions.add(fixUnusedCommand(params.textDocument.uri, d));\n+ actions.add(new Refactor(compiler()).prependUnderscore(params.textDocument.uri, d.range));\n}\n}\nreturn actions;\n}\n- private CodeAction fixUnusedCommand(URI file, Diagnostic d) {\n- var from = extractUnusedName(d.message);\n- var a = new CodeAction();\n- a.kind = CodeActionKind.QuickFix;\n- a.title = String.format(\"Prefix '%s' with an underscore\", from);\n- a.edit = new WorkspaceEdit();\n- a.edit.changes = Map.of(file, List.of(fixUnusedEdit(d.range, from)));\n- return a;\n- }\n-\n- private static final Pattern NOT_USED = Pattern.compile(\"`(\\\\w+)` is not used\");\n-\n- private String extractUnusedName(String message) {\n- var matcher = NOT_USED.matcher(message);\n- if (!matcher.matches()) {\n- throw new RuntimeException(message);\n- }\n- return matcher.group(1);\n- }\n-\n- private TextEdit fixUnusedEdit(Range range, String from) {\n- var end = range.end;\n- var start = new Position(end.line, end.character - from.length());\n- return new TextEdit(new Range(start, end), \"_\" + from);\n- }\n-\n@Override\npublic void didSaveTextDocument(DidSaveTextDocumentParams params) {\nif (FileStore.isJavaFile(params.textDocument.uri)) {\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/main/java/org/javacs/Refactor.java", "diff": "+package org.javacs;\n+\n+import java.net.URI;\n+import java.util.List;\n+import java.util.Map;\n+import org.javacs.lsp.*;\n+\n+class Refactor {\n+ private final JavaCompilerService compiler;\n+\n+ Refactor(JavaCompilerService compiler) {\n+ this.compiler = compiler;\n+ }\n+\n+ CodeAction prependUnderscore(URI file, Range range) {\n+ var edit = new TextEdit(new Range(range.start, range.start), \"_\");\n+ var a = new CodeAction();\n+ a.kind = CodeActionKind.QuickFix;\n+ a.title = String.format(\"Prefix with underscore\");\n+ a.edit = new WorkspaceEdit();\n+ a.edit.changes = Map.of(file, List.of(edit));\n+ return a;\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/lsp/DiagnosticSeverity.java", "new_path": "src/main/java/org/javacs/lsp/DiagnosticSeverity.java", "diff": "package org.javacs.lsp;\npublic class DiagnosticSeverity {\n- public static final int Error = 1, Warning = 2, Information = 3, Hint = 4;\n+ public static final int Error = 1, Warning = 2, Information = 3, Hint = 4; // TODO why isn't this italic and blue?\n}\n" } ]
Java
MIT License
georgewfraser/java-language-server
Move prepend _ into Refactor
244,058
16.11.2019 18:58:03
28,800
760063e362fb826a411dd3c5f340b7a6e7e704ba
More complex refactoring
[ { "change_type": "MODIFY", "old_path": "TODOS.md", "new_path": "TODOS.md", "diff": "- Delete unused tree\n- Fix imports\n- Create method\n+ - Implement abstract methods\n+ - static, final are redundant in interfaces inners\n- Selection\n- Extract constant\n- Extract variable\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/CompileBatch.java", "new_path": "src/main/java/org/javacs/CompileBatch.java", "diff": "@@ -238,14 +238,27 @@ class CompileBatch implements AutoCloseable {\nend = start + name.length();\n}\nvar message = String.format(\"`%s` is not used\", name);\n+ String code;\n+ if (leaf instanceof VariableTree) {\n+ if (path.getParentPath().getLeaf() instanceof MethodTree) {\n+ code = \"unused_param\";\n+ } else if (path.getParentPath().getLeaf() instanceof BlockTree) {\n+ code = \"unused_local\";\n+ } else {\n+ code = \"unused_field\";\n+ }\n+ } else {\n+ code = \"unused_other\";\n+ }\n+ return lspWarnUnused(DiagnosticSeverity.Information, code, message, start, end, root.getLineMap());\n// TODO create an additional warning with severity Hint that fades methods and classes\n- return lspWarnUnused(DiagnosticSeverity.Information, message, start, end, root.getLineMap());\n}\n- static org.javacs.lsp.Diagnostic lspWarnUnused(int severity, String message, int start, int end, LineMap lines) {\n+ static org.javacs.lsp.Diagnostic lspWarnUnused(\n+ int severity, String code, String message, int start, int end, LineMap lines) {\nvar result = new org.javacs.lsp.Diagnostic();\nresult.severity = severity;\n- result.code = \"unused\";\n+ result.code = code;\nresult.message = message;\nresult.tags = List.of(DiagnosticTag.Unnecessary);\nresult.range = new Span(start, end).asRange(lines);\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/main/java/org/javacs/FindRange.java", "diff": "+package org.javacs;\n+\n+import com.sun.source.tree.*;\n+import com.sun.source.util.*;\n+import java.util.Objects;\n+import java.util.logging.Logger;\n+\n+// Search for the smallest element that encompasses a range\n+class FindRange extends TreePathScanner<Void, Void> {\n+ private final SourcePositions pos;\n+ private final long start, end;\n+ private final CompilationUnitTree root;\n+ TreePath found = null;\n+\n+ FindRange(long start, long end, JavacTask task, CompilationUnitTree root) {\n+ var trees = Trees.instance(task);\n+ this.pos = trees.getSourcePositions();\n+ this.start = start;\n+ this.end = end;\n+ this.root = root;\n+ LOG.info(\"find \" + start + \" - \" + end);\n+ }\n+\n+ boolean containsRange(Tree tree) {\n+ Objects.requireNonNull(root, \"root was never set\");\n+ long start = pos.getStartPosition(root, tree), end = pos.getEndPosition(root, tree);\n+ LOG.info(tree + \" spans \" + start + \" - \" + end);\n+ return start <= this.start && this.end <= end;\n+ }\n+\n+ @Override\n+ public Void scan(Tree tree, Void nothing) {\n+ // This is pre-order traversal, so the deepest element will be the last one remaining in `found`\n+ if (containsRange(tree)) {\n+ found = new TreePath(getCurrentPath(), tree);\n+ }\n+ super.scan(tree, nothing);\n+ return null;\n+ }\n+\n+ @Override\n+ public Void visitErroneous(ErroneousTree node, Void nothing) {\n+ if (node.getErrorTrees() == null) return null;\n+ for (var t : node.getErrorTrees()) {\n+ scan(t, nothing);\n+ }\n+ return null;\n+ }\n+\n+ private static final Logger LOG = Logger.getLogger(\"main\");\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/JavaLanguageServer.java", "new_path": "src/main/java/org/javacs/JavaLanguageServer.java", "diff": "@@ -1023,8 +1023,13 @@ class JavaLanguageServer extends LanguageServer {\npublic List<CodeAction> codeAction(CodeActionParams params) {\nvar actions = new ArrayList<CodeAction>();\nfor (var d : params.context.diagnostics) {\n- if (Refactor.canPrependUnderscore(d)) {\n- actions.add(Refactor.prependUnderscore(params.textDocument.uri, d.range));\n+ for (var rule : Refactor.RULES) {\n+ if (!rule.canRefactor(d)) continue;\n+ var parse = Parser.parseFile(Paths.get(params.textDocument.uri));\n+ var error = parse.findPath(d.range);\n+ var action = rule.refactor(parse, error);\n+ if (action == CodeAction.NONE) continue;\n+ actions.add(action);\n}\n}\nreturn actions;\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/Parser.java", "new_path": "src/main/java/org/javacs/Parser.java", "diff": "@@ -28,6 +28,7 @@ class Parser {\nfinal String contents;\nprivate final JavacTask task;\nfinal CompilationUnitTree root;\n+ final Trees trees;\nprivate Parser(JavaFileObject file) {\nObjects.requireNonNull(file);\n@@ -43,6 +44,7 @@ class Parser {\n} catch (IOException e) {\nthrow new RuntimeException(e);\n}\n+ this.trees = Trees.instance(task);\n}\nstatic Parser parseFile(Path file) {\n@@ -214,6 +216,17 @@ class Parser {\nreturn finder.found;\n}\n+ TreePath findPath(Range range) {\n+ var start = root.getLineMap().getPosition(range.start.line + 1, range.start.character + 1);\n+ var end = root.getLineMap().getPosition(range.end.line + 1, range.end.character + 1);\n+ var finder = new FindRange(start, end, task, root);\n+ finder.scan(root, null);\n+ if (finder.found == null) {\n+ return new TreePath(root);\n+ }\n+ return finder.found;\n+ }\n+\nboolean isIdentifier(long cursor) {\nvar path = findPath(cursor);\nreturn path.getLeaf() instanceof IdentifierTree;\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/Refactor.java", "new_path": "src/main/java/org/javacs/Refactor.java", "diff": "package org.javacs;\n-import java.net.URI;\n+import com.sun.source.tree.VariableTree;\n+import com.sun.source.util.TreePath;\nimport java.util.List;\nimport java.util.Map;\n+import java.util.logging.Logger;\nimport org.javacs.lsp.*;\n-class Refactor {\n- private final JavaCompilerService compiler;\n+interface Refactor {\n+ boolean canRefactor(Diagnostic d);\n- Refactor(JavaCompilerService compiler) {\n- this.compiler = compiler;\n+ CodeAction refactor(Parser parse, TreePath error);\n+\n+ Refactor[] RULES = { // TODO this is used!\n+ new PrependUnderscore(), new RemoveVar(),\n+ };\n+\n+ class PrependUnderscore implements Refactor {\n+ @Override\n+ public boolean canRefactor(Diagnostic d) {\n+ return d.code.equals(\"unused_param\");\n}\n- static boolean canPrependUnderscore(Diagnostic d) {\n- return d.code.equals(\"unused\") && d.severity == DiagnosticSeverity.Information;\n+ @Override\n+ public CodeAction refactor(Parser parse, TreePath error) {\n+ var file = error.getCompilationUnit().getSourceFile().toUri();\n+ var edit = new TextEdit(parse.range(error), \"_\");\n+ var a = new CodeAction();\n+ a.kind = CodeActionKind.QuickFix;\n+ a.title = \"Prefix with underscore\";\n+ a.edit = new WorkspaceEdit();\n+ a.edit.changes = Map.of(file, List.of(edit));\n+ return a;\n+ }\n+ }\n+\n+ class RemoveVar implements Refactor {\n+ @Override\n+ public boolean canRefactor(Diagnostic d) {\n+ return d.code.equals(\"unused_local\");\n}\n- static CodeAction prependUnderscore(URI file, Range range) {\n- var edit = new TextEdit(new Range(range.start, range.start), \"_\");\n+ @Override\n+ public CodeAction refactor(Parser parse, TreePath error) {\n+ LOG.info(\"Try to remove LHS...\");\n+ if (!(error.getLeaf() instanceof VariableTree)) {\n+ LOG.info(\"...not a variable\");\n+ return CodeAction.NONE;\n+ }\n+ var file = error.getCompilationUnit().getSourceFile().toUri();\n+ var variable = (VariableTree) error.getLeaf();\n+ var expression = variable.getInitializer();\n+ var pos = parse.trees.getSourcePositions();\n+ var startVar = (int) pos.getStartPosition(parse.root, variable);\n+ var startRhs = (int) pos.getStartPosition(parse.root, expression);\n+ var delete = new Span(startVar, startRhs).asRange(parse.root.getLineMap());\n+ var edit = new TextEdit(delete, \"\");\nvar a = new CodeAction();\na.kind = CodeActionKind.QuickFix;\n- a.title = String.format(\"Prefix with underscore\");\n+ a.title = \"Remove variable\";\na.edit = new WorkspaceEdit();\na.edit.changes = Map.of(file, List.of(edit));\nreturn a;\n}\n}\n+\n+ Logger LOG = Logger.getLogger(\"main\");\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/lsp/CodeAction.java", "new_path": "src/main/java/org/javacs/lsp/CodeAction.java", "diff": "@@ -7,4 +7,5 @@ public class CodeAction {\npublic List<Diagnostic> diagnostics;\npublic WorkspaceEdit edit;\npublic Command command;\n+ public static CodeAction NONE;\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/test/examples/maven-project/src/org/javacs/action/TestPrefixParam.java", "diff": "+package org.javacs.docs.action;\n+\n+class TestPrefixParam {\n+ void test(int unusedParam) {\n+ }\n+}\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/test/examples/maven-project/src/org/javacs/action/TestRemoveVar.java", "diff": "+package org.javacs.docs.action;\n+\n+class TestRemoveVar {\n+ void test() {\n+ int unusedLocal = makeInt();\n+ }\n+\n+ int makeInt() {\n+ return 1;\n+ }\n+}\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/test/java/org/javacs/CodeActionTest.java", "diff": "+package org.javacs;\n+\n+import static org.hamcrest.Matchers.*;\n+import static org.junit.Assert.*;\n+\n+import java.util.ArrayList;\n+import java.util.List;\n+import org.javacs.lsp.*;\n+import org.junit.Test;\n+\n+public class CodeActionTest {\n+ private static List<Diagnostic> errors = new ArrayList<>();\n+ protected static final JavaLanguageServer server = LanguageServerFixture.getJavaLanguageServer(errors::add);\n+ private static final String[][] cases = {\n+ {\"org/javacs/action/TestRemoveVar.java\", \"Remove variable\"},\n+ {\"org/javacs/action/TestPrefixParam.java\", \"Prefix with underscore\"},\n+ };\n+\n+ @Test\n+ public void testCodeActions() {\n+ for (var c : cases) {\n+ var file = FindResource.path(c[0]);\n+ server.lint(List.of(file));\n+ var params = new CodeActionParams();\n+ params.textDocument = new TextDocumentIdentifier(file.toUri());\n+ params.context = new CodeActionContext();\n+ params.context.diagnostics = errors;\n+ var actions = server.codeAction(params);\n+ var titles = titles(actions);\n+ for (int i = 1; i < c.length; i++) {\n+ assertThat(titles, hasItem(c[i]));\n+ }\n+ }\n+ }\n+\n+ private List<String> titles(List<CodeAction> actions) {\n+ var titles = new ArrayList<String>();\n+ for (var a : actions) {\n+ titles.add(a.title);\n+ }\n+ return titles;\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/test/java/org/javacs/CodeLensTest.java", "new_path": "src/test/java/org/javacs/CodeLensTest.java", "diff": "@@ -34,16 +34,6 @@ public class CodeLensTest {\nreturn commands;\n}\n- private List<String> titles(List<? extends CodeLens> lenses) {\n- var titles = new ArrayList<String>();\n- for (var lens : lenses) {\n- var line = lens.range.start.line + 1;\n- var title = lens.command.title;\n- titles.add(line + \":\" + title);\n- }\n- return titles;\n- }\n-\n@Test\npublic void testMethods() {\nvar lenses = lenses(\"/org/javacs/example/HasTest.java\");\n" }, { "change_type": "MODIFY", "old_path": "src/test/java/org/javacs/WarningsTest.java", "new_path": "src/test/java/org/javacs/WarningsTest.java", "diff": "@@ -38,14 +38,14 @@ public class WarningsTest {\nvar file = FindResource.path(\"org/javacs/err/ClearErrorIncrementally.java\");\nopen(file);\nserver.lint(List.of(file));\n- assertThat(errors, containsInAnyOrder(\"compiler.err.prob.found.req(5)\", \"unused(5)\"));\n+ assertThat(errors, containsInAnyOrder(\"compiler.err.prob.found.req(5)\", \"unused_local(5)\"));\n// Change 1 to \"1\"\nvar newContents =\n\"package org.javacs.err;\\n\\npublic class ClearErrorIncrementally {\\n void test() {\\n String x = \\\"1\\\";\\n }\\n}\";\nedit(file, newContents);\nerrors.clear();\nserver.lint(List.of(file));\n- assertThat(errors, contains(\"unused(5)\"));\n+ assertThat(errors, contains(\"unused_local(5)\"));\n// Delete line `String x = \"1\";`\nnewContents =\n\"package org.javacs.err;\\n\\npublic class ClearErrorIncrementally {\\n void test() {\\n }\\n}\";\n@@ -79,19 +79,19 @@ public class WarningsTest {\n@Test\npublic void unused() {\nserver.lint(List.of(FindResource.path(\"org/javacs/warn/Unused.java\")));\n- assertThat(errors, hasItem(\"unused(7)\")); // int unusedLocal\n- assertThat(errors, hasItem(\"unused(10)\")); // int unusedPrivate\n- assertThat(errors, hasItem(\"unused(13)\")); // int unusedLocalInLambda\n- assertThat(errors, hasItem(\"unused(16)\")); // int unusedMethod() { ... }\n- assertThat(errors, hasItem(\"unused(22)\")); // private Unused(int i) { }\n- assertThat(errors, hasItem(\"unused(24)\")); // private class UnusedClass { }\n- assertThat(errors, hasItem(\"unused(26)\")); // void unusedSelfReference() { ... }\n- assertThat(errors, not(\"unused(6)\")); // test(int unusedParam)\n- assertThat(errors, not(\"unused(12)\")); // unusedLambdaParam -> {};\n- assertThat(errors, not(hasItem(\"unused(20)\"))); // private Unused() { }\n- assertThat(errors, hasItem(\"unused(30)\")); // private void unusedMutuallyRecursive1() { ... }\n- assertThat(errors, hasItem(\"unused(34)\")); // private void unusedMutuallyRecursive2() { ... }\n- assertThat(errors, not(hasItem(\"unused(38)\"))); // private int usedByUnusedVar() { ... }\n+ assertThat(errors, hasItem(\"unused_local(7)\")); // int unusedLocal\n+ assertThat(errors, hasItem(\"unused_field(10)\")); // int unusedPrivate\n+ assertThat(errors, hasItem(\"unused_local(13)\")); // int unusedLocalInLambda\n+ assertThat(errors, hasItem(\"unused_other(16)\")); // int unusedMethod() { ... }\n+ assertThat(errors, hasItem(\"unused_other(22)\")); // private Unused(int i) { }\n+ assertThat(errors, hasItem(\"unused_other(24)\")); // private class UnusedClass { }\n+ assertThat(errors, hasItem(\"unused_other(26)\")); // void unusedSelfReference() { ... }\n+ assertThat(errors, not(\"unused_param(6)\")); // test(int unusedParam)\n+ assertThat(errors, not(\"unused_param(12)\")); // unusedLambdaParam -> {};\n+ assertThat(errors, not(hasItem(\"unused_other(20)\"))); // private Unused() { }\n+ assertThat(errors, hasItem(\"unused_other(30)\")); // private void unusedMutuallyRecursive1() { ... }\n+ assertThat(errors, hasItem(\"unused_other(34)\")); // private void unusedMutuallyRecursive2() { ... }\n+ assertThat(errors, not(hasItem(\"unused_other(38)\"))); // private int usedByUnusedVar() { ... }\n}\n@Test\n" } ]
Java
MIT License
georgewfraser/java-language-server
More complex refactoring
244,058
16.11.2019 19:07:17
28,800
47f39ff7d7abc0a287107c60cd770c031a504c8f
Make more selective
[ { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/Refactor.java", "new_path": "src/main/java/org/javacs/Refactor.java", "diff": "package org.javacs;\n+import com.sun.source.tree.Tree;\nimport com.sun.source.tree.VariableTree;\nimport com.sun.source.util.TreePath;\nimport java.util.List;\nimport java.util.Map;\n-import java.util.logging.Logger;\nimport org.javacs.lsp.*;\ninterface Refactor {\n@@ -13,7 +13,7 @@ interface Refactor {\nCodeAction refactor(Parser parse, TreePath error);\nRefactor[] RULES = { // TODO this is used!\n- new PrependUnderscore(), new RemoveVar(),\n+ new PrependUnderscore(), new ConvertToStatement(),\n};\nclass PrependUnderscore implements Refactor {\n@@ -35,21 +35,38 @@ interface Refactor {\n}\n}\n- class RemoveVar implements Refactor {\n+ class ConvertToStatement implements Refactor {\n@Override\npublic boolean canRefactor(Diagnostic d) {\nreturn d.code.equals(\"unused_local\");\n}\n+ /** https://docs.oracle.com/javase/specs/jls/se13/html/jls-14.html#jls-14.8 */\n+ static boolean isExpressionStatement(Tree t) {\n+ switch (t.getKind()) {\n+ case ASSIGNMENT:\n+ case PREFIX_INCREMENT:\n+ case PREFIX_DECREMENT:\n+ case POSTFIX_INCREMENT:\n+ case POSTFIX_DECREMENT:\n+ case METHOD_INVOCATION:\n+ case NEW_CLASS:\n+ return true;\n+ default:\n+ return false;\n+ }\n+ }\n+\n@Override\npublic CodeAction refactor(Parser parse, TreePath error) {\n- LOG.info(\"Try to remove LHS...\");\nif (!(error.getLeaf() instanceof VariableTree)) {\n- LOG.info(\"...not a variable\");\nreturn CodeAction.NONE;\n}\n- var file = error.getCompilationUnit().getSourceFile().toUri();\nvar variable = (VariableTree) error.getLeaf();\n+ if (!isExpressionStatement(variable.getInitializer())) {\n+ return CodeAction.NONE;\n+ }\n+ var file = error.getCompilationUnit().getSourceFile().toUri();\nvar expression = variable.getInitializer();\nvar pos = parse.trees.getSourcePositions();\nvar startVar = (int) pos.getStartPosition(parse.root, variable);\n@@ -58,12 +75,10 @@ interface Refactor {\nvar edit = new TextEdit(delete, \"\");\nvar a = new CodeAction();\na.kind = CodeActionKind.QuickFix;\n- a.title = \"Remove variable\";\n+ a.title = \"Convert to statement\";\na.edit = new WorkspaceEdit();\na.edit.changes = Map.of(file, List.of(edit));\nreturn a;\n}\n}\n-\n- Logger LOG = Logger.getLogger(\"main\");\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/test/examples/maven-project/src/org/javacs/action/TestCantConvertToStatement.java", "diff": "+package org.javacs.docs.action;\n+\n+class TestCantConvertToStatement {\n+ void test() {\n+ int unusedLocal = 1;\n+ }\n+}\n\\ No newline at end of file\n" }, { "change_type": "RENAME", "old_path": "src/test/examples/maven-project/src/org/javacs/action/TestRemoveVar.java", "new_path": "src/test/examples/maven-project/src/org/javacs/action/TestConvertToStatement.java", "diff": "package org.javacs.docs.action;\n-class TestRemoveVar {\n+class TestConvertToStatement {\nvoid test() {\nint unusedLocal = makeInt();\n}\n" }, { "change_type": "MODIFY", "old_path": "src/test/java/org/javacs/CodeActionTest.java", "new_path": "src/test/java/org/javacs/CodeActionTest.java", "diff": "@@ -12,7 +12,8 @@ public class CodeActionTest {\nprivate static List<Diagnostic> errors = new ArrayList<>();\nprotected static final JavaLanguageServer server = LanguageServerFixture.getJavaLanguageServer(errors::add);\nprivate static final String[][] cases = {\n- {\"org/javacs/action/TestRemoveVar.java\", \"Remove variable\"},\n+ {\"org/javacs/action/TestCantConvertToStatement.java\"},\n+ {\"org/javacs/action/TestConvertToStatement.java\", \"Convert to statement\"},\n{\"org/javacs/action/TestPrefixParam.java\", \"Prefix with underscore\"},\n};\n@@ -27,9 +28,11 @@ public class CodeActionTest {\nparams.context.diagnostics = errors;\nvar actions = server.codeAction(params);\nvar titles = titles(actions);\n+ var expect = new String[c.length - 1];\nfor (int i = 1; i < c.length; i++) {\n- assertThat(titles, hasItem(c[i]));\n+ expect[i - 1] = c[i];\n}\n+ assertThat(titles, hasItems(expect));\n}\n}\n" } ]
Java
MIT License
georgewfraser/java-language-server
Make more selective
244,058
16.11.2019 19:22:46
28,800
4589a56f1832d7f454d43d9e4e7d4611dcf2359b
Convert-to-block refactor
[ { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/FindRange.java", "new_path": "src/main/java/org/javacs/FindRange.java", "diff": "@@ -3,7 +3,6 @@ package org.javacs;\nimport com.sun.source.tree.*;\nimport com.sun.source.util.*;\nimport java.util.Objects;\n-import java.util.logging.Logger;\n// Search for the smallest element that encompasses a range\nclass FindRange extends TreePathScanner<Void, Void> {\n@@ -18,13 +17,11 @@ class FindRange extends TreePathScanner<Void, Void> {\nthis.start = start;\nthis.end = end;\nthis.root = root;\n- LOG.info(\"find \" + start + \" - \" + end);\n}\nboolean containsRange(Tree tree) {\nObjects.requireNonNull(root, \"root was never set\");\nlong start = pos.getStartPosition(root, tree), end = pos.getEndPosition(root, tree);\n- LOG.info(tree + \" spans \" + start + \" - \" + end);\nreturn start <= this.start && this.end <= end;\n}\n@@ -46,6 +43,4 @@ class FindRange extends TreePathScanner<Void, Void> {\n}\nreturn null;\n}\n-\n- private static final Logger LOG = Logger.getLogger(\"main\");\n}\n" }, { "change_type": "MODIFY", "old_path": "src/main/java/org/javacs/Refactor.java", "new_path": "src/main/java/org/javacs/Refactor.java", "diff": "@@ -5,6 +5,7 @@ import com.sun.source.tree.VariableTree;\nimport com.sun.source.util.TreePath;\nimport java.util.List;\nimport java.util.Map;\n+import javax.lang.model.element.Modifier;\nimport org.javacs.lsp.*;\ninterface Refactor {\n@@ -13,7 +14,7 @@ interface Refactor {\nCodeAction refactor(Parser parse, TreePath error);\nRefactor[] RULES = { // TODO this is used!\n- new PrependUnderscore(), new ConvertToStatement(),\n+ new PrependUnderscore(), new ConvertToStatement(), new ConvertToBlock(),\n};\nclass PrependUnderscore implements Refactor {\n@@ -63,11 +64,11 @@ interface Refactor {\nreturn CodeAction.NONE;\n}\nvar variable = (VariableTree) error.getLeaf();\n- if (!isExpressionStatement(variable.getInitializer())) {\n+ var expression = variable.getInitializer();\n+ if (!isExpressionStatement(expression)) {\nreturn CodeAction.NONE;\n}\nvar file = error.getCompilationUnit().getSourceFile().toUri();\n- var expression = variable.getInitializer();\nvar pos = parse.trees.getSourcePositions();\nvar startVar = (int) pos.getStartPosition(parse.root, variable);\nvar startRhs = (int) pos.getStartPosition(parse.root, expression);\n@@ -81,4 +82,44 @@ interface Refactor {\nreturn a;\n}\n}\n+\n+ class ConvertToBlock implements Refactor {\n+ @Override\n+ public boolean canRefactor(Diagnostic d) {\n+ return d.code.equals(\"unused_field\");\n+ }\n+\n+ @Override\n+ public CodeAction refactor(Parser parse, TreePath error) {\n+ if (!(error.getLeaf() instanceof VariableTree)) {\n+ return CodeAction.NONE;\n+ }\n+ var variable = (VariableTree) error.getLeaf();\n+ var expression = variable.getInitializer();\n+ if (expression == null) {\n+ return CodeAction.NONE;\n+ }\n+ if (!ConvertToStatement.isExpressionStatement(expression)) {\n+ return CodeAction.NONE;\n+ }\n+ var file = error.getCompilationUnit().getSourceFile().toUri();\n+ var pos = parse.trees.getSourcePositions();\n+ var startVar = (int) pos.getStartPosition(parse.root, variable);\n+ var startRhs = (int) pos.getStartPosition(parse.root, expression);\n+ var deleteLhs = new Span(startVar, startRhs).asRange(parse.root.getLineMap());\n+ var fixLhs = new TextEdit(deleteLhs, \"{ \");\n+ if (variable.getModifiers().getFlags().contains(Modifier.STATIC)) {\n+ fixLhs.newText = \"static {\";\n+ }\n+ var right = (int) pos.getEndPosition(parse.root, variable);\n+ var insertRight = new Span(right, right).asRange(parse.root.getLineMap());\n+ var fixRhs = new TextEdit(insertRight, \" }\");\n+ var a = new CodeAction();\n+ a.kind = CodeActionKind.QuickFix;\n+ a.title = \"Convert to block\";\n+ a.edit = new WorkspaceEdit();\n+ a.edit.changes = Map.of(file, List.of(fixLhs, fixRhs));\n+ return a;\n+ }\n+ }\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/test/examples/maven-project/src/org/javacs/action/TestConvertToBlock.java", "diff": "+package org.javacs.docs.action;\n+\n+class TestConvertToBlock {\n+ private int unusedField = makeInt();\n+\n+ int makeInt() {\n+ return 1;\n+ }\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/test/java/org/javacs/CodeActionTest.java", "new_path": "src/test/java/org/javacs/CodeActionTest.java", "diff": "@@ -14,6 +14,7 @@ public class CodeActionTest {\nprivate static final String[][] cases = {\n{\"org/javacs/action/TestCantConvertToStatement.java\"},\n{\"org/javacs/action/TestConvertToStatement.java\", \"Convert to statement\"},\n+ {\"org/javacs/action/TestConvertToBlock.java\", \"Convert to block\"},\n{\"org/javacs/action/TestPrefixParam.java\", \"Prefix with underscore\"},\n};\n" } ]
Java
MIT License
georgewfraser/java-language-server
Convert-to-block refactor