From de15f5777c25a590ca5fbabfa100328bd6dbb1c3 Mon Sep 17 00:00:00 2001 From: Chiara Seim Date: Tue, 5 Nov 2024 10:13:18 -0800 Subject: [PATCH] Add identity file to althea types lib --- althea_types/src/identity.rs | 3 +- althea_types/src/interop.rs | 94 +------------------ althea_types/src/legacy.rs | 5 +- althea_types/src/lib.rs | 1 + althea_types/src/websockets/encryption.rs | 3 +- althea_types/src/websockets/mod.rs | 4 +- antenna_forwarding_client/src/lib.rs | 2 +- antenna_forwarding_protocol/src/lib.rs | 2 +- integration_tests/src/setup_utils/rita.rs | 2 +- integration_tests/src/utils.rs | 2 +- rita_client/src/dashboard/neighbors.rs | 2 +- rita_client/src/exit_manager/exit_loop.rs | 2 +- rita_client/src/exit_manager/exit_switcher.rs | 2 +- rita_client/src/heartbeat/dummy.rs | 2 +- rita_client/src/heartbeat/mod.rs | 2 +- rita_client/src/operator_fee_manager/mod.rs | 2 +- .../src/operator_update/ops_websocket.rs | 2 +- rita_client/src/traffic_watcher/mod.rs | 2 +- rita_client_registration/src/client_db.rs | 2 +- rita_client_registration/src/lib.rs | 2 +- rita_common/src/dashboard/debts.rs | 2 +- rita_common/src/debt_keeper/mod.rs | 2 +- rita_common/src/payment_controller/mod.rs | 2 +- rita_common/src/payment_validator/mod.rs | 2 +- rita_common/src/peer_listener/message.rs | 8 +- .../src/simulated_txfee_manager/mod.rs | 2 +- rita_common/src/traffic_watcher/mod.rs | 2 +- rita_common/src/tunnel_manager/gc.rs | 2 +- rita_common/src/tunnel_manager/mod.rs | 4 +- .../src/tunnel_manager/neighbor_status.rs | 2 +- rita_common/src/usage_tracker/structs.rs | 2 +- rita_common/src/usage_tracker/tests.rs | 2 +- rita_db_migration/src/lib.rs | 2 +- rita_exit/src/database/in_memory_database.rs | 4 +- rita_exit/src/database/mod.rs | 2 +- rita_exit/src/network_endpoints/mod.rs | 2 +- rita_exit/src/rita_loop/mod.rs | 2 +- rita_exit/src/traffic_watcher/mod.rs | 2 +- settings/src/client.rs | 2 +- settings/src/exit.rs | 2 +- settings/src/lib.rs | 4 +- 41 files changed, 53 insertions(+), 139 deletions(-) diff --git a/althea_types/src/identity.rs b/althea_types/src/identity.rs index 7dc3208b0..a24d109bf 100644 --- a/althea_types/src/identity.rs +++ b/althea_types/src/identity.rs @@ -192,7 +192,7 @@ impl Identity { }; AbiToken::Struct(vec![ AbiToken::Uint(u128::from_be_bytes(ip_bytes).into()), - AbiToken::Uint(self.wg_public_key.into()), + AbiToken::Uint(self.wg_public_key.as_bytes().into()), AbiToken::Address(self.eth_address), ]) } @@ -253,6 +253,7 @@ impl Identity { ))) } }) + .to_be_bytes() .into(); // 3rd entry is the eth address diff --git a/althea_types/src/interop.rs b/althea_types/src/interop.rs index 69f2f9fa4..f8d0dc6c2 100644 --- a/althea_types/src/interop.rs +++ b/althea_types/src/interop.rs @@ -1,15 +1,13 @@ +use crate::identity::Identity; use crate::wg_key::WgKey; use crate::{ClientExtender, WifiDevice}; -use arrayvec::ArrayString; use babel_monitor::structs::Neighbor; use babel_monitor::structs::Route; use clarity::Address; -use deep_space::Address as AltheaAddress; use ipnetwork::IpNetwork; use num256::Uint256; use serde::Serialize; use serde::{Deserialize, Deserializer, Serializer}; -use std::collections::hash_map::DefaultHasher; use std::fmt; use std::fmt::Display; use std::hash::{Hash, Hasher}; @@ -17,98 +15,8 @@ use std::net::IpAddr; use std::str::FromStr; use std::time::{Duration, SystemTime}; -/// This is how nodes are identified. -#[derive(Debug, Serialize, Deserialize, Clone, Copy)] -pub struct Identity { - pub mesh_ip: IpAddr, - pub eth_address: Address, - pub wg_public_key: WgKey, - pub nickname: Option>, -} - -impl Display for Identity { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self.nickname { - Some(nick) => { - write!( - f, - "nickname: {}, mesh_ip: {}, eth_address: {}, althea_address: {:?}, wg_pubkey {}", - nick, self.mesh_ip, self.eth_address, self.get_althea_address(), self.wg_public_key - ) - } - None => write!( - f, - "mesh_ip: {}, eth_address: {}, althea_address: {:?}, wg_pubkey {}", - self.mesh_ip, - self.eth_address, - self.get_althea_address(), - self.wg_public_key - ), - } - } -} - pub const ALTHEA_PREFIX: &str = "althea"; -impl Identity { - pub fn new( - mesh_ip: IpAddr, - eth_address: Address, - wg_public_key: WgKey, - nickname: Option>, - ) -> Identity { - Identity { - mesh_ip, - eth_address, - wg_public_key, - nickname, - } - } - - /// Returns true if this identity is converged, meaning the Althea address is - /// derived from and is interchangeable with the ETH address. If false we have - /// to avoid assumptions avoid these being the same private key - pub fn get_althea_address(&self) -> AltheaAddress { - AltheaAddress::from_slice(self.eth_address.as_bytes(), ALTHEA_PREFIX).unwrap() - } - - pub fn get_hash(&self) -> u64 { - let mut hasher = DefaultHasher::new(); - self.hash(&mut hasher); - hasher.finish() - } - - pub fn get_hash_array(&self) -> [u8; 8] { - let mut hasher = DefaultHasher::new(); - self.hash(&mut hasher); - let bits = hasher.finish(); - bits.to_be_bytes() - } -} - -// Comparison ignoring nicknames to allow changing -// nicknames without breaking everything -impl PartialEq for Identity { - fn eq(&self, other: &Identity) -> bool { - self.mesh_ip == other.mesh_ip - && self.eth_address == other.eth_address - && self.wg_public_key == other.wg_public_key - } -} - -// I don't understand why we need this -// docs insist on it though https://doc.rust-lang.org/std/cmp/trait.Eq.html -impl Eq for Identity {} - -// Custom hash implementation that also ignores nickname -impl Hash for Identity { - fn hash(&self, state: &mut H) { - self.mesh_ip.hash(state); - self.eth_address.hash(state); - self.wg_public_key.hash(state); - } -} - #[derive(PartialEq, Eq, Hash, Clone, Debug, Serialize, Deserialize)] pub struct Denom { /// String representation of token, ex, ualthea, wei, from athea chain will be some unpredictable ibc/ diff --git a/althea_types/src/legacy.rs b/althea_types/src/legacy.rs index b21d3dfd3..d474c4145 100644 --- a/althea_types/src/legacy.rs +++ b/althea_types/src/legacy.rs @@ -9,10 +9,11 @@ use std::time::Duration; use babel_monitor::structs::BabeldConfig; use clarity::Address; +use crate::identity::Identity; use crate::{ websockets::OperatorAction, BillingDetails, ContactType, ExitConnection, HardwareInfo, - Identity, InstallationDetails, NeighborStatus, ShaperSettings, SystemChain, UpdateType, - UpdateTypeLegacy, UsageTrackerFlat, UsageTrackerTransfer, + InstallationDetails, NeighborStatus, ShaperSettings, SystemChain, UpdateType, UpdateTypeLegacy, + UsageTrackerFlat, UsageTrackerTransfer, }; fn default_ops_last_seen_usage_hour() -> u64 { diff --git a/althea_types/src/lib.rs b/althea_types/src/lib.rs index 25b9895e5..75c7fee42 100644 --- a/althea_types/src/lib.rs +++ b/althea_types/src/lib.rs @@ -3,6 +3,7 @@ extern crate serde_derive; pub mod contact_info; pub mod error; +pub mod identity; pub mod interop; pub mod legacy; pub mod monitoring; diff --git a/althea_types/src/websockets/encryption.rs b/althea_types/src/websockets/encryption.rs index 39bae1ae2..b3beba3a2 100644 --- a/althea_types/src/websockets/encryption.rs +++ b/althea_types/src/websockets/encryption.rs @@ -157,8 +157,9 @@ mod tests { use std::net::IpAddr; use crate::{ + identity::Identity, websockets::{OperatorWebsocketMessage, RouterWebsocketMessage, WsOperatorAddressStruct}, - Identity, WgKey, + WgKey, }; // test encryption and decryption of router messages diff --git a/althea_types/src/websockets/mod.rs b/althea_types/src/websockets/mod.rs index 02dcf1f78..1339f0b23 100644 --- a/althea_types/src/websockets/mod.rs +++ b/althea_types/src/websockets/mod.rs @@ -7,8 +7,8 @@ use num256::Uint256; pub mod encryption; use crate::{ - BillingDetails, ContactType, ExitConnection, HardwareInfo, Identity, InstallationDetails, - NeighborStatus, ShaperSettings, SystemChain, UpdateType, UpdateTypeLegacy, + identity::Identity, BillingDetails, ContactType, ExitConnection, HardwareInfo, + InstallationDetails, NeighborStatus, ShaperSettings, SystemChain, UpdateType, UpdateTypeLegacy, UsageTrackerTransfer, WgKey, WifiToken, }; diff --git a/antenna_forwarding_client/src/lib.rs b/antenna_forwarding_client/src/lib.rs index 7154426f8..6c7226424 100644 --- a/antenna_forwarding_client/src/lib.rs +++ b/antenna_forwarding_client/src/lib.rs @@ -9,7 +9,7 @@ extern crate lazy_static; use althea_kernel_interface::KernelInterface; use althea_kernel_interface::LinuxCommandRunner; -use althea_types::Identity; +use althea_types::identity::Identity; use althea_types::WgKey; use antenna_forwarding_protocol::process_streams; use antenna_forwarding_protocol::write_all_spinlock; diff --git a/antenna_forwarding_protocol/src/lib.rs b/antenna_forwarding_protocol/src/lib.rs index 8ecaea7a1..76201a505 100644 --- a/antenna_forwarding_protocol/src/lib.rs +++ b/antenna_forwarding_protocol/src/lib.rs @@ -14,7 +14,7 @@ extern crate log; #[macro_use] extern crate lazy_static; -use althea_types::Identity; +use althea_types::identity::Identity; use althea_types::WgKey; use sodiumoxide::crypto::box_; use sodiumoxide::crypto::box_::Nonce; diff --git a/integration_tests/src/setup_utils/rita.rs b/integration_tests/src/setup_utils/rita.rs index ac4b814f9..8ee8b7223 100644 --- a/integration_tests/src/setup_utils/rita.rs +++ b/integration_tests/src/setup_utils/rita.rs @@ -5,7 +5,7 @@ use super::namespaces::get_nsfd; use super::namespaces::NamespaceInfo; use super::namespaces::NodeType; use althea_kernel_interface::KernelInterfaceError; -use althea_types::Identity; +use althea_types::identity::Identity; use clarity::Address; use ipnetwork::IpNetwork; use ipnetwork::Ipv6Network; diff --git a/integration_tests/src/utils.rs b/integration_tests/src/utils.rs index 2cf9d417d..8c559669f 100644 --- a/integration_tests/src/utils.rs +++ b/integration_tests/src/utils.rs @@ -17,7 +17,7 @@ use althea_proto::{ query_client::QueryClient, Metadata, QueryDenomMetadataRequest, }, }; -use althea_types::{ContactType, Denom, Identity, SystemChain, WgKey}; +use althea_types::{identity::Identity, ContactType, Denom, SystemChain, WgKey}; use awc::http::StatusCode; use babel_monitor::{open_babel_stream, parse_routes, structs::Route}; use clarity::{Address, Transaction, Uint256}; diff --git a/rita_client/src/dashboard/neighbors.rs b/rita_client/src/dashboard/neighbors.rs index d24d16fa5..0cd10485a 100644 --- a/rita_client/src/dashboard/neighbors.rs +++ b/rita_client/src/dashboard/neighbors.rs @@ -1,6 +1,6 @@ use actix_web_async::http::StatusCode; use actix_web_async::{HttpRequest, HttpResponse}; -use althea_types::Identity; +use althea_types::identity::Identity; use arrayvec::ArrayString; use babel_monitor::parsing::get_installed_route; use babel_monitor::parsing::get_route_via_neigh; diff --git a/rita_client/src/exit_manager/exit_loop.rs b/rita_client/src/exit_manager/exit_loop.rs index 52ed762a3..304ec4c69 100644 --- a/rita_client/src/exit_manager/exit_loop.rs +++ b/rita_client/src/exit_manager/exit_loop.rs @@ -8,9 +8,9 @@ use crate::exit_manager::{ }; use crate::traffic_watcher::{query_exit_debts, QueryExitDebts}; use actix_async::System as AsyncSystem; +use althea_types::identity::Identity; use althea_types::ExitList; use althea_types::ExitState; -use althea_types::Identity; use futures::future::join_all; use futures::join; use rita_common::blockchain_oracle::low_balance; diff --git a/rita_client/src/exit_manager/exit_switcher.rs b/rita_client/src/exit_manager/exit_switcher.rs index 5869f73ea..7323bcc8b 100644 --- a/rita_client/src/exit_manager/exit_switcher.rs +++ b/rita_client/src/exit_manager/exit_switcher.rs @@ -758,7 +758,7 @@ pub fn get_babel_routes(babel_port: u16) -> Result, RitaClientError> #[cfg(test)] mod tests { - use althea_types::{FromStr, Identity, WgKey}; + use althea_types::{identity::Identity, FromStr, WgKey}; use clarity::Address; use ipnetwork::IpNetwork; diff --git a/rita_client/src/heartbeat/dummy.rs b/rita_client/src/heartbeat/dummy.rs index 92bb5f4e5..7f29f90d0 100644 --- a/rita_client/src/heartbeat/dummy.rs +++ b/rita_client/src/heartbeat/dummy.rs @@ -1,8 +1,8 @@ //! This module contains a bunch of dummy functions that are called to populate a dummy exit so that heart beats //! send data to op tools without actually being connected to an exit +use althea_types::identity::Identity; use althea_types::ExitDetails; use althea_types::FromStr; -use althea_types::Identity; use althea_types::LocalIdentity; use althea_types::WgKey; use babel_monitor::structs::Neighbor; diff --git a/rita_client/src/heartbeat/mod.rs b/rita_client/src/heartbeat/mod.rs index 7aed31857..cf024d926 100644 --- a/rita_client/src/heartbeat/mod.rs +++ b/rita_client/src/heartbeat/mod.rs @@ -29,8 +29,8 @@ use rita_common::tunnel_manager::Neighbor as RitaNeighbor; use crate::exit_manager::get_selected_exit_ip as get_selected_exit_em; +use althea_types::identity::Identity; use althea_types::HeartbeatMessage; -use althea_types::Identity; use althea_types::WgKey; use babel_monitor::structs::Neighbor; use babel_monitor::structs::Route; diff --git a/rita_client/src/operator_fee_manager/mod.rs b/rita_client/src/operator_fee_manager/mod.rs index 3a7987e59..e5ec792ef 100644 --- a/rita_client/src/operator_fee_manager/mod.rs +++ b/rita_client/src/operator_fee_manager/mod.rs @@ -14,7 +14,7 @@ //! will need to be re-written to better reflect a normal billing system at some point, perhaps //! querying an API for an individual bill. As this is not designed to be a trustless payment -use althea_types::Identity; +use althea_types::identity::Identity; use althea_types::PaymentTx; use num256::Uint256; use rita_common::blockchain_oracle::get_oracle_balance; diff --git a/rita_client/src/operator_update/ops_websocket.rs b/rita_client/src/operator_update/ops_websocket.rs index 8608d6653..91b3afa78 100644 --- a/rita_client/src/operator_update/ops_websocket.rs +++ b/rita_client/src/operator_update/ops_websocket.rs @@ -5,11 +5,11 @@ use crate::operator_update::{ use actix_async::System; use actix_web_actors::ws; use althea_types::{ + identity::Identity, websockets::{ OperatorWebsocketResponse, RouterWebsocketMessage, WsConnectionDetailsStruct, WsCustomerDetailsStruct, WsOperatorAddressStruct, WsTimeseriesDataStruct, }, - Identity, }; use awc::ws::Frame; use crypto_box::{PublicKey, SecretKey}; diff --git a/rita_client/src/traffic_watcher/mod.rs b/rita_client/src/traffic_watcher/mod.rs index 09b4c4720..5a73b896c 100644 --- a/rita_client/src/traffic_watcher/mod.rs +++ b/rita_client/src/traffic_watcher/mod.rs @@ -23,7 +23,7 @@ use crate::rita_loop::is_gateway_client; use crate::RitaClientError; -use althea_types::Identity; +use althea_types::identity::Identity; use babel_monitor::parsing::get_installed_route; use babel_monitor::structs::BabelMonitorError; use babel_monitor::structs::Route; diff --git a/rita_client_registration/src/client_db.rs b/rita_client_registration/src/client_db.rs index f8e7396e0..0c66ee281 100644 --- a/rita_client_registration/src/client_db.rs +++ b/rita_client_registration/src/client_db.rs @@ -1,6 +1,6 @@ use std::{net::IpAddr, time::Duration}; -use althea_types::{Identity, WgKey}; +use althea_types::{identity::Identity, WgKey}; use clarity::{ abi::{encode_call, AbiToken}, utils::bytes_to_hex_str, diff --git a/rita_client_registration/src/lib.rs b/rita_client_registration/src/lib.rs index e649e9fda..3a8306035 100644 --- a/rita_client_registration/src/lib.rs +++ b/rita_client_registration/src/lib.rs @@ -7,7 +7,7 @@ use std::{ time::Duration, }; -use althea_types::{ExitClientIdentity, Identity, WgKey}; +use althea_types::{identity::Identity, ExitClientIdentity, WgKey}; use awc::error::{JsonPayloadError, SendRequestError}; use clarity::Address; use phonenumber::PhoneNumber; diff --git a/rita_common/src/dashboard/debts.rs b/rita_common/src/dashboard/debts.rs index 30f52930a..b867df399 100644 --- a/rita_common/src/dashboard/debts.rs +++ b/rita_common/src/dashboard/debts.rs @@ -2,7 +2,7 @@ use crate::debt_keeper::get_debts_list; use crate::debt_keeper::traffic_replace; use crate::debt_keeper::Traffic; use actix_web_async::{web::Json, HttpRequest, HttpResponse}; -use althea_types::Identity; +use althea_types::identity::Identity; pub async fn get_debts(_req: HttpRequest) -> HttpResponse { trace!("get_debts: Hit"); diff --git a/rita_common/src/debt_keeper/mod.rs b/rita_common/src/debt_keeper/mod.rs index 19cb807b7..c28075f7a 100755 --- a/rita_common/src/debt_keeper/mod.rs +++ b/rita_common/src/debt_keeper/mod.rs @@ -16,8 +16,8 @@ use crate::tunnel_manager::TunnelAction; use crate::tunnel_manager::TunnelChange; use crate::RitaCommonError; use crate::KI; +use althea_types::identity::Identity; use althea_types::Denom; -use althea_types::Identity; use althea_types::UnpublishedPaymentTx; use num256::{Int256, Uint256}; use num_traits::identities::Zero; diff --git a/rita_common/src/payment_controller/mod.rs b/rita_common/src/payment_controller/mod.rs index b2c4d4cbd..43060e695 100644 --- a/rita_common/src/payment_controller/mod.rs +++ b/rita_common/src/payment_controller/mod.rs @@ -10,8 +10,8 @@ use crate::payment_validator::ToValidate; use crate::payment_validator::{ALTHEA_CHAIN_PREFIX, ALTHEA_CONTACT_TIMEOUT}; use crate::rita_loop::get_web3_server; use althea_types::interop::UnpublishedPaymentTx; +use althea_types::{identity::Identity, SystemChain}; use althea_types::{Denom, PaymentTx}; -use althea_types::{Identity, SystemChain}; use awc; use deep_space::client::ChainStatus; use deep_space::{Coin, Contact, EthermintPrivateKey}; diff --git a/rita_common/src/payment_validator/mod.rs b/rita_common/src/payment_validator/mod.rs index 585ad073a..5e18403a4 100644 --- a/rita_common/src/payment_validator/mod.rs +++ b/rita_common/src/payment_validator/mod.rs @@ -16,8 +16,8 @@ use crate::usage_tracker::update_payments; use crate::RitaCommonError; use crate::KI; use althea_proto::althea::microtx::v1::MsgMicrotx; +use althea_types::identity::Identity; use althea_types::Denom; -use althea_types::Identity; use althea_types::PaymentTx; use althea_types::SystemChain; use clarity::Address; diff --git a/rita_common/src/peer_listener/message.rs b/rita_common/src/peer_listener/message.rs index 80c4a8f94..ffda367bb 100644 --- a/rita_common/src/peer_listener/message.rs +++ b/rita_common/src/peer_listener/message.rs @@ -248,7 +248,7 @@ fn test_decode_imhere_with_multicast_interface() { fn test_hello_serde() { use crate::peer_listener::Hello; use crate::peer_listener::Peer; - use althea_types::Identity; + use althea_types::identity::Identity; use althea_types::LocalIdentity; use althea_types::WgKey; use bincode; @@ -293,7 +293,7 @@ fn test_hello_serde() { fn test_encoded_hello_size() { use crate::peer_listener::Hello; use crate::peer_listener::Peer; - use althea_types::Identity; + use althea_types::identity::Identity; use althea_types::LocalIdentity; use althea_types::WgKey; use clarity::Address; @@ -348,7 +348,7 @@ fn test_encoded_hello_size() { fn test_hello_encode_decode() { use crate::peer_listener::Hello; use crate::peer_listener::Peer; - use althea_types::Identity; + use althea_types::identity::Identity; use althea_types::LocalIdentity; use althea_types::WgKey; use clarity::Address; @@ -412,7 +412,7 @@ fn test_hello_encode_decode() { fn test_deserialize_with_wrong_serialization() { use crate::peer_listener::Hello; use crate::peer_listener::Peer; - use althea_types::Identity; + use althea_types::identity::Identity; use althea_types::LocalIdentity; use althea_types::WgKey; use clarity::Address; diff --git a/rita_common/src/simulated_txfee_manager/mod.rs b/rita_common/src/simulated_txfee_manager/mod.rs index 323a93b30..5359ff0cd 100644 --- a/rita_common/src/simulated_txfee_manager/mod.rs +++ b/rita_common/src/simulated_txfee_manager/mod.rs @@ -5,7 +5,7 @@ use crate::payment_controller::TRANSACTION_SUBMISSION_TIMEOUT; use crate::rita_loop::get_web3_server; use crate::usage_tracker::update_payments; use crate::KI; -use althea_types::Identity; +use althea_types::identity::Identity; use althea_types::PaymentTx; use num256::Uint256; use num_traits::{Signed, Zero}; diff --git a/rita_common/src/traffic_watcher/mod.rs b/rita_common/src/traffic_watcher/mod.rs index cfc3091e0..91b743ff7 100644 --- a/rita_common/src/traffic_watcher/mod.rs +++ b/rita_common/src/traffic_watcher/mod.rs @@ -12,7 +12,7 @@ use crate::RitaCommonError; use crate::KI; use althea_kernel_interface::open_tunnel::is_link_local; use althea_kernel_interface::FilterTarget; -use althea_types::Identity; +use althea_types::identity::Identity; use babel_monitor::structs::Route; use ipnetwork::IpNetwork; diff --git a/rita_common/src/tunnel_manager/gc.rs b/rita_common/src/tunnel_manager/gc.rs index fcf5f58b4..8cf7384bb 100644 --- a/rita_common/src/tunnel_manager/gc.rs +++ b/rita_common/src/tunnel_manager/gc.rs @@ -1,6 +1,6 @@ use super::{Tunnel, TunnelManager}; use crate::KI; -use althea_types::Identity; +use althea_types::identity::Identity; use babel_monitor::structs::Interface; use std::time::Duration; use std::{collections::HashMap, time::Instant}; diff --git a/rita_common/src/tunnel_manager/mod.rs b/rita_common/src/tunnel_manager/mod.rs index 2f8ab367d..6d1e9d646 100644 --- a/rita_common/src/tunnel_manager/mod.rs +++ b/rita_common/src/tunnel_manager/mod.rs @@ -22,7 +22,7 @@ use crate::KI; use crate::TUNNEL_HANDSHAKE_TIMEOUT; use crate::TUNNEL_TIMEOUT; use althea_kernel_interface::open_tunnel::TunnelOpenArgs; -use althea_types::Identity; +use althea_types::identity::Identity; use althea_types::LocalIdentity; use babel_monitor::monitor; use babel_monitor::open_babel_stream; @@ -661,7 +661,7 @@ pub mod tests { use crate::tunnel_manager::get_test_tunnel; use crate::tunnel_manager::Tunnel; use crate::tunnel_manager::TunnelManager; - use althea_types::Identity; + use althea_types::identity::Identity; /// gets a mutable reference tunnel from the list with the given index fn get_mut_tunnel_by_ifidx(ifidx: u32, tunnels: &mut [Tunnel]) -> Option<&mut Tunnel> { diff --git a/rita_common/src/tunnel_manager/neighbor_status.rs b/rita_common/src/tunnel_manager/neighbor_status.rs index ad8ee1d08..35692f4e7 100644 --- a/rita_common/src/tunnel_manager/neighbor_status.rs +++ b/rita_common/src/tunnel_manager/neighbor_status.rs @@ -1,6 +1,6 @@ use super::get_tunnel_manager; use super::PaymentState; -use althea_types::Identity; +use althea_types::identity::Identity; use althea_types::NeighborStatus; use std::collections::HashMap; diff --git a/rita_common/src/usage_tracker/structs.rs b/rita_common/src/usage_tracker/structs.rs index c65d6dbaa..b9749b21b 100644 --- a/rita_common/src/usage_tracker/structs.rs +++ b/rita_common/src/usage_tracker/structs.rs @@ -1,4 +1,4 @@ -use althea_types::{Identity, IndexedUsageHour, PaymentTx, Usage}; +use althea_types::{identity::Identity, IndexedUsageHour, PaymentTx, Usage}; use num256::Uint256; use std::collections::{HashMap, HashSet, VecDeque}; use std::hash::Hash; diff --git a/rita_common/src/usage_tracker/tests.rs b/rita_common/src/usage_tracker/tests.rs index 3b8a0834f..e173ba2fa 100644 --- a/rita_common/src/usage_tracker/tests.rs +++ b/rita_common/src/usage_tracker/tests.rs @@ -11,7 +11,7 @@ pub mod test { }; use crate::RitaCommonError; use althea_types::{ - convert_map_to_flat_usage_data, Identity, IndexedUsageHour, UnpublishedPaymentTx, + convert_map_to_flat_usage_data, identity::Identity, IndexedUsageHour, UnpublishedPaymentTx, UsageTrackerTransfer, }; use flate2::write::ZlibEncoder; diff --git a/rita_db_migration/src/lib.rs b/rita_db_migration/src/lib.rs index dedddae6e..fce76512d 100644 --- a/rita_db_migration/src/lib.rs +++ b/rita_db_migration/src/lib.rs @@ -10,7 +10,7 @@ pub mod models; pub mod schema; use crate::schema::clients::dsl::clients; -use althea_types::Identity; +use althea_types::identity::Identity; use diesel::{r2d2::ConnectionManager, PgConnection, RunQueryDsl}; use error::RitaDBMigrationError; use models::Client; diff --git a/rita_exit/src/database/in_memory_database.rs b/rita_exit/src/database/in_memory_database.rs index 74f549404..53cc8f6fc 100644 --- a/rita_exit/src/database/in_memory_database.rs +++ b/rita_exit/src/database/in_memory_database.rs @@ -1,5 +1,5 @@ use althea_kernel_interface::ExitClient; -use althea_types::{Identity, WgKey}; +use althea_types::{identity::Identity, WgKey}; use ipnetwork::{IpNetwork, Ipv4Network, Ipv6Network}; use std::collections::hash_map::DefaultHasher; use std::collections::{HashMap, HashSet}; @@ -315,7 +315,7 @@ pub fn display_hashset(input: &HashSet) -> String { #[cfg(test)] mod tests { - use althea_types::Identity; + use althea_types::identity::Identity; use ipnetwork::IpNetwork; use crate::database::in_memory_database::{ diff --git a/rita_exit/src/database/mod.rs b/rita_exit/src/database/mod.rs index 8eec34729..3e50117df 100644 --- a/rita_exit/src/database/mod.rs +++ b/rita_exit/src/database/mod.rs @@ -15,7 +15,7 @@ use crate::rita_loop::LEGACY_INTERFACE; use crate::IpAssignmentMap; use crate::RitaExitError; use althea_kernel_interface::ExitClient; -use althea_types::Identity; +use althea_types::identity::Identity; use althea_types::WgKey; use althea_types::{ExitClientDetails, ExitClientIdentity, ExitDetails, ExitState, ExitVerifMode}; use clarity::Address; diff --git a/rita_exit/src/network_endpoints/mod.rs b/rita_exit/src/network_endpoints/mod.rs index 4bd85083c..2d407f5b5 100644 --- a/rita_exit/src/network_endpoints/mod.rs +++ b/rita_exit/src/network_endpoints/mod.rs @@ -5,10 +5,10 @@ use crate::database::{client_status, get_exit_info, signup_client}; use crate::RitaExitError; use actix_web_async::{http::StatusCode, web::Json, HttpRequest, HttpResponse, Result}; +use althea_types::{identity::Identity, EncryptedExitList}; use althea_types::{ EncryptedExitClientIdentity, EncryptedExitState, ExitClientIdentity, ExitState, ExitSystemTime, }; -use althea_types::{EncryptedExitList, Identity}; use althea_types::{ExitList, WgKey}; use num256::Int256; use rita_common::blockchain_oracle::potential_payment_issues_detected; diff --git a/rita_exit/src/rita_loop/mod.rs b/rita_exit/src/rita_loop/mod.rs index 5df0816b4..51c07d82a 100644 --- a/rita_exit/src/rita_loop/mod.rs +++ b/rita_exit/src/rita_loop/mod.rs @@ -20,7 +20,7 @@ use actix_async::System as AsyncSystem; use actix_web_async::{web, App, HttpServer}; use althea_kernel_interface::wg_iface_counter::WgUsage; use althea_kernel_interface::ExitClient; -use althea_types::{Identity, WgKey}; +use althea_types::{identity::Identity, WgKey}; use babel_monitor::{open_babel_stream, parse_routes}; use rita_client_registration::client_db::get_all_regsitered_clients; diff --git a/rita_exit/src/traffic_watcher/mod.rs b/rita_exit/src/traffic_watcher/mod.rs index be0811a33..4fd7e63d3 100644 --- a/rita_exit/src/traffic_watcher/mod.rs +++ b/rita_exit/src/traffic_watcher/mod.rs @@ -15,7 +15,7 @@ use crate::RitaExitError; use althea_kernel_interface::wg_iface_counter::prepare_usage_history; use althea_kernel_interface::wg_iface_counter::WgUsage; use althea_kernel_interface::KI; -use althea_types::Identity; +use althea_types::identity::Identity; use althea_types::WgKey; use babel_monitor::structs::Route; use ipnetwork::IpNetwork; diff --git a/settings/src/client.rs b/settings/src/client.rs index 55fa0b670..9b64a6bcc 100644 --- a/settings/src/client.rs +++ b/settings/src/client.rs @@ -5,7 +5,7 @@ use crate::operator::OperatorSettings; use crate::payment::PaymentSettings; use crate::{json_merge, set_rita_client, SettingsError}; use althea_types::wg_key::WgKey; -use althea_types::{ContactStorage, ExitState, Identity}; +use althea_types::{identity::Identity, ContactStorage, ExitState}; use clarity::Address; use ipnetwork::IpNetwork; use std::collections::{HashMap, HashSet}; diff --git a/settings/src/exit.rs b/settings/src/exit.rs index b691b6b82..ee0c051ba 100644 --- a/settings/src/exit.rs +++ b/settings/src/exit.rs @@ -2,7 +2,7 @@ use crate::localization::LocalizationSettings; use crate::network::NetworkSettings; use crate::payment::PaymentSettings; use crate::{json_merge, set_rita_exit, SettingsError}; -use althea_types::{Identity, WgKey}; +use althea_types::{identity::Identity, WgKey}; use clarity::Address; use core::str::FromStr; use ipnetwork::IpNetwork; diff --git a/settings/src/lib.rs b/settings/src/lib.rs index 61aeced3c..2ca1f2590 100644 --- a/settings/src/lib.rs +++ b/settings/src/lib.rs @@ -18,7 +18,9 @@ extern crate log; extern crate arrayvec; use althea_kernel_interface::KI; -use althea_types::{BillingDetails, ContactType, Identity, InstallationDetails, SystemChain}; +use althea_types::{ + identity::Identity, BillingDetails, ContactType, InstallationDetails, SystemChain, +}; use clarity::Address; use network::NetworkSettings; use payment::PaymentSettings;