diff --git a/rayhunter/src/config.rs b/rayhunter/src/config.rs
index 1e6ae39..ef910ac 100644
--- a/rayhunter/src/config.rs
+++ b/rayhunter/src/config.rs
@@ -1,4 +1,4 @@
-use crate::error::WavehunterError;
+use crate::error::RayhunterError;
use serde::Deserialize;
@@ -19,18 +19,18 @@ pub struct Config {
impl Default for Config {
fn default() -> Self {
Config {
- qmdl_store_path: "/data/wavehunter/qmdl".to_string(),
+ qmdl_store_path: "/data/rayhunter/qmdl".to_string(),
port: 8080,
readonly_mode: false,
}
}
}
-pub fn parse_config
(path: P) -> Result where P: AsRef {
+pub fn parse_config(path: P) -> Result where P: AsRef {
let mut config = Config::default();
if let Ok(config_file) = std::fs::read_to_string(&path) {
let parsed_config: ConfigFile = toml::from_str(&config_file)
- .map_err(WavehunterError::ConfigFileParsingError)?;
+ .map_err(RayhunterError::ConfigFileParsingError)?;
if let Some(path) = parsed_config.qmdl_store_path { config.qmdl_store_path = path }
if let Some(port) = parsed_config.port { config.port = port }
if let Some(readonly_mode) = parsed_config.readonly_mode { config.readonly_mode = readonly_mode }
diff --git a/rayhunter/src/diag.rs b/rayhunter/src/diag.rs
index f6e35ba..3aefe1b 100644
--- a/rayhunter/src/diag.rs
+++ b/rayhunter/src/diag.rs
@@ -12,7 +12,7 @@ use tokio::sync::mpsc::error::TryRecvError;
use tokio::task::JoinHandle;
use tokio_util::task::TaskTracker;
-use crate::error::WavehunterError;
+use crate::error::RayhunterError;
use crate::qmdl_store::QmdlStore;
use crate::server::ServerState;
@@ -22,7 +22,7 @@ pub enum DiagDeviceCtrlMessage {
Exit,
}
-pub fn run_diag_read_thread(task_tracker: &TaskTracker, mut dev: DiagDevice, mut qmdl_file_rx: Receiver, qmdl_store_lock: Arc>) -> JoinHandle> {
+pub fn run_diag_read_thread(task_tracker: &TaskTracker, mut dev: DiagDevice, mut qmdl_file_rx: Receiver, qmdl_store_lock: Arc>) -> JoinHandle> {
// mpsc channel for updating QmdlStore entry filesizes. First usize is the
// index, second is the size in bytes
let (tx, mut rx) = mpsc::channel::<(usize, usize)>(1);
@@ -67,7 +67,7 @@ pub fn run_diag_read_thread(task_tracker: &TaskTracker, mut dev: DiagDevice, mut
// returned here. Until then, the DiagDevice has already written those messages
// to the QMDL file, so we can just ignore them.
debug!("reading response from diag device...");
- let _messages = dev.read_response().map_err(WavehunterError::DiagReadError)?;
+ let _messages = dev.read_response().map_err(RayhunterError::DiagReadError)?;
debug!("got diag response ({} messages)", _messages.len());
// keep track of how many bytes were written to the QMDL file so we can read
diff --git a/rayhunter/src/error.rs b/rayhunter/src/error.rs
index ed1d34d..42c5f48 100644
--- a/rayhunter/src/error.rs
+++ b/rayhunter/src/error.rs
@@ -4,7 +4,7 @@ use orca::diag_device::DiagDeviceError;
use crate::qmdl_store::QmdlStoreError;
#[derive(Error, Debug)]
-pub enum WavehunterError {
+pub enum RayhunterError{
#[error("Config file parsing error: {0}")]
ConfigFileParsingError(#[from] toml::de::Error),
#[error("Diag intialization error: {0}")]
diff --git a/rayhunter/src/main.rs b/rayhunter/src/main.rs
index d135e04..41aec2c 100644
--- a/rayhunter/src/main.rs
+++ b/rayhunter/src/main.rs
@@ -12,7 +12,7 @@ use crate::qmdl_store::QmdlStore;
use crate::server::{ServerState, get_qmdl, serve_static};
use crate::pcap::get_pcap;
use crate::stats::get_system_stats;
-use crate::error::WavehunterError;
+use crate::error::RayhunterError;
use axum::response::Redirect;
use diag::{DiagDeviceCtrlMessage, start_recording, stop_recording};
@@ -73,11 +73,11 @@ async fn server_shutdown_signal(server_shutdown_rx: oneshot::Receiver<()>) {
// Loads a QmdlStore if one exists, and if not, only create one if we're not in
// readonly mode.
-async fn init_qmdl_store(config: &config::Config) -> Result {
+async fn init_qmdl_store(config: &config::Config) -> Result {
match (QmdlStore::exists(&config.qmdl_store_path).await?, config.readonly_mode) {
(true, _) => Ok(QmdlStore::load(&config.qmdl_store_path).await?),
(false, false) => Ok(QmdlStore::create(&config.qmdl_store_path).await?),
- (false, true) => Err(WavehunterError::NoStoreReadonlyMode(config.qmdl_store_path.clone())),
+ (false, true) => Err(RayhunterError::NoStoreReadonlyMode(config.qmdl_store_path.clone())),
}
}
@@ -89,7 +89,7 @@ fn run_ctrl_c_thread(
diag_device_sender: Sender,
server_shutdown_tx: oneshot::Sender<()>,
qmdl_store_lock: Arc>
-) -> JoinHandle> {
+) -> JoinHandle> {
task_tracker.spawn(async move {
match tokio::signal::ctrl_c().await {
Ok(()) => {
@@ -114,7 +114,7 @@ fn run_ctrl_c_thread(
}
#[tokio::main]
-async fn main() -> Result<(), WavehunterError> {
+async fn main() -> Result<(), RayhunterError> {
env_logger::init();
let args = parse_args();
@@ -130,9 +130,9 @@ async fn main() -> Result<(), WavehunterError> {
let qmdl_file = qmdl_store_lock.write().await.new_entry().await?;
let qmdl_writer = QmdlWriter::new(qmdl_file.into_std().await);
let mut dev = DiagDevice::new(Some(qmdl_writer))
- .map_err(WavehunterError::DiagInitError)?;
+ .map_err(RayhunterError::DiagInitError)?;
dev.config_logs()
- .map_err(WavehunterError::DiagInitError)?;
+ .map_err(RayhunterError::DiagInitError)?;
run_diag_read_thread(&task_tracker, dev, rx, qmdl_store_lock.clone());
}