-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
526 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[workspace] | ||
members = ["nasl-syntax", "nasl-cli"] | ||
members = ["nasl-syntax", "nasl-cli", "nvtcache"] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "nvtcache" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
redis = "0.22.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# NVTCache | ||
|
||
Libary for initializing and loading up the NVT Cache for OpenVAS Scanner written in rust. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use redis::*; | ||
use std::error; | ||
use std::fmt; | ||
|
||
pub mod dberror { | ||
use super::*; | ||
|
||
pub type Result<T> = std::result::Result<T, DbError>; | ||
|
||
#[derive(Debug)] | ||
pub enum DbError { | ||
RedisErr(RedisError), | ||
CustomErr(String), | ||
} | ||
|
||
impl fmt::Display for DbError { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
match &*self { | ||
DbError::RedisErr(..) => write!(f, "Redis Error"), | ||
DbError::CustomErr(e) => write!(f, "Error: String Message {}", e), | ||
} | ||
} | ||
} | ||
|
||
impl error::Error for DbError { | ||
fn source(&self) -> Option<&(dyn error::Error + 'static)> { | ||
match *self { | ||
DbError::RedisErr(ref e) => Some(e), | ||
DbError::CustomErr(_) => None, | ||
} | ||
} | ||
} | ||
|
||
impl From<RedisError> for DbError { | ||
fn from(err: RedisError) -> DbError { | ||
DbError::RedisErr(err) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pub mod dberror; | ||
pub mod nvtcache; | ||
pub mod redisconnector; |
Oops, something went wrong.